File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -1723,11 +1723,15 @@ - (void)flagsChanged:(NSEvent *)event
1723
1723
}
1724
1724
1725
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) {
1726
+ self->timer = [NSTimer timerWithTimeInterval : interval
1727
+ repeats: !single
1728
+ block: ^(NSTimer *timer) {
1729
1729
gil_call_method ((PyObject*)self, " _on_timer" );
1730
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
+
1731
1735
exit :
1732
1736
Py_XDECREF (py_interval);
1733
1737
Py_XDECREF (py_single);
You can’t perform that action at this time.
0 commit comments