xserver: Branch 'master' - 2 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jan 9 00:48:21 UTC 2024


 Xext/xtest.c                 |    5 +----
 dix/devices.c                |    2 ++
 hw/xwayland/xwayland-xtest.c |   11 +++++------
 include/exevents.h           |    7 +++++++
 4 files changed, 15 insertions(+), 10 deletions(-)

New commits:
commit de0031eefd5648c2b7464efc2e89fede7c364097
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Dec 21 11:28:04 2023 +1000

    dix: initialize the XTest sendEventsProc for all devices
    
    XTest requests lets the client specify a device ID, only if none
    is specified do we fall back to the XTEST special device.
    As of commit
      aa4074251 input: Add new hook DeviceSendEventsProc for XTEST
    regular devices are no longer able to send XTest events because they
    have no sendEventsProc set.
    
    This caused issue #1574 and the crash was fixed with commit
      e820030de xtest: Check whether there is a sendEventsProc to call
    but we still cannot send XTest events through a specific device.
    
    Fix this by defaulting every device to the XTest send function and
    punting it to the DDX (i.e. Xwayland) to override the devices as
    necessary.
    
    Fixes e820030de2da3d0064f36504ccad53302e0f718d
    Fixes aa4074251fa6135f65687b39cf11e1432208846c

diff --git a/Xext/xtest.c b/Xext/xtest.c
index 4d2910a60..f03d8c951 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -148,7 +148,7 @@ ProcXTestCompareCursor(ClientPtr client)
     return Success;
 }
 
-static void
+void
 XTestDeviceSendEvents(DeviceIntPtr dev,
                       int type,
                       int detail,
@@ -645,9 +645,6 @@ AllocXTestDevice(ClientPtr client, const char *name,
                                      XIGetKnownProperty(XI_PROP_XTEST_DEVICE),
                                      FALSE);
         XIRegisterPropertyHandler(*keybd, DeviceSetXTestProperty, NULL, NULL);
-
-        (*ptr)->sendEventsProc = XTestDeviceSendEvents;
-        (*keybd)->sendEventsProc = XTestDeviceSendEvents;
     }
 
     free(xtestname);
diff --git a/dix/devices.c b/dix/devices.c
index 39cb42b0d..dca98c8d1 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -283,6 +283,8 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
     dev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
     dev->deviceGrab.sync.event = calloc(1, sizeof(InternalEvent));
 
+    dev->sendEventsProc = XTestDeviceSendEvents;
+
     XkbSetExtension(dev, ProcessKeyboardEvent);
 
     dev->coreEvents = TRUE;
diff --git a/include/exevents.h b/include/exevents.h
index c900c7b2c..7e3029fc9 100644
--- a/include/exevents.h
+++ b/include/exevents.h
@@ -305,4 +305,11 @@ XISetEventMask(DeviceIntPtr dev, WindowPtr win, ClientPtr client,
 extern int
  XICheckInvalidMaskBits(ClientPtr client, unsigned char *mask, int len);
 
+void
+XTestDeviceSendEvents(DeviceIntPtr dev,
+                      int type,
+                      int detail,
+                      int flags,
+                      const ValuatorMask *mask);
+
 #endif                          /* EXEVENTS_H */
commit 7f7adfdef803d548b867e032586783ab00288381
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Dec 21 11:34:26 2023 +1000

    xwayland: override the XTest sendEventsProc for all devices
    
    Otherwise only XTest events on the XTest device get handled, XTest
    requests on real devices are still processed as normal events.

diff --git a/hw/xwayland/xwayland-xtest.c b/hw/xwayland/xwayland-xtest.c
index def8926d8..e4a297ab5 100644
--- a/hw/xwayland/xwayland-xtest.c
+++ b/hw/xwayland/xwayland-xtest.c
@@ -647,6 +647,9 @@ xwayland_xtest_send_events(DeviceIntPtr dev,
     struct xwl_ei_client *xwl_ei_client;
     bool accept = false;
 
+    if (!IsXTestDevice(dev, NULL))
+        return;
+
     client = GetCurrentClient();
     xwl_ei_client = get_xwl_ei_client(client);
     if (!xwl_ei_client) {
@@ -915,9 +918,7 @@ xwayland_override_xtest(void)
     DeviceIntPtr d;
 
     nt_list_for_each_entry(d, inputInfo.devices, next) {
-        if (IsXTestDevice(d, NULL)) {
-            xwayland_override_events_proc(d);
-        }
+        xwayland_override_events_proc(d);
     }
 }
 
@@ -927,8 +928,6 @@ xwayland_restore_xtest(void)
     DeviceIntPtr d;
 
     nt_list_for_each_entry(d, inputInfo.devices, next) {
-        if (IsXTestDevice(d, NULL)) {
-            xwayland_restore_events_proc(d);
-        }
+        xwayland_restore_events_proc(d);
     }
 }


More information about the xorg-commit mailing list