Show More
@@ -116,11 +116,8 b' def _wake(NSApp):' | |||||
116 | msg(NSApp, n('postEvent:atStart:'), void_p(event), True) |
|
116 | msg(NSApp, n('postEvent:atStart:'), void_p(event), True) | |
117 |
|
117 | |||
118 |
|
118 | |||
119 | _triggered = Event() |
|
|||
120 |
|
||||
121 | def _input_callback(fdref, flags, info): |
|
119 | def _input_callback(fdref, flags, info): | |
122 | """Callback to fire when there's input to be read""" |
|
120 | """Callback to fire when there's input to be read""" | |
123 | _triggered.set() |
|
|||
124 | CFFileDescriptorInvalidate(fdref) |
|
121 | CFFileDescriptorInvalidate(fdref) | |
125 | CFRelease(fdref) |
|
122 | CFRelease(fdref) | |
126 | NSApp = _NSApp() |
|
123 | NSApp = _NSApp() | |
@@ -134,7 +131,6 b' _c_input_callback = _c_callback_func_type(_input_callback)' | |||||
134 |
|
131 | |||
135 | def _stop_on_read(fd): |
|
132 | def _stop_on_read(fd): | |
136 | """Register callback to stop eventloop when there's data on fd""" |
|
133 | """Register callback to stop eventloop when there's data on fd""" | |
137 | _triggered.clear() |
|
|||
138 | fdref = CFFileDescriptorCreate(None, fd, False, _c_input_callback, None) |
|
134 | fdref = CFFileDescriptorCreate(None, fd, False, _c_input_callback, None) | |
139 | CFFileDescriptorEnableCallBacks(fdref, kCFFileDescriptorReadCallBack) |
|
135 | CFFileDescriptorEnableCallBacks(fdref, kCFFileDescriptorReadCallBack) | |
140 | source = CFFileDescriptorCreateRunLoopSource(None, fdref, 0) |
|
136 | source = CFFileDescriptorCreateRunLoopSource(None, fdref, 0) | |
@@ -149,9 +145,3 b' def inputhook(context):' | |||||
149 | _stop_on_read(context.fileno()) |
|
145 | _stop_on_read(context.fileno()) | |
150 | objc.objc_msgSend.argtypes = [void_p, void_p] |
|
146 | objc.objc_msgSend.argtypes = [void_p, void_p] | |
151 | msg(NSApp, n('run')) |
|
147 | msg(NSApp, n('run')) | |
152 | if not _triggered.is_set(): |
|
|||
153 | # app closed without firing callback, |
|
|||
154 | # probably due to last window being closed. |
|
|||
155 | # Run the loop manually in this case, |
|
|||
156 | # since there may be events still to process (#9734) |
|
|||
157 | CoreFoundation.CFRunLoopRun() |
|
General Comments 0
You need to be logged in to leave comments.
Login now