From ced78c6c8561cd0df4d3a2d6eee00bfbf1d3a31a Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Wed, 7 Nov 2012 08:49:59 -0800 Subject: [PATCH] Don't lose focus if a child window gains focus --- src/video/x11/SDL_x11events.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index 30d0bdb74..51f342629 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -249,6 +249,12 @@ X11_DispatchEvent(_THIS) /* Gaining input focus? */ case FocusIn:{ + if (xevent.xfocus.detail == NotifyInferior) { +#ifdef DEBUG_XEVENTS + printf("window %p: FocusIn (NotifierInferior, ignoring)\n", data); +#endif + break; + } #ifdef DEBUG_XEVENTS printf("window %p: FocusIn!\n", data); #endif @@ -259,6 +265,13 @@ X11_DispatchEvent(_THIS) /* Losing input focus? */ case FocusOut:{ + if (xevent.xfocus.detail == NotifyInferior) { + /* We still have focus if a child gets focus */ +#ifdef DEBUG_XEVENTS + printf("window %p: FocusOut (NotifierInferior, ignoring)\n", data); +#endif + break; + } #ifdef DEBUG_XEVENTS printf("window %p: FocusOut!\n", data); #endif