steamvr_drv: serialize passthrough toggle edge detection

NotifyButton runs on each controller's RunFrame thread and shared the
rising-edge state unlocked, so simultaneous presses could double-toggle
or tear the menu double-press timestamp. Hold the camera mutex.
This commit is contained in:
lbgos committed 2026-10-13 00:31:49 +03:00
1 parent 8e15b31087
commit eb6a18d19e
1 file changed
+2
@@ -96,6 +96,8 @@ MonadoCamera::NotifyButton(enum xrt_input_name name, bool pressed)
MonadoCamera *self = s_instance.load();
if (!self || !self->shm || (name != XRT_INPUT_TOUCH_SYSTEM_CLICK && name != XRT_INPUT_TOUCH_MENU_CLICK))
return;
// Called from every controller's RunFrame; edge state is shared.
std::lock_guard<std::mutex> lock(self->mutex);
// RunFrame reports the held state repeatedly. Toggle only on rising edges.
bool &previous = name == XRT_INPUT_TOUCH_SYSTEM_CLICK ? self->system_pressed : self->menu_pressed;
if (pressed == previous)