diff --git a/intern/ghost/intern/GHOST_NDOFManager.cc b/intern/ghost/intern/GHOST_NDOFManager.cc index 553064576bd..991c4dcd2e9 100644 --- a/intern/ghost/intern/GHOST_NDOFManager.cc +++ b/intern/ghost/intern/GHOST_NDOFManager.cc @@ -674,6 +674,17 @@ static bool nearHomePosition(const GHOST_TEventNDOFMotionData *ndof, float thres bool GHOST_NDOFManager::sendMotionEvent() { if (!motion_event_pending_) { + if (motion_state_ != GHOST_kNotStarted) { + /* Detect window de-activation and change the `motion_state_` even when no motion is pending. + * Without this check it's possible the window is de-activated before the NDOF + * motion callbacks have run, while the `motion_state_` is active. + * In this case, activating the window again would create an event + * with a large time-delta, see: #134733. */ + if (system_.getWindowManager()->getActiveWindow() == nullptr) { + /* Avoid large `dt` times when changing windows. */ + motion_state_ = GHOST_kNotStarted; + } + } return false; }