I have this message loop:
while (!shutdown_now_)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask
untilDate:[NSDate distantFuture]
inMode:NSDefaultRunLoopMode
dequeue:YES];
if (event) [NSApp sendEvent:event];
// If modifying window event, do something!!!
[pool drain];
}
I want to filter all NSEvents that modifying a window, for example move, resize, order out e.t.c. I've trying looking for the type in Apple documentation but w/o success. Any help? Thanks!
The event type I was looking for is NSAppKitDefined
:
while (!shutdown_now_)
{
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask
untilDate:[NSDate distantFuture]
inMode:NSDefaultRunLoopMode
dequeue:YES];
if (event.type == NSAppKitDefined)
{
NSLog(@"NSAppKitDefinedEvent with subtype: %d", event.subtype);
}
if (event) [NSApp sendEvent:event];
[pool drain];
}