Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Hopefully fixed the fullscreen mode code for KDE
  • Loading branch information
Sam Lantinga committed Jul 7, 2001
1 parent 1e22c6a commit 6765e8c
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 57 deletions.
6 changes: 0 additions & 6 deletions src/video/x11/SDL_x11events.c
Expand Up @@ -347,13 +347,7 @@ printf("MapNotify!\n");

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);
}
Expand Down
54 changes: 25 additions & 29 deletions src/video/x11/SDL_x11modes.c
Expand Up @@ -37,6 +37,7 @@ static char rcsid =
#include "SDL_x11video.h"
#include "SDL_x11wm_c.h"
#include "SDL_x11modes_c.h"
#include "SDL_x11image_c.h"


#ifdef XFREE86_VM
Expand Down Expand Up @@ -459,31 +460,6 @@ int X11_EnterFullScreen(_THIS)
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 ) {
Expand All @@ -502,7 +478,19 @@ int X11_EnterFullScreen(_THIS)
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);
}

Expand All @@ -518,9 +506,6 @@ int X11_LeaveFullScreen(_THIS)
#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;
}
Expand All @@ -530,5 +515,16 @@ int X11_LeaveFullScreen(_THIS)
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);
}
12 changes: 0 additions & 12 deletions src/video/x11/SDL_x11video.c
Expand Up @@ -853,11 +853,7 @@ static int X11_CreateWindow(_THIS, SDL_Surface *screen,
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;
}
Expand All @@ -881,11 +877,7 @@ static int X11_ResizeWindow(_THIS,
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 ) {
Expand Down Expand Up @@ -969,12 +961,8 @@ static int X11_ToggleFullScreen(_THIS, int on)
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);
Expand Down
25 changes: 15 additions & 10 deletions src/video/x11/SDL_x11wm.c
Expand Up @@ -258,16 +258,17 @@ SDL_GrabMode X11_GrabInputNoLock(_THIS, SDL_GrabMode mode)
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 */
Expand All @@ -278,16 +279,20 @@ SDL_GrabMode X11_GrabInputNoLock(_THIS, SDL_GrabMode mode)
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) )
Expand Down

0 comments on commit 6765e8c

Please sign in to comment.