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