diff src/video/x11/SDL_x11modes.c @ 88:71774090f286

Hopefully fixed the fullscreen mode code for KDE
author Sam Lantinga <slouken@lokigames.com>
date Sat, 07 Jul 2001 07:59:37 +0000
parents 74212992fb08
children ee1f71c10889
line wrap: on
line diff
--- a/src/video/x11/SDL_x11modes.c	Sat Jul 07 06:33:33 2001 +0000
+++ b/src/video/x11/SDL_x11modes.c	Sat Jul 07 07:59:37 2001 +0000
@@ -37,6 +37,7 @@
 #include "SDL_x11video.h"
 #include "SDL_x11wm_c.h"
 #include "SDL_x11modes_c.h"
+#include "SDL_x11image_c.h"
 
 
 #ifdef XFREE86_VM
@@ -459,31 +460,6 @@
 	XRaiseWindow(SDL_Display, FSwindow);
 #endif
 
-        /* Grab the mouse on the fullscreen window
-           The event handling will know when we become active, and then
-           enter fullscreen mode if we can't grab the mouse this time.
-         */
-#ifdef GRAB_FULLSCREEN
-        if ( (XGrabPointer(SDL_Display, FSwindow, True, 0,
-                          GrabModeAsync, GrabModeAsync,
-                          FSwindow, None, CurrentTime) != GrabSuccess) ||
-             (XGrabKeyboard(SDL_Display, WMwindow, True,
-                          GrabModeAsync, GrabModeAsync, CurrentTime) != 0) ) {
-#else
-        if ( XGrabPointer(SDL_Display, FSwindow, True, 0,
-                          GrabModeAsync, GrabModeAsync,
-                          FSwindow, None, CurrentTime) != GrabSuccess ) {
-#endif
-            /* We lost the grab, so try again later */
-            XUnmapWindow(SDL_Display, FSwindow);
-            X11_WaitUnmapped(this, FSwindow);
-            X11_QueueEnterFullScreen(this);
-            return(0);
-        }
-#ifdef GRAB_FULLSCREEN
-	SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
-#endif
-
 #ifdef XFREE86_VM
         /* Save the current video mode */
         if ( use_vidmode ) {
@@ -502,7 +478,19 @@
 		XInstallColormap(SDL_Display, SDL_XColorMap);
 	}
     }
-    X11_GrabInputNoLock(this, this->input_grab | SDL_GRAB_FULLSCREEN);
+    if ( okay )
+        X11_GrabInputNoLock(this, this->input_grab | SDL_GRAB_FULLSCREEN);
+
+    /* We may need to refresh the screen at this point (no backing store)
+       We also don't get an event, which is why we explicitly refresh. */
+    if ( this->screen ) {
+        if ( this->screen->flags & SDL_OPENGL ) {
+            SDL_PrivateExpose();
+        } else {
+            X11_RefreshDisplay(this);
+        }
+    }
+
     return(okay);
 }
 
@@ -518,9 +506,6 @@
 #endif
         XUnmapWindow(SDL_Display, FSwindow);
         X11_WaitUnmapped(this, FSwindow);
-#ifdef GRAB_FULLSCREEN
-        XUngrabKeyboard(SDL_Display, CurrentTime);
-#endif
         XSync(SDL_Display, True);   /* Flush spurious mode change events */
         currently_fullscreen = 0;
     }
@@ -530,5 +515,16 @@
        explicitly grabbed.
      */
     X11_GrabInputNoLock(this, this->input_grab & ~SDL_GRAB_FULLSCREEN);
+
+    /* We may need to refresh the screen at this point (no backing store)
+       We also don't get an event, which is why we explicitly refresh. */
+    if ( this->screen ) {
+        if ( this->screen->flags & SDL_OPENGL ) {
+            SDL_PrivateExpose();
+        } else {
+            X11_RefreshDisplay(this);
+        }
+    }
+
     return(0);
 }