Query the primary display with SDL_GetPrimaryDisplay().

Everything else doesn't work reliable and is depended on the display
server. X11 uses it's display IDs, Wayland some UUIDs...
This commit is contained in:
Yamagi 2024-04-02 17:47:27 +02:00
parent bcbeb81198
commit 5d30c5913b
1 changed files with 7 additions and 7 deletions

View File

@ -288,7 +288,7 @@ PrintDisplayModes(void)
from the first display. This is the from the first display. This is the
primary display and likely the one the primary display and likely the one the
game will run on. */ game will run on. */
curdisplay = 1; curdisplay = SDL_GetPrimaryDisplay();
} }
else else
{ {
@ -299,7 +299,7 @@ PrintDisplayModes(void)
add a fallback to the first display. */ add a fallback to the first display. */
if ((curdisplay = SDL_GetDisplayForWindow(window)) == 0) if ((curdisplay = SDL_GetDisplayForWindow(window)) == 0)
{ {
curdisplay = 1; curdisplay = SDL_GetPrimaryDisplay();
} }
} }
@ -689,7 +689,7 @@ GLimp_InitGraphics(int fullscreen, int *pwidth, int *pheight)
unable to get the current display,one X11 unable to get the current display,one X11
server with several screen is one of these, server with several screen is one of these,
so add a fallback to the first display. */ so add a fallback to the first display. */
curdisplay = 1; curdisplay = SDL_GetPrimaryDisplay();
} }
const SDL_DisplayMode *mode; const SDL_DisplayMode *mode;
@ -836,7 +836,7 @@ GLimp_GetRefreshRate(void)
called if there is a working window. Otherwise called if there is a working window. Otherwise
things will likely break somewhere else in the things will likely break somewhere else in the
client. */ client. */
curdisplay = 1; curdisplay = SDL_GetPrimaryDisplay();
} }
else else
{ {
@ -846,7 +846,7 @@ GLimp_GetRefreshRate(void)
unable to get the current display,one X11 unable to get the current display,one X11
server with several screen is one of these, server with several screen is one of these,
so add a fallback to the first display. */ so add a fallback to the first display. */
curdisplay = 1; curdisplay = SDL_GetPrimaryDisplay();
} }
} }
@ -877,7 +877,7 @@ GLimp_GetDesktopMode(int *pwidth, int *pheight)
by passing the mode and not the geometry from by passing the mode and not the geometry from
the renderer to GLimp_InitGraphics(), however the renderer to GLimp_InitGraphics(), however
that would break the renderer API. */ that would break the renderer API. */
last_display = 1; last_display = SDL_GetPrimaryDisplay();
} }
else else
{ {
@ -888,7 +888,7 @@ GLimp_GetDesktopMode(int *pwidth, int *pheight)
unable to get the current display,one X11 unable to get the current display,one X11
server with several screen is one of these, server with several screen is one of these,
so add a fallback to the first display. */ so add a fallback to the first display. */
last_display = 1; last_display = SDL_GetPrimaryDisplay();
} }
SDL_GetWindowPosition(window, &last_position_x, &last_position_y); SDL_GetWindowPosition(window, &last_position_x, &last_position_y);