diff src/video/x11/SDL_x11modes.c @ 98:8a5aff5c1294

Fixed some problems with the fullscreen code. Wooo. :)
author Sam Lantinga <slouken@lokigames.com>
date Mon, 09 Jul 2001 22:36:16 +0000
parents e85e03f195b4
children a1c973c35fef
line wrap: on
line diff
--- a/src/video/x11/SDL_x11modes.c	Mon Jul 09 15:47:40 2001 +0000
+++ b/src/video/x11/SDL_x11modes.c	Mon Jul 09 22:36:16 2001 +0000
@@ -396,7 +396,7 @@
         set_best_resolution(this, current_w, current_h);
         move_cursor_to(this, 0, 0);
         get_real_resolution(this, &real_w, &real_h);
-        XResizeWindow(SDL_Display, FSwindow, real_w, real_h);
+        XMoveResizeWindow(SDL_Display, FSwindow, 0, 0, real_w, real_h);
         move_cursor_to(this, real_w/2, real_h/2);
 
         /* Center and reparent the drawing window */
@@ -425,58 +425,62 @@
     Window tmpwin, *windows;
     int i, nwindows;
 #endif
+    int real_w, real_h;
 
     okay = 1;
-    if ( ! currently_fullscreen ) {
-        int real_w, real_h;
+    if ( currently_fullscreen ) {
+        return(okay);
+    }
 
-        /* Map the fullscreen window to blank the screen */
-        get_real_resolution(this, &real_w, &real_h);
-        XResizeWindow(SDL_Display, FSwindow, real_w, real_h);
-        XMapRaised(SDL_Display, FSwindow);
-        X11_WaitMapped(this, FSwindow);
+    /* Ungrab the input so that we can move the mouse around */
+    X11_GrabInputNoLock(this, SDL_GRAB_OFF);
+
+    /* Map the fullscreen window to blank the screen */
+    get_real_resolution(this, &real_w, &real_h);
+    XMoveResizeWindow(SDL_Display, FSwindow, 0, 0, real_w, real_h);
+    XMapRaised(SDL_Display, FSwindow);
+    X11_WaitMapped(this, FSwindow);
 
 #if 0 /* This seems to break WindowMaker in focus-follows-mouse mode */
-        /* Make sure we got to the top of the window stack */
-        if ( XQueryTree(SDL_Display, SDL_Root, &tmpwin, &tmpwin,
-                                &windows, &nwindows) && windows ) {
-            /* If not, try to put us there - if fail... oh well */
-            if ( windows[nwindows-1] != FSwindow ) {
-                tmpwin = windows[nwindows-1];
-                for ( i=0; i<nwindows; ++i ) {
-                    if ( windows[i] == FSwindow ) {
-                        memcpy(&windows[i], &windows[i+1],
-                               (nwindows-i-1)*sizeof(windows[i]));
-                        break;
-                    }
+    /* Make sure we got to the top of the window stack */
+    if ( XQueryTree(SDL_Display, SDL_Root, &tmpwin, &tmpwin,
+                            &windows, &nwindows) && windows ) {
+        /* If not, try to put us there - if fail... oh well */
+        if ( windows[nwindows-1] != FSwindow ) {
+            tmpwin = windows[nwindows-1];
+            for ( i=0; i<nwindows; ++i ) {
+                if ( windows[i] == FSwindow ) {
+                    memcpy(&windows[i], &windows[i+1],
+                           (nwindows-i-1)*sizeof(windows[i]));
+                    break;
                 }
-                windows[nwindows-1] = FSwindow;
-                XRestackWindows(SDL_Display, windows, nwindows);
-                XSync(SDL_Display, False);
             }
-            XFree(windows);
+            windows[nwindows-1] = FSwindow;
+            XRestackWindows(SDL_Display, windows, nwindows);
+            XSync(SDL_Display, False);
         }
+        XFree(windows);
+    }
 #else
-	XRaiseWindow(SDL_Display, FSwindow);
+    XRaiseWindow(SDL_Display, FSwindow);
 #endif
 
 #ifdef XFREE86_VM
-        /* Save the current video mode */
-        if ( use_vidmode ) {
-            XVidMode(LockModeSwitch, (SDL_Display, SDL_Screen, True));
-        }
+    /* Save the current video mode */
+    if ( use_vidmode ) {
+        XVidMode(LockModeSwitch, (SDL_Display, SDL_Screen, True));
+    }
 #endif
-        currently_fullscreen = 1;
+    currently_fullscreen = 1;
 
-        /* Set the new resolution */
-        okay = X11_ResizeFullScreen(this);
-        if ( ! okay ) {
-            X11_LeaveFullScreen(this);
-        }
-	/* Set the colormap */
-	if ( SDL_XColorMap ) {
-		XInstallColormap(SDL_Display, SDL_XColorMap);
-	}
+    /* Set the new resolution */
+    okay = X11_ResizeFullScreen(this);
+    if ( ! okay ) {
+        X11_LeaveFullScreen(this);
+    }
+    /* Set the colormap */
+    if ( SDL_XColorMap ) {
+        XInstallColormap(SDL_Display, SDL_XColorMap);
     }
     if ( okay )
         X11_GrabInputNoLock(this, this->input_grab | SDL_GRAB_FULLSCREEN);