Merge 8796b2ece90350fd19400d005680619897bd624f into a6139bc44d641d28bd57fa419d83c707494706c4

This commit is contained in:
SR_team 2024-02-10 18:31:24 -07:00 committed by GitHub
commit 47bacbb1ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 4 deletions

View File

@ -1553,12 +1553,15 @@ startSDL2(void)
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, profiles[i].major); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, profiles[i].major);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, profiles[i].minor); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, profiles[i].minor);
SDL_Rect bounds;
SDL_GetDisplayBounds(glGlobals.currentMonitor, &bounds);
if(mode->flags & VIDEOMODEEXCLUSIVE) { if(mode->flags & VIDEOMODEEXCLUSIVE) {
win = SDL_CreateWindow(glGlobals.winTitle, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, mode->mode.w, mode->mode.h, SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN); win = SDL_CreateWindow(glGlobals.winTitle, bounds.x, bounds.y, mode->mode.w, mode->mode.h, SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL | SDL_WINDOW_FULLSCREEN);
if (win) if (win)
SDL_SetWindowDisplayMode(win, &mode->mode); SDL_SetWindowDisplayMode(win, &mode->mode);
} else { } else {
win = SDL_CreateWindow(glGlobals.winTitle, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, glGlobals.winWidth, glGlobals.winHeight, SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL); win = SDL_CreateWindow(glGlobals.winTitle, bounds.x, bounds.y, glGlobals.winWidth, glGlobals.winHeight, SDL_WINDOW_RESIZABLE | SDL_WINDOW_OPENGL);
if (win) if (win)
SDL_SetWindowDisplayMode(win, NULL); SDL_SetWindowDisplayMode(win, NULL);
} }
@ -1940,7 +1943,20 @@ deviceSystemSDL2(DeviceReq req, void *arg, int32 n)
case DEVICEFINALIZE: case DEVICEFINALIZE:
return finalizeOpenGL(); return finalizeOpenGL();
// TODO: implement subsystems case DEVICEGETNUMSUBSYSTEMS:
return SDL_GetNumVideoDisplays();
case DEVICEGETSUBSSYSTEMINFO:
if (n > SDL_GetNumVideoDisplays())
return 0;
strncpy(((SubSystemInfo*)arg)->name, SDL_GetDisplayName(n), sizeof(SubSystemInfo::name));
return 1;
case DEVICEGETCURRENTSUBSYSTEM:
return glGlobals.currentMonitor;
case DEVICESETSUBSYSTEM:
if (n > SDL_GetNumVideoDisplays())
return 0;
glGlobals.currentMonitor = n;
return 1;
case DEVICEGETNUMVIDEOMODES: case DEVICEGETNUMVIDEOMODES:
return glGlobals.numModes; return glGlobals.numModes;

View File

@ -45,8 +45,8 @@ struct GlGlobals
GLFWmonitor *monitor; GLFWmonitor *monitor;
int numMonitors; int numMonitors;
int currentMonitor;
#endif #endif
int currentMonitor;
DisplayMode *modes; DisplayMode *modes;
int numModes; int numModes;