Fix VR session toggle not changing reliably on session start/end

The text and icon were supposed to change but didn't reliably, which was
a race condition I think. It depended on how fast the OpenXR runtime
would transition the session state.
This also makes sure the correct notifier is sent on session exit.
This commit is contained in:
Julian Eisel 2020-03-31 16:39:59 +02:00
parent afe707cc3a
commit f149d5e4b2
2 changed files with 3 additions and 1 deletions

View File

@ -38,7 +38,7 @@ static bool rna_XrSessionState_is_running(bContext *C)
{
# ifdef WITH_XR_OPENXR
const wmWindowManager *wm = CTX_wm_manager(C);
return WM_xr_session_is_ready(&wm->xr);
return WM_xr_session_exists(&wm->xr);
# else
UNUSED_VARS(C);
return false;

View File

@ -3711,6 +3711,8 @@ static void wm_xr_session_update_screen(Main *bmain, const wmXrData *xr_data)
}
}
}
WM_main_add_notifier(NC_WM | ND_XR_DATA_CHANGED, NULL);
}
static void wm_xr_session_update_screen_on_exit_cb(const wmXrData *xr_data)