@@ -528,14 +528,13 @@ static bool CheckWaylandPresentationTime()
528528
529529int g_nPreferredOutputWidth = 0 ;
530530int g_nPreferredOutputHeight = 0 ;
531+ bool g_bExposeWayland = false ;
531532
532533int main (int argc, char **argv)
533534{
534535 // Force disable this horrible broken layer.
535536 setenv (" DISABLE_LAYER_AMD_SWITCHABLE_GRAPHICS_1" , " 1" , 1 );
536537
537- bool bExposeWayland = false ;
538-
539538 static std::string optstring = build_optstring (gamescope_options);
540539 gamescope_optstring = optstring.c_str ();
541540
@@ -627,7 +626,7 @@ int main(int argc, char **argv)
627626 } else if (strcmp (opt_name, " adaptive-sync" ) == 0 ) {
628627 s_bInitialWantsVRREnabled = true ;
629628 } else if (strcmp (opt_name, " expose-wayland" ) == 0 ) {
630- bExposeWayland = true ;
629+ g_bExposeWayland = true ;
631630 } else if (strcmp (opt_name, " headless" ) == 0 ) {
632631 g_bHeadless = true ;
633632 g_bIsNested = true ;
@@ -843,7 +842,7 @@ int main(int argc, char **argv)
843842 gamescope_xwayland_server_t *base_server = wlserver_get_xwayland_server (0 );
844843
845844 setenv (" DISPLAY" , base_server->get_nested_display_name (), 1 );
846- if ( bExposeWayland )
845+ if ( g_bExposeWayland )
847846 setenv (" XDG_SESSION_TYPE" , " wayland" , 1 );
848847 else
849848 setenv (" XDG_SESSION_TYPE" , " x11" , 1 );
@@ -863,7 +862,7 @@ int main(int argc, char **argv)
863862 setenv (" STEAM_GAME_DISPLAY_0" , base_server->get_nested_display_name (), 1 );
864863 }
865864 setenv (" GAMESCOPE_WAYLAND_DISPLAY" , wlserver_get_wl_display_name (), 1 );
866- if ( bExposeWayland )
865+ if ( g_bExposeWayland )
867866 setenv (" WAYLAND_DISPLAY" , wlserver_get_wl_display_name (), 1 );
868867
869868#if HAVE_PIPEWIRE
0 commit comments