Skip to content

Commit 0f1503f

Browse files
slipherillwieckz
authored andcommitted
sdl3: fix r_displayIndex on Linux
First of all, SDL always centers the window on all our platforms regardless of whether "centered" or "undefined" position is requested. It turns out that on Linux, requesting centering on display N makes it center on display N, while requesting any position on display N means center on unspecified display. So NUKE r_centerWindow and always request centering since not centering is never possible and this makes r_displayIndex be honored on Linux.
1 parent fd99b1d commit 0f1503f

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

src/engine/sys/sdl_glimp.cpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,6 @@ enum class rserr_t
472472
};
473473

474474
cvar_t *r_allowResize; // make window resizable
475-
cvar_t *r_centerWindow;
476475
cvar_t *r_displayIndex;
477476
cvar_t *r_sdlDriver;
478477

@@ -886,18 +885,8 @@ static bool GLimp_CreateWindow( bool fullscreen, bool bordered, const glConfigur
886885

887886
SDL_free( displayIDs );
888887

889-
int x, y;
890-
if ( r_centerWindow->integer )
891-
{
892-
// center window on specified display
893-
x = SDL_WINDOWPOS_CENTERED_DISPLAY( displayID );
894-
y = SDL_WINDOWPOS_CENTERED_DISPLAY( displayID );
895-
}
896-
else
897-
{
898-
x = SDL_WINDOWPOS_UNDEFINED_DISPLAY( displayID );
899-
y = SDL_WINDOWPOS_UNDEFINED_DISPLAY( displayID );
900-
}
888+
int x = SDL_WINDOWPOS_CENTERED_DISPLAY( displayID );
889+
int y = SDL_WINDOWPOS_CENTERED_DISPLAY( displayID );
901890

902891
windowProperties = SDL_CreateProperties();
903892
if ( !windowProperties )
@@ -2708,7 +2697,6 @@ bool GLimp_Init()
27082697

27092698
r_sdlDriver = Cvar_Get( "r_sdlDriver", "", CVAR_ROM );
27102699
r_allowResize = Cvar_Get( "r_allowResize", "0", CVAR_LATCH );
2711-
r_centerWindow = Cvar_Get( "r_centerWindow", "0", 0 );
27122700
r_displayIndex = Cvar_Get( "r_displayIndex", "0", 0 );
27132701

27142702
Cvar::Latch( workaround_glDriver_amd_adrenalin_disableBindlessTexture );

0 commit comments

Comments
 (0)