From 58509f03ba00f7adaca77b27515e585412e440cc Mon Sep 17 00:00:00 2001 From: Joshua Ashton Date: Sun, 7 Jan 2024 01:38:49 +0000 Subject: [PATCH] main: Only set XCURSOR_SIZE if cursor scale height is set --- src/main.cpp | 10 +++++++++- src/steamcompmgr.cpp | 4 +--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 5bbb01bde7..220ee15836 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -45,6 +45,8 @@ const char *gamescope_optstring = nullptr; const char *g_pOriginalDisplay = nullptr; const char *g_pOriginalWaylandDisplay = nullptr; +int g_nCursorScaleHeight = -1; + const struct option *gamescope_options = (struct option[]){ { "help", no_argument, nullptr, 0 }, { "nested-width", required_argument, nullptr, 'w' }, @@ -639,6 +641,8 @@ int main(int argc, char **argv) } else if (strcmp(opt_name, "headless") == 0) { g_bHeadless = true; g_bIsNested = true; + } else if (strcmp(opt_name, "cursor-scale-height") == 0) { + g_nCursorScaleHeight = atoi(optarg); } #if HAVE_OPENVR else if (strcmp(opt_name, "openvr") == 0) { @@ -700,7 +704,11 @@ int main(int argc, char **argv) #endif setenv( "XWAYLAND_FORCE_ENABLE_EXTRA_MODES", "1", 1 ); - setenv( "XCURSOR_SIZE", "256", 1 ); + + if ( g_nCursorScaleHeight > 0 ) + { + setenv( "XCURSOR_SIZE", "256", 1 ); + } raise_fd_limit(); diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp index 0091f5dd36..177530c70f 100644 --- a/src/steamcompmgr.cpp +++ b/src/steamcompmgr.cpp @@ -1104,7 +1104,7 @@ namespace gamescope static std::atomic g_bForceRepaint{false}; -static int g_nCursorScaleHeight = -1; +extern int g_nCursorScaleHeight; // poor man's semaphore class sem @@ -7797,8 +7797,6 @@ steamcompmgr_main(int argc, char **argv) g_FadeOutDuration = atoi(optarg); } else if (strcmp(opt_name, "force-windows-fullscreen") == 0) { bForceWindowsFullscreen = true; - } else if (strcmp(opt_name, "cursor-scale-height") == 0) { - g_nCursorScaleHeight = atoi(optarg); } else if (strcmp(opt_name, "hdr-enabled") == 0) { g_bHDREnabled = true; } else if (strcmp(opt_name, "hdr-debug-force-support") == 0) {