Hopefully fixed the fullscreen mode code for KDE
authorSam Lantinga <slouken@lokigames.com>
Sat, 07 Jul 2001 07:59:37 +0000
changeset 8871774090f286
parent 87 3ef4bc90c388
child 89 69b8fac3e1c0
Hopefully fixed the fullscreen mode code for KDE
src/video/x11/SDL_x11events.c
src/video/x11/SDL_x11modes.c
src/video/x11/SDL_x11video.c
src/video/x11/SDL_x11wm.c
     1.1 --- a/src/video/x11/SDL_x11events.c	Sat Jul 07 06:33:33 2001 +0000
     1.2 +++ b/src/video/x11/SDL_x11events.c	Sat Jul 07 07:59:37 2001 +0000
     1.3 @@ -347,13 +347,7 @@
     1.4  
     1.5  		if ( SDL_VideoSurface &&
     1.6  		     (SDL_VideoSurface->flags & SDL_FULLSCREEN) ) {
     1.7 -#ifdef GRAB_FULLSCREEN
     1.8  			X11_EnterFullScreen(this);
     1.9 -#else
    1.10 -			/* Queue entry into fullscreen mode */
    1.11 -			switch_waiting = 0x01 | SDL_FULLSCREEN;
    1.12 -			switch_time = SDL_GetTicks() + 1500;
    1.13 -#endif
    1.14  		} else {
    1.15  			X11_GrabInputNoLock(this, this->input_grab);
    1.16  		}
     2.1 --- a/src/video/x11/SDL_x11modes.c	Sat Jul 07 06:33:33 2001 +0000
     2.2 +++ b/src/video/x11/SDL_x11modes.c	Sat Jul 07 07:59:37 2001 +0000
     2.3 @@ -37,6 +37,7 @@
     2.4  #include "SDL_x11video.h"
     2.5  #include "SDL_x11wm_c.h"
     2.6  #include "SDL_x11modes_c.h"
     2.7 +#include "SDL_x11image_c.h"
     2.8  
     2.9  
    2.10  #ifdef XFREE86_VM
    2.11 @@ -459,31 +460,6 @@
    2.12  	XRaiseWindow(SDL_Display, FSwindow);
    2.13  #endif
    2.14  
    2.15 -        /* Grab the mouse on the fullscreen window
    2.16 -           The event handling will know when we become active, and then
    2.17 -           enter fullscreen mode if we can't grab the mouse this time.
    2.18 -         */
    2.19 -#ifdef GRAB_FULLSCREEN
    2.20 -        if ( (XGrabPointer(SDL_Display, FSwindow, True, 0,
    2.21 -                          GrabModeAsync, GrabModeAsync,
    2.22 -                          FSwindow, None, CurrentTime) != GrabSuccess) ||
    2.23 -             (XGrabKeyboard(SDL_Display, WMwindow, True,
    2.24 -                          GrabModeAsync, GrabModeAsync, CurrentTime) != 0) ) {
    2.25 -#else
    2.26 -        if ( XGrabPointer(SDL_Display, FSwindow, True, 0,
    2.27 -                          GrabModeAsync, GrabModeAsync,
    2.28 -                          FSwindow, None, CurrentTime) != GrabSuccess ) {
    2.29 -#endif
    2.30 -            /* We lost the grab, so try again later */
    2.31 -            XUnmapWindow(SDL_Display, FSwindow);
    2.32 -            X11_WaitUnmapped(this, FSwindow);
    2.33 -            X11_QueueEnterFullScreen(this);
    2.34 -            return(0);
    2.35 -        }
    2.36 -#ifdef GRAB_FULLSCREEN
    2.37 -	SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
    2.38 -#endif
    2.39 -
    2.40  #ifdef XFREE86_VM
    2.41          /* Save the current video mode */
    2.42          if ( use_vidmode ) {
    2.43 @@ -502,7 +478,19 @@
    2.44  		XInstallColormap(SDL_Display, SDL_XColorMap);
    2.45  	}
    2.46      }
    2.47 -    X11_GrabInputNoLock(this, this->input_grab | SDL_GRAB_FULLSCREEN);
    2.48 +    if ( okay )
    2.49 +        X11_GrabInputNoLock(this, this->input_grab | SDL_GRAB_FULLSCREEN);
    2.50 +
    2.51 +    /* We may need to refresh the screen at this point (no backing store)
    2.52 +       We also don't get an event, which is why we explicitly refresh. */
    2.53 +    if ( this->screen ) {
    2.54 +        if ( this->screen->flags & SDL_OPENGL ) {
    2.55 +            SDL_PrivateExpose();
    2.56 +        } else {
    2.57 +            X11_RefreshDisplay(this);
    2.58 +        }
    2.59 +    }
    2.60 +
    2.61      return(okay);
    2.62  }
    2.63  
    2.64 @@ -518,9 +506,6 @@
    2.65  #endif
    2.66          XUnmapWindow(SDL_Display, FSwindow);
    2.67          X11_WaitUnmapped(this, FSwindow);
    2.68 -#ifdef GRAB_FULLSCREEN
    2.69 -        XUngrabKeyboard(SDL_Display, CurrentTime);
    2.70 -#endif
    2.71          XSync(SDL_Display, True);   /* Flush spurious mode change events */
    2.72          currently_fullscreen = 0;
    2.73      }
    2.74 @@ -530,5 +515,16 @@
    2.75         explicitly grabbed.
    2.76       */
    2.77      X11_GrabInputNoLock(this, this->input_grab & ~SDL_GRAB_FULLSCREEN);
    2.78 +
    2.79 +    /* We may need to refresh the screen at this point (no backing store)
    2.80 +       We also don't get an event, which is why we explicitly refresh. */
    2.81 +    if ( this->screen ) {
    2.82 +        if ( this->screen->flags & SDL_OPENGL ) {
    2.83 +            SDL_PrivateExpose();
    2.84 +        } else {
    2.85 +            X11_RefreshDisplay(this);
    2.86 +        }
    2.87 +    }
    2.88 +
    2.89      return(0);
    2.90  }
     3.1 --- a/src/video/x11/SDL_x11video.c	Sat Jul 07 06:33:33 2001 +0000
     3.2 +++ b/src/video/x11/SDL_x11video.c	Sat Jul 07 07:59:37 2001 +0000
     3.3 @@ -853,11 +853,7 @@
     3.4  		if ( flags & SDL_FULLSCREEN ) {
     3.5  			screen->flags |= SDL_FULLSCREEN;
     3.6  			X11_WaitMapped(this, WMwindow);
     3.7 -#ifdef GRAB_FULLSCREEN
     3.8  			X11_EnterFullScreen(this);
     3.9 -#else
    3.10 -			X11_QueueEnterFullScreen(this);
    3.11 -#endif
    3.12  		} else {
    3.13  			screen->flags &= ~SDL_FULLSCREEN;
    3.14  		}
    3.15 @@ -881,11 +877,7 @@
    3.16  				X11_ResizeFullScreen(this);
    3.17  			} else {
    3.18  				screen->flags |= SDL_FULLSCREEN;
    3.19 -#ifdef GRAB_FULLSCREEN
    3.20  				X11_EnterFullScreen(this);
    3.21 -#else
    3.22 -				X11_QueueEnterFullScreen(this);
    3.23 -#endif
    3.24  			}
    3.25  		} else {
    3.26  			if ( screen->flags & SDL_FULLSCREEN ) {
    3.27 @@ -969,12 +961,8 @@
    3.28  		SDL_Lock_EventThread();
    3.29  	}
    3.30  	if ( on ) {
    3.31 -#ifdef GRAB_FULLSCREEN
    3.32  		this->screen->flags |= SDL_FULLSCREEN;
    3.33  		X11_EnterFullScreen(this);
    3.34 -#else
    3.35 -		X11_QueueEnterFullScreen(this);
    3.36 -#endif
    3.37  	} else {
    3.38  		this->screen->flags &= ~SDL_FULLSCREEN;
    3.39  		X11_LeaveFullScreen(this);
     4.1 --- a/src/video/x11/SDL_x11wm.c	Sat Jul 07 06:33:33 2001 +0000
     4.2 +++ b/src/video/x11/SDL_x11wm.c	Sat Jul 07 07:59:37 2001 +0000
     4.3 @@ -258,16 +258,17 @@
     4.4  						True, 0,
     4.5  						GrabModeAsync, GrabModeAsync,
     4.6  						FSwindow, None, CurrentTime);
     4.7 -				if ( result == AlreadyGrabbed ) {
     4.8 +				if ( result == GrabSuccess ) {
     4.9  					break;
    4.10  				}
    4.11  				SDL_Delay(100);
    4.12  			}
    4.13 +			if ( result != GrabSuccess ) {
    4.14 +				/* Uh, oh, what do we do here? */ ;
    4.15 +			}
    4.16  		}
    4.17 -#ifdef GRAB_FULLSCREEN
    4.18  		if ( !(this->screen->flags & SDL_FULLSCREEN) )
    4.19 -#endif
    4.20 -		XUngrabKeyboard(SDL_Display, CurrentTime);
    4.21 +			XUngrabKeyboard(SDL_Display, CurrentTime);
    4.22  	} else {
    4.23  		if ( this->screen->flags & SDL_FULLSCREEN ) {
    4.24  			/* Unbind the mouse from the fullscreen window */
    4.25 @@ -278,16 +279,20 @@
    4.26  			result = XGrabPointer(SDL_Display, SDL_Window, True, 0,
    4.27  						GrabModeAsync, GrabModeAsync,
    4.28  						SDL_Window, None, CurrentTime);
    4.29 -			if ( result != AlreadyGrabbed ) {
    4.30 +			if ( result == GrabSuccess ) {
    4.31  				break;
    4.32  			}
    4.33  			SDL_Delay(100);
    4.34  		}
    4.35 -#ifdef GRAB_FULLSCREEN
    4.36 -		if ( !(this->screen->flags & SDL_FULLSCREEN) )
    4.37 -#endif
    4.38 -		XGrabKeyboard(SDL_Display, WMwindow, True,
    4.39 -			GrabModeAsync, GrabModeAsync, CurrentTime);
    4.40 +		if ( result != GrabSuccess ) {
    4.41 +			/* Uh, oh, what do we do here? */ ;
    4.42 +		}
    4.43 +		/* Grab the keyboard if we're in fullscreen mode */
    4.44 +		if ( !(this->screen->flags & SDL_FULLSCREEN) ) {
    4.45 +			XGrabKeyboard(SDL_Display, WMwindow, True,
    4.46 +				GrabModeAsync, GrabModeAsync, CurrentTime);
    4.47 +			SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
    4.48 +		}
    4.49  
    4.50  		/* Raise the window if we grab the mouse */
    4.51  		if ( !(this->screen->flags & SDL_FULLSCREEN) )