diff options
author | Po Lu <luangruo@yahoo.com> | 2022-08-24 19:10:44 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2022-08-24 19:12:16 +0800 |
commit | e518146a3017669981b6d31c356d0bb105200928 (patch) | |
tree | ef4846af53eb77924bb8e169776662332751a396 /src | |
parent | 1007800a5994ac49b6bc9cd7528edb2d709d2031 (diff) | |
download | emacs-e518146a3017669981b6d31c356d0bb105200928.tar.gz |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/xterm.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/xterm.c b/src/xterm.c index 3dfa908f1e2..0684402b147 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; |