Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9921e39

Browse filesBrowse files
committed
FIX: macosx flush_events should process all events
1 parent a0f16a8 commit 9921e39
Copy full SHA for 9921e39

File tree

Expand file treeCollapse file tree

1 file changed

+14
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+14
-3
lines changed

‎src/_macosx.m

Copy file name to clipboardExpand all lines: src/_macosx.m
+14-3Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,9 +391,20 @@ static CGFloat _get_device_scale(CGContextRef cr)
391391
static PyObject*
392392
FigureCanvas_flush_events(FigureCanvas* self)
393393
{
394-
// We need to allow the runloop to run very briefly
395-
// to allow the view to be displayed when used in a fast updating animation
396-
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.0]];
394+
// We run the app, matching any events that are waiting in the queue
395+
// to process, breaking out of the loop when no events remain and
396+
// displaying the canvas if needed.
397+
NSEvent *event;
398+
while (true) {
399+
event = [NSApp nextEventMatchingMask: NSEventMaskAny
400+
untilDate: [NSDate distantPast]
401+
inMode: NSDefaultRunLoopMode
402+
dequeue: YES];
403+
if (!event) {
404+
break;
405+
}
406+
[NSApp sendEvent:event];
407+
}
397408
[self->view displayIfNeeded];
398409
Py_RETURN_NONE;
399410
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.