From f1d5ced167ae9c7f11dd90a412141e81df70a25b Mon Sep 17 00:00:00 2001 From: James Legg Date: Wed, 17 Jun 2020 12:48:40 +0100 Subject: [PATCH] x11: Fix spurious keyboard focus events --- src/video/x11/SDL_x11events.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/video/x11/SDL_x11events.c b/src/video/x11/SDL_x11events.c index ff65d982e..bdd951863 100644 --- a/src/video/x11/SDL_x11events.c +++ b/src/video/x11/SDL_x11events.c @@ -818,9 +818,9 @@ X11_DispatchEvent(_THIS) break; } - if (xevent.xfocus.detail == NotifyInferior) { + if (xevent.xfocus.detail == NotifyInferior || xevent.xfocus.detail == NotifyPointer) { #ifdef DEBUG_XEVENTS - printf("window %p: FocusIn (NotifierInferior, ignoring)\n", data); + printf("window %p: FocusIn (NotifyInferior/NotifyPointer, ignoring)\n", data); #endif break; } @@ -851,10 +851,12 @@ X11_DispatchEvent(_THIS) #endif break; } - if (xevent.xfocus.detail == NotifyInferior) { - /* We still have focus if a child gets focus */ + if (xevent.xfocus.detail == NotifyInferior || xevent.xfocus.detail == NotifyPointer) { + /* We still have focus if a child gets focus. We also don't + care about the position of the pointer when the keyboard + focus changed. */ #ifdef DEBUG_XEVENTS - printf("window %p: FocusOut (NotifierInferior, ignoring)\n", data); + printf("window %p: FocusOut (NotifyInferior/NotifyPointer, ignoring)\n", data); #endif break; }