emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master e518146a30: Fix input extension focus tracking with some window m


From: Po Lu
Subject: master e518146a30: Fix input extension focus tracking with some window managers
Date: Wed, 24 Aug 2022 07:12:26 -0400 (EDT)

branch: master
commit e518146a3017669981b6d31c356d0bb105200928
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Fix input extension focus tracking with some window managers
    
    * src/xterm.c (handle_one_xevent): If a window manager sends us
    FocusIn and FocusOut with XSendEvent (they do that), don't
    detect focus changes when XInput 2 is enabled.  The X server
    will tell us the actual truth if the focus really did change.
---
 src/xterm.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/src/xterm.c b/src/xterm.c
index 3dfa908f1e..0684402b14 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -19254,6 +19254,21 @@ handle_one_xevent (struct x_display_info *dpyinfo,
       goto OTHER;
 
     case FocusIn:
+#if defined HAVE_XINPUT2                                               \
+  && (defined HAVE_GTK3 || (!defined USE_GTK && !defined USE_X_TOOLKIT))
+      /* If a FocusIn event is received (because the window manager
+        sent us one), don't set the core focus if XInput 2 is
+        enabled, since that would mess up the device-specific focus
+        tracking.
+
+        The long looking preprocessor conditional only enables this
+        code on GTK 3 and no toolkit builds, since those are the only
+        builds where focus is tracked specific to each master device.
+        Other builds use core events and the client pointer to handle
+        focus, much like on a build without XInput 2.  */
+      if (dpyinfo->supports_xi2)
+       goto OTHER;
+#endif
 #ifdef USE_GTK
       /* Some WMs (e.g. Mutter in Gnome Shell), don't unmap
          minimized/iconified windows; thus, for those WMs we won't get
@@ -19367,6 +19382,21 @@ handle_one_xevent (struct x_display_info *dpyinfo,
       goto OTHER;
 
     case FocusOut:
+#if defined HAVE_XINPUT2                                               \
+  && (defined HAVE_GTK3 || (!defined USE_GTK && !defined USE_X_TOOLKIT))
+      /* If a FocusIn event is received (because the window manager
+        sent us one), don't set the core focus if XInput 2 is
+        enabled, since that would mess up the device-specific focus
+        tracking.
+
+        The long looking preprocessor conditional only enables this
+        code on GTK 3 and no toolkit builds, since those are the only
+        builds where focus is tracked specific to each master device.
+        Other builds use core events and the client pointer to handle
+        focus, much like on a build without XInput 2.  */
+      if (dpyinfo->supports_xi2)
+       goto OTHER;
+#endif
       x_detect_focus_change (dpyinfo, any, event, &inev.ie);
       goto OTHER;
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]