##// END OF EJS Templates
Merge pull request #12805 from meeseeksmachine/auto-backport-of-pr-12804-on-7.x...
Matthias Bussonnier -
r26322:e59266a1 merge
parent child Browse files
Show More
@@ -77,24 +77,42 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"""
85 event = msg(C('NSEvent'),
86 objc.objc_msgSend.argtypes = [
86 n('otherEventWithType:location:modifierFlags:'
87 void_p,
87 'timestamp:windowNumber:context:subtype:data1:data2:'),
88 void_p,
88 15, # Type
89 void_p,
89 0, # location
90 void_p,
90 0, # flags
91 void_p,
91 0, # timestamp
92 void_p,
92 0, # window
93 void_p,
93 None, # context
94 void_p,
94 0, # subtype
95 void_p,
95 0, # data1
96 void_p,
96 0, # data2
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 msg(NSApp, n('postEvent:atStart:'), void_p(event), True)
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 CFFileDescriptorInvalidate(fdref)
124 CFFileDescriptorInvalidate(fdref)
107 CFRelease(fdref)
125 CFRelease(fdref)
108 NSApp = _NSApp()
126 NSApp = _NSApp()
127 objc.objc_msgSend.argtypes = [void_p, void_p, void_p]
109 msg(NSApp, n('stop:'), NSApp)
128 msg(NSApp, n('stop:'), NSApp)
110 _wake(NSApp)
129 _wake(NSApp)
111
130
@@ -128,6 +147,7 b' def inputhook(context):'
128 """Inputhook for Cocoa (NSApp)"""
147 """Inputhook for Cocoa (NSApp)"""
129 NSApp = _NSApp()
148 NSApp = _NSApp()
130 _stop_on_read(context.fileno())
149 _stop_on_read(context.fileno())
150 objc.objc_msgSend.argtypes = [void_p, void_p]
131 msg(NSApp, n('run'))
151 msg(NSApp, n('run'))
132 if not _triggered.is_set():
152 if not _triggered.is_set():
133 # app closed without firing callback,
153 # app closed without firing callback,
General Comments 0
You need to be logged in to leave comments. Login now