44
44
static PyOS_sighandler_t originalSigintAction = NULL ;
45
45
46
46
// Stop the current app's run loop, sending an event to ensure it actually stops
47
- static void stop_with_event () {
47
+ static void stopWithEvent () {
48
48
[NSApp stop: nil ];
49
49
// Post an event to trigger the actual stopping.
50
50
[NSApp postEvent: [NSEvent otherEventWithType: NSEventTypeApplicationDefined
@@ -59,9 +59,9 @@ static void stop_with_event() {
59
59
atStart: YES ];
60
60
}
61
61
62
- // Signal handler for SIGINT, only argument matching for stop_with_event
62
+ // Signal handler for SIGINT, only argument matching for stopWithEvent
63
63
static void handleSigint (int signal) {
64
- stop_with_event ();
64
+ stopWithEvent ();
65
65
}
66
66
67
67
// Helper function to flush all events.
@@ -70,9 +70,9 @@ static void handleSigint(int signal) {
70
70
static void flushEvents () {
71
71
while (true ) {
72
72
NSEvent * event = [NSApp nextEventMatchingMask: NSEventMaskAny
73
- untilDate: [NSDate distantPast ]
74
- inMode: NSDefaultRunLoopMode
75
- dequeue: YES ];
73
+ untilDate: [NSDate distantPast ]
74
+ inMode: NSDefaultRunLoopMode
75
+ dequeue: YES ];
76
76
if (!event) {
77
77
break ;
78
78
}
@@ -100,9 +100,9 @@ static int wait_for_stdin() {
100
100
101
101
// Register for data available notifications on standard input
102
102
id notificationID = [[NSNotificationCenter defaultCenter ] addObserverForName: NSFileHandleDataAvailableNotification
103
- object: stdinHandle
104
- queue: [NSOperationQueue mainQueue ] // Use the main queue
105
- usingBlock: ^(NSNotification *notification) {stop_with_event ();}
103
+ object: stdinHandle
104
+ queue: [NSOperationQueue mainQueue ] // Use the main queue
105
+ usingBlock: ^(NSNotification *notification) {stopWithEvent ();}
106
106
];
107
107
108
108
// Wait in the background for anything that happens to stdin
@@ -216,16 +216,16 @@ void process_event(char const* cls_name, char const* fmt, ...)
216
216
static bool backend_inited = false ;
217
217
218
218
static void lazy_init (void ) {
219
- // Run our own event loop while waiting for stdin on the Python side
220
- // this is needed to keep the application responsive while waiting for input
221
- PyOS_InputHook = wait_for_stdin;
222
-
223
219
if (backend_inited) { return ; }
224
220
backend_inited = true ;
225
221
226
222
NSApp = [NSApplication sharedApplication ];
227
223
[NSApp setActivationPolicy: NSApplicationActivationPolicyRegular];
228
224
[NSApp setDelegate: [[[MatplotlibAppDelegate alloc ] init ] autorelease ]];
225
+
226
+ // Run our own event loop while waiting for stdin on the Python side
227
+ // this is needed to keep the application responsive while waiting for input
228
+ PyOS_InputHook = wait_for_stdin;
229
229
}
230
230
231
231
static PyObject*
@@ -260,7 +260,7 @@ static void lazy_init(void) {
260
260
static PyObject*
261
261
stop (PyObject* self)
262
262
{
263
- stop_with_event ();
263
+ stopWithEvent ();
264
264
Py_RETURN_NONE;
265
265
}
266
266
@@ -1126,8 +1126,8 @@ - (void)close
1126
1126
--FigureWindowCount;
1127
1127
if (!FigureWindowCount) [NSApp stop: self ];
1128
1128
/* This is needed for show(), which should exit from [NSApp run]
1129
- * after all windows are closed.
1130
- */
1129
+ * after all windows are closed.
1130
+ */
1131
1131
// For each new window, we have incremented the manager reference, so
1132
1132
// we need to bring that down during close and not just dealloc.
1133
1133
Py_DECREF (manager);
0 commit comments