Don't lose focus if a child window gains focus
authorSam Lantinga <slouken@libsdl.org>
Wed, 07 Nov 2012 08:49:59 -0800
changeset 6660 4fa0723e6874
parent 6659 4016ef96095a
child 6661 cd8befc0a969
Don't lose focus if a child window gains focus
src/video/x11/SDL_x11events.c
--- a/src/video/x11/SDL_x11events.c	Tue Nov 06 10:34:47 2012 -0800
+++ b/src/video/x11/SDL_x11events.c	Wed Nov 07 08:49:59 2012 -0800
@@ -249,6 +249,12 @@
 
         /* 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 @@
 
         /* 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