Fixed creating fullscreen windows on Steam Link
authorSam Lantinga <slouken@libsdl.org>
Fri, 22 Jan 2016 13:12:16 -0800
changeset 10056 4f139e059592
parent 10055 b2fd76446eee
child 10057 1599a0012da5
Fixed creating fullscreen windows on Steam Link
src/video/SDL_video.c
--- a/src/video/SDL_video.c	Sat Jan 16 21:58:49 2016 -0800
+++ b/src/video/SDL_video.c	Fri Jan 22 13:12:16 2016 -0800
@@ -1309,11 +1309,6 @@
 static void
 SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags)
 {
-    window->windowed.x = window->x;
-    window->windowed.y = window->y;
-    window->windowed.w = window->w;
-    window->windowed.h = window->h;
-
     if (flags & SDL_WINDOW_MAXIMIZED) {
         SDL_MaximizeWindow(window);
     }
@@ -1413,6 +1408,25 @@
             window->y = bounds.y + (bounds.h - h) / 2;
         }
     }
+    window->windowed.x = window->x;
+    window->windowed.y = window->y;
+    window->windowed.w = window->w;
+    window->windowed.h = window->h;
+
+    if (flags & SDL_WINDOW_FULLSCREEN) {
+        SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window);
+        int displayIndex;
+        SDL_Rect bounds;
+
+        displayIndex = SDL_GetIndexOfDisplay(display);
+        SDL_GetDisplayBounds(displayIndex, &bounds);
+
+        window->x = bounds.x;
+        window->y = bounds.y;
+        window->w = bounds.w;
+        window->h = bounds.h;
+    }
+
     window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN);
     window->last_fullscreen_flags = window->flags;
     window->opacity = 1.0f;