Skip to content

Commit b2eaad1

Browse files
committed
Review comments
1 parent 0e8baa5 commit b2eaad1

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/_macosx.m

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
static PyOS_sighandler_t originalSigintAction = NULL;
4545

4646
// 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() {
4848
[NSApp stop: nil];
4949
// Post an event to trigger the actual stopping.
5050
[NSApp postEvent: [NSEvent otherEventWithType: NSEventTypeApplicationDefined
@@ -59,9 +59,9 @@ static void stop_with_event() {
5959
atStart: YES];
6060
}
6161

62-
// Signal handler for SIGINT, only argument matching for stop_with_event
62+
// Signal handler for SIGINT, only argument matching for stopWithEvent
6363
static void handleSigint(int signal) {
64-
stop_with_event();
64+
stopWithEvent();
6565
}
6666

6767
// Helper function to flush all events.
@@ -70,9 +70,9 @@ static void handleSigint(int signal) {
7070
static void flushEvents() {
7171
while (true) {
7272
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];
7676
if (!event) {
7777
break;
7878
}
@@ -100,9 +100,9 @@ static int wait_for_stdin() {
100100

101101
// Register for data available notifications on standard input
102102
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();}
106106
];
107107

108108
// Wait in the background for anything that happens to stdin
@@ -216,16 +216,16 @@ void process_event(char const* cls_name, char const* fmt, ...)
216216
static bool backend_inited = false;
217217

218218
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-
223219
if (backend_inited) { return; }
224220
backend_inited = true;
225221

226222
NSApp = [NSApplication sharedApplication];
227223
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
228224
[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;
229229
}
230230

231231
static PyObject*
@@ -260,7 +260,7 @@ static void lazy_init(void) {
260260
static PyObject*
261261
stop(PyObject* self)
262262
{
263-
stop_with_event();
263+
stopWithEvent();
264264
Py_RETURN_NONE;
265265
}
266266

@@ -1126,8 +1126,8 @@ - (void)close
11261126
--FigureWindowCount;
11271127
if (!FigureWindowCount) [NSApp stop: self];
11281128
/* 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+
*/
11311131
// For each new window, we have incremented the manager reference, so
11321132
// we need to bring that down during close and not just dealloc.
11331133
Py_DECREF(manager);

0 commit comments

Comments
 (0)