@@ -848,23 +848,8 @@ static bool GLimp_CreateWindow( bool fullscreen, bool bordered, const glConfigur
848848 }
849849 }
850850
851- int numDisplays;
852- SDL_DisplayID *displayIDs = SDL_GetDisplays ( &numDisplays );
853-
854- if ( !displayIDs )
855- {
856- Sys::Error ( " SDL_GetDisplays failed: %s" , SDL_GetError () );
857- }
858-
859- SDL_DisplayID displayID =
860- r_displayIndex->integer < numDisplays || r_displayIndex->integer > numDisplays
861- ? displayIDs[ r_displayIndex->integer ]
862- : 0 ; // 0 implies primary display
863-
864- SDL_free ( displayIDs );
865-
866- int x = SDL_WINDOWPOS_CENTERED_DISPLAY ( displayID );
867- int y = SDL_WINDOWPOS_CENTERED_DISPLAY ( displayID );
851+ int x = SDL_WINDOWPOS_CENTERED_DISPLAY ( glConfig.sdlDisplayID );
852+ int y = SDL_WINDOWPOS_CENTERED_DISPLAY ( glConfig.sdlDisplayID );
868853
869854 windowProperties = SDL_CreateProperties ();
870855 if ( !windowProperties )
@@ -1052,11 +1037,13 @@ static rserr_t GLimp_SetModeAndResolution( const int mode )
10521037 Sys::Error ( " SDL_GetDisplays returned 0 displays" );
10531038 }
10541039
1055- SDL_DisplayID displayID = displayIDs[ Math::Clamp ( r_displayIndex->integer , 0 , numDisplays - 1 ) ];
1040+ glConfig.sdlDisplayID = r_displayIndex->integer >= 0 && r_displayIndex->integer < numDisplays
1041+ ? displayIDs[ r_displayIndex->integer ]
1042+ : 0 ; // 0 indicates primary display
10561043
10571044 SDL_free ( displayIDs );
10581045
1059- const SDL_DisplayMode *desktopMode = SDL_GetDesktopDisplayMode ( displayID );
1046+ const SDL_DisplayMode *desktopMode = SDL_GetDesktopDisplayMode ( glConfig. sdlDisplayID );
10601047
10611048 if ( desktopMode )
10621049 {
@@ -1803,9 +1790,6 @@ static rserr_t GLimp_StartDriverAndSetMode( int mode, bool fullscreen, bool bord
18031790 logger.Notice ( " Using OpenGL ABI \" %s\" " , DAEMON_OPENGL_ABI_STRING );
18041791#endif
18051792
1806- AssertCvarRange ( r_displayIndex, 0 , numDisplays - 1 , true );
1807- glConfig.displayIndex = r_displayIndex->integer ;
1808-
18091793 rserr_t err = GLimp_SetMode (mode, fullscreen, bordered);
18101794
18111795 const char * glRequirements =
0 commit comments