mirror of
https://github.com/joel16/SDL2.git
synced 2025-03-04 09:27:15 +00:00
Fixed some problems with the fullscreen code. Wooo. :)
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%4099
This commit is contained in:
parent
0d895fa8a8
commit
d8a033f83d
@ -396,7 +396,7 @@ int X11_ResizeFullScreen(_THIS)
|
||||
set_best_resolution(this, current_w, current_h);
|
||||
move_cursor_to(this, 0, 0);
|
||||
get_real_resolution(this, &real_w, &real_h);
|
||||
XResizeWindow(SDL_Display, FSwindow, real_w, real_h);
|
||||
XMoveResizeWindow(SDL_Display, FSwindow, 0, 0, real_w, real_h);
|
||||
move_cursor_to(this, real_w/2, real_h/2);
|
||||
|
||||
/* Center and reparent the drawing window */
|
||||
@ -425,14 +425,19 @@ int X11_EnterFullScreen(_THIS)
|
||||
Window tmpwin, *windows;
|
||||
int i, nwindows;
|
||||
#endif
|
||||
int real_w, real_h;
|
||||
|
||||
okay = 1;
|
||||
if ( ! currently_fullscreen ) {
|
||||
int real_w, real_h;
|
||||
if ( currently_fullscreen ) {
|
||||
return(okay);
|
||||
}
|
||||
|
||||
/* Ungrab the input so that we can move the mouse around */
|
||||
X11_GrabInputNoLock(this, SDL_GRAB_OFF);
|
||||
|
||||
/* Map the fullscreen window to blank the screen */
|
||||
get_real_resolution(this, &real_w, &real_h);
|
||||
XResizeWindow(SDL_Display, FSwindow, real_w, real_h);
|
||||
XMoveResizeWindow(SDL_Display, FSwindow, 0, 0, real_w, real_h);
|
||||
XMapRaised(SDL_Display, FSwindow);
|
||||
X11_WaitMapped(this, FSwindow);
|
||||
|
||||
@ -477,7 +482,6 @@ int X11_EnterFullScreen(_THIS)
|
||||
if ( SDL_XColorMap ) {
|
||||
XInstallColormap(SDL_Display, SDL_XColorMap);
|
||||
}
|
||||
}
|
||||
if ( okay )
|
||||
X11_GrabInputNoLock(this, this->input_grab | SDL_GRAB_FULLSCREEN);
|
||||
|
||||
|
@ -250,32 +250,21 @@ SDL_GrabMode X11_GrabInputNoLock(_THIS, SDL_GrabMode mode)
|
||||
return(mode); /* Will be set later on mode switch */
|
||||
}
|
||||
if ( mode == SDL_GRAB_OFF ) {
|
||||
printf("SDL grab OFF\n");
|
||||
XUngrabPointer(SDL_Display, CurrentTime);
|
||||
if ( this->screen->flags & SDL_FULLSCREEN ) {
|
||||
/* Rebind the mouse to the fullscreen window */
|
||||
for ( numtries = 0; numtries < 10; ++numtries ) {
|
||||
result = XGrabPointer(SDL_Display, FSwindow,
|
||||
True, 0,
|
||||
GrabModeAsync, GrabModeAsync,
|
||||
FSwindow, None, CurrentTime);
|
||||
if ( result == GrabSuccess ) {
|
||||
break;
|
||||
}
|
||||
SDL_Delay(100);
|
||||
}
|
||||
if ( result != GrabSuccess ) {
|
||||
/* Uh, oh, what do we do here? */ ;
|
||||
}
|
||||
}
|
||||
if ( !(this->screen->flags & SDL_FULLSCREEN) )
|
||||
XUngrabKeyboard(SDL_Display, CurrentTime);
|
||||
} else {
|
||||
printf("SDL grab ON\n");
|
||||
if ( this->screen->flags & SDL_FULLSCREEN ) {
|
||||
/* Unbind the mouse from the fullscreen window */
|
||||
XUngrabPointer(SDL_Display, CurrentTime);
|
||||
}
|
||||
/* Try to grab the mouse */
|
||||
#if 0 /* We'll wait here until we actually grab, otherwise behavior undefined */
|
||||
for ( numtries = 0; numtries < 10; ++numtries ) {
|
||||
#else
|
||||
while ( 1 ) {
|
||||
#endif
|
||||
result = XGrabPointer(SDL_Display, SDL_Window, True, 0,
|
||||
GrabModeAsync, GrabModeAsync,
|
||||
SDL_Window, None, CurrentTime);
|
||||
@ -287,16 +276,16 @@ SDL_GrabMode X11_GrabInputNoLock(_THIS, SDL_GrabMode mode)
|
||||
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) ) {
|
||||
/* Now grab the keyboard */
|
||||
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) )
|
||||
XRaiseWindow(SDL_Display, WMwindow);
|
||||
|
||||
/* Make sure we register input focus */
|
||||
SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
|
||||
}
|
||||
XSync(SDL_Display, False);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user