]> git.eshelyaron.com Git - emacs.git/commitdiff
Ignore spurious focus events
authorDaniel Colascione <dancol@dancol.org>
Wed, 4 Mar 2020 02:27:51 +0000 (18:27 -0800)
committerDaniel Colascione <dancol@dancol.org>
Wed, 4 Mar 2020 02:29:41 +0000 (18:29 -0800)
* src/xterm.c (x_detect_focus_change): Ignore FocusIn and FocusOut
events from grabs

src/xterm.c

index 21d99f0c7bbc8c7acb8f270123e0187e231aad99..5d229e4f5242e338eadaa5bffa9c5fad675138fc 100644 (file)
@@ -4790,6 +4790,16 @@ x_detect_focus_change (struct x_display_info *dpyinfo, struct frame *frame,
 
     case FocusIn:
     case FocusOut:
+      /* Ignore transient focus events from hotkeys, window manager
+         gadgets, and other odd sources.  Some buggy window managers
+         (e.g., Muffin 4.2.4) send FocusIn events of this type without
+         corresponding FocusOut events even when some other window
+         really has focus, and these kinds of focus event don't
+         correspond to real user input changes.  GTK+ uses the same
+         filtering. */
+      if (event->xfocus.mode == NotifyGrab ||
+          event->xfocus.mode == NotifyUngrab)
+        return;
       x_focus_changed (event->type,
                       (event->xfocus.detail == NotifyPointer ?
                        FOCUS_IMPLICIT : FOCUS_EXPLICIT),