chore: Use env_to_bool in touch gesture patch as well

This commit is contained in:
Kyle Gospodnetich 2024-02-10 21:30:14 -08:00
parent 129b5f2f9e
commit 9533c50809
2 changed files with 13 additions and 14 deletions

View File

@ -26,7 +26,7 @@ index 00c00e9..795898c 100644
int height = xwayland_mode_ctl[ 2 ];
- if ( g_nOutputWidth != 1280 && width == 1280 )
+ if ( g_nOutputWidth != 1280 && width == 1280 && !env_to_bool( getenv("GAMESCOPE_ENABLE_720P_RESTRICT") ) )
+ if ( g_nOutputWidth != 1280 && width == 1280 && !env_to_bool(getenv("GAMESCOPE_ENABLE_720P_RESTRICT")) )
{
width = g_nOutputWidth;
height = g_nOutputHeight;

View File

@ -1,18 +1,17 @@
From 0e7329bd8275e46705a97a584c548a3998d08a25 Mon Sep 17 00:00:00 2001
From: Kyle Gospodnetich <me@kylegospodneti.ch>
Date: Fri, 9 Feb 2024 16:55:04 -0800
Subject: [PATCH] Add environment variable to disable touch gestures
Requested by some of our users due to them accidentally firing them off. Defaults to gestures enabled
---
src/wlserver.cpp | 54 ++++++++++++++++++++++++++----------------------
1 file changed, 29 insertions(+), 25 deletions(-)
diff --git a/src/wlserver.cpp b/src/wlserver.cpp
index e7fb7c9eb..31e0998a8 100644
index d569ee5..0512ab0 100644
--- a/src/wlserver.cpp
+++ b/src/wlserver.cpp
@@ -2048,34 +2048,38 @@ void wlserver_touchmotion( double x, double y, int touch_id, uint32_t time )
@@ -66,6 +66,8 @@ extern "C" {
static LogScope wl_log("wlserver");
+extern bool env_to_bool(const char *env);
+
struct wlserver_t wlserver = {
.touch_down_ids = {}
};
@@ -2043,34 +2045,38 @@ void wlserver_touchmotion( double x, double y, int touch_id, uint32_t time )
if ( get_effective_touch_mode() == WLSERVER_TOUCH_CLICK_PASSTHROUGH )
{
@ -37,7 +36,7 @@ index e7fb7c9eb..31e0998a8 100644
- wl_log.infof("Detected Home gesture");
- wlserver_open_steam_menu(0);
- start_gesture = false;
+ if(!getenv("GAMESCOPE_DISABLE_TOUCH_GESTURES")) {
+ if (!env_to_bool(getenv("GAMESCOPE_DISABLE_TOUCH_GESTURES"))) {
+ bool start_gesture = false;
+
+ // Round the x-coordinate to the nearest whole number