summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-01-05 09:39:57 +0800
committerPo Lu <luangruo@yahoo.com>2022-01-05 09:39:57 +0800
commit6719a3ccabec33e010aa4a42be2ee07e4e219b3c (patch)
tree8439c70b986e1b76a6bbe6effe2a318eddf02820
parent30d4cfc0806ee1de5a8e5091f0cc5bce22830460 (diff)
downloademacs-6719a3ccabec33e010aa4a42be2ee07e4e219b3c.tar.gz
emacs-6719a3ccabec33e010aa4a42be2ee07e4e219b3c.tar.bz2
emacs-6719a3ccabec33e010aa4a42be2ee07e4e219b3c.zip
Correctly set up XI key input mask on X Toolkit builds
* src/xfns.c (setup_xi_event_mask): Also set the key event mask on the outer window, which might also have the input focus. (x_window) [USE_X_TOOLKIT]: Set up XI event mask a bit later.
-rw-r--r--src/xfns.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/xfns.c b/src/xfns.c
index d1b0b72b7f0..b94fe179224 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -2934,15 +2934,11 @@ setup_xi_event_mask (struct frame *f)
XISetMask (m, XI_ButtonPress);
XISetMask (m, XI_ButtonRelease);
- XISetMask (m, XI_KeyPress);
- XISetMask (m, XI_KeyRelease);
XISetMask (m, XI_Motion);
XISetMask (m, XI_Enter);
XISetMask (m, XI_Leave);
-#if 0
- XISetMask (m, XI_FocusIn);
- XISetMask (m, XI_FocusOut);
-#endif
+ XISetMask (m, XI_KeyPress);
+ XISetMask (m, XI_KeyRelease);
XISelectEvents (FRAME_X_DISPLAY (f),
FRAME_X_WINDOW (f),
&mask, 1);
@@ -2950,6 +2946,16 @@ setup_xi_event_mask (struct frame *f)
memset (m, 0, l);
#endif /* !USE_GTK */
+#ifdef USE_X_TOOLKIT
+ XISetMask (m, XI_KeyPress);
+ XISetMask (m, XI_KeyRelease);
+
+ XISelectEvents (FRAME_X_DISPLAY (f),
+ FRAME_OUTER_WINDOW (f),
+ &mask, 1);
+ memset (m, 0, l);
+#endif
+
mask.deviceid = XIAllDevices;
XISetMask (m, XI_PropertyEvent);
@@ -3140,11 +3146,6 @@ x_window (struct frame *f, long window_prompting)
class_hints.res_class = SSDATA (Vx_resource_class);
XSetClassHint (FRAME_X_DISPLAY (f), XtWindow (shell_widget), &class_hints);
-#ifdef HAVE_XINPUT2
- if (FRAME_DISPLAY_INFO (f)->supports_xi2)
- setup_xi_event_mask (f);
-#endif
-
#ifdef HAVE_X_I18N
FRAME_XIC (f) = NULL;
if (use_xim)
@@ -3232,6 +3233,11 @@ x_window (struct frame *f, long window_prompting)
/* This is a no-op, except under Motif. Make sure main areas are
set to something reasonable, in case we get an error later. */
lw_set_main_areas (pane_widget, 0, frame_widget);
+
+#ifdef HAVE_XINPUT2
+ if (FRAME_DISPLAY_INFO (f)->supports_xi2)
+ setup_xi_event_mask (f);
+#endif
}
#else /* not USE_X_TOOLKIT */