We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 5ffafd0 + b2f72f9 commit 45f4888Copy full SHA for 45f4888
1 file changed
src/_macosx.m
@@ -1723,11 +1723,15 @@ - (void)flagsChanged:(NSEvent *)event
1723
}
1724
1725
// hold a reference to the timer so we can invalidate/stop it later
1726
- self->timer = [NSTimer scheduledTimerWithTimeInterval: interval
1727
- repeats: !single
1728
- block: ^(NSTimer *timer) {
+ self->timer = [NSTimer timerWithTimeInterval: interval
+ repeats: !single
+ block: ^(NSTimer *timer) {
1729
gil_call_method((PyObject*)self, "_on_timer");
1730
}];
1731
+ // Schedule the timer on the main run loop which is needed
1732
+ // when updating the UI from a background thread
1733
+ [[NSRunLoop mainRunLoop] addTimer: self->timer forMode: NSRunLoopCommonModes];
1734
+
1735
exit:
1736
Py_XDECREF(py_interval);
1737
Py_XDECREF(py_single);
0 commit comments