diff options
author | Kevin Walzer <kw@codebykevin.com> | 2017-10-16 12:29:26 (GMT) |
---|---|---|
committer | Kevin Walzer <kw@codebykevin.com> | 2017-10-16 12:29:26 (GMT) |
commit | 62f3ae6765db50a2101ef6347967e895e62df95f (patch) | |
tree | 2da6cc64bf827e39f1a4c5b14eff5388eb836e41 /macosx/tkMacOSXNotify.c | |
parent | 7a05bd40788df950ef8fbf738eef4dcc12fcdb8b (diff) | |
download | tk-62f3ae6765db50a2101ef6347967e895e62df95f.zip tk-62f3ae6765db50a2101ef6347967e895e62df95f.tar.gz tk-62f3ae6765db50a2101ef6347967e895e62df95f.tar.bz2 |
Restore tests for live resizing on macOS so event loop is not overloaded
Diffstat (limited to 'macosx/tkMacOSXNotify.c')
-rw-r--r-- | macosx/tkMacOSXNotify.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/macosx/tkMacOSXNotify.c b/macosx/tkMacOSXNotify.c index 086ed6a..b78d7ff 100644 --- a/macosx/tkMacOSXNotify.c +++ b/macosx/tkMacOSXNotify.c @@ -260,6 +260,7 @@ TkMacOSXEventsCheckProc( /* runloopMode will be nil if we are in a Tcl event loop. */ if (flags & TCL_WINDOW_EVENTS && !runloopMode) { NSEvent *currentEvent = nil; + NSEvent *testEvent = nil; NSModalSession modalSession; /* It is possible for the SetupProc to be called before this function * returns. This happens, for example, when we process an event which @@ -270,6 +271,20 @@ TkMacOSXEventsCheckProc( [NSApp _lockAutoreleasePool]; do { modalSession = TkMacOSXGetModalSession(); + testEvent = [NSApp nextEventMatchingMask:NSAnyEventMask + untilDate:[NSDate distantPast] + inMode:GetRunLoopMode(modalSession) + dequeue:NO]; + /* We must not steal any events during LiveResize. */ +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 + if (testEvent && [[testEvent window] inLiveResize]) { + break; + } +#else + if (testEvent && [[[testEvent window] contentView] inLiveResize]) { + break; + } +#endif currentEvent = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:GetRunLoopMode(modalSession) |