Commit 96c61446 authored by Sam Lantinga's avatar Sam Lantinga

Hopefully fixed the fullscreen mode code for KDE

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%4089
parent 4e0366dc
......@@ -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);
}
......
......@@ -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
......@@ -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 ) {
......@@ -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);
}
......@@ -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;
}
......@@ -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);
}
......@@ -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;
}
......@@ -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 ) {
......@@ -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);
......
......@@ -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 */
......@@ -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) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment