Applied the same logic as the fix for bug 894.
authorSam Lantinga <slouken@libsdl.org>
Tue, 20 Jul 2010 00:05:32 -0700
changeset 45584d95152d9e39
parent 4556 cc06f306c053
child 4559 f8c3870af5a2
Applied the same logic as the fix for bug 894.

Anytime we enter the window, we gain the mouse focus. If we leave the window because of a normal LeaveNotify, then we lose mouse focus.
src/video/x11/SDL_x11events.c
     1.1 --- a/src/video/x11/SDL_x11events.c	Mon Jul 19 23:29:45 2010 -0700
     1.2 +++ b/src/video/x11/SDL_x11events.c	Tue Jul 20 00:05:32 2010 -0700
     1.3 @@ -25,7 +25,7 @@
     1.4  #include <sys/time.h>
     1.5  #include <signal.h>
     1.6  #include <unistd.h>
     1.7 -#include <limits.h>	/* For INT_MAX */
     1.8 +#include <limits.h> /* For INT_MAX */
     1.9  
    1.10  #include "SDL_x11video.h"
    1.11  #include "../../events/SDL_events_c.h"
    1.12 @@ -92,8 +92,8 @@
    1.13      case EnterNotify:{
    1.14  #ifdef DEBUG_XEVENTS
    1.15              printf("EnterNotify! (%d,%d,%d)\n", 
    1.16 -	           xevent.xcrossing.x,
    1.17 - 	           xevent.xcrossing.y,
    1.18 +                   xevent.xcrossing.x,
    1.19 +                   xevent.xcrossing.y,
    1.20                     xevent.xcrossing.mode);
    1.21              if (xevent.xcrossing.mode == NotifyGrab)
    1.22                  printf("Mode: NotifyGrab\n");
    1.23 @@ -108,15 +108,17 @@
    1.24      case LeaveNotify:{
    1.25  #ifdef DEBUG_XEVENTS
    1.26              printf("LeaveNotify! (%d,%d,%d)\n", 
    1.27 -	           xevent.xcrossing.x,
    1.28 - 	           xevent.xcrossing.y,
    1.29 +                   xevent.xcrossing.x,
    1.30 +                   xevent.xcrossing.y,
    1.31                     xevent.xcrossing.mode);
    1.32              if (xevent.xcrossing.mode == NotifyGrab)
    1.33                  printf("Mode: NotifyGrab\n");
    1.34              if (xevent.xcrossing.mode == NotifyUngrab)
    1.35                  printf("Mode: NotifyUngrab\n");
    1.36  #endif
    1.37 -            if (xevent.xcrossing.detail != NotifyInferior) {
    1.38 +            if (xevent.xcrossing.mode != NotifyGrab &&
    1.39 +                xevent.xcrossing.mode != NotifyUngrab &&
    1.40 +                xevent.xcrossing.detail != NotifyInferior) {
    1.41                  SDL_SetMouseFocus(NULL);
    1.42              }
    1.43          }