comparison src/video/x11/SDL_x11modes.c @ 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 74212992fb08
children ee1f71c10889
comparison
equal deleted inserted replaced
87:3ef4bc90c388 88:71774090f286
35 #include "SDL_events.h" 35 #include "SDL_events.h"
36 #include "SDL_events_c.h" 36 #include "SDL_events_c.h"
37 #include "SDL_x11video.h" 37 #include "SDL_x11video.h"
38 #include "SDL_x11wm_c.h" 38 #include "SDL_x11wm_c.h"
39 #include "SDL_x11modes_c.h" 39 #include "SDL_x11modes_c.h"
40 #include "SDL_x11image_c.h"
40 41
41 42
42 #ifdef XFREE86_VM 43 #ifdef XFREE86_VM
43 Bool XVidMode(GetModeInfo, (Display *dpy, int scr, XF86VidModeModeInfo *info)) 44 Bool XVidMode(GetModeInfo, (Display *dpy, int scr, XF86VidModeModeInfo *info))
44 { 45 {
457 } 458 }
458 #else 459 #else
459 XRaiseWindow(SDL_Display, FSwindow); 460 XRaiseWindow(SDL_Display, FSwindow);
460 #endif 461 #endif
461 462
462 /* Grab the mouse on the fullscreen window
463 The event handling will know when we become active, and then
464 enter fullscreen mode if we can't grab the mouse this time.
465 */
466 #ifdef GRAB_FULLSCREEN
467 if ( (XGrabPointer(SDL_Display, FSwindow, True, 0,
468 GrabModeAsync, GrabModeAsync,
469 FSwindow, None, CurrentTime) != GrabSuccess) ||
470 (XGrabKeyboard(SDL_Display, WMwindow, True,
471 GrabModeAsync, GrabModeAsync, CurrentTime) != 0) ) {
472 #else
473 if ( XGrabPointer(SDL_Display, FSwindow, True, 0,
474 GrabModeAsync, GrabModeAsync,
475 FSwindow, None, CurrentTime) != GrabSuccess ) {
476 #endif
477 /* We lost the grab, so try again later */
478 XUnmapWindow(SDL_Display, FSwindow);
479 X11_WaitUnmapped(this, FSwindow);
480 X11_QueueEnterFullScreen(this);
481 return(0);
482 }
483 #ifdef GRAB_FULLSCREEN
484 SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS);
485 #endif
486
487 #ifdef XFREE86_VM 463 #ifdef XFREE86_VM
488 /* Save the current video mode */ 464 /* Save the current video mode */
489 if ( use_vidmode ) { 465 if ( use_vidmode ) {
490 XVidMode(LockModeSwitch, (SDL_Display, SDL_Screen, True)); 466 XVidMode(LockModeSwitch, (SDL_Display, SDL_Screen, True));
491 } 467 }
500 /* Set the colormap */ 476 /* Set the colormap */
501 if ( SDL_XColorMap ) { 477 if ( SDL_XColorMap ) {
502 XInstallColormap(SDL_Display, SDL_XColorMap); 478 XInstallColormap(SDL_Display, SDL_XColorMap);
503 } 479 }
504 } 480 }
505 X11_GrabInputNoLock(this, this->input_grab | SDL_GRAB_FULLSCREEN); 481 if ( okay )
482 X11_GrabInputNoLock(this, this->input_grab | SDL_GRAB_FULLSCREEN);
483
484 /* We may need to refresh the screen at this point (no backing store)
485 We also don't get an event, which is why we explicitly refresh. */
486 if ( this->screen ) {
487 if ( this->screen->flags & SDL_OPENGL ) {
488 SDL_PrivateExpose();
489 } else {
490 X11_RefreshDisplay(this);
491 }
492 }
493
506 return(okay); 494 return(okay);
507 } 495 }
508 496
509 int X11_LeaveFullScreen(_THIS) 497 int X11_LeaveFullScreen(_THIS)
510 { 498 {
516 XVidMode(LockModeSwitch, (SDL_Display, SDL_Screen, False)); 504 XVidMode(LockModeSwitch, (SDL_Display, SDL_Screen, False));
517 } 505 }
518 #endif 506 #endif
519 XUnmapWindow(SDL_Display, FSwindow); 507 XUnmapWindow(SDL_Display, FSwindow);
520 X11_WaitUnmapped(this, FSwindow); 508 X11_WaitUnmapped(this, FSwindow);
521 #ifdef GRAB_FULLSCREEN
522 XUngrabKeyboard(SDL_Display, CurrentTime);
523 #endif
524 XSync(SDL_Display, True); /* Flush spurious mode change events */ 509 XSync(SDL_Display, True); /* Flush spurious mode change events */
525 currently_fullscreen = 0; 510 currently_fullscreen = 0;
526 } 511 }
527 /* If we get popped out of fullscreen mode for some reason, input_grab 512 /* If we get popped out of fullscreen mode for some reason, input_grab
528 will still have the SDL_GRAB_FULLSCREEN flag set, since this is only 513 will still have the SDL_GRAB_FULLSCREEN flag set, since this is only
529 temporary. In this case, release the grab unless the input has been 514 temporary. In this case, release the grab unless the input has been
530 explicitly grabbed. 515 explicitly grabbed.
531 */ 516 */
532 X11_GrabInputNoLock(this, this->input_grab & ~SDL_GRAB_FULLSCREEN); 517 X11_GrabInputNoLock(this, this->input_grab & ~SDL_GRAB_FULLSCREEN);
518
519 /* We may need to refresh the screen at this point (no backing store)
520 We also don't get an event, which is why we explicitly refresh. */
521 if ( this->screen ) {
522 if ( this->screen->flags & SDL_OPENGL ) {
523 SDL_PrivateExpose();
524 } else {
525 X11_RefreshDisplay(this);
526 }
527 }
528
533 return(0); 529 return(0);
534 } 530 }