xserver: Branch 'master' - 2 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 5 02:47:58 UTC 2021


 Xext/shm.c       |    2 +-
 Xi/exevents.c    |    9 ++++++++-
 os/inputthread.c |    4 ++--
 3 files changed, 11 insertions(+), 4 deletions(-)

New commits:
commit 3ab3083cc20534c83a5a35f0af1f2779f8df0b7b
Author: Povilas Kanapickas <povilas at radix.lt>
Date:   Sun Dec 20 01:11:43 2020 +0200

    xi: Don't deliver emulated motion when there's no owner for touch end
    
    Pointer-emulated touch events should only be delivered to the client
    that owns the sequence even if it's a core client that became the
    effective owner of the sequency by selecting for pointer press and
    movement.
    
    Currently the emulated events are delivered like this already (see
    TouchResourceIsOwner() check in DeliverEmulatedMotionEvent()), except in
    the case of TouchEnd, in which case the generated motion event is still
    delivered to some client that's not necessarily the owner of the touch
    sequence.
    
    We already know whether a touch sequence that is about to emulate a
    pointer event has an owner, we just need to check that. This further
    allows to simplify DeliverEmulatedMotionEvent() as it won't ever be
    called for non-owned touch events.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=60394
    
    Signed-off-by: Povilas Kanapickas <povilas at radix.lt>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 22dc214c9..193e57e22 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1389,6 +1389,12 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
     nevents = TouchConvertToPointerEvent(ev, &motion, &button);
     BUG_RETURN_VAL(nevents == 0, BadValue);
 
+    /* Note that here we deliver only part of the events that are generated by the touch event:
+     *
+     * TouchBegin results in ButtonPress (motion is handled in DeliverEmulatedMotionEvent)
+     * TouchUpdate results in Motion
+     * TouchEnd results in ButtonRelease (motion is handled in DeliverEmulatedMotionEvent)
+     */
     if (nevents > 1)
         ptrev = &button;
 
@@ -1593,7 +1599,8 @@ ProcessTouchEvent(InternalEvent *ev, DeviceIntPtr dev)
     /* if emulate_pointer is set, emulate the motion event right
      * here, so we can ignore it for button event emulation. TouchUpdate
      * events which _only_ emulate motion just work normally */
-    if (emulate_pointer && ev->any.type != ET_TouchUpdate)
+    if (emulate_pointer && (ev->any.type == ET_TouchBegin ||
+                           (ev->any.type == ET_TouchEnd && ti->num_listeners > 0)))
         DeliverEmulatedMotionEvent(dev, ti, ev);
 
     if (emulate_pointer && IsMaster(dev))
commit 365cbbfc4b99f7d9937d1b8b61f1483556a5b57a
Author: Adam Jackson <ajax at redhat.com>
Date:   Fri Dec 18 09:36:30 2020 -0500

    os, shm: fcntl()'s third argument is integer, not pointer
    
    All of these uses were attempting to set FD_CLOEXEC, which happens to be
    (1<<0). Since flags is going to be aligned in memory, its address is
    never going to have the low bit set, so we were never actually setting
    what we meant to.
    
    Fixes: xorg/xserver#1114

diff --git a/Xext/shm.c b/Xext/shm.c
index 0deb9a945..071bd1a41 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -1248,7 +1248,7 @@ shm_tmpfile(void)
         int flags = fcntl(fd, F_GETFD);
         if (flags != -1) {
             flags |= FD_CLOEXEC;
-            (void) fcntl(fd, F_SETFD, &flags);
+            (void) fcntl(fd, F_SETFD, flags);
         }
 #endif
         return fd;
diff --git a/os/inputthread.c b/os/inputthread.c
index 361d96efa..3469cfc1c 100644
--- a/os/inputthread.c
+++ b/os/inputthread.c
@@ -427,7 +427,7 @@ InputThreadPreInit(void)
     flags = fcntl(inputThreadInfo->readPipe, F_GETFD);
     if (flags != -1) {
         flags |= FD_CLOEXEC;
-        (void)fcntl(inputThreadInfo->readPipe, F_SETFD, &flags);
+        (void)fcntl(inputThreadInfo->readPipe, F_SETFD, flags);
     }
     SetNotifyFd(inputThreadInfo->readPipe, InputThreadNotifyPipe, X_NOTIFY_READ, NULL);
 
@@ -438,7 +438,7 @@ InputThreadPreInit(void)
     flags = fcntl(hotplugPipeRead, F_GETFD);
     if (flags != -1) {
         flags |= FD_CLOEXEC;
-        (void)fcntl(hotplugPipeRead, F_SETFD, &flags);
+        (void)fcntl(hotplugPipeRead, F_SETFD, flags);
     }
     hotplugPipeWrite = hotplugPipe[1];
 


More information about the xorg-commit mailing list