From bde503b6c48d5d70f0e44dea722402630a5a9ccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mon=20ou=C3=AFe?= Date: Fri, 1 Dec 2023 02:34:22 +0100 Subject: Allow SteamVR to send scrolling events to the window No smooth scrolling for now because that would require a lot of boilerplate code to simulate XInput2 events, but the discrete events that are being sent seem to scroll at an adequate rate for now. --- src/main.cpp | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index 3444528..e884be0 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1192,17 +1192,17 @@ bool CMainApplication::BInitOverlay() &thumbnail_handle ); - vr::VROverlay()->SetOverlayInputMethod( overlay_handle, vr::VROverlayInputMethod_Mouse ); + vr::VROverlay()->SetOverlayInputMethod(overlay_handle, vr::VROverlayInputMethod_Mouse); - vr::VROverlay()->SetOverlayFlag( overlay_handle, vr::VROverlayFlags_IgnoreTextureAlpha, true ); - vr::VROverlay()->SetOverlayFlag( overlay_handle, vr::VROverlayFlags_EnableControlBar, true ); - vr::VROverlay()->SetOverlayFlag( overlay_handle, vr::VROverlayFlags_EnableControlBarKeyboard, true ); - vr::VROverlay()->SetOverlayFlag( overlay_handle, vr::VROverlayFlags_EnableControlBarClose, true ); - vr::VROverlay()->SetOverlayFlag( overlay_handle, vr::VROverlayFlags_WantsModalBehavior, false ); - vr::VROverlay()->SetOverlayFlag( overlay_handle, vr::VROverlayFlags_SendVRSmoothScrollEvents, true ); - vr::VROverlay()->SetOverlayFlag( overlay_handle, vr::VROverlayFlags_VisibleInDashboard, true ); + vr::VROverlay()->SetOverlayFlag(overlay_handle, vr::VROverlayFlags_IgnoreTextureAlpha, true); + vr::VROverlay()->SetOverlayFlag(overlay_handle, vr::VROverlayFlags_EnableControlBar, true); + vr::VROverlay()->SetOverlayFlag(overlay_handle, vr::VROverlayFlags_EnableControlBarKeyboard, true); + vr::VROverlay()->SetOverlayFlag(overlay_handle, vr::VROverlayFlags_EnableControlBarClose, true); + vr::VROverlay()->SetOverlayFlag(overlay_handle, vr::VROverlayFlags_WantsModalBehavior, false); + vr::VROverlay()->SetOverlayFlag(overlay_handle, vr::VROverlayFlags_SendVRDiscreteScrollEvents, true); + vr::VROverlay()->SetOverlayFlag(overlay_handle, vr::VROverlayFlags_VisibleInDashboard, true); - vr::VROverlay()->SetOverlayFromFile( thumbnail_handle, "frog.png"); + vr::VROverlay()->SetOverlayFromFile(thumbnail_handle, "frog.png"); overlay_xdo = xdo_new_with_opened_display(x_display, nullptr, 0); @@ -1663,6 +1663,15 @@ void CMainApplication::ProcessVREvent( const vr::VREvent_t & event ) event.data.mouse.button); } break; + + case vr::VREvent_ScrollDiscrete: + if (overlay_xdo && src_window_id != None) { + if (event.data.scroll.ydelta > 0) + xdo_click_window(overlay_xdo, src_window_id, 4); + else if (event.data.scroll.ydelta < 0) + xdo_click_window(overlay_xdo, src_window_id, 5); + } + break; } } -- cgit v1.2.3