Pārlūkot izejas kodu

Add a capability for fullscreen-only video drivers

Cameron Cawley 1 gadu atpakaļ
vecāks
revīzija
d760f16ba6

+ 2 - 1
src/video/SDL_sysvideo.h

@@ -156,7 +156,8 @@ typedef enum
 {
     VIDEO_DEVICE_CAPS_MODE_SWITCHING_EMULATED = 0x01,
     VIDEO_DEVICE_CAPS_HAS_POPUP_WINDOW_SUPPORT = 0x02,
-    VIDEO_DEVICE_CAPS_SENDS_FULLSCREEN_DIMENSIONS = 0x04
+    VIDEO_DEVICE_CAPS_SENDS_FULLSCREEN_DIMENSIONS = 0x04,
+    VIDEO_DEVICE_CAPS_FULLSCREEN_ONLY = 0x08
 } DeviceCaps;
 
 struct SDL_VideoDevice

+ 7 - 1
src/video/SDL_video.c

@@ -179,6 +179,11 @@ static SDL_bool SDL_SendsFullscreenDimensions(SDL_VideoDevice *_this)
     return !!(_this->device_caps & VIDEO_DEVICE_CAPS_SENDS_FULLSCREEN_DIMENSIONS);
 }
 
+static SDL_bool IsFullscreenOnly(SDL_VideoDevice *_this)
+{
+    return !!(_this->device_caps & VIDEO_DEVICE_CAPS_FULLSCREEN_ONLY);
+}
+
 /* Hint to treat all window ops as synchronous */
 static SDL_bool syncHint;
 
@@ -2135,7 +2140,7 @@ SDL_Window *SDL_CreateWindowWithProperties(SDL_PropertiesID props)
     window->undefined_x = undefined_x;
     window->undefined_y = undefined_y;
 
-    if (flags & SDL_WINDOW_FULLSCREEN) {
+    if (flags & SDL_WINDOW_FULLSCREEN || IsFullscreenOnly(_this)) {
         SDL_VideoDisplay *display = SDL_GetVideoDisplayForWindow(window);
         SDL_Rect bounds;
 
@@ -2144,6 +2149,7 @@ SDL_Window *SDL_CreateWindowWithProperties(SDL_PropertiesID props)
         window->y = bounds.y;
         window->w = bounds.w;
         window->h = bounds.h;
+        flags |= SDL_WINDOW_FULLSCREEN;
     }
 
     window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);

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

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

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

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