xserver: Branch 'master' - 15 commits
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Nov 26 20:17:03 UTC 2020
Xi/exevents.c | 98 ++++++------
Xi/xiselectev.c | 13 +
config/udev.c | 7
configure.ac | 2
dix/devices.c | 25 +++
dix/events.c | 176 +++++++++++++----------
dix/inpututils.c | 25 +++
dix/touch.c | 77 ++--------
glx/createcontext.c | 1
glx/glxcmds.c | 15 +
glx/glxcontext.h | 5
hw/xfree86/common/xf86Bus.c | 2
hw/xfree86/common/xf86str.h | 2
hw/xfree86/drivers/modesetting/driver.c | 3
hw/xfree86/drivers/modesetting/driver.h | 4
hw/xfree86/drivers/modesetting/drmmode_display.c | 2
hw/xfree86/drivers/modesetting/drmmode_display.h | 2
hw/xfree86/os-support/linux/lnx_platform.c | 5
hw/xwin/InitOutput.c | 2
hw/xwin/dri/windowsdri.h | 1
include/dix.h | 4
include/input.h | 29 ++-
include/inputstr.h | 2
include/inpututils.h | 3
test/xi2/protocol-xiselectevents.c | 2
25 files changed, 298 insertions(+), 209 deletions(-)
New commits:
commit 95b79aa907789a16f736097abe959e906f86f63a
Author: Erik Kurzinger <ekurzinger at nvidia.com>
Date: Fri Nov 13 14:36:14 2020 -0800
GLX: fix context render type queries
Querying the GLX_RENDER_TYPE of a GLX context via glXQueryContext will
currently return the render type of the context's FB config, which is
a bitmask of GLX_RGBA_BIT / GLX_COLOR_INDEX_BIT / ... values. However,
this query should really return the render type that was specified
when creating the context, which is one of GLX_RGBA_TYPE /
GLX_COLOR_INDEX_TYPE / .... To enable this, save the render type when
creating a new context (defaulting to GLX_RGBA_TYPE if unspecified),
and then include this value in the context attributes sent to clients.
diff --git a/glx/createcontext.c b/glx/createcontext.c
index 3c1695bf0..37d14fe99 100644
--- a/glx/createcontext.c
+++ b/glx/createcontext.c
@@ -350,6 +350,7 @@ __glXDisp_CreateContextAttribsARB(__GLXclientState * cl, GLbyte * pc)
ctx->renderMode = GL_RENDER;
ctx->resetNotificationStrategy = reset;
ctx->releaseBehavior = flush;
+ ctx->renderType = render_type;
/* Add the new context to the various global tables of GLX contexts.
*/
diff --git a/glx/glxcmds.c b/glx/glxcmds.c
index 98ddc7e5e..37576b6ef 100644
--- a/glx/glxcmds.c
+++ b/glx/glxcmds.c
@@ -241,7 +241,8 @@ __glXdirectContextCreate(__GLXscreen * screen,
static int
DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
GLXContextID shareList, __GLXconfig * config,
- __GLXscreen * pGlxScreen, GLboolean isDirect)
+ __GLXscreen * pGlxScreen, GLboolean isDirect,
+ int renderType)
{
ClientPtr client = cl->client;
__GLXcontext *glxc, *shareglxc;
@@ -332,6 +333,7 @@ DoCreateContext(__GLXclientState * cl, GLXContextID gcId,
glxc->idExists = GL_TRUE;
glxc->isDirect = isDirect;
glxc->renderMode = GL_RENDER;
+ glxc->renderType = renderType;
/* The GLX_ARB_create_context_robustness spec says:
*
@@ -381,7 +383,8 @@ __glXDisp_CreateContext(__GLXclientState * cl, GLbyte * pc)
return err;
return DoCreateContext(cl, req->context, req->shareList,
- config, pGlxScreen, req->isDirect);
+ config, pGlxScreen, req->isDirect,
+ GLX_RGBA_TYPE);
}
int
@@ -398,7 +401,8 @@ __glXDisp_CreateNewContext(__GLXclientState * cl, GLbyte * pc)
return err;
return DoCreateContext(cl, req->context, req->shareList,
- config, pGlxScreen, req->isDirect);
+ config, pGlxScreen, req->isDirect,
+ req->renderType);
}
int
@@ -419,7 +423,8 @@ __glXDisp_CreateContextWithConfigSGIX(__GLXclientState * cl, GLbyte * pc)
return err;
return DoCreateContext(cl, req->context, req->shareList,
- config, pGlxScreen, req->isDirect);
+ config, pGlxScreen, req->isDirect,
+ req->renderType);
}
int
@@ -1668,7 +1673,7 @@ DoQueryContext(__GLXclientState * cl, GLXContextID gcId)
sendBuf[6] = GLX_FBCONFIG_ID;
sendBuf[7] = (int) (ctx->config ? ctx->config->fbconfigID : 0);
sendBuf[8] = GLX_RENDER_TYPE;
- sendBuf[9] = (int) (ctx->config ? ctx->config->renderType : GLX_DONT_CARE);
+ sendBuf[9] = (int) (ctx->renderType);
if (client->swapped) {
int length = reply.length;
diff --git a/glx/glxcontext.h b/glx/glxcontext.h
index 8f623b4b4..5dd0ebca6 100644
--- a/glx/glxcontext.h
+++ b/glx/glxcontext.h
@@ -104,6 +104,11 @@ struct __GLXcontext {
*/
GLenum releaseBehavior;
+ /**
+ * Context render type
+ */
+ int renderType;
+
/*
** Buffers for feedback and selection.
*/
commit 9c81b8f5b5d7bc987f73e8ef01a81e61205e58ee
Author: Fabrice Fontaine <fontaine.fabrice at gmail.com>
Date: Wed Jan 8 22:51:42 2020 +0100
configure.ac: KMS support also depends on dri2
Kernel modesettings support also depends on dri2, see
http://cgit.freedesktop.org/xorg/xserver/tree/hw/xfree86/drivers/modesetting/Makefile.am#n46
Fix #479
Signed-off-by: Bernd Kuhls <bernd.kuhls at t-online.de>
[Patch retrieved (with a small update of commit message) from:
https://git.buildroot.net/buildroot/tree/package/x11r7/xserver_xorg-server/1.20.6/0001-modesettings-needs-dri2.patch]
Signed-off-by: Fabrice Fontaine <fontaine.fabrice at gmail.com>
diff --git a/configure.ac b/configure.ac
index 96e918ad9..14f936c62 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1947,7 +1947,7 @@ if test "x$XORG" = xyes; then
XORG_SYS_LIBS="$XORG_SYS_LIBS $XORG_MODULES_LIBS"
fi
- if test "x$DRM" = xyes; then
+ if test "x$DRM" = xyes -a "x$DRI2" = xyes; then
XORG_DRIVER_MODESETTING=yes
fi
commit 682167475c1930f80a68de58e522ac08dbb35fa8
Author: Böszörményi Zoltán <zboszor at pr.hu>
Date: Thu Nov 14 09:29:20 2019 +0100
Introduce and use BUS_USB
With !155, the device bus ID received via udev is constructed
properly with the "usb:" prefix. But, it is not enough to
make the following line to work in Section "Device":
BusID "usb:0:1.2:1.0"
Introduce BUS_USB, so the prefix can be distinguished from BUS_PCI
and check the supplied BusID value against device->attribs->busid
in xf86PlatformDeviceCheckBusID().
Signed-off-by: Böszörményi Zoltán <zboszor at pr.hu>
diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c
index 0263e6907..5e34eab99 100644
--- a/hw/xfree86/common/xf86Bus.c
+++ b/hw/xfree86/common/xf86Bus.c
@@ -268,6 +268,8 @@ StringToBusType(const char *busID, const char **retID)
ret = BUS_SBUS;
if (!xf86NameCmp(p, "platform"))
ret = BUS_PLATFORM;
+ if (!xf86NameCmp(p, "usb"))
+ ret = BUS_USB;
if (ret != BUS_NONE)
if (retID)
*retID = busID + strlen(p) + 1;
diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
index f38f6cd68..8f8685ef2 100644
--- a/hw/xfree86/common/xf86str.h
+++ b/hw/xfree86/common/xf86str.h
@@ -254,6 +254,7 @@ typedef struct _DriverRec {
#undef BUS_PCI
#undef BUS_SBUS
#undef BUS_PLATFORM
+#undef BUS_USB
#undef BUS_last
#endif
@@ -262,6 +263,7 @@ typedef enum {
BUS_PCI,
BUS_SBUS,
BUS_PLATFORM,
+ BUS_USB,
BUS_last /* Keep last */
} BusType;
diff --git a/hw/xfree86/os-support/linux/lnx_platform.c b/hw/xfree86/os-support/linux/lnx_platform.c
index e62306219..fe2142182 100644
--- a/hw/xfree86/os-support/linux/lnx_platform.c
+++ b/hw/xfree86/os-support/linux/lnx_platform.c
@@ -103,6 +103,11 @@ xf86PlatformDeviceCheckBusID(struct xf86_platform_device *device, const char *bu
return FALSE;
return TRUE;
}
+ else if (bustype == BUS_USB) {
+ if (strcasecmp(busid, device->attribs->busid))
+ return FALSE;
+ return TRUE;
+ }
return FALSE;
}
commit c0dcadad6c18b06ddc6e349d7c58bfccb715ff55
Author: Reza Arbab <arbab at linux.ibm.com>
Date: Wed Mar 27 11:45:02 2019 -0500
linux: Fix udev ID_PATH parsing for udl devices
The ID_PATH for a udl device looks like this:
$ udevadm info /dev/dri/card2 | grep -w ID_PATH
E: ID_PATH=pci-0000:00:14.0-usb-0:9.1:1.0
The parsing added in 0816e8fca6194 ("linux: Make platform device probe
less fragile"), sets OdevAttributes::busid to "pci:0000:00:14.0", where
drmGetBusid() would have returned "3-9.1:1.0".
Identifying this as a "pci:*" device eventually causes the vendor/device
id check in probeSingleDevice() to fail, because a USB controller isn't
a supported device:
$ udevadm info --path=/devices/pci0000:00/0000:00:14.0 | grep -e VENDOR -e ID_PCI_CLASS
E: ID_PCI_CLASS_FROM_DATABASE=Serial bus controller
E: ID_VENDOR_FROM_DATABASE=Intel Corporation
Instead of parsing out "pci:0000:00:14.0" in this case, use
"usb:0:9.1:1.0" so the device probe will succeed.
Fixes: 0816e8fca6194 ("linux: Make platform device probe less fragile")
Signed-off-by: Reza Arbab <arbab at linux.ibm.com>
diff --git a/config/udev.c b/config/udev.c
index c51bda98a..411a459f4 100644
--- a/config/udev.c
+++ b/config/udev.c
@@ -517,7 +517,12 @@ config_udev_odev_setup_attribs(struct udev_device *udev_device, const char *path
value = udev_device_get_property_value(udev_device, "ID_PATH");
if (value && (str = strrstr(value, "pci-"))) {
- attribs->busid = XNFstrdup(str);
+ value = str;
+
+ if ((str = strstr(value, "usb-")))
+ value = str;
+
+ attribs->busid = XNFstrdup(value);
attribs->busid[3] = ':';
}
commit af4622d3f90382225afb83e3896cb6f236f30c0a
Author: Aaron Plattner <aplattner at nvidia.com>
Date: Fri Nov 20 19:43:25 2020 -0800
modesetting: Add missing copyright notices
I forgot to add these in commits 4fefe73fe, b6985d6b3, 245b9db03, and 4e670f128.
Signed-off-by: Aaron Plattner <aplattner at nvidia.com>
diff --git a/hw/xfree86/drivers/modesetting/driver.c b/hw/xfree86/drivers/modesetting/driver.c
index f1e7d15bd..49f7349d8 100644
--- a/hw/xfree86/drivers/modesetting/driver.c
+++ b/hw/xfree86/drivers/modesetting/driver.c
@@ -1,6 +1,7 @@
/*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
* Copyright 2011 Dave Airlie
+ * Copyright 2019 NVIDIA CORPORATION
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -26,6 +27,8 @@
*
* Original Author: Alan Hourihane <alanh at tungstengraphics.com>
* Rewrite: Dave Airlie <airlied at redhat.com>
+ * Additional contributors:
+ * Aaron Plattner <aplattner at nvidia.com>
*
*/
diff --git a/hw/xfree86/drivers/modesetting/driver.h b/hw/xfree86/drivers/modesetting/driver.h
index 38b7ef1ff..77afc8302 100644
--- a/hw/xfree86/drivers/modesetting/driver.h
+++ b/hw/xfree86/drivers/modesetting/driver.h
@@ -1,5 +1,6 @@
/*
* Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2019 NVIDIA CORPORATION
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -24,7 +25,8 @@
*
*
* Author: Alan Hourihane <alanh at tungstengraphics.com>
- *
+ * Additional contributors:
+ * Aaron Plattner <aplattner at nvidia.com>
*/
#include <errno.h>
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c
index e81168e26..57c50a5ec 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.c
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.c
@@ -1,5 +1,6 @@
/*
* Copyright © 2007 Red Hat, Inc.
+ * Copyright © 2019 NVIDIA CORPORATION
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -22,6 +23,7 @@
*
* Authors:
* Dave Airlie <airlied at redhat.com>
+ * Aaron Plattner <aplattner at nvidia.com>
*
*/
diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.h b/hw/xfree86/drivers/modesetting/drmmode_display.h
index c3d3f712d..dbb413c12 100644
--- a/hw/xfree86/drivers/modesetting/drmmode_display.h
+++ b/hw/xfree86/drivers/modesetting/drmmode_display.h
@@ -1,5 +1,6 @@
/*
* Copyright © 2007 Red Hat, Inc.
+ * Copyright © 2019 NVIDIA CORPORATION
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -22,6 +23,7 @@
*
* Authors:
* Dave Airlie <airlied at redhat.com>
+ * Aaron Plattner <aplattner at nvidia.com>
*
*/
#ifndef DRMMODE_DISPLAY_H
commit 07e6935030c8f0a757bce0a90c54b59d8bf47df6
Author: Povilas Kanapickas <povilas at radix.lt>
Date: Sat Oct 10 02:51:40 2020 +0300
test/xi2: Fix mask size in XISelectEvents test
XI2LASTEVENT identifies the bit number, not the mask size in bits. The
mask size in bits is XI2LASTEVENT + 1 and the mask size in bytes is
(XI2LASTEVENT + 8) / 8 or XI2MASKSIZE.
diff --git a/test/xi2/protocol-xiselectevents.c b/test/xi2/protocol-xiselectevents.c
index 06050ade7..6c94ea73c 100644
--- a/test/xi2/protocol-xiselectevents.c
+++ b/test/xi2/protocol-xiselectevents.c
@@ -142,7 +142,7 @@ request_XISelectEvents_masks(xXISelectEventsReq * req)
{
int i, j;
xXIEventMask *mask;
- int nmasks = (XI2LASTEVENT + 7) / 8;
+ int nmasks = XI2MASKSIZE;
unsigned char *bits;
mask = (xXIEventMask *) &req[1];
commit f5220117e970a40c09babe199709bb2db69c4311
Author: Povilas Kanapickas <povilas at radix.lt>
Date: Sat Oct 10 02:51:39 2020 +0300
dix: Extract FreezeThisEventIfNeededForSyncGrab()
diff --git a/dix/events.c b/dix/events.c
index 22880008a..1441cff25 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4256,7 +4256,6 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
GrabPtr grab;
GrabInfoPtr grabinfo;
int deliveries = 0;
- DeviceIntPtr dev;
SpritePtr pSprite = thisDev->spriteInfo->sprite;
BOOL sendCore = FALSE;
@@ -4304,30 +4303,40 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
event->any.type == ET_KeyRelease ||
event->any.type == ET_ButtonPress ||
event->any.type == ET_ButtonRelease)) {
- switch (grabinfo->sync.state) {
- case FREEZE_BOTH_NEXT_EVENT:
- dev = GetPairedDevice(thisDev);
- if (dev) {
- FreezeThaw(dev, TRUE);
- if ((dev->deviceGrab.sync.state == FREEZE_BOTH_NEXT_EVENT) &&
- (CLIENT_BITS(grab->resource) ==
- CLIENT_BITS(dev->deviceGrab.grab->resource)))
- dev->deviceGrab.sync.state = FROZEN_NO_EVENT;
- else
- dev->deviceGrab.sync.other = grab;
- }
- /* fall through */
- case FREEZE_NEXT_EVENT:
- grabinfo->sync.state = FROZEN_WITH_EVENT;
- FreezeThaw(thisDev, TRUE);
- *grabinfo->sync.event = *event;
- break;
- }
+ FreezeThisEventIfNeededForSyncGrab(thisDev, event);
}
return deliveries;
}
+void
+FreezeThisEventIfNeededForSyncGrab(DeviceIntPtr thisDev, InternalEvent *event)
+{
+ GrabInfoPtr grabinfo = &thisDev->deviceGrab;
+ GrabPtr grab = grabinfo->grab;
+ DeviceIntPtr dev;
+
+ switch (grabinfo->sync.state) {
+ case FREEZE_BOTH_NEXT_EVENT:
+ dev = GetPairedDevice(thisDev);
+ if (dev) {
+ FreezeThaw(dev, TRUE);
+ if ((dev->deviceGrab.sync.state == FREEZE_BOTH_NEXT_EVENT) &&
+ (CLIENT_BITS(grab->resource) ==
+ CLIENT_BITS(dev->deviceGrab.grab->resource)))
+ dev->deviceGrab.sync.state = FROZEN_NO_EVENT;
+ else
+ dev->deviceGrab.sync.other = grab;
+ }
+ /* fall through */
+ case FREEZE_NEXT_EVENT:
+ grabinfo->sync.state = FROZEN_WITH_EVENT;
+ FreezeThaw(thisDev, TRUE);
+ *grabinfo->sync.event = *event;
+ break;
+ }
+}
+
/* This function is used to set the key pressed or key released state -
this is only used when the pressing of keys does not cause
the device's processInputProc to be called, as in for example Mouse Keys.
diff --git a/include/dix.h b/include/dix.h
index 017be8a49..ece8b6f76 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -449,6 +449,10 @@ DeliverGrabbedEvent(InternalEvent * /* event */ ,
DeviceIntPtr /* thisDev */ ,
Bool /* deactivateGrab */ );
+extern void
+FreezeThisEventIfNeededForSyncGrab(DeviceIntPtr thisDev,
+ InternalEvent *event);
+
extern void
FixKeyState(DeviceEvent * /* event */ ,
DeviceIntPtr /* keybd */ );
commit 36f8dacc0652ddc5657e70942269f1f9e22710c6
Author: Povilas Kanapickas <povilas at radix.lt>
Date: Sat Oct 10 02:51:37 2020 +0300
dix: Extract ActivateGrabNoDeliver()
diff --git a/dix/events.c b/dix/events.c
index 75ac0330b..22880008a 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3669,7 +3669,6 @@ ActivatePassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event,
InternalEvent *real_event)
{
SpritePtr pSprite = device->spriteInfo->sprite;
- GrabInfoPtr grabinfo = &device->deviceGrab;
xEvent *xE = NULL;
int count;
int rc;
@@ -3719,8 +3718,7 @@ ActivatePassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event,
}
}
- (*grabinfo->ActivateGrab) (device, grab,
- ClientTimeToServerTime(event->any.time), TRUE);
+ ActivateGrabNoDelivery(device, grab, event, real_event);
if (xE) {
FixUpEventFromWindow(pSprite, xE, grab->window, None, TRUE);
@@ -3731,12 +3729,29 @@ ActivatePassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event,
GetEventFilter(device, xE), grab);
}
+ free(xE);
+ return TRUE;
+}
+
+/**
+ * Activates a grab without event delivery.
+ *
+ * @param device The device of the event to check.
+ * @param grab The grab to check.
+ * @param event The current device event.
+ * @param real_event The original event, in case of touch emulation. The
+ * real event is the one stored in the sync queue.
+ */
+void ActivateGrabNoDelivery(DeviceIntPtr dev, GrabPtr grab,
+ InternalEvent *event, InternalEvent *real_event)
+{
+ GrabInfoPtr grabinfo = &dev->deviceGrab;
+ (*grabinfo->ActivateGrab) (dev, grab,
+ ClientTimeToServerTime(event->any.time), TRUE);
+
if (grabinfo->sync.state == FROZEN_NO_EVENT)
grabinfo->sync.state = FROZEN_WITH_EVENT;
*grabinfo->sync.event = *real_event;
-
- free(xE);
- return TRUE;
}
static BOOL
diff --git a/include/input.h b/include/input.h
index 78c8246aa..0208562d9 100644
--- a/include/input.h
+++ b/include/input.h
@@ -630,6 +630,9 @@ extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y);
extern int EventIsDeliverable(DeviceIntPtr dev, int evtype, WindowPtr win);
extern Bool ActivatePassiveGrab(DeviceIntPtr dev, GrabPtr grab,
InternalEvent *ev, InternalEvent *real_event);
+extern void ActivateGrabNoDelivery(DeviceIntPtr dev, GrabPtr grab,
+ InternalEvent *event,
+ InternalEvent *real_event);
/**
* Masks specifying the type of event to deliver for an InternalEvent; used
* by EventIsDeliverable.
commit 23a8b62d34344575f9df9d057fb74bfefa94a77b
Author: Povilas Kanapickas <povilas at radix.lt>
Date: Sat Oct 10 02:51:36 2020 +0300
dix: Store replayed event into GrabInfoRec struct as InternalEvent*
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 0dde38738..22dc214c9 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1451,7 +1451,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
g = AllocGrab(devgrab);
BUG_WARN(!g);
- *dev->deviceGrab.sync.event = ev->device_event;
+ *dev->deviceGrab.sync.event = *ev;
/* The listener array has a sequence of grabs and then one event
* selection. Implicit grab activation occurs through delivering an
diff --git a/dix/devices.c b/dix/devices.c
index 4ac27a2d8..0ab9f37c2 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -281,7 +281,7 @@ AddInputDevice(ClientPtr client, DeviceProc deviceProc, Bool autoStart)
dev->deviceGrab.grabTime = currentTime;
dev->deviceGrab.ActivateGrab = ActivateKeyboardGrab;
dev->deviceGrab.DeactivateGrab = DeactivateKeyboardGrab;
- dev->deviceGrab.sync.event = calloc(1, sizeof(DeviceEvent));
+ dev->deviceGrab.sync.event = calloc(1, sizeof(InternalEvent));
XkbSetExtension(dev, ProcessKeyboardEvent);
diff --git a/dix/events.c b/dix/events.c
index 418de7860..75ac0330b 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1304,7 +1304,6 @@ static void
ComputeFreezes(void)
{
DeviceIntPtr replayDev = syncEvents.replayDev;
- WindowPtr w;
GrabPtr grab;
DeviceIntPtr dev;
@@ -1316,26 +1315,29 @@ ComputeFreezes(void)
return;
syncEvents.playingEvents = TRUE;
if (replayDev) {
- DeviceEvent *event = replayDev->deviceGrab.sync.event;
+ InternalEvent *event = replayDev->deviceGrab.sync.event;
syncEvents.replayDev = (DeviceIntPtr) NULL;
- w = XYToWindow(replayDev->spriteInfo->sprite,
- event->root_x, event->root_y);
- if (!CheckDeviceGrabs(replayDev, event, syncEvents.replayWin)) {
- if (IsTouchEvent((InternalEvent *) event)) {
+ if (!CheckDeviceGrabs(replayDev, &event->device_event,
+ syncEvents.replayWin)) {
+ if (IsTouchEvent(event)) {
TouchPointInfoPtr ti =
- TouchFindByClientID(replayDev, event->touchid);
+ TouchFindByClientID(replayDev, event->device_event.touchid);
BUG_WARN(!ti);
TouchListenerAcceptReject(replayDev, ti, 0, XIRejectTouch);
}
- else if (replayDev->focus &&
- !IsPointerEvent((InternalEvent *) event))
- DeliverFocusedEvent(replayDev, (InternalEvent *) event, w);
- else
- DeliverDeviceEvents(w, (InternalEvent *) event, NullGrab,
- NullWindow, replayDev);
+ else {
+ WindowPtr w = XYToWindow(replayDev->spriteInfo->sprite,
+ event->device_event.root_x,
+ event->device_event.root_y);
+ if (replayDev->focus && !IsPointerEvent(event))
+ DeliverFocusedEvent(replayDev, event, w);
+ else
+ DeliverDeviceEvents(w, event, NullGrab,
+ NullWindow, replayDev);
+ }
}
}
for (dev = inputInfo.devices; dev; dev = dev->next) {
@@ -1813,8 +1815,8 @@ AllowSome(ClientPtr client, TimeStamp time, DeviceIntPtr thisDev, int newState)
* anything else is accept.
*/
if (newState != NOT_GRABBED /* Replay */ &&
- IsTouchEvent((InternalEvent*)grabinfo->sync.event)) {
- TouchAcceptAndEnd(thisDev, grabinfo->sync.event->touchid);
+ IsTouchEvent(grabinfo->sync.event)) {
+ TouchAcceptAndEnd(thisDev, grabinfo->sync.event->device_event.touchid);
}
}
@@ -3731,7 +3733,7 @@ ActivatePassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event,
if (grabinfo->sync.state == FROZEN_NO_EVENT)
grabinfo->sync.state = FROZEN_WITH_EVENT;
- *grabinfo->sync.event = real_event->device_event;
+ *grabinfo->sync.event = *real_event;
free(xE);
return TRUE;
@@ -4303,7 +4305,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
case FREEZE_NEXT_EVENT:
grabinfo->sync.state = FROZEN_WITH_EVENT;
FreezeThaw(thisDev, TRUE);
- *grabinfo->sync.event = event->device_event;
+ *grabinfo->sync.event = *event;
break;
}
}
diff --git a/dix/touch.c b/dix/touch.c
index 6b79b7c02..1705d85aa 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -877,7 +877,7 @@ TouchRemovePointerGrab(DeviceIntPtr dev)
{
TouchPointInfoPtr ti;
GrabPtr grab;
- DeviceEvent *ev;
+ InternalEvent *ev;
if (!dev->touch)
return;
@@ -887,10 +887,10 @@ TouchRemovePointerGrab(DeviceIntPtr dev)
return;
ev = dev->deviceGrab.sync.event;
- if (!IsTouchEvent((InternalEvent *) ev))
+ if (!IsTouchEvent(ev))
return;
- ti = TouchFindByClientID(dev, ev->touchid);
+ ti = TouchFindByClientID(dev, ev->device_event.touchid);
if (!ti)
return;
diff --git a/include/inputstr.h b/include/inputstr.h
index bf35dbf4b..33d440b2c 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -501,7 +501,7 @@ typedef struct _GrabInfoRec {
Bool frozen;
int state;
GrabPtr other; /* if other grab has this frozen */
- DeviceEvent *event; /* saved to be replayed */
+ InternalEvent *event; /* saved to be replayed */
} sync;
} GrabInfoRec, *GrabInfoPtr;
commit 8bd8b3af1931629db548d39bb390edbef4315b0b
Author: Povilas Kanapickas <povilas at radix.lt>
Date: Sat Oct 10 02:51:35 2020 +0300
dix: Rename LISTENER_* to TOUCH_LISTENER_*
diff --git a/Xi/exevents.c b/Xi/exevents.c
index 41a4097cc..0dde38738 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1043,8 +1043,8 @@ ActivateEarlyAccept(DeviceIntPtr dev, TouchPointInfoPtr ti)
XID error;
GrabPtr grab = ti->listeners[0].grab;
- BUG_RETURN(ti->listeners[0].type != LISTENER_GRAB &&
- ti->listeners[0].type != LISTENER_POINTER_GRAB);
+ BUG_RETURN(ti->listeners[0].type != TOUCH_LISTENER_GRAB &&
+ ti->listeners[0].type != TOUCH_LISTENER_POINTER_GRAB);
BUG_RETURN(!grab);
client = rClient(grab);
@@ -1077,8 +1077,8 @@ FindOldestPointerEmulatedTouch(DeviceIntPtr dev)
continue;
for (j = 0; j < ti->num_listeners; j++) {
- if (ti->listeners[j].type == LISTENER_POINTER_GRAB ||
- ti->listeners[j].type == LISTENER_POINTER_REGULAR)
+ if (ti->listeners[j].type == TOUCH_LISTENER_POINTER_GRAB ||
+ ti->listeners[j].type == TOUCH_LISTENER_POINTER_REGULAR)
break;
}
if (j == ti->num_listeners)
@@ -1105,17 +1105,17 @@ TouchPuntToNextOwner(DeviceIntPtr dev, TouchPointInfoPtr ti,
TouchOwnershipEvent *ev)
{
TouchListener *listener = &ti->listeners[0]; /* new owner */
- int accepted_early = listener->state == LISTENER_EARLY_ACCEPT;
+ int accepted_early = listener->state == TOUCH_LISTENER_EARLY_ACCEPT;
/* Deliver the ownership */
- if (listener->state == LISTENER_AWAITING_OWNER || accepted_early)
+ if (listener->state == TOUCH_LISTENER_AWAITING_OWNER || accepted_early)
DeliverTouchEvents(dev, ti, (InternalEvent *) ev,
listener->listener);
- else if (listener->state == LISTENER_AWAITING_BEGIN) {
+ else if (listener->state == TOUCH_LISTENER_AWAITING_BEGIN) {
/* We can't punt to a pointer listener unless all older pointer
* emulated touches have been seen already. */
- if ((listener->type == LISTENER_POINTER_GRAB ||
- listener->type == LISTENER_POINTER_REGULAR) &&
+ if ((listener->type == TOUCH_LISTENER_POINTER_GRAB ||
+ listener->type == TOUCH_LISTENER_POINTER_REGULAR) &&
ti != FindOldestPointerEmulatedTouch(dev))
return;
@@ -1158,7 +1158,7 @@ CheckOldestTouch(DeviceIntPtr dev)
{
TouchPointInfoPtr oldest = FindOldestPointerEmulatedTouch(dev);
- if (oldest && oldest->listeners[0].state == LISTENER_AWAITING_BEGIN)
+ if (oldest && oldest->listeners[0].state == TOUCH_LISTENER_AWAITING_BEGIN)
TouchPuntToNextOwner(dev, oldest, NULL);
}
@@ -1182,7 +1182,7 @@ TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource,
* haven't received one yet already */
for (i = 0; i < ti->num_listeners; i++) {
if (ti->listeners[i].listener == resource) {
- if (ti->listeners[i].state != LISTENER_HAS_END)
+ if (ti->listeners[i].state != TOUCH_LISTENER_HAS_END)
TouchEmitTouchEnd(sourcedev, ti, TOUCH_REJECT, resource);
break;
}
@@ -1228,12 +1228,12 @@ ProcessTouchOwnershipEvent(TouchOwnershipEvent *ev,
/* For pointer-emulated listeners that ungrabbed the active grab,
- * the state was forced to LISTENER_HAS_END. Still go
+ * the state was forced to TOUCH_LISTENER_HAS_END. Still go
* through the motions of ending the touch if the listener has
* already seen the end. This ensures that the touch record is ended in
* the server.
*/
- if (ti->listeners[0].state == LISTENER_HAS_END)
+ if (ti->listeners[0].state == TOUCH_LISTENER_HAS_END)
TouchEmitTouchEnd(dev, ti, TOUCH_ACCEPT, ti->listeners[0].listener);
/* The touch owner has accepted the touch. Send TouchEnd events to
@@ -1244,10 +1244,10 @@ ProcessTouchOwnershipEvent(TouchOwnershipEvent *ev,
while (ti->num_listeners > 1)
TouchRemoveListener(ti, ti->listeners[1].listener);
/* Owner accepted after receiving end */
- if (ti->listeners[0].state == LISTENER_HAS_END)
+ if (ti->listeners[0].state == TOUCH_LISTENER_HAS_END)
TouchEndTouch(dev, ti);
else
- ti->listeners[0].state = LISTENER_HAS_ACCEPTED;
+ ti->listeners[0].state = TOUCH_LISTENER_HAS_ACCEPTED;
}
else { /* this is the very first ownership event for a grab */
DeliverTouchEvents(dev, ti, (InternalEvent *) ev, ev->resource);
@@ -1294,8 +1294,8 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
*mask = NULL;
*grab = NULL;
- if (listener->type == LISTENER_GRAB ||
- listener->type == LISTENER_POINTER_GRAB) {
+ if (listener->type == TOUCH_LISTENER_GRAB ||
+ listener->type == TOUCH_LISTENER_POINTER_GRAB) {
*grab = listener->grab;
BUG_RETURN_VAL(!*grab, FALSE);
@@ -1322,7 +1322,7 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
int evtype;
if (ti->emulate_pointer &&
- listener->type == LISTENER_POINTER_REGULAR)
+ listener->type == TOUCH_LISTENER_POINTER_REGULAR)
evtype = GetXI2Type(TouchGetPointerEventType(ev));
else
evtype = GetXI2Type(ev->any.type);
@@ -1463,16 +1463,16 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
//l->resource_type = RT_NONE;
if (devgrab->grabtype != XI2 || devgrab->type != XI_TouchBegin)
- l->type = LISTENER_POINTER_GRAB;
+ l->type = TOUCH_LISTENER_POINTER_GRAB;
else
- l->type = LISTENER_GRAB;
+ l->type = TOUCH_LISTENER_GRAB;
}
}
if (ev->any.type == ET_TouchBegin)
- listener->state = LISTENER_IS_OWNER;
+ listener->state = TOUCH_LISTENER_IS_OWNER;
else if (ev->any.type == ET_TouchEnd)
- listener->state = LISTENER_HAS_END;
+ listener->state = TOUCH_LISTENER_HAS_END;
return Success;
}
@@ -1489,8 +1489,8 @@ DeliverEmulatedMotionEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
GrabPtr grab;
XI2Mask *mask;
- if (ti->listeners[0].type != LISTENER_POINTER_REGULAR &&
- ti->listeners[0].type != LISTENER_POINTER_GRAB)
+ if (ti->listeners[0].type != TOUCH_LISTENER_POINTER_REGULAR &&
+ ti->listeners[0].type != TOUCH_LISTENER_POINTER_GRAB)
return;
motion = ev->device_event;
@@ -1879,14 +1879,14 @@ DeliverTouchBeginEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
int rc = Success;
Bool has_ownershipmask;
- if (listener->type == LISTENER_POINTER_REGULAR ||
- listener->type == LISTENER_POINTER_GRAB) {
+ if (listener->type == TOUCH_LISTENER_POINTER_REGULAR ||
+ listener->type == TOUCH_LISTENER_POINTER_GRAB) {
rc = DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win,
grab, xi2mask);
if (rc == Success) {
- listener->state = LISTENER_IS_OWNER;
+ listener->state = TOUCH_LISTENER_IS_OWNER;
/* async grabs cannot replay, so automatically accept this touch */
- if (listener->type == LISTENER_POINTER_GRAB &&
+ if (listener->type == TOUCH_LISTENER_POINTER_GRAB &&
dev->deviceGrab.grab &&
dev->deviceGrab.fromPassiveGrab &&
dev->deviceGrab.grab->pointerMode == GrabModeAsync)
@@ -1901,18 +1901,18 @@ DeliverTouchBeginEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
if (!TouchResourceIsOwner(ti, listener->listener)) {
if (has_ownershipmask)
- state = LISTENER_AWAITING_OWNER;
+ state = TOUCH_LISTENER_AWAITING_OWNER;
else
- state = LISTENER_AWAITING_BEGIN;
+ state = TOUCH_LISTENER_AWAITING_BEGIN;
}
else {
if (has_ownershipmask)
TouchSendOwnershipEvent(dev, ti, 0, listener->listener);
- if (listener->type == LISTENER_REGULAR)
- state = LISTENER_HAS_ACCEPTED;
+ if (listener->type == TOUCH_LISTENER_REGULAR)
+ state = TOUCH_LISTENER_HAS_ACCEPTED;
else
- state = LISTENER_IS_OWNER;
+ state = TOUCH_LISTENER_IS_OWNER;
}
listener->state = state;
@@ -1927,14 +1927,14 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
{
int rc = Success;
- if (listener->type == LISTENER_POINTER_REGULAR ||
- listener->type == LISTENER_POINTER_GRAB) {
+ if (listener->type == TOUCH_LISTENER_POINTER_REGULAR ||
+ listener->type == TOUCH_LISTENER_POINTER_GRAB) {
/* Note: If the active grab was ungrabbed, we already changed the
- * state to LISTENER_HAS_END but still get here. So we mustn't
+ * state to TOUCH_LISTENER_HAS_END but still get here. So we mustn't
* actually send the event.
* This is part two of the hack in DeactivatePointerGrab
*/
- if (listener->state != LISTENER_HAS_END) {
+ if (listener->state != TOUCH_LISTENER_HAS_END) {
rc = DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win,
grab, xi2mask);
@@ -1944,14 +1944,14 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
* and we can continue.
*/
if (rc == Success)
- listener->state = LISTENER_HAS_END;
+ listener->state = TOUCH_LISTENER_HAS_END;
}
goto out;
}
/* A client is waiting for the begin, don't give it a TouchEnd */
- if (listener->state == LISTENER_AWAITING_BEGIN) {
- listener->state = LISTENER_HAS_END;
+ if (listener->state == TOUCH_LISTENER_AWAITING_BEGIN) {
+ listener->state = TOUCH_LISTENER_HAS_END;
goto out;
}
@@ -1959,19 +1959,19 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
if (ev->device_event.flags & TOUCH_REJECT ||
(ev->device_event.flags & TOUCH_ACCEPT && !TouchResourceIsOwner(ti, listener->listener))) {
/* Touch has been rejected, or accepted by its owner which is not this listener */
- if (listener->state != LISTENER_HAS_END)
+ if (listener->state != TOUCH_LISTENER_HAS_END)
rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
- listener->state = LISTENER_HAS_END;
+ listener->state = TOUCH_LISTENER_HAS_END;
}
else if (TouchResourceIsOwner(ti, listener->listener)) {
Bool normal_end = !(ev->device_event.flags & TOUCH_ACCEPT);
/* FIXME: what about early acceptance */
- if (normal_end && listener->state != LISTENER_HAS_END)
+ if (normal_end && listener->state != TOUCH_LISTENER_HAS_END)
rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
if ((ti->num_listeners > 1 ||
- (ti->num_grabs > 0 && listener->state != LISTENER_HAS_ACCEPTED)) &&
+ (ti->num_grabs > 0 && listener->state != TOUCH_LISTENER_HAS_ACCEPTED)) &&
(ev->device_event.flags & (TOUCH_ACCEPT | TOUCH_REJECT)) == 0) {
ev->any.type = ET_TouchUpdate;
ev->device_event.flags |= TOUCH_PENDING_END;
@@ -1979,7 +1979,7 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
}
if (normal_end)
- listener->state = LISTENER_HAS_END;
+ listener->state = TOUCH_LISTENER_HAS_END;
}
out:
@@ -2002,7 +2002,7 @@ DeliverTouchEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
if (!TouchResourceIsOwner(ti, listener->listener))
goto out;
rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev);
- listener->state = LISTENER_IS_OWNER;
+ listener->state = TOUCH_LISTENER_IS_OWNER;
}
else
ev->device_event.deviceid = dev->id;
@@ -2012,8 +2012,8 @@ DeliverTouchEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev,
xi2mask);
}
else if (ev->any.type == ET_TouchUpdate) {
- if (listener->type == LISTENER_POINTER_REGULAR ||
- listener->type == LISTENER_POINTER_GRAB)
+ if (listener->type == TOUCH_LISTENER_POINTER_REGULAR ||
+ listener->type == TOUCH_LISTENER_POINTER_GRAB)
DeliverTouchEmulatedEvent(dev, ti, ev, listener, client, win, grab,
xi2mask);
else if (TouchResourceIsOwner(ti, listener->listener) ||
diff --git a/dix/events.c b/dix/events.c
index c1f847ad8..418de7860 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1480,14 +1480,14 @@ UpdateTouchesForGrab(DeviceIntPtr mouse)
CLIENT_BITS(listener->listener) == grab->resource) {
listener->listener = grab->resource;
listener->level = grab->grabtype;
- listener->state = LISTENER_IS_OWNER;
+ listener->state = TOUCH_LISTENER_IS_OWNER;
listener->window = grab->window;
if (grab->grabtype == CORE || grab->grabtype == XI ||
!xi2mask_isset(grab->xi2mask, mouse, XI_TouchBegin))
- listener->type = LISTENER_POINTER_GRAB;
+ listener->type = TOUCH_LISTENER_POINTER_GRAB;
else
- listener->type = LISTENER_GRAB;
+ listener->type = TOUCH_LISTENER_GRAB;
if (listener->grab)
FreeGrab(listener->grab);
listener->grab = AllocGrab(grab);
@@ -1583,7 +1583,7 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
* ProcessTouchOwnershipEvent() will still call
* TouchEmitTouchEnd for this listener. The other half of
* this hack is in DeliverTouchEndEvent */
- ti->listeners[0].state = LISTENER_HAS_END;
+ ti->listeners[0].state = TOUCH_LISTENER_HAS_END;
}
TouchListenerAcceptReject(mouse, ti, 0, mode);
}
diff --git a/dix/touch.c b/dix/touch.c
index 4e6910f26..6b79b7c02 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -682,7 +682,7 @@ TouchRemoveListener(TouchPointInfoPtr ti, XID resource)
ti->listeners[j] = ti->listeners[j + 1];
ti->num_listeners--;
ti->listeners[ti->num_listeners].listener = 0;
- ti->listeners[ti->num_listeners].state = LISTENER_AWAITING_BEGIN;
+ ti->listeners[ti->num_listeners].state = TOUCH_LISTENER_AWAITING_BEGIN;
return TRUE;
}
@@ -693,7 +693,7 @@ static void
TouchAddGrabListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
InternalEvent *ev, GrabPtr grab)
{
- enum TouchListenerType type = LISTENER_GRAB;
+ enum TouchListenerType type = TOUCH_LISTENER_GRAB;
/* FIXME: owner_events */
@@ -701,16 +701,16 @@ TouchAddGrabListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
if (!xi2mask_isset(grab->xi2mask, dev, XI_TouchOwnership))
TouchEventHistoryAllocate(ti);
if (!xi2mask_isset(grab->xi2mask, dev, XI_TouchBegin))
- type = LISTENER_POINTER_GRAB;
+ type = TOUCH_LISTENER_POINTER_GRAB;
}
else if (grab->grabtype == XI || grab->grabtype == CORE) {
TouchEventHistoryAllocate(ti);
- type = LISTENER_POINTER_GRAB;
+ type = TOUCH_LISTENER_POINTER_GRAB;
}
/* grab listeners are always RT_NONE since we keep the grab pointer */
TouchAddListener(ti, grab->resource, RT_NONE, grab->grabtype,
- type, LISTENER_AWAITING_BEGIN, grab->window, grab);
+ type, TOUCH_LISTENER_AWAITING_BEGIN, grab->window, grab);
}
/**
@@ -738,7 +738,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
InputClients *iclients = NULL;
OtherInputMasks *inputMasks = NULL;
uint16_t evtype = 0; /* may be event type or emulated event type */
- enum TouchListenerType type = LISTENER_REGULAR;
+ enum TouchListenerType type = TOUCH_LISTENER_REGULAR;
int mask;
evtype = GetXI2Type(ev->any.type);
@@ -749,7 +749,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
mask = EventIsDeliverable(dev, TouchGetPointerEventType(ev), win);
if (mask) {
evtype = GetXI2Type(TouchGetPointerEventType(ev));
- type = LISTENER_POINTER_REGULAR;
+ type = TOUCH_LISTENER_POINTER_REGULAR;
}
}
if (!mask)
@@ -766,7 +766,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
TouchEventHistoryAllocate(ti);
TouchAddListener(ti, iclients->resource, RT_INPUTCLIENT, XI2,
- type, LISTENER_AWAITING_BEGIN, win, NULL);
+ type, TOUCH_LISTENER_AWAITING_BEGIN, win, NULL);
return TRUE;
}
}
@@ -781,7 +781,8 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
TouchEventHistoryAllocate(ti);
TouchAddListener(ti, iclients->resource, RT_INPUTCLIENT, XI,
- LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN,
+ TOUCH_LISTENER_POINTER_REGULAR,
+ TOUCH_LISTENER_AWAITING_BEGIN,
win, NULL);
return TRUE;
}
@@ -796,7 +797,8 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
if (IsMaster(dev) && (win->eventMask & core_filter)) {
TouchEventHistoryAllocate(ti);
TouchAddListener(ti, win->drawable.id, RT_WINDOW, CORE,
- LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN,
+ TOUCH_LISTENER_POINTER_REGULAR,
+ TOUCH_LISTENER_AWAITING_BEGIN,
win, NULL);
return TRUE;
}
@@ -808,7 +810,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
TouchEventHistoryAllocate(ti);
TouchAddListener(ti, oclients->resource, RT_OTHERCLIENT, CORE,
- type, LISTENER_AWAITING_BEGIN, win, NULL);
+ type, TOUCH_LISTENER_AWAITING_BEGIN, win, NULL);
return TRUE;
}
}
@@ -950,7 +952,7 @@ TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti, int listener,
if (mode == XIRejectTouch)
TouchRejected(dev, ti, ti->listeners[listener].listener, NULL);
else
- ti->listeners[listener].state = LISTENER_EARLY_ACCEPT;
+ ti->listeners[listener].state = TOUCH_LISTENER_EARLY_ACCEPT;
return Success;
}
diff --git a/include/input.h b/include/input.h
index 8732890a0..78c8246aa 100644
--- a/include/input.h
+++ b/include/input.h
@@ -555,20 +555,21 @@ extern _X_EXPORT InputAttributes *DuplicateInputAttributes(InputAttributes *
extern _X_EXPORT void FreeInputAttributes(InputAttributes * attrs);
enum TouchListenerState {
- LISTENER_AWAITING_BEGIN = 0, /**< Waiting for a TouchBegin event */
- LISTENER_AWAITING_OWNER, /**< Waiting for a TouchOwnership event */
- LISTENER_EARLY_ACCEPT, /**< Waiting for ownership, has already
- accepted */
- LISTENER_IS_OWNER, /**< Is the current owner, hasn't accepted */
- LISTENER_HAS_ACCEPTED, /**< Is the current owner, has accepted */
- LISTENER_HAS_END, /**< Has already received the end event */
+ TOUCH_LISTENER_AWAITING_BEGIN = 0, /**< Waiting for a TouchBegin event */
+ TOUCH_LISTENER_AWAITING_OWNER, /**< Waiting for a TouchOwnership event */
+ TOUCH_LISTENER_EARLY_ACCEPT, /**< Waiting for ownership, has already
+ accepted */
+ TOUCH_LISTENER_IS_OWNER, /**< Is the current owner, hasn't
+ accepted */
+ TOUCH_LISTENER_HAS_ACCEPTED, /**< Is the current owner, has accepted */
+ TOUCH_LISTENER_HAS_END, /**< Has already received the end event */
};
enum TouchListenerType {
- LISTENER_GRAB,
- LISTENER_POINTER_GRAB,
- LISTENER_REGULAR,
- LISTENER_POINTER_REGULAR,
+ TOUCH_LISTENER_GRAB,
+ TOUCH_LISTENER_POINTER_GRAB,
+ TOUCH_LISTENER_REGULAR,
+ TOUCH_LISTENER_POINTER_REGULAR,
};
extern void TouchInitDDXTouchPoint(DeviceIntPtr dev,
commit f6e0bf68333f7edb02e3b937bc164f6591da2320
Author: Povilas Kanapickas <povilas at radix.lt>
Date: Sat Oct 10 02:51:34 2020 +0300
Xi: Make check_for_touch_selection_conflicts() more generic
diff --git a/Xi/xiselectev.c b/Xi/xiselectev.c
index 0498e0188..0266a8d30 100644
--- a/Xi/xiselectev.c
+++ b/Xi/xiselectev.c
@@ -44,7 +44,9 @@
* - If A has XIAllMasterDevices, B may select on XIAllDevices
* - if A has device X, B may select on XIAllDevices/XIAllMasterDevices
*/
-static int check_for_touch_selection_conflicts(ClientPtr B, WindowPtr win, int deviceid)
+static int
+check_for_touch_selection_conflicts(ClientPtr B, WindowPtr win, int deviceid,
+ int evtype)
{
OtherInputMasks *inputMasks = wOtherInputMasks(win);
InputClients *A = NULL;
@@ -67,19 +69,19 @@ static int check_for_touch_selection_conflicts(ClientPtr B, WindowPtr win, int d
return BadImplementation; /* this shouldn't happen */
/* A has XIAllDevices */
- if (xi2mask_isset_for_device(A->xi2mask, inputInfo.all_devices, XI_TouchBegin)) {
+ if (xi2mask_isset_for_device(A->xi2mask, inputInfo.all_devices, evtype)) {
if (deviceid == XIAllDevices)
return BadAccess;
}
/* A has XIAllMasterDevices */
- if (xi2mask_isset_for_device(A->xi2mask, inputInfo.all_master_devices, XI_TouchBegin)) {
+ if (xi2mask_isset_for_device(A->xi2mask, inputInfo.all_master_devices, evtype)) {
if (deviceid == XIAllMasterDevices)
return BadAccess;
}
/* A has this device */
- if (xi2mask_isset_for_device(A->xi2mask, tmp, XI_TouchBegin))
+ if (xi2mask_isset_for_device(A->xi2mask, tmp, evtype))
return BadAccess;
}
@@ -230,7 +232,8 @@ ProcXISelectEvents(ClientPtr client)
if (BitIsOn(bits, XI_TouchBegin)) {
rc = check_for_touch_selection_conflicts(client,
win,
- evmask->deviceid);
+ evmask->deviceid,
+ XI_TouchBegin);
if (rc != Success)
return rc;
}
commit 56d720592155c55617728e8ddf1ba8192fe5d46c
Author: Povilas Kanapickas <povilas at radix.lt>
Date: Sat Oct 10 02:51:33 2020 +0300
dix: Extract DeliverDeviceClassesChangedEvent() utility function
diff --git a/dix/devices.c b/dix/devices.c
index 59a4dbfee..4ac27a2d8 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -2811,3 +2811,26 @@ valuator_set_mode(DeviceIntPtr dev, int axis, int mode)
dev->valuator->axes[i].mode = mode;
}
}
+
+void
+DeliverDeviceClassesChangedEvent(int sourceid, Time time)
+{
+ DeviceIntPtr dev;
+ int num_events = 0;
+ InternalEvent dcce;
+
+ dixLookupDevice(&dev, sourceid, serverClient, DixWriteAccess);
+
+ if (!dev)
+ return;
+
+ /* UpdateFromMaster generates at most one event */
+ UpdateFromMaster(&dcce, dev, DEVCHANGE_POINTER_EVENT, &num_events);
+ BUG_WARN(num_events > 1);
+
+ if (num_events) {
+ dcce.any.time = time;
+ /* FIXME: This doesn't do anything */
+ dev->public.processInputProc(&dcce, dev);
+ }
+}
diff --git a/dix/inpututils.c b/dix/inpututils.c
index e7e1ce815..b60ffff0d 100644
--- a/dix/inpututils.c
+++ b/dix/inpututils.c
@@ -1245,4 +1245,3 @@ CopySprite(SpritePtr src, SpritePtr dst)
dst->spriteTraceGood = src->spriteTraceGood;
return TRUE;
}
-
diff --git a/dix/touch.c b/dix/touch.c
index 193931294..4e6910f26 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -447,7 +447,7 @@ TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev, XID resource)
if (!ti->history)
return;
- TouchDeliverDeviceClassesChangedEvent(ti, ti->history[0].time, resource);
+ DeliverDeviceClassesChangedEvent(ti->sourceid, ti->history[0].time);
for (i = 0; i < ti->history_elements; i++) {
DeviceEvent *ev = &ti->history[i];
@@ -471,30 +471,6 @@ TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev, XID resource)
}
}
-void
-TouchDeliverDeviceClassesChangedEvent(TouchPointInfoPtr ti, Time time,
- XID resource)
-{
- DeviceIntPtr dev;
- int num_events = 0;
- InternalEvent dcce;
-
- dixLookupDevice(&dev, ti->sourceid, serverClient, DixWriteAccess);
-
- if (!dev)
- return;
-
- /* UpdateFromMaster generates at most one event */
- UpdateFromMaster(&dcce, dev, DEVCHANGE_POINTER_EVENT, &num_events);
- BUG_WARN(num_events > 1);
-
- if (num_events) {
- dcce.any.time = time;
- /* FIXME: This doesn't do anything */
- dev->public.processInputProc(&dcce, dev);
- }
-}
-
Bool
TouchBuildDependentSpriteTrace(DeviceIntPtr dev, SpritePtr sprite)
{
@@ -1073,7 +1049,7 @@ TouchEmitTouchEnd(DeviceIntPtr dev, TouchPointInfoPtr ti, int flags, XID resourc
flags |= TOUCH_CLIENT_ID;
if (ti->emulate_pointer)
flags |= TOUCH_POINTER_EMULATED;
- TouchDeliverDeviceClassesChangedEvent(ti, GetTimeInMillis(), resource);
+ DeliverDeviceClassesChangedEvent(ti->sourceid, GetTimeInMillis());
GetDixTouchEnd(&event, dev, ti, flags);
DeliverTouchEvents(dev, ti, &event, resource);
if (ti->num_grabs == 0)
diff --git a/include/input.h b/include/input.h
index e57de626d..8732890a0 100644
--- a/include/input.h
+++ b/include/input.h
@@ -549,6 +549,7 @@ extern int AllocXTestDevice(ClientPtr client, const char *name,
extern BOOL IsXTestDevice(DeviceIntPtr dev, DeviceIntPtr master);
extern DeviceIntPtr GetXTestDevice(DeviceIntPtr master);
extern void SendDevicePresenceEvent(int deviceid, int type);
+extern void DeliverDeviceClassesChangedEvent(int sourceid, Time time);
extern _X_EXPORT InputAttributes *DuplicateInputAttributes(InputAttributes *
attrs);
extern _X_EXPORT void FreeInputAttributes(InputAttributes * attrs);
@@ -612,8 +613,6 @@ extern int TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti,
extern int TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
uint32_t touchid, Window grab_window, XID *error);
extern void TouchEndPhysicallyActiveTouches(DeviceIntPtr dev);
-extern void TouchDeliverDeviceClassesChangedEvent(TouchPointInfoPtr ti,
- Time time, XID resource);
extern void TouchEmitTouchEnd(DeviceIntPtr dev, TouchPointInfoPtr ti, int flags, XID resource);
extern void TouchAcceptAndEnd(DeviceIntPtr dev, int touchid);
commit 5b0c5344b7131f0812bcbf070194adaa2175d150
Author: Povilas Kanapickas <povilas at radix.lt>
Date: Sat Oct 10 02:51:32 2020 +0300
dix: Extract CopySprite() utility
diff --git a/dix/inpututils.c b/dix/inpututils.c
index a36d88503..e7e1ce815 100644
--- a/dix/inpututils.c
+++ b/dix/inpututils.c
@@ -1220,3 +1220,29 @@ xi2mask_get_one_mask(const XI2Mask *mask, int deviceid)
return mask->masks[deviceid];
}
+
+/**
+ * Copies a sprite data from src to dst sprites.
+ *
+ * Returns FALSE on error.
+ */
+Bool
+CopySprite(SpritePtr src, SpritePtr dst)
+{
+ WindowPtr *trace;
+ if (src->spriteTraceGood > dst->spriteTraceSize) {
+ trace = reallocarray(dst->spriteTrace,
+ src->spriteTraceSize, sizeof(*trace));
+ if (!trace) {
+ dst->spriteTraceGood = 0;
+ return FALSE;
+ }
+ dst->spriteTrace = trace;
+ dst->spriteTraceSize = src->spriteTraceGood;
+ }
+ memcpy(dst->spriteTrace, src->spriteTrace,
+ src->spriteTraceGood * sizeof(*trace));
+ dst->spriteTraceGood = src->spriteTraceGood;
+ return TRUE;
+}
+
diff --git a/dix/touch.c b/dix/touch.c
index 337674ddb..193931294 100644
--- a/dix/touch.c
+++ b/dix/touch.c
@@ -500,7 +500,6 @@ TouchBuildDependentSpriteTrace(DeviceIntPtr dev, SpritePtr sprite)
{
int i;
TouchClassPtr t = dev->touch;
- WindowPtr *trace;
SpritePtr srcsprite;
/* All touches should have the same sprite trace, so find and reuse an
@@ -516,21 +515,7 @@ TouchBuildDependentSpriteTrace(DeviceIntPtr dev, SpritePtr sprite)
else
return FALSE;
- if (srcsprite->spriteTraceGood > sprite->spriteTraceSize) {
- trace = reallocarray(sprite->spriteTrace,
- srcsprite->spriteTraceSize, sizeof(*trace));
- if (!trace) {
- sprite->spriteTraceGood = 0;
- return FALSE;
- }
- sprite->spriteTrace = trace;
- sprite->spriteTraceSize = srcsprite->spriteTraceGood;
- }
- memcpy(sprite->spriteTrace, srcsprite->spriteTrace,
- srcsprite->spriteTraceGood * sizeof(*trace));
- sprite->spriteTraceGood = srcsprite->spriteTraceGood;
-
- return TRUE;
+ return CopySprite(srcsprite, sprite);
}
/**
diff --git a/include/inpututils.h b/include/inpututils.h
index 48c95c4c1..2dfe122c9 100644
--- a/include/inpututils.h
+++ b/include/inpututils.h
@@ -70,4 +70,7 @@ size_t xi2mask_mask_size(const XI2Mask *mask);
void xi2mask_set_one_mask(XI2Mask *xi2mask, int deviceid,
const unsigned char *mask, size_t mask_size);
const unsigned char *xi2mask_get_one_mask(const XI2Mask *xi2mask, int deviceid);
+
+Bool CopySprite(SpritePtr src, SpritePtr dst);
+
#endif
commit acd819ac07bf66165f5d44af4a224f68c31bc30d
Author: Povilas Kanapickas <povilas at radix.lt>
Date: Sat Oct 10 02:51:31 2020 +0300
dix: Extract FixUpXI2DeviceEventFromWindow()
diff --git a/dix/events.c b/dix/events.c
index 9431e4f12..c1f847ad8 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2502,6 +2502,35 @@ FindChildForEvent(SpritePtr pSprite, WindowPtr event)
return child;
}
+static void
+FixUpXI2DeviceEventFromWindow(SpritePtr pSprite, int evtype,
+ xXIDeviceEvent *event, WindowPtr pWin, Window child)
+{
+ event->root = RootWindow(pSprite)->drawable.id;
+ event->event = pWin->drawable.id;
+
+ if (evtype == XI_TouchOwnership) {
+ event->child = child;
+ return;
+ }
+
+ if (pSprite->hot.pScreen == pWin->drawable.pScreen) {
+ event->event_x = event->root_x - double_to_fp1616(pWin->drawable.x);
+ event->event_y = event->root_y - double_to_fp1616(pWin->drawable.y);
+ event->child = child;
+ }
+ else {
+ event->event_x = 0;
+ event->event_y = 0;
+ event->child = None;
+ }
+
+ if (event->evtype == XI_Enter || event->evtype == XI_Leave ||
+ event->evtype == XI_FocusIn || event->evtype == XI_FocusOut)
+ ((xXIEnterEvent *) event)->same_screen =
+ (pSprite->hot.pScreen == pWin->drawable.pScreen);
+}
+
/**
* Adjust event fields to comply with the window properties.
*
@@ -2520,8 +2549,6 @@ FixUpEventFromWindow(SpritePtr pSprite,
child = FindChildForEvent(pSprite, pWin);
if ((evtype = xi2_get_type(xE))) {
- xXIDeviceEvent *event = (xXIDeviceEvent *) xE;
-
switch (evtype) {
case XI_RawKeyPress:
case XI_RawKeyRelease:
@@ -2538,33 +2565,10 @@ FixUpEventFromWindow(SpritePtr pSprite,
case XI_BarrierLeave:
return;
default:
+ FixUpXI2DeviceEventFromWindow(pSprite, evtype,
+ (xXIDeviceEvent*) xE, pWin, child);
break;
}
-
- event->root = RootWindow(pSprite)->drawable.id;
- event->event = pWin->drawable.id;
-
- if (evtype == XI_TouchOwnership) {
- event->child = child;
- return;
- }
-
- if (pSprite->hot.pScreen == pWin->drawable.pScreen) {
- event->event_x = event->root_x - double_to_fp1616(pWin->drawable.x);
- event->event_y = event->root_y - double_to_fp1616(pWin->drawable.y);
- event->child = child;
- }
- else {
- event->event_x = 0;
- event->event_y = 0;
- event->child = None;
- }
-
- if (event->evtype == XI_Enter || event->evtype == XI_Leave ||
- event->evtype == XI_FocusIn || event->evtype == XI_FocusOut)
- ((xXIEnterEvent *) event)->same_screen =
- (pSprite->hot.pScreen == pWin->drawable.pScreen);
-
}
else {
XE_KBPTR.root = RootWindow(pSprite)->drawable.id;
commit bb7aab6afe8655fc40ecff49791889b6512bb6a0
Author: Jon Turney <jon.turney at dronecode.org.uk>
Date: Sat Nov 21 15:45:49 2020 +0000
hw/xwin: Fix building with -fno-common
Provide an actual definition of noDriExtension where used, rather than a
tentative definition in a header, to fix compilation with -fno-common
(the default with gcc 10).
diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c
index c9390fd18..7a03bfb91 100644
--- a/hw/xwin/InitOutput.c
+++ b/hw/xwin/InitOutput.c
@@ -111,6 +111,8 @@ static PixmapFormatRec g_PixmapFormats[] = {
{32, 32, BITMAP_SCANLINE_PAD}
};
+static Bool noDriExtension;
+
static const ExtensionModule xwinExtensions[] = {
#ifdef GLXEXT
#ifdef XWIN_WINDOWS_DRI
diff --git a/hw/xwin/dri/windowsdri.h b/hw/xwin/dri/windowsdri.h
index 852b716b0..ce5769f1a 100644
--- a/hw/xwin/dri/windowsdri.h
+++ b/hw/xwin/dri/windowsdri.h
@@ -25,6 +25,5 @@
#define windowsdri_h
void WindowsDRIExtensionInit(void);
-Bool noDriExtension;
#endif /* windowsdri_h */
More information about the xorg-commit
mailing list