diff options
| author | Po Lu | 2022-01-08 18:24:53 +0800 |
|---|---|---|
| committer | Po Lu | 2022-01-08 18:24:53 +0800 |
| commit | 86ed4b985871e20d55fe01c3d1e60de71cab91d9 (patch) | |
| tree | 6e45de4d00c4514a36f2bd68127b3b50c7d54fed /src | |
| parent | e86a2ce5fccae57e134d6f19d02b5c46dfce6efc (diff) | |
| download | emacs-86ed4b985871e20d55fe01c3d1e60de71cab91d9.tar.gz emacs-86ed4b985871e20d55fe01c3d1e60de71cab91d9.zip | |
Add an option to rely on passive touch grabs on X
This prevents crashes with three-finger touch gestures on
Xwayland running on GNOME Shell, and also when running some
programs that make use of an Emacs window's XID on the same X
server.
* src/xterm.c (handle_one_xevent): Respect
`x-input-grab-touch-events'.
(syms_of_xterm): New option `x-input-grab-touch-events.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/xterm.c b/src/xterm.c index 9b4bd4b8db2..6a05ad98949 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -11134,8 +11134,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 11134 | { | 11134 | { |
| 11135 | *finish = X_EVENT_DROP; | 11135 | *finish = X_EVENT_DROP; |
| 11136 | x_catch_errors (dpyinfo->display); | 11136 | x_catch_errors (dpyinfo->display); |
| 11137 | XIAllowTouchEvents (dpyinfo->display, xev->deviceid, | 11137 | if (x_input_grab_touch_events) |
| 11138 | xev->detail, xev->event, XIAcceptTouch); | 11138 | XIAllowTouchEvents (dpyinfo->display, xev->deviceid, |
| 11139 | xev->detail, xev->event, XIAcceptTouch); | ||
| 11139 | if (!x_had_errors_p (dpyinfo->display)) | 11140 | if (!x_had_errors_p (dpyinfo->display)) |
| 11140 | { | 11141 | { |
| 11141 | xi_link_touch_point (device, xev->detail, xev->event_x, | 11142 | xi_link_touch_point (device, xev->detail, xev->event_x, |
| @@ -11154,8 +11155,9 @@ handle_one_xevent (struct x_display_info *dpyinfo, | |||
| 11154 | else | 11155 | else |
| 11155 | { | 11156 | { |
| 11156 | x_catch_errors (dpyinfo->display); | 11157 | x_catch_errors (dpyinfo->display); |
| 11157 | XIAllowTouchEvents (dpyinfo->display, xev->deviceid, | 11158 | if (x_input_grab_touch_events) |
| 11158 | xev->detail, xev->event, XIRejectTouch); | 11159 | XIAllowTouchEvents (dpyinfo->display, xev->deviceid, |
| 11160 | xev->detail, xev->event, XIRejectTouch); | ||
| 11159 | x_uncatch_errors (); | 11161 | x_uncatch_errors (); |
| 11160 | } | 11162 | } |
| 11161 | #endif | 11163 | #endif |
| @@ -15946,4 +15948,12 @@ support. */); | |||
| 15946 | This provides better support for some modern input methods, and is | 15948 | This provides better support for some modern input methods, and is |
| 15947 | only effective when Emacs is built with GTK. */); | 15949 | only effective when Emacs is built with GTK. */); |
| 15948 | x_gtk_use_native_input = false; | 15950 | x_gtk_use_native_input = false; |
| 15951 | |||
| 15952 | DEFVAR_BOOL ("x-input-grab-touch-events", x_input_grab_touch_events, | ||
| 15953 | doc: /* Non-nil means to actively grab touch events. | ||
| 15954 | This means touch sequences that started on an Emacs frame will | ||
| 15955 | reliably continue to receive updates even if the finger moves off the | ||
| 15956 | frame, but may cause crashes with some window managers and/or external | ||
| 15957 | programs. */); | ||
| 15958 | x_input_grab_touch_events = true; | ||
| 15949 | } | 15959 | } |