emacs-diffs
[Top][All Lists]
Advanced

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

master 86ed4b9858: Add an option to rely on passive touch grabs on X


From: Po Lu
Subject: master 86ed4b9858: Add an option to rely on passive touch grabs on X
Date: Sat, 8 Jan 2022 05:27:00 -0500 (EST)

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

    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.
---
 src/xterm.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index 9b4bd4b8db..6a05ad9894 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -11134,8 +11134,9 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                    {
                      *finish = X_EVENT_DROP;
                      x_catch_errors (dpyinfo->display);
-                     XIAllowTouchEvents (dpyinfo->display, xev->deviceid,
-                                         xev->detail, xev->event, 
XIAcceptTouch);
+                     if (x_input_grab_touch_events)
+                       XIAllowTouchEvents (dpyinfo->display, xev->deviceid,
+                                           xev->detail, xev->event, 
XIAcceptTouch);
                      if (!x_had_errors_p (dpyinfo->display))
                        {
                          xi_link_touch_point (device, xev->detail, 
xev->event_x,
@@ -11154,8 +11155,9 @@ handle_one_xevent (struct x_display_info *dpyinfo,
                  else
                    {
                      x_catch_errors (dpyinfo->display);
-                     XIAllowTouchEvents (dpyinfo->display, xev->deviceid,
-                                         xev->detail, xev->event, 
XIRejectTouch);
+                     if (x_input_grab_touch_events)
+                       XIAllowTouchEvents (dpyinfo->display, xev->deviceid,
+                                           xev->detail, xev->event, 
XIRejectTouch);
                      x_uncatch_errors ();
                    }
 #endif
@@ -15946,4 +15948,12 @@ support. */);
 This provides better support for some modern input methods, and is
 only effective when Emacs is built with GTK.  */);
   x_gtk_use_native_input = false;
+
+  DEFVAR_BOOL ("x-input-grab-touch-events", x_input_grab_touch_events,
+              doc: /* Non-nil means to actively grab touch events.
+This means touch sequences that started on an Emacs frame will
+reliably continue to receive updates even if the finger moves off the
+frame, but may cause crashes with some window managers and/or external
+programs.  */);
+  x_input_grab_touch_events = true;
 }



reply via email to

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