changeset 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 3ef4bc90c388
children 69b8fac3e1c0
files src/video/x11/SDL_x11events.c src/video/x11/SDL_x11modes.c src/video/x11/SDL_x11video.c src/video/x11/SDL_x11wm.c
diffstat 4 files changed, 40 insertions(+), 57 deletions(-) [+]
line wrap: on
line diff
--- a/src/video/x11/SDL_x11events.c	Sat Jul 07 06:33:33 2001 +0000
+++ b/src/video/x11/SDL_x11events.c	Sat Jul 07 07:59:37 2001 +0000
@@ -347,13 +347,7 @@
 
 		if ( SDL_VideoSurface &&
 		     (SDL_VideoSurface->flags & SDL_FULLSCREEN) ) {
-#ifdef GRAB_FULLSCREEN
 			X11_EnterFullScreen(this);
-#else
-			/* Queue entry into fullscreen mode */
-			switch_waiting = 0x01 | SDL_FULLSCREEN;
-			switch_time = SDL_GetTicks() + 1500;
-#endif
 		} else {
 			X11_GrabInputNoLock(this, this->input_grab);
 		}
--- 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);
 }
--- a/src/video/x11/SDL_x11video.c	Sat Jul 07 06:33:33 2001 +0000
+++ b/src/video/x11/SDL_x11video.c	Sat Jul 07 07:59:37 2001 +0000
@@ -853,11 +853,7 @@
 		if ( flags & SDL_FULLSCREEN ) {
 			screen->flags |= SDL_FULLSCREEN;
 			X11_WaitMapped(this, WMwindow);
-#ifdef GRAB_FULLSCREEN
 			X11_EnterFullScreen(this);
-#else
-			X11_QueueEnterFullScreen(this);
-#endif
 		} else {
 			screen->flags &= ~SDL_FULLSCREEN;
 		}
@@ -881,11 +877,7 @@
 				X11_ResizeFullScreen(this);
 			} else {
 				screen->flags |= SDL_FULLSCREEN;
-#ifdef GRAB_FULLSCREEN
 				X11_EnterFullScreen(this);
-#else
-				X11_QueueEnterFullScreen(this);
-#endif
 			}
 		} else {
 			if ( screen->flags & SDL_FULLSCREEN ) {
@@ -969,12 +961,8 @@
 		SDL_Lock_EventThread();
 	}
 	if ( on ) {
-#ifdef GRAB_FULLSCREEN
 		this->screen->flags |= SDL_FULLSCREEN;
 		X11_EnterFullScreen(this);
-#else
-		X11_QueueEnterFullScreen(this);
-#endif
 	} else {
 		this->screen->flags &= ~SDL_FULLSCREEN;
 		X11_LeaveFullScreen(this);
--- a/src/video/x11/SDL_x11wm.c	Sat Jul 07 06:33:33 2001 +0000
+++ b/src/video/x11/SDL_x11wm.c	Sat Jul 07 07:59:37 2001 +0000
@@ -258,16 +258,17 @@
 						True, 0,
 						GrabModeAsync, GrabModeAsync,
 						FSwindow, None, CurrentTime);
-				if ( result == AlreadyGrabbed ) {
+				if ( result == GrabSuccess ) {
 					break;
 				}
 				SDL_Delay(100);
 			}
+			if ( result != GrabSuccess ) {
+				/* Uh, oh, what do we do here? */ ;
+			}
 		}
-#ifdef GRAB_FULLSCREEN
 		if ( !(this->screen->flags & SDL_FULLSCREEN) )
-#endif
-		XUngrabKeyboard(SDL_Display, CurrentTime);
+			XUngrabKeyboard(SDL_Display, CurrentTime);
 	} else {
 		if ( this->screen->flags & SDL_FULLSCREEN ) {
 			/* Unbind the mouse from the fullscreen window */
@@ -278,16 +279,20 @@
 			result = XGrabPointer(SDL_Display, SDL_Window, True, 0,
 						GrabModeAsync, GrabModeAsync,
 						SDL_Window, None, CurrentTime);
-			if ( result != AlreadyGrabbed ) {
+			if ( result == GrabSuccess ) {
 				break;
 			}
 			SDL_Delay(100);
 		}
-#ifdef GRAB_FULLSCREEN
-		if ( !(this->screen->flags & SDL_FULLSCREEN) )
-#endif
-		XGrabKeyboard(SDL_Display, WMwindow, True,
-			GrabModeAsync, GrabModeAsync, CurrentTime);
+		if ( result != GrabSuccess ) {
+			/* Uh, oh, what do we do here? */ ;
+		}
+		/* Grab the keyboard if we're in fullscreen mode */
+		if ( !(this->screen->flags & SDL_FULLSCREEN) ) {
+			XGrabKeyboard(SDL_Display, WMwindow, True,
+				GrabModeAsync, GrabModeAsync, CurrentTime);
+			SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
+		}
 
 		/* Raise the window if we grab the mouse */
 		if ( !(this->screen->flags & SDL_FULLSCREEN) )