Skip to content

Commit

Permalink
OpenVRBackend: Add command-line support for overlay click stabilization
Browse files Browse the repository at this point in the history
This works on all overlay types (subview, dashboard, etc)
  • Loading branch information
jeremyselan committed Jan 17, 2025
1 parent 3d230c9 commit 328f06b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Backends/OpenVRBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,8 @@ namespace gamescope
m_bEnableControlBarKeyboard = true;
} else if (strcmp(opt_name, "vr-overlay-enable-control-bar-close") == 0) {
m_bEnableControlBarClose = true;
} else if (strcmp(opt_name, "vr-overlay-enable-click-stabilization") == 0) {
m_bEnableClickStabilization = true;
} else if (strcmp(opt_name, "vr-overlay-modal") == 0) {
m_bModal = true;
} else if (strcmp(opt_name, "vr-overlay-physical-width") == 0) {
Expand Down Expand Up @@ -886,6 +888,7 @@ namespace gamescope
bool ShouldEnableControlBar() const { return m_bEnableControlBar; }
bool ShouldEnableControlBarKeyboard() const { return m_bEnableControlBarKeyboard; }
bool ShouldEnableControlBarClose() const { return m_bEnableControlBarClose; }
bool ShouldEnableClickStabilization() const { return m_bEnableClickStabilization; }
bool IsModal() const { return m_bModal; }
float GetPhysicalWidth() const { return m_flPhysicalWidth; }
float GetPhysicalCurvature() const { return m_flPhysicalCurvature; }
Expand Down Expand Up @@ -1226,6 +1229,7 @@ namespace gamescope
bool m_bEnableControlBar = false;
bool m_bEnableControlBarKeyboard = false;
bool m_bEnableControlBarClose = false;
bool m_bEnableClickStabilization = false;
bool m_bModal = false;
float m_flPhysicalWidth = 2.0f;
float m_flPhysicalCurvature = 0.0f;
Expand Down Expand Up @@ -1690,6 +1694,7 @@ namespace gamescope
vr::VROverlay()->CreateSubviewOverlay( pParent->GetOverlay(), szSubviewName.c_str(), "Gamescope Layer", &m_hOverlay );
}

vr::VROverlay()->SetOverlayFlag( m_hOverlay, vr::VROverlayFlags_EnableClickStabilization, m_pBackend->ShouldEnableClickStabilization() );
vr::VROverlay()->SetOverlayFlag( m_hOverlay, vr::VROverlayFlags_IsPremultiplied, true );
vr::VROverlay()->SetOverlayInputMethod( m_hOverlay, vr::VROverlayInputMethod_Mouse );
vr::VROverlay()->SetOverlaySortOrder( m_hOverlay, m_uSortOrder );
Expand Down
2 changes: 2 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ const struct option *gamescope_options = (struct option[]){
{ "vr-overlay-enable-control-bar", no_argument, nullptr, 0 },
{ "vr-overlay-enable-control-bar-keyboard", no_argument, nullptr, 0 },
{ "vr-overlay-enable-control-bar-close", no_argument, nullptr, 0 },
{ "vr-overlay-enable-click-stabilization", no_argument, nullptr, 0 },
{ "vr-overlay-modal", no_argument, nullptr, 0 },
{ "vr-overlay-physical-width", required_argument, nullptr, 0 },
{ "vr-overlay-physical-curvature", required_argument, nullptr, 0 },
Expand Down Expand Up @@ -234,6 +235,7 @@ const char usage[] =
" --vr-overlay-enable-control-bar Enables the SteamVR control bar\n"
" --vr-overlay-enable-control-bar-keyboard Enables the SteamVR keyboard button on the control bar\n"
" --vr-overlay-enable-control-bar-close Enables the SteamVR close button on the control bar\n"
" --vr-overlay-enable-click-stabilization Enables the SteamVR click stabilization\n"
" --vr-overlay-modal Makes our VR overlay appear as a modal\n"
" --vr-overlay-physical-width Sets the physical width of our VR overlay in metres\n"
" --vr-overlay-physical-curvature Sets the curvature of our VR overlay\n"
Expand Down

0 comments on commit 328f06b

Please sign in to comment.