Browse Source

Add a quirk for fullscreen-only video drivers

Cameron Cawley 1 year ago
parent
commit
596096a86a

+ 1 - 0
src/video/SDL_sysvideo.h

@@ -155,6 +155,7 @@ typedef enum
 {
     VIDEO_DEVICE_QUIRK_DISABLE_DISPLAY_MODE_SWITCHING = 0x01,
     VIDEO_DEVICE_QUIRK_DISABLE_UNSET_FULLSCREEN_ON_MINIMIZE = 0x02,
+    VIDEO_DEVICE_QUIRK_FULLSCREEN_ONLY = 0x04,
 } DeviceQuirkFlags;
 
 struct SDL_VideoDevice

+ 7 - 1
src/video/SDL_video.c

@@ -188,6 +188,11 @@ static SDL_bool DisableUnsetFullscreenOnMinimize(_THIS)
     return !!(_this->quirk_flags & VIDEO_DEVICE_QUIRK_DISABLE_UNSET_FULLSCREEN_ON_MINIMIZE);
 }
 
+static SDL_bool IsFullscreenOnly(_THIS)
+{
+    return !!(_this->quirk_flags & VIDEO_DEVICE_QUIRK_FULLSCREEN_ONLY);
+}
+
 /* Support for framebuffer emulation using an accelerated renderer */
 
 #define SDL_WINDOWTEXTUREDATA "_SDL_WindowTextureData"
@@ -1752,7 +1757,7 @@ SDL_Window *SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint
     window->windowed.w = window->w;
     window->windowed.h = window->h;
 
-    if (flags & SDL_WINDOW_FULLSCREEN) {
+    if (flags & SDL_WINDOW_FULLSCREEN || IsFullscreenOnly(_this)) {
         SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
         int displayIndex;
         SDL_Rect bounds;
@@ -1779,6 +1784,7 @@ SDL_Window *SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint
         window->y = bounds.y;
         window->w = bounds.w;
         window->h = bounds.h;
+        flags |= SDL_WINDOW_FULLSCREEN;
     }
 
     window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);

+ 1 - 0
src/video/nacl/SDL_naclvideo.c

@@ -128,6 +128,7 @@ static SDL_VideoDevice *NACL_CreateDevice(void) {
     device->GL_SwapWindow = NACL_GLES_SwapWindow;
     device->GL_DeleteContext = NACL_GLES_DeleteContext;
 
+    device->quirk_flags = VIDEO_DEVICE_QUIRK_FULLSCREEN_ONLY;
 
     return device;
 }

+ 0 - 1
src/video/nacl/SDL_naclwindow.c

@@ -45,7 +45,6 @@ int NACL_CreateWindow(_THIS, SDL_Window * window)
     window->h = driverdata->h;
 
     window->flags &= ~SDL_WINDOW_RESIZABLE;     /* window is NEVER resizeable */
-    window->flags |= SDL_WINDOW_FULLSCREEN;     /* window is always fullscreen */
     window->flags &= ~SDL_WINDOW_HIDDEN;
     window->flags |= SDL_WINDOW_SHOWN;          /* only one window on NaCl */
     window->flags |= SDL_WINDOW_INPUT_FOCUS;    /* always has input focus */

+ 3 - 0
src/video/riscos/SDL_riscosvideo.c

@@ -90,6 +90,9 @@ static SDL_VideoDevice *RISCOS_CreateDevice(void)
 
     device->free = RISCOS_DeleteDevice;
 
+    /* TODO: Support windowed mode */
+    device->quirk_flags = VIDEO_DEVICE_QUIRK_FULLSCREEN_ONLY;
+
     return device;
 }
 

+ 0 - 2
src/video/riscos/SDL_riscoswindow.c

@@ -41,8 +41,6 @@ int RISCOS_CreateWindow(_THIS, SDL_Window *window)
     }
     driverdata->window = window;
 
-    window->flags |= SDL_WINDOW_FULLSCREEN;
-
     SDL_SetMouseFocus(window);
 
     /* All done! */