0
这里定义为我的事件循环:类型,应用程序包
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];
}
类型由应用程序套件定义是:
enum {
NSWindowExposedEventType = 0,
NSApplicationActivatedEventType = 1,
NSApplicationDeactivatedEventType = 2,
NSWindowMovedEventType = 4,
NSScreenChangedEventType = 8,
NSAWTEventType = 16
};
但是,我得到其他枚举,如:9,21,22,30
和更多。 这些类型定义在哪里?
请注意,这是行不通的;如果你这样做,你并没有运行主线程的运行循环,因此,依赖于主运行循环运行的所有类型的服务都无法工作。 – bbum