From 52fbc915d4c3b87e34f514b474bd31e241c37b97 Mon Sep 17 00:00:00 2001 From: Miska Alexia Date: Sat, 6 Apr 2024 16:29:57 -0700 Subject: [PATCH 1/2] workaround steam overlay's issue with nested wayland --- src/steamcompmgr.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp index 85f4d6a95..149d4ec4c 100644 --- a/src/steamcompmgr.cpp +++ b/src/steamcompmgr.cpp @@ -6541,6 +6541,10 @@ spawn_client( char **argv, bool bAsyncChild ) const char *pchCurrentPreload = getenv( "LD_PRELOAD" ); bool bFirst = true; + if( overlayWorkaround ){ + xwm_log.debugf( "Working around steam overlay" ); + } + if ( pchCurrentPreload != nullptr ) { pchPreloadCopy = strdup( pchCurrentPreload ); @@ -6561,7 +6565,7 @@ spawn_client( char **argv, bool bAsyncChild ) // If there's a string and it's not gameoverlayrenderer, append it to our new LD_PRELOAD if ( pchPreloadCopy[ i ] != '\0' ) { - if ( strstr( pchPreloadCopy + i, "gameoverlayrenderer.so" ) == nullptr ) + if ( overlayWorkaround || strstr( pchPreloadCopy + i, "gameoverlayrenderer.so" ) == nullptr ) { if ( bFirst == false ) { From 0fd9441ac1ba03945465ead602d0ee16d5570ba4 Mon Sep 17 00:00:00 2001 From: Miska Alexia Date: Sat, 6 Apr 2024 16:28:24 -0700 Subject: [PATCH 2/2] add a launch option to control steam overlay workaround --- src/main.cpp | 2 ++ src/steamcompmgr.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 88c4c7c06..f23768b38 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -116,6 +116,7 @@ const struct option *gamescope_options = (struct option[]){ { "debug-hud", no_argument, nullptr, 'v' }, { "debug-events", no_argument, nullptr, 0 }, { "steam", no_argument, nullptr, 'e' }, + { "overlay-workaround", no_argument, nullptr, 0 }, { "force-composition", no_argument, nullptr, 'c' }, { "composite-debug", no_argument, nullptr, 0 }, { "disable-xres", no_argument, nullptr, 'x' }, @@ -168,6 +169,7 @@ const char usage[] = " -T, --stats-path write statistics to path\n" " -C, --hide-cursor-delay hide cursor image after delay\n" " -e, --steam enable Steam integration\n" + " --overlay-workaround workaround steam overlay's issues with wayland by allowing the overlay attach to the game rather than gamescope\n" " --xwayland-count create N xwayland servers\n" " --prefer-vk-device prefer Vulkan device for compositing (ex: 1002:7300)\n" " --force-orientation rotate the internal display (left, right, normal, upsidedown)\n" diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp index 149d4ec4c..9f246fcc1 100644 --- a/src/steamcompmgr.cpp +++ b/src/steamcompmgr.cpp @@ -1097,6 +1097,7 @@ static bool debugFocus = false; static bool drawDebugInfo = false; static bool debugEvents = false; bool steamMode = false; +bool overlayWorkaround = false; bool alwaysComposite = false; static bool useXRes = true; @@ -7419,6 +7420,8 @@ steamcompmgr_main(int argc, char **argv) debugFocus = true; } else if (strcmp(opt_name, "synchronous-x11") == 0) { synchronize = true; + } else if (strcmp(opt_name, "overlay-workaround") == 0) { + overlayWorkaround = true; } else if (strcmp(opt_name, "debug-events") == 0) { debugEvents = true; } else if (strcmp(opt_name, "cursor") == 0) {