From eceab3fe6f680582ae785fd3e368bb2698ea7c66 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 20 Jul 2010 00:05:32 -0700 Subject: [PATCH] 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 | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index 9f0da0c35..0dd20c671 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -25,7 +25,7 @@ #include #include #include -#include /* For INT_MAX */ +#include /* For INT_MAX */ #include "SDL_x11video.h" #include "../../events/SDL_events_c.h" @@ -92,8 +92,8 @@ X11_DispatchEvent(_THIS) case EnterNotify:{ #ifdef DEBUG_XEVENTS printf("EnterNotify! (%d,%d,%d)\n", - xevent.xcrossing.x, - xevent.xcrossing.y, + xevent.xcrossing.x, + xevent.xcrossing.y, xevent.xcrossing.mode); if (xevent.xcrossing.mode == NotifyGrab) printf("Mode: NotifyGrab\n"); @@ -108,15 +108,17 @@ X11_DispatchEvent(_THIS) case LeaveNotify:{ #ifdef DEBUG_XEVENTS printf("LeaveNotify! (%d,%d,%d)\n", - xevent.xcrossing.x, - xevent.xcrossing.y, + xevent.xcrossing.x, + xevent.xcrossing.y, xevent.xcrossing.mode); if (xevent.xcrossing.mode == NotifyGrab) printf("Mode: NotifyGrab\n"); if (xevent.xcrossing.mode == NotifyUngrab) printf("Mode: NotifyUngrab\n"); #endif - if (xevent.xcrossing.detail != NotifyInferior) { + if (xevent.xcrossing.mode != NotifyGrab && + xevent.xcrossing.mode != NotifyUngrab && + xevent.xcrossing.detail != NotifyInferior) { SDL_SetMouseFocus(NULL); } }