mirror of
https://github.com/ublue-os/bazzite.git
synced 2025-01-10 06:51:52 +00:00
78 lines
3.4 KiB
Diff
78 lines
3.4 KiB
Diff
diff --git a/src/wlserver.cpp b/src/wlserver.cpp
|
|
index d569ee5..0512ab0 100644
|
|
--- a/src/wlserver.cpp
|
|
+++ b/src/wlserver.cpp
|
|
@@ -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 )
|
|
{
|
|
- bool start_gesture = false;
|
|
wlr_seat_touch_notify_motion( wlserver.wlr.seat, time, touch_id, wlserver.mouse_surface_cursorx, wlserver.mouse_surface_cursory );
|
|
|
|
- // Round the x-coordinate to the nearest whole number
|
|
- uint32_t roundedCursorX = static_cast<int>(std::round(wlserver.mouse_surface_cursorx));
|
|
- // Grab 2% of the display to be used for the edge range
|
|
- double edge_range = g_nOutputWidth * 0.02;
|
|
-
|
|
- // if the touch cursor x position is less or equal to the range then start the gesture for left to right
|
|
- if (roundedCursorX <= edge_range) {
|
|
- start_gesture = true;
|
|
- }
|
|
- // if the touch cursor x position is the output width minus the edge range value then we are doing right to left
|
|
- if (roundedCursorX >= g_nOutputWidth - edge_range) {
|
|
- start_gesture = true;
|
|
- }
|
|
- // when the gesture is started and we are moving to the end of the edge range open home
|
|
- if (start_gesture && roundedCursorX >= 1 && roundedCursorX <= edge_range) {
|
|
- wl_log.infof("Detected Home gesture");
|
|
- wlserver_open_steam_menu(0);
|
|
- start_gesture = false;
|
|
+ if (!env_to_bool(getenv("GAMESCOPE_DISABLE_TOUCH_GESTURES"))) {
|
|
+ bool start_gesture = false;
|
|
+
|
|
+ // Round the x-coordinate to the nearest whole number
|
|
+ uint32_t roundedCursorX = static_cast<int>(std::round(wlserver.mouse_surface_cursorx));
|
|
+ // Grab 2% of the display to be used for the edge range
|
|
+ double edge_range = g_nOutputWidth * 0.02;
|
|
+
|
|
+ // if the touch cursor x position is less or equal to the range then start the gesture for left to right
|
|
+ if (roundedCursorX <= edge_range) {
|
|
+ start_gesture = true;
|
|
+ }
|
|
+ // if the touch cursor x position is the output width minus the edge range value then we are doing right to left
|
|
+ if (roundedCursorX >= g_nOutputWidth - edge_range) {
|
|
+ start_gesture = true;
|
|
+ }
|
|
+ // when the gesture is started and we are moving to the end of the edge range open home
|
|
+ if (start_gesture && roundedCursorX >= 1 && roundedCursorX <= edge_range) {
|
|
+ wl_log.infof("Detected Home gesture");
|
|
+ wlserver_open_steam_menu(0);
|
|
+ start_gesture = false;
|
|
+ }
|
|
+ // when the gesture is started and we are moving from the output width minus the edge range to the output width open QAM
|
|
+ if (start_gesture && roundedCursorX >= g_nOutputWidth - edge_range && roundedCursorX <= g_nOutputWidth ) {
|
|
+ wl_log.infof("Detected QAM gesture");
|
|
+ wlserver_open_steam_menu(1);
|
|
+ start_gesture = false;
|
|
+ }
|
|
}
|
|
- // when the gesture is started and we are moving from the output width minus the edge range to the output width open QAM
|
|
- if (start_gesture && roundedCursorX >= g_nOutputWidth - edge_range && roundedCursorX <= g_nOutputWidth ) {
|
|
- wl_log.infof("Detected QAM gesture");
|
|
- wlserver_open_steam_menu(1);
|
|
- start_gesture = false;
|
|
- } }
|
|
+ }
|
|
else if ( get_effective_touch_mode() == WLSERVER_TOUCH_CLICK_DISABLED )
|
|
{
|
|
return;
|