Skip to content

Commit ad04a33

Browse files
committed
FIX: Add a 0-length timer to allow fast animations to redraw on macosx
The macosx backend would not update on flush_events calls due to the loop being run too fast for the view to update properly in the NSApp. Fix that by adding an unnoticeable RunLoop timer slowdown that allows the app to see the changes.
1 parent fce4431 commit ad04a33

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/_macosx.m

+3
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,9 @@ static CGFloat _get_device_scale(CGContextRef cr)
383383
PyErr_SetString(PyExc_RuntimeError, "NSView* is NULL");
384384
return NULL;
385385
}
386+
// We need to interrupt the runloop very briefly to allow the view to be
387+
// displayed when used in a fast updating animation
388+
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.0]];
386389
[view displayIfNeeded];
387390
Py_RETURN_NONE;
388391
}

0 commit comments

Comments
 (0)