diff options
author | Mon ouïe <mon.ouie@gmail.com> | 2023-12-01 02:34:22 +0100 |
---|---|---|
committer | Mon ouïe <mon.ouie@gmail.com> | 2023-12-01 02:37:02 +0100 |
commit | bde503b6c48d5d70f0e44dea722402630a5a9ccf (patch) | |
tree | 44b6e97c45c79dcfdb3c678154b36f9e9ef87b66 /src | |
parent | 1e9f087546a4e92aea6f27eaf33f4ef08219fac3 (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
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; } } |