Skip to content

Commit

Permalink
main: Only set XCURSOR_SIZE if cursor scale height is set
Browse files Browse the repository at this point in the history
  • Loading branch information
misyltoad committed Jan 7, 2024
1 parent 1a008fa commit 58509f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 9 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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();

Expand Down
4 changes: 1 addition & 3 deletions src/steamcompmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,7 @@ namespace gamescope

static std::atomic<bool> g_bForceRepaint{false};

static int g_nCursorScaleHeight = -1;
extern int g_nCursorScaleHeight;

// poor man's semaphore
class sem
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 58509f0

Please sign in to comment.