diff src/events/SDL_windowevents.c @ 5254:7a963be087ef

Mostly fixed fullscreen mode on Mac OS X, and you can toggle it on and off. There are still some problems with the ConvertNSRect() calculations when switching video modes, which causes wierd window positioning issues, and the fullscreen window is still minimized on exit.
author Sam Lantinga <slouken@libsdl.org>
date Fri, 11 Feb 2011 00:25:44 -0800
parents 4d39eeaad00b
children 595814f561f7
line wrap: on
line diff
--- a/src/events/SDL_windowevents.c	Thu Feb 10 22:49:14 2011 -0800
+++ b/src/events/SDL_windowevents.c	Fri Feb 11 00:25:44 2011 -0800
@@ -82,24 +82,35 @@
         SDL_OnWindowHidden(window);
         break;
     case SDL_WINDOWEVENT_MOVED:
-        if (window->flags & SDL_WINDOW_FULLSCREEN) {
+        if (SDL_WINDOWPOS_ISUNDEFINED(data1) ||
+            SDL_WINDOWPOS_ISUNDEFINED(data2)) {
             return 0;
         }
-        if (data1 == SDL_WINDOWPOS_UNDEFINED) {
-            data1 = window->x;
-        }
-        if (data2 == SDL_WINDOWPOS_UNDEFINED) {
-            data2 = window->y;
+        if (window->flags & SDL_WINDOW_FULLSCREEN) {
+            window->fullscreen.x = data1;
+            window->fullscreen.y = data1;
+        } else {
+            window->windowed.x = data1;
+            window->windowed.y = data1;
         }
         if (data1 == window->x && data2 == window->y) {
             return 0;
         }
         window->x = data1;
         window->y = data2;
+
+        if (window->flags & SDL_WINDOW_FULLSCREEN) {
+            /* Do we really want to do this? */
+            return 0;
+        }
         break;
     case SDL_WINDOWEVENT_RESIZED:
         if (window->flags & SDL_WINDOW_FULLSCREEN) {
-            return 0;
+            window->fullscreen.w = data1;
+            window->fullscreen.h = data1;
+        } else {
+            window->windowed.w = data1;
+            window->windowed.h = data1;
         }
         if (data1 == window->w && data2 == window->h) {
             return 0;
@@ -107,6 +118,11 @@
         window->w = data1;
         window->h = data2;
         SDL_OnWindowResized(window);
+
+        if (window->flags & SDL_WINDOW_FULLSCREEN) {
+            /* Do we really want to do this? */
+            return 0;
+        }
         break;
     case SDL_WINDOWEVENT_MINIMIZED:
         if (window->flags & SDL_WINDOW_MINIMIZED) {