···551551 case XRT_SESSION_EVENT_STATE_CHANGE:
552552 sess->compositor_visible = xse.state.visible;
553553 sess->compositor_focused = xse.state.focused;
554554+555555+ // Do not use xse.state.timestamp_ns, server side focused / visible state does not correspond
556556+ // 1:1 to the cycle we tell the app. In particular the compositor may have become focused /
557557+ // visible much earlier than what we tell the app when it became so.
558558+554559 break;
555560 case XRT_SESSION_EVENT_OVERLAY_CHANGE:
556561#ifdef OXR_HAVE_EXTX_overlay
···11621167 "Failed to create xrt_session and xrt_compositor_native! '%i'", xret);
11631168 }
11641169 if (sess->sys->xsysc->xmcc != NULL) {
11651165- xrt_syscomp_set_state(sess->sys->xsysc, &sess->xcn->base, true, true);
11701170+ xrt_syscomp_set_state(sess->sys->xsysc, &sess->xcn->base, true, true, os_monotonic_get_ns());
11661171 xrt_syscomp_set_z_order(sess->sys->xsysc, &sess->xcn->base, 0);
11671172 }
11681173 return XR_SUCCESS;