diff options
| author | Po Lu | 2022-08-16 21:11:03 +0800 |
|---|---|---|
| committer | Po Lu | 2022-08-16 21:11:50 +0800 |
| commit | b4879603fd8f9c8e82e30c5fbb65fa63d8166ee4 (patch) | |
| tree | 1e22ea48430d56aa01474bb0c2d2d485f8c6e2cb | |
| parent | 81ff64d3ca8d6e43e976f209399d2a0e9b4a7dd8 (diff) | |
| download | emacs-b4879603fd8f9c8e82e30c5fbb65fa63d8166ee4.tar.gz emacs-b4879603fd8f9c8e82e30c5fbb65fa63d8166ee4.zip | |
Fix XInput hierarchy events not being delivered in daemon mode
* src/xfns.c (setup_xi_event_mask): Stop selecting for device
hierarchy events.
* src/xterm.c (xi_select_hierarchy_events, x_term_init): Select
those here instead, on the default root window.
| -rw-r--r-- | src/xfns.c | 14 | ||||
| -rw-r--r-- | src/xterm.c | 33 |
2 files changed, 39 insertions, 8 deletions
diff --git a/src/xfns.c b/src/xfns.c index 6ed93ee42ca..a275e3e11a8 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -3773,14 +3773,11 @@ setup_xi_event_mask (struct frame *f) | |||
| 3773 | memset (m, 0, l); | 3773 | memset (m, 0, l); |
| 3774 | #endif | 3774 | #endif |
| 3775 | 3775 | ||
| 3776 | mask.deviceid = XIAllDevices; | ||
| 3777 | |||
| 3778 | XISetMask (m, XI_PropertyEvent); | ||
| 3779 | XISetMask (m, XI_HierarchyChanged); | ||
| 3780 | XISetMask (m, XI_DeviceChanged); | ||
| 3781 | #ifdef HAVE_XINPUT2_2 | 3776 | #ifdef HAVE_XINPUT2_2 |
| 3782 | if (FRAME_DISPLAY_INFO (f)->xi2_version >= 2) | 3777 | if (FRAME_DISPLAY_INFO (f)->xi2_version >= 2) |
| 3783 | { | 3778 | { |
| 3779 | mask.deviceid = XIAllDevices; | ||
| 3780 | |||
| 3784 | XISetMask (m, XI_TouchBegin); | 3781 | XISetMask (m, XI_TouchBegin); |
| 3785 | XISetMask (m, XI_TouchUpdate); | 3782 | XISetMask (m, XI_TouchUpdate); |
| 3786 | XISetMask (m, XI_TouchEnd); | 3783 | XISetMask (m, XI_TouchEnd); |
| @@ -3792,11 +3789,12 @@ setup_xi_event_mask (struct frame *f) | |||
| 3792 | XISetMask (m, XI_GesturePinchEnd); | 3789 | XISetMask (m, XI_GesturePinchEnd); |
| 3793 | } | 3790 | } |
| 3794 | #endif | 3791 | #endif |
| 3792 | |||
| 3793 | XISelectEvents (FRAME_X_DISPLAY (f), | ||
| 3794 | FRAME_X_WINDOW (f), | ||
| 3795 | &mask, 1); | ||
| 3795 | } | 3796 | } |
| 3796 | #endif | 3797 | #endif |
| 3797 | XISelectEvents (FRAME_X_DISPLAY (f), | ||
| 3798 | FRAME_X_WINDOW (f), | ||
| 3799 | &mask, 1); | ||
| 3800 | 3798 | ||
| 3801 | #ifndef HAVE_XINPUT2_1 | 3799 | #ifndef HAVE_XINPUT2_1 |
| 3802 | FRAME_X_OUTPUT (f)->xi_masks = selected; | 3800 | FRAME_X_OUTPUT (f)->xi_masks = selected; |
diff --git a/src/xterm.c b/src/xterm.c index ee0035234b5..7487450d649 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -27634,6 +27634,33 @@ my_log_handler (const gchar *log_domain, GLogLevelFlags log_level, | |||
| 27634 | connection established. */ | 27634 | connection established. */ |
| 27635 | static unsigned x_display_id; | 27635 | static unsigned x_display_id; |
| 27636 | 27636 | ||
| 27637 | #if defined HAVE_XINPUT2 && !defined HAVE_GTK3 | ||
| 27638 | |||
| 27639 | /* Select for device change events on the root window of DPYINFO. | ||
| 27640 | These include device change and hierarchy change notifications. */ | ||
| 27641 | |||
| 27642 | static void | ||
| 27643 | xi_select_hierarchy_events (struct x_display_info *dpyinfo) | ||
| 27644 | { | ||
| 27645 | XIEventMask mask; | ||
| 27646 | ptrdiff_t l; | ||
| 27647 | unsigned char *m; | ||
| 27648 | |||
| 27649 | l = XIMaskLen (XI_LASTEVENT); | ||
| 27650 | mask.mask = m = alloca (l); | ||
| 27651 | memset (m, 0, l); | ||
| 27652 | mask.mask_len = l; | ||
| 27653 | |||
| 27654 | XISetMask (m, XI_PropertyEvent); | ||
| 27655 | XISetMask (m, XI_HierarchyChanged); | ||
| 27656 | XISetMask (m, XI_DeviceChanged); | ||
| 27657 | |||
| 27658 | XISelectEvents (dpyinfo->display, dpyinfo->root_window, | ||
| 27659 | &mask, 1); | ||
| 27660 | } | ||
| 27661 | |||
| 27662 | #endif | ||
| 27663 | |||
| 27637 | /* Open a connection to X display DISPLAY_NAME, and return | 27664 | /* Open a connection to X display DISPLAY_NAME, and return |
| 27638 | the structure that describes the open display. | 27665 | the structure that describes the open display. |
| 27639 | If we cannot contact the display, return null. */ | 27666 | If we cannot contact the display, return null. */ |
| @@ -28263,6 +28290,12 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) | |||
| 28263 | if (rc == Success) | 28290 | if (rc == Success) |
| 28264 | { | 28291 | { |
| 28265 | dpyinfo->supports_xi2 = true; | 28292 | dpyinfo->supports_xi2 = true; |
| 28293 | #ifndef HAVE_GTK3 | ||
| 28294 | /* Select for hierarchy events on the root window. GTK 3.x | ||
| 28295 | does this itself. */ | ||
| 28296 | xi_select_hierarchy_events (dpyinfo); | ||
| 28297 | #endif | ||
| 28298 | |||
| 28266 | x_cache_xi_devices (dpyinfo); | 28299 | x_cache_xi_devices (dpyinfo); |
| 28267 | } | 28300 | } |
| 28268 | } | 28301 | } |