Show More
@@ -77,11 +77,14 b" kCFRunLoopCommonModes = void_p.in_dll(CoreFoundation, 'kCFRunLoopCommonModes')" | |||
|
77 | 77 | |
|
78 | 78 | def _NSApp(): |
|
79 | 79 | """Return the global NSApplication instance (NSApp)""" |
|
80 | objc.objc_msgSend.argtypes = [void_p, void_p] | |
|
80 | 81 | return msg(C('NSApplication'), n('sharedApplication')) |
|
81 | 82 | |
|
82 | 83 | |
|
83 | 84 | def _wake(NSApp): |
|
84 | 85 | """Wake the Application""" |
|
86 | objc.objc_msgSend.argtypes = [void_p, void_p, void_p, void_p, void_p, void_p, | |
|
87 | void_p, void_p, void_p, void_p, void_p] | |
|
85 | 88 | event = msg(C('NSEvent'), |
|
86 | 89 | n('otherEventWithType:location:modifierFlags:' |
|
87 | 90 | 'timestamp:windowNumber:context:subtype:data1:data2:'), |
@@ -95,6 +98,7 b' def _wake(NSApp):' | |||
|
95 | 98 | 0, # data1 |
|
96 | 99 | 0, # data2 |
|
97 | 100 | ) |
|
101 | objc.objc_msgSend.argtypes = [void_p, void_p, void_p, void_p] | |
|
98 | 102 | msg(NSApp, n('postEvent:atStart:'), void_p(event), True) |
|
99 | 103 | |
|
100 | 104 | |
@@ -106,6 +110,7 b' def _input_callback(fdref, flags, info):' | |||
|
106 | 110 | CFFileDescriptorInvalidate(fdref) |
|
107 | 111 | CFRelease(fdref) |
|
108 | 112 | NSApp = _NSApp() |
|
113 | objc.objc_msgSend.argtypes = [void_p, void_p, void_p] | |
|
109 | 114 | msg(NSApp, n('stop:'), NSApp) |
|
110 | 115 | _wake(NSApp) |
|
111 | 116 | |
@@ -128,6 +133,7 b' def inputhook(context):' | |||
|
128 | 133 | """Inputhook for Cocoa (NSApp)""" |
|
129 | 134 | NSApp = _NSApp() |
|
130 | 135 | _stop_on_read(context.fileno()) |
|
136 | objc.objc_msgSend.argtypes = [void_p, void_p] | |
|
131 | 137 | msg(NSApp, n('run')) |
|
132 | 138 | if not _triggered.is_set(): |
|
133 | 139 | # app closed without firing callback, |
General Comments 0
You need to be logged in to leave comments.
Login now