Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-05-03 17:29:59 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-05-03 17:39:49 +0300
commit12d8720b9be46674c23d4e1cc45159695ed06cf4 (patch)
tree87587d11c6d0099eb0a0668b8d55b8056178d505 /source/blender/windowmanager/intern/wm_window.c
parent0ac6852a4232bed72944e0b74013a72359320a17 (diff)
WM: disable idle event handling timer when simulating events
Diffstat (limited to 'source/blender/windowmanager/intern/wm_window.c')
-rw-r--r--source/blender/windowmanager/intern/wm_window.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c
index b90352b9e62..cdd5ea12df8 100644
--- a/source/blender/windowmanager/intern/wm_window.c
+++ b/source/blender/windowmanager/intern/wm_window.c
@@ -1563,8 +1563,11 @@ void wm_window_process_events(const bContext *C)
has_event |= wm_xr_events_handle(CTX_wm_manager(C));
#endif
- /* no event, we sleep 5 milliseconds */
- if (has_event == false) {
+ /* When there is no event, sleep 5 milliseconds not to use too much CPU when idle.
+ *
+ * Skip sleeping when simulating events so tests don't idle unnecessarily as simulated
+ * events are typically generated from a timer that runs in the main loop. */
+ if ((has_event == false) && !(G.f & G_FLAG_EVENT_SIMULATE)) {
PIL_sleep_ms(5);
}
}