WM: disable idle event handling timer when simulating events

This commit is contained in:
Campbell Barton 2021-05-04 00:29:59 +10:00
parent 0ac6852a42
commit 12d8720b9b
1 changed files with 5 additions and 2 deletions

View File

@ -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);
}
}