xserver: Branch 'master' - 2 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Feb 15 04:47:05 UTC 2021


 Xi/exevents.c |   20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

New commits:
commit 213129012bc0fe508a8a4180ffda1ef661894049
Author: Povilas Kanapickas <povilas at radix.lt>
Date:   Sun Dec 20 00:48:22 2020 +0200

    Xi: Deliver pointer emulated touch events to grabbing client
    
    Delivery of emulated events usually happens only to the owning client.
    If there are grabs, only the grabbing client may receive these events.
    
    This logic does not work during the touch event replay in
    DeactivatePointerGrab(), as the previous grab is no longer in the
    listener queue of the touch, so the next owner gets whole emulated event
    sequence. This may trigger implicit grabs. After replay,
    DeactivatePointerGrab() will update the global grab without regard to
    this new implicit grab, which leads to issues down the line.
    
    This change is effectively the same as 35e5a76cc1 except that the change
    is limited to only emulated pointer events. Otherwise, in the case of a
    device grab we end up not sending any touch events to clients that
    selected XI_TouchOwnership event and should get touch events before they
    get ownership of touch sequence.
    
    Fixes #7
    
    https://bugs.freedesktop.org/show_bug.cgi?id=96536

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 29c617c14..dd3e90ae5 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1373,6 +1373,16 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
     int nevents;
     DeviceIntPtr kbd;
 
+    /* There may be a pointer grab on the device */
+    if (!grab) {
+        grab = dev->deviceGrab.grab;
+        if (grab) {
+            win = grab->window;
+            xi2mask = grab->xi2mask;
+            client = rClient(grab);
+        }
+    }
+
     /* We don't deliver pointer events to non-owners */
     if (!TouchResourceIsOwner(ti, listener->listener))
         return !Success;
@@ -1502,16 +1512,6 @@ DeliverEmulatedMotionEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
                                        &mask))
             return;
 
-        /* There may be a pointer grab on the device */
-        if (!grab) {
-            grab = dev->deviceGrab.grab;
-            if (grab) {
-                win = grab->window;
-                mask = grab->xi2mask;
-                client = rClient(grab);
-            }
-        }
-
         DeliverTouchEmulatedEvent(dev, ti, (InternalEvent*)&motion, &ti->listeners[0], client,
                                   win, grab, mask);
     }
commit 30e11535afb3c4efc3a5cef640de44c7cd9bb561
Author: Povilas Kanapickas <povilas at radix.lt>
Date:   Sun Dec 20 00:48:21 2020 +0200

    Revert "Xi: Use current device active grab to deliver touch events if any"
    
    This reverts commit 98e3db2ac43d4a3f13475cb160c8ce0155ac7d61.

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 193e57e22..29c617c14 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1292,21 +1292,13 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
     int rc;
     InputClients *iclients = NULL;
     *mask = NULL;
-    *grab = NULL;
 
     if (listener->type == TOUCH_LISTENER_GRAB ||
         listener->type == TOUCH_LISTENER_POINTER_GRAB) {
         *grab = listener->grab;
 
         BUG_RETURN_VAL(!*grab, FALSE);
-    }
-    else if (ti->emulate_pointer && dev->deviceGrab.grab &&
-             !dev->deviceGrab.fromPassiveGrab) {
-        /* There may be an active pointer grab on the device */
-        *grab = dev->deviceGrab.grab;
-    }
 
-    if (*grab) {
         *client = rClient(*grab);
         *win = (*grab)->window;
         *mask = (*grab)->xi2mask;
@@ -1363,6 +1355,8 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
             /* if owner selected, oclients is NULL */
             *client = oclients ? rClient(oclients) : wClient(*win);
         }
+
+        *grab = NULL;
     }
 
     return TRUE;
@@ -1508,6 +1502,16 @@ DeliverEmulatedMotionEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
                                        &mask))
             return;
 
+        /* There may be a pointer grab on the device */
+        if (!grab) {
+            grab = dev->deviceGrab.grab;
+            if (grab) {
+                win = grab->window;
+                mask = grab->xi2mask;
+                client = rClient(grab);
+            }
+        }
+
         DeliverTouchEmulatedEvent(dev, ti, (InternalEvent*)&motion, &ti->listeners[0], client,
                                   win, grab, mask);
     }


More information about the xorg-commit mailing list