Show More
@@ -77,24 +77,42 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""" |
|
85 | event = msg(C('NSEvent'), | |
|
86 | n('otherEventWithType:location:modifierFlags:' | |
|
87 | 'timestamp:windowNumber:context:subtype:data1:data2:'), | |
|
88 | 15, # Type | |
|
89 | 0, # location | |
|
90 | 0, # flags | |
|
91 | 0, # timestamp | |
|
92 | 0, # window | |
|
93 | None, # context | |
|
94 | 0, # subtype | |
|
95 | 0, # data1 | |
|
96 | 0, # data2 | |
|
86 | objc.objc_msgSend.argtypes = [ | |
|
87 | void_p, | |
|
88 | void_p, | |
|
89 | void_p, | |
|
90 | void_p, | |
|
91 | void_p, | |
|
92 | void_p, | |
|
93 | void_p, | |
|
94 | void_p, | |
|
95 | void_p, | |
|
96 | void_p, | |
|
97 | void_p, | |
|
98 | ] | |
|
99 | event = msg( | |
|
100 | C("NSEvent"), | |
|
101 | n( | |
|
102 | "otherEventWithType:location:modifierFlags:" | |
|
103 | "timestamp:windowNumber:context:subtype:data1:data2:" | |
|
104 | ), | |
|
105 | 15, # Type | |
|
106 | 0, # location | |
|
107 | 0, # flags | |
|
108 | 0, # timestamp | |
|
109 | 0, # window | |
|
110 | None, # context | |
|
111 | 0, # subtype | |
|
112 | 0, # data1 | |
|
113 | 0, # data2 | |
|
97 | 114 | ) |
|
115 | objc.objc_msgSend.argtypes = [void_p, void_p, void_p, void_p] | |
|
98 | 116 | msg(NSApp, n('postEvent:atStart:'), void_p(event), True) |
|
99 | 117 | |
|
100 | 118 | |
@@ -106,6 +124,7 b' def _input_callback(fdref, flags, info):' | |||
|
106 | 124 | CFFileDescriptorInvalidate(fdref) |
|
107 | 125 | CFRelease(fdref) |
|
108 | 126 | NSApp = _NSApp() |
|
127 | objc.objc_msgSend.argtypes = [void_p, void_p, void_p] | |
|
109 | 128 | msg(NSApp, n('stop:'), NSApp) |
|
110 | 129 | _wake(NSApp) |
|
111 | 130 | |
@@ -128,6 +147,7 b' def inputhook(context):' | |||
|
128 | 147 | """Inputhook for Cocoa (NSApp)""" |
|
129 | 148 | NSApp = _NSApp() |
|
130 | 149 | _stop_on_read(context.fileno()) |
|
150 | objc.objc_msgSend.argtypes = [void_p, void_p] | |
|
131 | 151 | msg(NSApp, n('run')) |
|
132 | 152 | if not _triggered.is_set(): |
|
133 | 153 | # app closed without firing callback, |
General Comments 0
You need to be logged in to leave comments.
Login now