aboutsummaryrefslogtreecommitdiff
path: root/xorg-server
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-02-13 08:47:19 +0100
committermarha <marha@users.sourceforge.net>2012-02-13 08:47:19 +0100
commiteaa70945cb3f1a432b8c505ecede9ebc7769f36d (patch)
tree8e44ff4da739e384a2c6a34c1b42ecfb8e212344 /xorg-server
parent474621addc25cb22865c54b70ffbec07c82eb04c (diff)
downloadvcxsrv-eaa70945cb3f1a432b8c505ecede9ebc7769f36d.tar.gz
vcxsrv-eaa70945cb3f1a432b8c505ecede9ebc7769f36d.tar.bz2
vcxsrv-eaa70945cb3f1a432b8c505ecede9ebc7769f36d.zip
libX11 libxcb mesa xserver mkfontscale git update 13 feb 2012
Diffstat (limited to 'xorg-server')
-rw-r--r--xorg-server/Xi/exevents.c160
-rw-r--r--xorg-server/Xi/xiallowev.c81
-rw-r--r--xorg-server/configure.ac6
-rw-r--r--xorg-server/dix/events.c36
-rw-r--r--xorg-server/dix/inpututils.c3
-rw-r--r--xorg-server/dix/touch.c73
-rw-r--r--xorg-server/hw/xfree86/common/xf86Xinput.c10
-rw-r--r--xorg-server/hw/xfree86/dri2/dri2.c20
-rw-r--r--xorg-server/hw/xfree86/os-support/xf86_OSlib.h2
-rw-r--r--xorg-server/hw/xfree86/parser/InputClass.c76
-rw-r--r--xorg-server/hw/xfree86/parser/xf86Parser.h20
-rw-r--r--xorg-server/include/exevents.h7
-rw-r--r--xorg-server/include/input.h7
-rw-r--r--xorg-server/include/inputstr.h5
-rw-r--r--xorg-server/include/list.h114
-rw-r--r--xorg-server/test/input.c12
-rw-r--r--xorg-server/test/list.c132
-rw-r--r--xorg-server/xfixes/cursor.c16
18 files changed, 427 insertions, 353 deletions
diff --git a/xorg-server/Xi/exevents.c b/xorg-server/Xi/exevents.c
index 6b2db4b59..1ecc3ba5a 100644
--- a/xorg-server/Xi/exevents.c
+++ b/xorg-server/Xi/exevents.c
@@ -1088,20 +1088,71 @@ DeliverOneTouchEvent(ClientPtr client, DeviceIntPtr dev, TouchPointInfoPtr ti,
return TRUE;
}
+static void
+ActivateEarlyAccept(DeviceIntPtr dev, TouchPointInfoPtr ti)
+{
+ int rc;
+ ClientPtr client;
+ XID error;
+
+ rc = dixLookupClient(&client, ti->listeners[0].listener, serverClient,
+ DixSendAccess);
+ if (rc != Success)
+ {
+ ErrorF("[Xi] Failed to lookup early accepting client.\n");
+ return;
+ }
+
+ if (TouchAcceptReject(client, dev, XIAcceptTouch, ti->client_id,
+ ti->listeners[0].window->drawable.id, &error) !=
+ Success)
+ ErrorF("[Xi] Failed to accept touch grab after early acceptance.\n");
+}
+
/**
- * If the current owner has rejected the event, deliver the
- * TouchOwnership/TouchBegin to the next item in the sprite stack.
+ * Generate and deliver a TouchEnd event.
+ *
+ * @param dev The device to deliver the event for.
+ * @param ti The touch point record to deliver the event for.
+ * @param flags Internal event flags. The called does not need to provide
+ * TOUCH_CLIENT_ID and TOUCH_POINTER_EMULATED, this function will ensure
+ * they are set appropriately.
+ * @param resource The client resource to deliver to, or 0 for all clients.
*/
static void
-TouchPuntToNextOwner(DeviceIntPtr dev, TouchPointInfoPtr ti,
- TouchOwnershipEvent *ev)
+EmitTouchEnd(DeviceIntPtr dev, TouchPointInfoPtr ti, int flags, XID resource)
{
InternalEvent *tel = InitEventList(GetMaximumEventsNum());
ValuatorMask *mask = valuator_mask_new(2);
int i, nev;
+ valuator_mask_set_double(mask, 0,
+ valuator_mask_get_double(ti->valuators, 0));
+ valuator_mask_set_double(mask, 1,
+ valuator_mask_get_double(ti->valuators, 1));
+
+ flags |= TOUCH_CLIENT_ID;
+ if (ti->emulate_pointer)
+ flags |= TOUCH_POINTER_EMULATED;
+ nev = GetTouchEvents(tel, dev, ti->client_id, XI_TouchEnd, flags, mask);
+ for (i = 0; i < nev; i++)
+ DeliverTouchEvents(dev, ti, tel + i, resource);
+
+ valuator_mask_free(&mask);
+ FreeEventList(tel, GetMaximumEventsNum());
+}
+
+/**
+ * If the current owner has rejected the event, deliver the
+ * TouchOwnership/TouchBegin to the next item in the sprite stack.
+ */
+static void
+TouchPuntToNextOwner(DeviceIntPtr dev, TouchPointInfoPtr ti,
+ TouchOwnershipEvent *ev)
+{
/* Deliver the ownership */
- if (ti->listeners[0].state == LISTENER_AWAITING_OWNER)
+ if (ti->listeners[0].state == LISTENER_AWAITING_OWNER ||
+ ti->listeners[0].state == LISTENER_EARLY_ACCEPT)
DeliverTouchEvents(dev, ti, (InternalEvent*)ev, ti->listeners[0].listener);
else if (ti->listeners[0].state == LISTENER_AWAITING_BEGIN)
TouchEventHistoryReplay(ti, dev, ti->listeners[0].listener);
@@ -1111,52 +1162,41 @@ TouchPuntToNextOwner(DeviceIntPtr dev, TouchPointInfoPtr ti,
if (ti->num_listeners == 1 && ti->num_grabs == 0 &&
ti->pending_finish)
{
- int flags;
- valuator_mask_set_double(mask, 0,
- valuator_mask_get_double(ti->valuators, 0));
- valuator_mask_set_double(mask, 1,
- valuator_mask_get_double(ti->valuators, 1));
-
- flags = TOUCH_CLIENT_ID;
- if (ti->emulate_pointer)
- flags |= TOUCH_POINTER_EMULATED;
- nev = GetTouchEvents(tel, dev, ti->client_id, XI_TouchEnd, flags, mask);
- for (i = 0; i < nev; i++)
- DeliverTouchEvents(dev, ti, tel + i, 0);
+ EmitTouchEnd(dev, ti, 0, 0);
TouchEndTouch(dev, ti);
}
- valuator_mask_free(&mask);
- FreeEventList(tel, GetMaximumEventsNum());
+ if (ti->listeners[0].state == LISTENER_EARLY_ACCEPT)
+ ActivateEarlyAccept(dev, ti);
}
-static void
-TouchEventRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti,
- TouchOwnershipEvent *ev)
+/**
+ * Process a touch rejection.
+ *
+ * @param sourcedev The source device of the touch sequence.
+ * @param ti The touchpoint info record.
+ * @param resource The resource of the client rejecting the touch.
+ * @param ev TouchOwnership event to send. Set to NULL if no event should be
+ * sent.
+ */
+void
+TouchRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, XID resource,
+ TouchOwnershipEvent *ev)
{
- InternalEvent *tel = InitEventList(GetMaximumEventsNum());
- ValuatorMask *mask = valuator_mask_new(2);
- Bool was_owner = (ev->resource == ti->listeners[0].listener);
+ Bool was_owner = (resource == ti->listeners[0].listener);
void *grab;
- int nev, i;
-
+ int i;
/* Send a TouchEnd event to the resource being removed, but only if they
* haven't received one yet already */
- if (ti->listeners[0].state != LISTENER_HAS_END)
+ for (i = 0; i < ti->num_listeners; i++)
{
- int flags;
- valuator_mask_set_double(mask, 0,
- valuator_mask_get_double(ti->valuators, 0));
- valuator_mask_set_double(mask, 1,
- valuator_mask_get_double(ti->valuators, 1));
-
- flags = TOUCH_CLIENT_ID|TOUCH_REJECT;
- if (ti->emulate_pointer)
- flags |= TOUCH_POINTER_EMULATED;
- nev = GetTouchEvents(tel, sourcedev, ti->client_id, XI_TouchEnd, flags, mask);
- for (i = 0; i < nev; i++)
- DeliverTouchEvents(sourcedev, ti, tel + i, ev->resource);
+ if (ti->listeners[i].listener == resource)
+ {
+ if (ti->listeners[i].state != LISTENER_HAS_END)
+ EmitTouchEnd(sourcedev, ti, TOUCH_REJECT, resource);
+ break;
+ }
}
/* If there are no other listeners left, and the touchpoint is pending
@@ -1164,26 +1204,22 @@ TouchEventRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti,
if (ti->num_listeners == 1 && ti->pending_finish)
{
TouchEndTouch(sourcedev, ti);
- goto out;
+ return;
}
/* Remove the resource from the listener list, updating
* ti->num_listeners, as well as ti->num_grabs if it was a grab. */
- if (TouchRemoveListener(ti, ev->resource))
+ if (TouchRemoveListener(ti, resource))
{
- if (dixLookupResourceByType(&grab, ev->resource, RT_PASSIVEGRAB,
+ if (dixLookupResourceByType(&grab, resource, RT_PASSIVEGRAB,
serverClient, DixGetAttrAccess) == Success)
ti->num_grabs--;
}
/* If the current owner was removed and there are further listeners, deliver
* the TouchOwnership or TouchBegin event to the new owner. */
- if (ti->num_listeners > 0 && was_owner)
+ if (ev && ti->num_listeners > 0 && was_owner)
TouchPuntToNextOwner(sourcedev, ti, ev);
-
-out:
- FreeEventList(tel, GetMaximumEventsNum());
- valuator_mask_free(&mask);
}
/**
@@ -1199,35 +1235,11 @@ ProcessTouchOwnershipEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
{
if (ev->reason == XIRejectTouch)
- TouchEventRejected(dev, ti, ev);
+ TouchRejected(dev, ti, ev->resource, ev);
else if (ev->reason == XIAcceptTouch) {
- int flags;
- int nev, i;
- ValuatorMask *mask;
-
- InternalEvent *tel = InitEventList(GetMaximumEventsNum());
-
- mask = valuator_mask_new(dev->valuator->numAxes);
- valuator_mask_set_double(mask, 0,
- valuator_mask_get_double(ti->valuators, 0));
- valuator_mask_set_double(mask, 1,
- valuator_mask_get_double(ti->valuators, 1));
-
- /* FIXME: what about early acceptance? a client may accept before it
- * owns the touch. */
-
/* The touch owner has accepted the touch. Send TouchEnd events to
* everyone else, and truncate the list of listeners. */
- flags = TOUCH_ACCEPT|TOUCH_CLIENT_ID;
- if (ti->emulate_pointer)
- flags |= TOUCH_POINTER_EMULATED;
- nev = GetTouchEvents(tel, dev, ti->client_id, XI_TouchEnd,
- flags, mask);
- for (i = 0; i < nev; i++)
- DeliverTouchEvents(dev, ti, tel + i, 0);
-
- FreeEventList(tel, GetMaximumEventsNum());
- valuator_mask_free(&mask);
+ EmitTouchEnd(dev, ti, TOUCH_ACCEPT, 0);
while (ti->num_listeners > 1)
TouchRemoveListener(ti, ti->listeners[1].listener);
diff --git a/xorg-server/Xi/xiallowev.c b/xorg-server/Xi/xiallowev.c
index a4b2f5782..d0856b656 100644
--- a/xorg-server/Xi/xiallowev.c
+++ b/xorg-server/Xi/xiallowev.c
@@ -41,6 +41,7 @@
#include <X11/extensions/XI2proto.h>
#include "exglobals.h" /* BadDevice */
+#include "exevents.h"
#include "xiallowev.h"
int
@@ -51,51 +52,14 @@ SProcXIAllowEvents(ClientPtr client)
swaps(&stuff->length);
swaps(&stuff->deviceid);
swapl(&stuff->time);
- /* FIXME swap touchid */
- /* FIXME swap window */
-
- return ProcXIAllowEvents(client);
-}
-
-static int
-AllowTouch(ClientPtr client, DeviceIntPtr dev, int mode, uint32_t touchid, XID *error)
-{
- TouchPointInfoPtr ti;
- int nev, i;
- InternalEvent *events = InitEventList(GetMaximumEventsNum());
-
- if (!events)
- return BadAlloc;
-
- if (!dev->touch)
- {
- *error = dev->id;
- return BadDevice;
- }
-
- /* FIXME window is unhandled */
-
- ti = TouchFindByClientID(dev, touchid);
- if (!ti)
+ if (stuff->length > 3)
{
- *error = touchid;
- return BadValue;
+ xXI2_2AllowEventsReq *req_xi22 = (xXI2_2AllowEventsReq*)stuff;
+ swapl(&req_xi22->touchid);
+ swapl(&req_xi22->grab_window);
}
- /* FIXME: Allow for early accept */
- if (ti->num_listeners == 0 || CLIENT_ID(ti->listeners[0].listener) != client->index)
- return BadAccess;
-
- nev = GetTouchOwnershipEvents(events, dev, ti, mode, ti->listeners[0].listener, 0);
- if (nev == 0)
- return BadAlloc;
- for (i = 0; i < nev; i++)
- mieqProcessDeviceEvent(dev, events + i, NULL);
-
- ProcessInputEvents();
-
- FreeEventList(events, GetMaximumEventsNum());
- return Success;
+ return ProcXIAllowEvents(client);
}
int
@@ -104,9 +68,21 @@ ProcXIAllowEvents(ClientPtr client)
TimeStamp time;
DeviceIntPtr dev;
int ret = Success;
+ XIClientPtr xi_client;
+ Bool have_xi22 = FALSE;
+ REQUEST(xXI2_2AllowEventsReq);
- REQUEST(xXIAllowEventsReq);
- /* FIXME: check request length, 12 for XI 2.0+, 20 for XI 2.2+ */
+ xi_client = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
+
+ if (version_compare(xi_client->major_version,
+ xi_client->minor_version, 2, 2) >= 0)
+ {
+ REQUEST_AT_LEAST_SIZE(xXI2_2AllowEventsReq);
+ have_xi22 = TRUE;
+ } else
+ {
+ REQUEST_SIZE_MATCH(xXIAllowEventsReq);
+ }
ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
if (ret != Success)
@@ -138,9 +114,20 @@ ProcXIAllowEvents(ClientPtr client)
break;
case XIRejectTouch:
case XIAcceptTouch:
- ret = AllowTouch(client, dev,
- stuff->mode, stuff->touchid,
- &client->errorValue);
+ {
+ int rc;
+ WindowPtr win;
+
+ if (!have_xi22)
+ return BadValue;
+
+ rc = dixLookupWindow(&win, stuff->grab_window, client, DixReadAccess);
+ if (rc != Success)
+ return rc;
+
+ ret = TouchAcceptReject(client, dev, stuff->mode, stuff->touchid,
+ stuff->grab_window, &client->errorValue);
+ }
break;
default:
client->errorValue = stuff->mode;
diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac
index 6241119c4..a44a12a11 100644
--- a/xorg-server/configure.ac
+++ b/xorg-server/configure.ac
@@ -26,8 +26,8 @@ dnl
dnl Process this file with autoconf to create configure.
AC_PREREQ(2.60)
-AC_INIT([xorg-server], 1.11.99.902, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
-RELEASE_DATE="2012-01-27"
+AC_INIT([xorg-server], 1.11.99.903, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server)
+RELEASE_DATE="2012-02-11"
AC_CONFIG_SRCDIR([Makefile.am])
AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE
@@ -776,7 +776,7 @@ XPROTO="xproto >= 7.0.22"
RANDRPROTO="randrproto >= 1.2.99.3"
RENDERPROTO="renderproto >= 0.11"
XEXTPROTO="xextproto >= 7.1.99"
-INPUTPROTO="inputproto >= 2.1.99.5"
+INPUTPROTO="inputproto >= 2.1.99.6"
KBPROTO="kbproto >= 1.0.3"
FONTSPROTO="fontsproto"
FIXESPROTO="fixesproto >= 5.0"
diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c
index 04d7fb59b..9998845d0 100644
--- a/xorg-server/dix/events.c
+++ b/xorg-server/dix/events.c
@@ -1122,8 +1122,8 @@ EnqueueEvent(InternalEvent *ev, DeviceIntPtr device)
int eventlen;
DeviceEvent *event = &ev->device_event;
- if (!list_is_empty(&syncEvents.pending))
- tail = list_last_entry(&syncEvents.pending, QdEventRec, next);
+ if (!xorg_list_is_empty(&syncEvents.pending))
+ tail = xorg_list_last_entry(&syncEvents.pending, QdEventRec, next);
NoticeTime((InternalEvent*)event);
@@ -1183,13 +1183,13 @@ EnqueueEvent(InternalEvent *ev, DeviceIntPtr device)
qe = malloc(sizeof(QdEventRec) + eventlen);
if (!qe)
return;
- list_init(&qe->next);
+ xorg_list_init(&qe->next);
qe->device = device;
qe->pScreen = pSprite->hotPhys.pScreen;
qe->months = currentTime.months;
qe->event = (InternalEvent *)(qe + 1);
memcpy(qe->event, event, eventlen);
- list_append(&qe->next, &syncEvents.pending);
+ xorg_list_append(&qe->next, &syncEvents.pending);
}
/**
@@ -1210,10 +1210,10 @@ PlayReleasedEvents(void)
DeviceIntPtr pDev;
restart:
- list_for_each_entry_safe(qe, tmp, &syncEvents.pending, next) {
+ xorg_list_for_each_entry_safe(qe, tmp, &syncEvents.pending, next) {
if (!qe->device->deviceGrab.sync.frozen)
{
- list_del(&qe->next);
+ xorg_list_del(&qe->next);
pDev = qe->device;
if (qe->event->any.type == ET_Motion)
CheckVirtualMotion(pDev, qe, NullWindow);
@@ -1297,7 +1297,7 @@ ComputeFreezes(void)
FreezeThaw(dev, dev->deviceGrab.sync.other ||
(dev->deviceGrab.sync.state >= FROZEN));
if (syncEvents.playingEvents ||
- (!replayDev && list_is_empty(&syncEvents.pending)))
+ (!replayDev && xorg_list_is_empty(&syncEvents.pending)))
return;
syncEvents.playingEvents = TRUE;
if (replayDev)
@@ -4266,7 +4266,6 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
if (grab->ownerEvents)
{
WindowPtr focus;
- WindowPtr win;
/* Hack: Some pointer device have a focus class. So we need to check
* for the type of event, to see if we really want to deliver it to
@@ -4283,16 +4282,15 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev,
else
focus = PointerRootWin;
if (focus == PointerRootWin)
- {
- win = pSprite->win;
- focus = NullWindow;
- } else if (focus && (focus == pSprite->win ||
- IsParent(focus, pSprite->win)))
- win = pSprite->win;
+ deliveries = DeliverDeviceEvents(pSprite->win, event, grab,
+ NullWindow, thisDev);
+ else if (focus && (focus == pSprite->win ||
+ IsParent(focus, pSprite->win)))
+ deliveries = DeliverDeviceEvents(pSprite->win, event, grab, focus,
+ thisDev);
else if (focus)
- win = focus;
-
- deliveries = DeliverDeviceEvents(win, event, grab, focus, thisDev);
+ deliveries = DeliverDeviceEvents(focus, event, grab, focus,
+ thisDev);
}
if (!deliveries)
{
@@ -5392,9 +5390,9 @@ InitEvents(void)
syncEvents.replayDev = (DeviceIntPtr)NULL;
syncEvents.replayWin = NullWindow;
if (syncEvents.pending.next)
- list_for_each_entry_safe(qe, tmp, &syncEvents.pending, next)
+ xorg_list_for_each_entry_safe(qe, tmp, &syncEvents.pending, next)
free(qe);
- list_init(&syncEvents.pending);
+ xorg_list_init(&syncEvents.pending);
syncEvents.playingEvents = FALSE;
syncEvents.time.months = 0;
syncEvents.time.milliseconds = 0; /* hardly matters */
diff --git a/xorg-server/dix/inpututils.c b/xorg-server/dix/inpututils.c
index d279c1d75..9e0c5518c 100644
--- a/xorg-server/dix/inpututils.c
+++ b/xorg-server/dix/inpututils.c
@@ -432,6 +432,9 @@ valuator_mask_new(int num_valuators)
* flying-car future, when we can dynamically alloc the masks and are
* not constrained by signals, we can start using num_valuators */
ValuatorMask *mask = calloc(1, sizeof(ValuatorMask));
+ if (mask == NULL)
+ return NULL;
+
mask->last_bit = -1;
return mask;
}
diff --git a/xorg-server/dix/touch.c b/xorg-server/dix/touch.c
index db0bf334a..d04801c86 100644
--- a/xorg-server/dix/touch.c
+++ b/xorg-server/dix/touch.c
@@ -34,6 +34,7 @@
#include "eventstr.h"
#include "exevents.h"
+#include "exglobals.h"
#include "inpututils.h"
#include "eventconvert.h"
#include "windowstr.h"
@@ -697,12 +698,14 @@ TouchResourceIsOwner(TouchPointInfoPtr ti, XID resource)
*/
void
TouchAddListener(TouchPointInfoPtr ti, XID resource, enum InputLevel level,
- enum TouchListenerType type, enum TouchListenerState state)
+ enum TouchListenerType type, enum TouchListenerState state,
+ WindowPtr window)
{
ti->listeners[ti->num_listeners].listener = resource;
ti->listeners[ti->num_listeners].level = level;
ti->listeners[ti->num_listeners].state = state;
ti->listeners[ti->num_listeners].type = type;
+ ti->listeners[ti->num_listeners].window = window;
ti->num_listeners++;
}
@@ -753,7 +756,7 @@ TouchAddGrabListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
}
TouchAddListener(ti, grab->resource, grab->grabtype,
- type, LISTENER_AWAITING_BEGIN);
+ type, LISTENER_AWAITING_BEGIN, grab->window);
ti->num_grabs++;
}
@@ -814,7 +817,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
TouchEventHistoryAllocate(ti);
TouchAddListener(ti, iclients->resource, XI2,
- type, LISTENER_AWAITING_BEGIN);
+ type, LISTENER_AWAITING_BEGIN, win);
return TRUE;
}
}
@@ -830,7 +833,8 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
TouchEventHistoryAllocate(ti);
TouchAddListener(ti, iclients->resource, XI,
- LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN);
+ LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN,
+ win);
return TRUE;
}
}
@@ -845,7 +849,8 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
{
TouchEventHistoryAllocate(ti);
TouchAddListener(ti, win->drawable.id, CORE,
- LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN);
+ LISTENER_POINTER_REGULAR, LISTENER_AWAITING_BEGIN,
+ win);
return TRUE;
}
@@ -857,7 +862,7 @@ TouchAddRegularListener(DeviceIntPtr dev, TouchPointInfoPtr ti,
TouchEventHistoryAllocate(ti);
TouchAddListener(ti, iclients->resource, CORE,
- type, LISTENER_AWAITING_BEGIN);
+ type, LISTENER_AWAITING_BEGIN, win);
return TRUE;
}
}
@@ -980,3 +985,59 @@ TouchListenerGone(XID resource)
FreeEventList(events, GetMaximumEventsNum());
}
+
+int
+TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
+ uint32_t touchid, Window grab_window, XID *error)
+{
+ TouchPointInfoPtr ti;
+ int nev, i;
+ InternalEvent *events = InitEventList(GetMaximumEventsNum());
+
+ if (!events)
+ return BadAlloc;
+
+ if (!dev->touch)
+ {
+ *error = dev->id;
+ return BadDevice;
+ }
+
+ ti = TouchFindByClientID(dev, touchid);
+ if (!ti)
+ {
+ *error = touchid;
+ return BadValue;
+ }
+
+ for (i = 0; i < ti->num_listeners; i++)
+ {
+ if (CLIENT_ID(ti->listeners[i].listener) == client->index &&
+ ti->listeners[i].window->drawable.id == grab_window)
+ break;
+ }
+ if (i == ti->num_listeners)
+ return BadAccess;
+
+ if (i > 0)
+ {
+ if (mode == XIRejectTouch)
+ TouchRejected(dev, ti, ti->listeners[i].listener, NULL);
+ else
+ ti->listeners[i].state = LISTENER_EARLY_ACCEPT;
+
+ return Success;
+ }
+
+ nev = GetTouchOwnershipEvents(events, dev, ti, mode,
+ ti->listeners[0].listener, 0);
+ if (nev == 0)
+ return BadAlloc;
+ for (i = 0; i < nev; i++)
+ mieqProcessDeviceEvent(dev, events + i, NULL);
+
+ ProcessInputEvents();
+
+ FreeEventList(events, GetMaximumEventsNum());
+ return Success;
+}
diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c
index fd40f28da..f6be99910 100644
--- a/xorg-server/hw/xfree86/common/xf86Xinput.c
+++ b/xorg-server/hw/xfree86/common/xf86Xinput.c
@@ -516,13 +516,13 @@ match_string_implicit(const char *attr, const char *pattern)
* If a pattern in each list entry is matched, return TRUE.
*/
static Bool
-MatchAttrToken(const char *attr, struct list *patterns,
+MatchAttrToken(const char *attr, struct xorg_list *patterns,
int (*compare)(const char *attr, const char *pattern))
{
const xf86MatchGroup *group;
/* If there are no patterns, accept the match */
- if (list_is_empty(patterns))
+ if (xorg_list_is_empty(patterns))
return TRUE;
/* If there are patterns but no attribute, reject the match */
@@ -533,7 +533,7 @@ MatchAttrToken(const char *attr, struct list *patterns,
* Otherwise, iterate the list of patterns ensuring each entry has a
* match. Each list entry is a separate Match line of the same type.
*/
- list_for_each_entry(group, patterns, entry) {
+ xorg_list_for_each_entry(group, patterns, entry) {
char * const *cur;
Bool match = FALSE;
@@ -590,7 +590,7 @@ InputClassMatches(const XF86ConfInputClassPtr iclass, const InputInfoPtr idev,
* MatchTag string
* See if any of the device's tags match any of the MatchTag tokens.
*/
- if (!list_is_empty(&iclass->match_tag)) {
+ if (!xorg_list_is_empty(&iclass->match_tag)) {
char * const *tag;
Bool match;
@@ -607,7 +607,7 @@ InputClassMatches(const XF86ConfInputClassPtr iclass, const InputInfoPtr idev,
}
/* MatchLayout string */
- if (!list_is_empty(&iclass->match_layout)) {
+ if (!xorg_list_is_empty(&iclass->match_layout)) {
if (!MatchAttrToken(xf86ConfigLayout.id,
&iclass->match_layout, match_string_implicit))
return FALSE;
diff --git a/xorg-server/hw/xfree86/dri2/dri2.c b/xorg-server/hw/xfree86/dri2/dri2.c
index d6441a234..5cc9068af 100644
--- a/xorg-server/hw/xfree86/dri2/dri2.c
+++ b/xorg-server/hw/xfree86/dri2/dri2.c
@@ -67,7 +67,7 @@ typedef struct _DRI2Screen *DRI2ScreenPtr;
typedef struct _DRI2Drawable {
DRI2ScreenPtr dri2_screen;
DrawablePtr drawable;
- struct list reference_list;
+ struct xorg_list reference_list;
int width;
int height;
DRI2BufferPtr *buffers;
@@ -179,7 +179,7 @@ DRI2AllocateDrawable(DrawablePtr pDraw)
pPriv->swap_limit = 1; /* default to double buffering */
pPriv->last_swap_msc = 0;
pPriv->last_swap_ust = 0;
- list_init(&pPriv->reference_list);
+ xorg_list_init(&pPriv->reference_list);
pPriv->serialNumber = DRI2DrawableSerial(pDraw);
pPriv->needInvalidate = FALSE;
@@ -229,7 +229,7 @@ typedef struct DRI2DrawableRefRec {
XID dri2_id;
DRI2InvalidateProcPtr invalidate;
void *priv;
- struct list link;
+ struct xorg_list link;
} DRI2DrawableRefRec, *DRI2DrawableRefPtr;
static DRI2DrawableRefPtr
@@ -237,7 +237,7 @@ DRI2LookupDrawableRef(DRI2DrawablePtr pPriv, XID id)
{
DRI2DrawableRefPtr ref;
- list_for_each_entry(ref, &pPriv->reference_list, link) {
+ xorg_list_for_each_entry(ref, &pPriv->reference_list, link) {
if (ref->id == id)
return ref;
}
@@ -270,7 +270,7 @@ DRI2AddDrawableRef(DRI2DrawablePtr pPriv, XID id, XID dri2_id,
ref->dri2_id = dri2_id;
ref->invalidate = invalidate;
ref->priv = priv;
- list_add(&ref->link, &pPriv->reference_list);
+ xorg_list_add(&ref->link, &pPriv->reference_list);
return Success;
}
@@ -307,9 +307,9 @@ static int DRI2DrawableGone(pointer p, XID id)
DrawablePtr pDraw;
int i;
- list_for_each_entry_safe(ref, next, &pPriv->reference_list, link) {
+ xorg_list_for_each_entry_safe(ref, next, &pPriv->reference_list, link) {
if (ref->dri2_id == id) {
- list_del(&ref->link);
+ xorg_list_del(&ref->link);
/* If this was the last ref under this X drawable XID,
* unregister the X drawable resource. */
if (!DRI2LookupDrawableRef(pPriv, ref->id))
@@ -319,13 +319,13 @@ static int DRI2DrawableGone(pointer p, XID id)
}
if (ref->id == id) {
- list_del(&ref->link);
+ xorg_list_del(&ref->link);
FreeResourceByType(ref->dri2_id, dri2DrawableRes, TRUE);
free(ref);
}
}
- if (!list_is_empty(&pPriv->reference_list))
+ if (!xorg_list_is_empty(&pPriv->reference_list))
return Success;
pDraw = pPriv->drawable;
@@ -586,7 +586,7 @@ DRI2InvalidateDrawable(DrawablePtr pDraw)
pPriv->needInvalidate = FALSE;
- list_for_each_entry(ref, &pPriv->reference_list, link)
+ xorg_list_for_each_entry(ref, &pPriv->reference_list, link)
ref->invalidate(pDraw, ref->priv, ref->id);
}
diff --git a/xorg-server/hw/xfree86/os-support/xf86_OSlib.h b/xorg-server/hw/xfree86/os-support/xf86_OSlib.h
index 0a5861f49..45500dbdb 100644
--- a/xorg-server/hw/xfree86/os-support/xf86_OSlib.h
+++ b/xorg-server/hw/xfree86/os-support/xf86_OSlib.h
@@ -98,8 +98,8 @@
# if !(defined (sun) && defined (SVR4))
# include <sys/immu.h>
# include <sys/region.h>
+# include <sys/proc.h>
# endif
-# include <sys/proc.h>
# include <sys/tss.h>
# include <sys/sysi86.h>
# if defined(SVR4) && !defined(sun)
diff --git a/xorg-server/hw/xfree86/parser/InputClass.c b/xorg-server/hw/xfree86/parser/InputClass.c
index 919ae1869..c25117c1a 100644
--- a/xorg-server/hw/xfree86/parser/InputClass.c
+++ b/xorg-server/hw/xfree86/parser/InputClass.c
@@ -67,14 +67,14 @@ xf86ConfigSymTabRec InputClassTab[] =
#define TOKEN_SEP "|"
static void
-add_group_entry(struct list *head, char **values)
+add_group_entry(struct xorg_list *head, char **values)
{
xf86MatchGroup *group;
group = malloc(sizeof(*group));
if (group) {
group->values = values;
- list_add(&group->entry, head);
+ xorg_list_add(&group->entry, head);
}
}
@@ -87,15 +87,15 @@ xf86parseInputClassSection(void)
parsePrologue(XF86ConfInputClassPtr, XF86ConfInputClassRec)
/* Initialize MatchGroup lists */
- list_init(&ptr->match_product);
- list_init(&ptr->match_vendor);
- list_init(&ptr->match_device);
- list_init(&ptr->match_os);
- list_init(&ptr->match_pnpid);
- list_init(&ptr->match_usbid);
- list_init(&ptr->match_driver);
- list_init(&ptr->match_tag);
- list_init(&ptr->match_layout);
+ xorg_list_init(&ptr->match_product);
+ xorg_list_init(&ptr->match_vendor);
+ xorg_list_init(&ptr->match_device);
+ xorg_list_init(&ptr->match_os);
+ xorg_list_init(&ptr->match_pnpid);
+ xorg_list_init(&ptr->match_usbid);
+ xorg_list_init(&ptr->match_driver);
+ xorg_list_init(&ptr->match_tag);
+ xorg_list_init(&ptr->match_layout);
while ((token = xf86getToken(InputClassTab)) != ENDSECTION) {
switch (token) {
@@ -274,63 +274,63 @@ xf86printInputClassSection (FILE * cf, XF86ConfInputClassPtr ptr)
if (ptr->driver)
fprintf(cf, "\tDriver \"%s\"\n", ptr->driver);
- list_for_each_entry(group, &ptr->match_product, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_product, entry) {
fprintf(cf, "\tMatchProduct \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_vendor, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_vendor, entry) {
fprintf(cf, "\tMatchVendor \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_device, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_device, entry) {
fprintf(cf, "\tMatchDevicePath \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_os, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_os, entry) {
fprintf(cf, "\tMatchOS \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_pnpid, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_pnpid, entry) {
fprintf(cf, "\tMatchPnPID \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_usbid, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_usbid, entry) {
fprintf(cf, "\tMatchUSBID \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_driver, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_driver, entry) {
fprintf(cf, "\tMatchDriver \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_tag, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_tag, entry) {
fprintf(cf, "\tMatchTag \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
*cur);
fprintf(cf, "\"\n");
}
- list_for_each_entry(group, &ptr->match_layout, entry) {
+ xorg_list_for_each_entry(group, &ptr->match_layout, entry) {
fprintf(cf, "\tMatchLayout \"");
for (cur = group->values; *cur; cur++)
fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP,
@@ -374,56 +374,56 @@ xf86freeInputClassList (XF86ConfInputClassPtr ptr)
TestFree(ptr->identifier);
TestFree(ptr->driver);
- list_for_each_entry_safe(group, next, &ptr->match_product, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_product, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_vendor, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_vendor, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_device, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_device, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_os, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_os, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_pnpid, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_pnpid, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_usbid, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_usbid, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_driver, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_driver, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_tag, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_tag, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
}
- list_for_each_entry_safe(group, next, &ptr->match_layout, entry) {
- list_del(&group->entry);
+ xorg_list_for_each_entry_safe(group, next, &ptr->match_layout, entry) {
+ xorg_list_del(&group->entry);
for (list = group->values; *list; list++)
free(*list);
free(group);
diff --git a/xorg-server/hw/xfree86/parser/xf86Parser.h b/xorg-server/hw/xfree86/parser/xf86Parser.h
index 7d4662b98..beac35404 100644
--- a/xorg-server/hw/xfree86/parser/xf86Parser.h
+++ b/xorg-server/hw/xfree86/parser/xf86Parser.h
@@ -340,7 +340,7 @@ xf86TriState;
typedef struct
{
- struct list entry;
+ struct xorg_list entry;
char **values;
}
xf86MatchGroup;
@@ -350,15 +350,15 @@ typedef struct
GenericListRec list;
char *identifier;
char *driver;
- struct list match_product;
- struct list match_vendor;
- struct list match_device;
- struct list match_os;
- struct list match_pnpid;
- struct list match_usbid;
- struct list match_driver;
- struct list match_tag;
- struct list match_layout;
+ struct xorg_list match_product;
+ struct xorg_list match_vendor;
+ struct xorg_list match_device;
+ struct xorg_list match_os;
+ struct xorg_list match_pnpid;
+ struct xorg_list match_usbid;
+ struct xorg_list match_driver;
+ struct xorg_list match_tag;
+ struct xorg_list match_layout;
xf86TriState is_keyboard;
xf86TriState is_pointer;
xf86TriState is_joystick;
diff --git a/xorg-server/include/exevents.h b/xorg-server/include/exevents.h
index 31acb30ea..fb2ef274c 100644
--- a/xorg-server/include/exevents.h
+++ b/xorg-server/include/exevents.h
@@ -323,6 +323,13 @@ SendEventToAllWindows(
xEvent * /* ev */,
int /* count */);
+extern void
+TouchRejected(
+ DeviceIntPtr /* sourcedev */,
+ TouchPointInfoPtr /* ti */,
+ XID /* resource */,
+ TouchOwnershipEvent * /* ev */);
+
extern _X_HIDDEN void XI2EventSwap(
xGenericEvent * /* from */,
xGenericEvent * /* to */);
diff --git a/xorg-server/include/input.h b/xorg-server/include/input.h
index fb456175a..b7825a762 100644
--- a/xorg-server/include/input.h
+++ b/xorg-server/include/input.h
@@ -583,6 +583,8 @@ 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 */
LISTENER_HAS_END, /**< Has already received the end event */
};
@@ -613,7 +615,8 @@ extern void TouchEventHistoryPush(TouchPointInfoPtr ti, const DeviceEvent *ev);
extern void TouchEventHistoryReplay(TouchPointInfoPtr ti, DeviceIntPtr dev, XID resource);
extern Bool TouchResourceIsOwner(TouchPointInfoPtr ti, XID resource);
extern void TouchAddListener(TouchPointInfoPtr ti, XID resource, enum InputLevel level,
- enum TouchListenerType type, enum TouchListenerState state);
+ enum TouchListenerType type, enum TouchListenerState state,
+ WindowPtr window);
extern Bool TouchRemoveListener(TouchPointInfoPtr ti, XID resource);
extern void TouchSetupListeners(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev);
extern Bool TouchEnsureSprite(DeviceIntPtr sourcedev, TouchPointInfoPtr ti,
@@ -624,6 +627,8 @@ extern int TouchConvertToPointerEvent(const InternalEvent *ev,
extern int TouchGetPointerEventType(const InternalEvent *ev);
extern void TouchRemovePointerGrab(DeviceIntPtr dev);
extern void TouchListenerGone(XID resource);
+extern int TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
+ uint32_t touchid, Window grab_window, XID *error);
/* misc event helpers */
extern Mask GetEventMask(DeviceIntPtr dev, xEvent* ev, InputClientsPtr clients);
diff --git a/xorg-server/include/inputstr.h b/xorg-server/include/inputstr.h
index c3297db64..86db811fc 100644
--- a/xorg-server/include/inputstr.h
+++ b/xorg-server/include/inputstr.h
@@ -314,6 +314,7 @@ typedef struct _TouchPointInfo {
enum TouchListenerType type;
enum TouchListenerState state;
enum InputLevel level; /* matters only for emulating touches */
+ WindowPtr window;
} *listeners;
int num_listeners;
int num_grabs; /* number of open grabs on this touch
@@ -622,7 +623,7 @@ extern _X_EXPORT InputInfo inputInfo;
/* for keeping the events for devices grabbed synchronously */
typedef struct _QdEvent *QdEventPtr;
typedef struct _QdEvent {
- struct list next;
+ struct xorg_list next;
DeviceIntPtr device;
ScreenPtr pScreen; /* what screen the pointer was on */
unsigned long months; /* milliseconds is in the event */
@@ -638,7 +639,7 @@ typedef struct _QdEvent {
* replayed and processed as if they would come from the device directly.
*/
typedef struct _EventSyncInfo {
- struct list pending;
+ struct xorg_list pending;
/** The device to replay events for. Only set in AllowEvents(), in which
* case it is set to the device specified in the request. */
diff --git a/xorg-server/include/list.h b/xorg-server/include/list.h
index 6ec2bac53..14c671f37 100644
--- a/xorg-server/include/list.h
+++ b/xorg-server/include/list.h
@@ -23,8 +23,8 @@
*
*/
-#ifndef _LIST_H_
-#define _LIST_H_
+#ifndef _XORG_LIST_H_
+#define _XORG_LIST_H_
/**
* @file Classic doubly-link circular list implementation.
@@ -41,17 +41,17 @@
* }
*
* We need one list head in bar and a list element in all list_of_foos (both are of
- * data type 'struct list').
+ * data type 'struct xorg_list').
*
* struct bar {
* ...
- * struct list list_of_foos;
+ * struct xorg_list list_of_foos;
* ...
* }
*
* struct foo {
* ...
- * struct list entry;
+ * struct xorg_list entry;
* ...
* }
*
@@ -59,74 +59,74 @@
*
* struct bar bar;
* ...
- * list_init(&bar.list_of_foos);
+ * xorg_list_init(&bar.list_of_foos);
*
* Then we create the first element and add it to this list:
*
* struct foo *foo = malloc(...);
* ....
- * list_add(&foo->entry, &bar.list_of_foos);
+ * xorg_list_add(&foo->entry, &bar.list_of_foos);
*
* Repeat the above for each element you want to add to the list. Deleting
* works with the element itself.
- * list_del(&foo->entry);
+ * xorg_list_del(&foo->entry);
* free(foo);
*
- * Note: calling list_del(&bar.list_of_foos) will set bar.list_of_foos to an empty
+ * Note: calling xorg_list_del(&bar.list_of_foos) will set bar.list_of_foos to an empty
* list again.
*
* Looping through the list requires a 'struct foo' as iterator and the
* name of the field the subnodes use.
*
* struct foo *iterator;
- * list_for_each_entry(iterator, &bar.list_of_foos, entry) {
+ * xorg_list_for_each_entry(iterator, &bar.list_of_foos, entry) {
* if (iterator->something == ...)
* ...
* }
*
- * Note: You must not call list_del() on the iterator if you continue the
+ * Note: You must not call xorg_list_del() on the iterator if you continue the
* loop. You need to run the safe for-each loop instead:
*
* struct foo *iterator, *next;
- * list_for_each_entry_safe(iterator, next, &bar.list_of_foos, entry) {
+ * xorg_list_for_each_entry_safe(iterator, next, &bar.list_of_foos, entry) {
* if (...)
- * list_del(&iterator->entry);
+ * xorg_list_del(&iterator->entry);
* }
*
*/
/**
* The linkage struct for list nodes. This struct must be part of your
- * to-be-linked struct. struct list is required for both the head of the
+ * to-be-linked struct. struct xorg_list is required for both the head of the
* list and for each list node.
*
- * Position and name of the struct list field is irrelevant.
+ * Position and name of the struct xorg_list field is irrelevant.
* There are no requirements that elements of a list are of the same type.
- * There are no requirements for a list head, any struct list can be a list
+ * There are no requirements for a list head, any struct xorg_list can be a list
* head.
*/
-struct list {
- struct list *next, *prev;
+struct xorg_list {
+ struct xorg_list *next, *prev;
};
/**
* Initialize the list as an empty list.
*
* Example:
- * list_init(&bar->list_of_foos);
+ * xorg_list_init(&bar->list_of_foos);
*
* @param The list to initialized.
*/
static void
-list_init(struct list *list)
+xorg_list_init(struct xorg_list *list)
{
list->next = list->prev = list;
}
static inline void
-__list_add(struct list *entry,
- struct list *prev,
- struct list *next)
+__xorg_list_add(struct xorg_list *entry,
+ struct xorg_list *prev,
+ struct xorg_list *next)
{
next->prev = entry;
entry->next = next;
@@ -144,15 +144,15 @@ __list_add(struct list *entry,
*
* Example:
* struct foo *newfoo = malloc(...);
- * list_add(&newfoo->entry, &bar->list_of_foos);
+ * xorg_list_add(&newfoo->entry, &bar->list_of_foos);
*
* @param entry The new element to prepend to the list.
* @param head The existing list.
*/
static inline void
-list_add(struct list *entry, struct list *head)
+xorg_list_add(struct xorg_list *entry, struct xorg_list *head)
{
- __list_add(entry, head, head->next);
+ __xorg_list_add(entry, head, head->next);
}
/**
@@ -165,20 +165,20 @@ list_add(struct list *entry, struct list *head)
*
* Example:
* struct foo *newfoo = malloc(...);
- * list_append(&newfoo->entry, &bar->list_of_foos);
+ * xorg_list_append(&newfoo->entry, &bar->list_of_foos);
*
* @param entry The new element to prepend to the list.
* @param head The existing list.
*/
static inline void
-list_append(struct list *entry, struct list *head)
+xorg_list_append(struct xorg_list *entry, struct xorg_list *head)
{
- __list_add(entry, head->prev, head);
+ __xorg_list_add(entry, head->prev, head);
}
static inline void
-__list_del(struct list *prev, struct list *next)
+__xorg_list_del(struct xorg_list *prev, struct xorg_list *next)
{
next->prev = prev;
prev->next = next;
@@ -189,32 +189,32 @@ __list_del(struct list *prev, struct list *next)
* the pointers to/from this element so it is removed from the list. It does
* NOT free the element itself or manipulate it otherwise.
*
- * Using list_del on a pure list head (like in the example at the top of
+ * Using xorg_list_del on a pure list head (like in the example at the top of
* this file) will NOT remove the first element from
* the list but rather reset the list as empty list.
*
* Example:
- * list_del(&foo->entry);
+ * xorg_list_del(&foo->entry);
*
* @param entry The element to remove.
*/
static inline void
-list_del(struct list *entry)
+xorg_list_del(struct xorg_list *entry)
{
- __list_del(entry->prev, entry->next);
- list_init(entry);
+ __xorg_list_del(entry->prev, entry->next);
+ xorg_list_init(entry);
}
/**
* Check if the list is empty.
*
* Example:
- * list_is_empty(&bar->list_of_foos);
+ * xorg_list_is_empty(&bar->list_of_foos);
*
* @return True if the list contains one or more elements or False otherwise.
*/
static inline Bool
-list_is_empty(struct list *head)
+xorg_list_is_empty(struct xorg_list *head)
{
return head->next == head;
}
@@ -227,9 +227,9 @@ list_is_empty(struct list *head)
* f = container_of(&foo->entry, struct foo, entry);
* assert(f == foo);
*
- * @param ptr Pointer to the struct list.
+ * @param ptr Pointer to the struct xorg_list.
* @param type Data type of the list element.
- * @param member Member name of the struct list field in the list element.
+ * @param member Member name of the struct xorg_list field in the list element.
* @return A pointer to the data struct containing the list head.
*/
#ifndef container_of
@@ -240,7 +240,7 @@ list_is_empty(struct list *head)
/**
* Alias of container_of
*/
-#define list_entry(ptr, type, member) \
+#define xorg_list_entry(ptr, type, member) \
container_of(ptr, type, member)
/**
@@ -248,30 +248,30 @@ list_is_empty(struct list *head)
*
* Example:
* struct foo *first;
- * first = list_first_entry(&bar->list_of_foos, struct foo, list_of_foos);
+ * first = xorg_list_first_entry(&bar->list_of_foos, struct foo, list_of_foos);
*
* @param ptr The list head
* @param type Data type of the list element to retrieve
- * @param member Member name of the struct list field in the list element.
+ * @param member Member name of the struct xorg_list field in the list element.
* @return A pointer to the first list element.
*/
-#define list_first_entry(ptr, type, member) \
- list_entry((ptr)->next, type, member)
+#define xorg_list_first_entry(ptr, type, member) \
+ xorg_list_entry((ptr)->next, type, member)
/**
* Retrieve the last list entry for the given listpointer.
*
* Example:
* struct foo *first;
- * first = list_last_entry(&bar->list_of_foos, struct foo, list_of_foos);
+ * first = xorg_list_last_entry(&bar->list_of_foos, struct foo, list_of_foos);
*
* @param ptr The list head
* @param type Data type of the list element to retrieve
- * @param member Member name of the struct list field in the list element.
+ * @param member Member name of the struct xorg_list field in the list element.
* @return A pointer to the last list element.
*/
-#define list_last_entry(ptr, type, member) \
- list_entry((ptr)->prev, type, member)
+#define xorg_list_last_entry(ptr, type, member) \
+ xorg_list_entry((ptr)->prev, type, member)
#define __container_of(ptr, sample, member) \
(void *)((char *)(ptr) \
@@ -281,19 +281,19 @@ list_is_empty(struct list *head)
*
* Example:
* struct foo *iterator;
- * list_for_each_entry(iterator, &bar->list_of_foos, entry) {
+ * xorg_list_for_each_entry(iterator, &bar->list_of_foos, entry) {
* [modify iterator]
* }
*
- * This macro is not safe for node deletion. Use list_for_each_entry_safe
+ * This macro is not safe for node deletion. Use xorg_list_for_each_entry_safe
* instead.
*
* @param pos Iterator variable of the type of the list elements.
* @param head List head
- * @param member Member name of the struct list in the list elements.
+ * @param member Member name of the struct xorg_list in the list elements.
*
*/
-#define list_for_each_entry(pos, head, member) \
+#define xorg_list_for_each_entry(pos, head, member) \
for (pos = __container_of((head)->next, pos, member); \
&pos->member != (head); \
pos = __container_of(pos->member.next, pos, member))
@@ -303,9 +303,9 @@ list_is_empty(struct list *head)
* macro allows for the deletion of a list element while looping through the
* list.
*
- * See list_for_each_entry for more details.
+ * See xorg_list_for_each_entry for more details.
*/
-#define list_for_each_entry_safe(pos, tmp, head, member) \
+#define xorg_list_for_each_entry_safe(pos, tmp, head, member) \
for (pos = __container_of((head)->next, pos, member), \
tmp = __container_of(pos->member.next, pos, member); \
&pos->member != (head); \
@@ -315,9 +315,9 @@ list_is_empty(struct list *head)
/* NULL-Terminated List Interface
*
- * The interface below does _not_ use the struct list as described above.
+ * The interface below does _not_ use the struct xorg_list as described above.
* It is mainly for legacy structures that cannot easily be switched to
- * struct list.
+ * struct xorg_list.
*
* This interface is for structs like
* struct foo {
@@ -349,7 +349,7 @@ list_is_empty(struct list *head)
* struct foo *element = list;
* while ((element = nt_list_next(element, next)) { }
*
- * This macro is not safe for node deletion. Use list_for_each_entry_safe
+ * This macro is not safe for node deletion. Use xorg_list_for_each_entry_safe
* instead.
*
* @param list The list or current element.
diff --git a/xorg-server/test/input.c b/xorg-server/test/input.c
index 576cd8531..e0291417f 100644
--- a/xorg-server/test/input.c
+++ b/xorg-server/test/input.c
@@ -1714,7 +1714,7 @@ dix_enqueue_events(void) {
spriteInfo.sprite = &sprite;
InitEvents();
- assert(list_is_empty(&syncEvents.pending));
+ assert(xorg_list_is_empty(&syncEvents.pending));
/* this way PlayReleasedEvents really runs through all events in the
* queue */
@@ -1728,22 +1728,22 @@ dix_enqueue_events(void) {
ev[i].any.length = sizeof(*ev);
ev[i].any.type = i;
EnqueueEvent(&ev[i], &dev);
- assert(!list_is_empty(&syncEvents.pending));
- qe = list_last_entry(&syncEvents.pending, QdEventRec, next);
+ assert(!xorg_list_is_empty(&syncEvents.pending));
+ qe = xorg_list_last_entry(&syncEvents.pending, QdEventRec, next);
assert(memcmp(qe->event, &ev[i], ev[i].any.length) == 0);
- qe = list_first_entry(&syncEvents.pending, QdEventRec, next);
+ qe = xorg_list_first_entry(&syncEvents.pending, QdEventRec, next);
assert(memcmp(qe->event, &ev[0], ev[i].any.length) == 0);
}
/* calls process_input_proc */
dev.deviceGrab.sync.frozen = 1;
PlayReleasedEvents();
- assert(!list_is_empty(&syncEvents.pending));
+ assert(!xorg_list_is_empty(&syncEvents.pending));
dev.deviceGrab.sync.frozen = 0;
PlayReleasedEvents();
- assert(list_is_empty(&syncEvents.pending));
+ assert(xorg_list_is_empty(&syncEvents.pending));
inputInfo.devices = NULL;
}
diff --git a/xorg-server/test/list.c b/xorg-server/test/list.c
index ffb85efd0..14bc74a08 100644
--- a/xorg-server/test/list.c
+++ b/xorg-server/test/list.c
@@ -33,18 +33,18 @@
struct parent {
int a;
- struct list children;
+ struct xorg_list children;
int b;
};
struct child {
int foo;
int bar;
- struct list node;
+ struct xorg_list node;
};
static void
-test_list_init(void)
+test_xorg_list_init(void)
{
struct parent parent, tmp;
@@ -54,146 +54,146 @@ test_list_init(void)
tmp = parent;
- list_init(&parent.children);
+ xorg_list_init(&parent.children);
/* test we haven't touched anything else. */
assert(parent.a == tmp.a);
assert(parent.b == tmp.b);
- assert(list_is_empty(&parent.children));
+ assert(xorg_list_is_empty(&parent.children));
}
static void
-test_list_add(void)
+test_xorg_list_add(void)
{
struct parent parent = {0};
struct child child[3];
struct child *c;
- list_init(&parent.children);
+ xorg_list_init(&parent.children);
- list_add(&child[0].node, &parent.children);
- assert(!list_is_empty(&parent.children));
+ xorg_list_add(&child[0].node, &parent.children);
+ assert(!xorg_list_is_empty(&parent.children));
- c = list_first_entry(&parent.children, struct child, node);
+ c = xorg_list_first_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
- /* note: list_add prepends */
- list_add(&child[1].node, &parent.children);
- c = list_first_entry(&parent.children, struct child, node);
+ /* note: xorg_list_add prepends */
+ xorg_list_add(&child[1].node, &parent.children);
+ c = xorg_list_first_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
- list_add(&child[2].node, &parent.children);
- c = list_first_entry(&parent.children, struct child, node);
+ xorg_list_add(&child[2].node, &parent.children);
+ c = xorg_list_first_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[2], sizeof(struct child)) == 0);
};
static void
-test_list_append(void)
+test_xorg_list_append(void)
{
struct parent parent = {0};
struct child child[3];
struct child *c;
int i;
- list_init(&parent.children);
+ xorg_list_init(&parent.children);
- list_append(&child[0].node, &parent.children);
- assert(!list_is_empty(&parent.children));
+ xorg_list_append(&child[0].node, &parent.children);
+ assert(!xorg_list_is_empty(&parent.children));
- c = list_first_entry(&parent.children, struct child, node);
+ c = xorg_list_first_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
- c = list_last_entry(&parent.children, struct child, node);
+ c = xorg_list_last_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
- list_append(&child[1].node, &parent.children);
- c = list_first_entry(&parent.children, struct child, node);
+ xorg_list_append(&child[1].node, &parent.children);
+ c = xorg_list_first_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
- c = list_last_entry(&parent.children, struct child, node);
+ c = xorg_list_last_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
- list_append(&child[2].node, &parent.children);
- c = list_first_entry(&parent.children, struct child, node);
+ xorg_list_append(&child[2].node, &parent.children);
+ c = xorg_list_first_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
- c = list_last_entry(&parent.children, struct child, node);
+ c = xorg_list_last_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[2], sizeof(struct child)) == 0);
i = 0;
- list_for_each_entry(c, &parent.children, node) {
+ xorg_list_for_each_entry(c, &parent.children, node) {
assert(memcmp(c, &child[i++], sizeof(struct child)) == 0);
}
};
static void
-test_list_del(void)
+test_xorg_list_del(void)
{
struct parent parent = {0};
struct child child[3];
struct child *c;
- list_init(&parent.children);
+ xorg_list_init(&parent.children);
- list_add(&child[0].node, &parent.children);
- assert(!list_is_empty(&parent.children));
+ xorg_list_add(&child[0].node, &parent.children);
+ assert(!xorg_list_is_empty(&parent.children));
- list_del(&parent.children);
- assert(list_is_empty(&parent.children));
+ xorg_list_del(&parent.children);
+ assert(xorg_list_is_empty(&parent.children));
- list_add(&child[0].node, &parent.children);
- list_del(&child[0].node);
- assert(list_is_empty(&parent.children));
+ xorg_list_add(&child[0].node, &parent.children);
+ xorg_list_del(&child[0].node);
+ assert(xorg_list_is_empty(&parent.children));
- list_add(&child[0].node, &parent.children);
- list_add(&child[1].node, &parent.children);
+ xorg_list_add(&child[0].node, &parent.children);
+ xorg_list_add(&child[1].node, &parent.children);
- c = list_first_entry(&parent.children, struct child, node);
+ c = xorg_list_first_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
/* delete first node */
- list_del(&child[1].node);
- assert(!list_is_empty(&parent.children));
- assert(list_is_empty(&child[1].node));
- c = list_first_entry(&parent.children, struct child, node);
+ xorg_list_del(&child[1].node);
+ assert(!xorg_list_is_empty(&parent.children));
+ assert(xorg_list_is_empty(&child[1].node));
+ c = xorg_list_first_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[0], sizeof(struct child)) == 0);
/* delete last node */
- list_add(&child[1].node, &parent.children);
- list_del(&child[0].node);
- c = list_first_entry(&parent.children, struct child, node);
+ xorg_list_add(&child[1].node, &parent.children);
+ xorg_list_del(&child[0].node);
+ c = xorg_list_first_entry(&parent.children, struct child, node);
assert(memcmp(c, &child[1], sizeof(struct child)) == 0);
/* delete list head */
- list_add(&child[0].node, &parent.children);
- list_del(&parent.children);
- assert(list_is_empty(&parent.children));
- assert(!list_is_empty(&child[1].node));
- assert(!list_is_empty(&child[2].node));
+ xorg_list_add(&child[0].node, &parent.children);
+ xorg_list_del(&parent.children);
+ assert(xorg_list_is_empty(&parent.children));
+ assert(!xorg_list_is_empty(&child[1].node));
+ assert(!xorg_list_is_empty(&child[2].node));
}
static void
-test_list_for_each(void)
+test_xorg_list_for_each(void)
{
struct parent parent = {0};
struct child child[3];
struct child *c;
int i = 0;
- list_init(&parent.children);
+ xorg_list_init(&parent.children);
- list_add(&child[2].node, &parent.children);
- list_add(&child[1].node, &parent.children);
- list_add(&child[0].node, &parent.children);
+ xorg_list_add(&child[2].node, &parent.children);
+ xorg_list_add(&child[1].node, &parent.children);
+ xorg_list_add(&child[0].node, &parent.children);
- list_for_each_entry(c, &parent.children, node) {
+ xorg_list_for_each_entry(c, &parent.children, node) {
assert(memcmp(c, &child[i], sizeof(struct child)) == 0);
i++;
}
/* foreach on empty list */
- list_del(&parent.children);
- assert(list_is_empty(&parent.children));
+ xorg_list_del(&parent.children);
+ assert(xorg_list_is_empty(&parent.children));
- list_for_each_entry(c, &parent.children, node) {
+ xorg_list_for_each_entry(c, &parent.children, node) {
assert(0); /* we must not get here */
}
}
@@ -359,11 +359,11 @@ test_nt_list_delete(void)
int main(int argc, char** argv)
{
- test_list_init();
- test_list_add();
- test_list_append();
- test_list_del();
- test_list_for_each();
+ test_xorg_list_init();
+ test_xorg_list_add();
+ test_xorg_list_append();
+ test_xorg_list_del();
+ test_xorg_list_for_each();
test_nt_list_init();
test_nt_list_append();
diff --git a/xorg-server/xfixes/cursor.c b/xorg-server/xfixes/cursor.c
index 53f9f202a..7c46269bf 100644
--- a/xorg-server/xfixes/cursor.c
+++ b/xorg-server/xfixes/cursor.c
@@ -116,7 +116,7 @@ typedef struct PointerBarrierClient *PointerBarrierClientPtr;
struct PointerBarrierClient {
ScreenPtr screen;
struct PointerBarrier barrier;
- struct list entry;
+ struct xorg_list entry;
};
/*
@@ -128,7 +128,7 @@ typedef struct _CursorScreen {
CloseScreenProcPtr CloseScreen;
ConstrainCursorHarderProcPtr ConstrainCursorHarder;
CursorHideCountPtr pCursorHideCounts;
- struct list barriers;
+ struct xorg_list barriers;
} CursorScreenRec, *CursorScreenPtr;
#define GetCursorScreen(s) ((CursorScreenPtr)dixLookupPrivate(&(s)->devPrivates, CursorScreenPrivateKey))
@@ -1172,7 +1172,7 @@ barrier_find_nearest(CursorScreenPtr cs, int dir,
struct PointerBarrier *nearest = NULL;
double min_distance = INT_MAX; /* can't get higher than that in X anyway */
- list_for_each_entry(c, &cs->barriers, entry) {
+ xorg_list_for_each_entry(c, &cs->barriers, entry) {
struct PointerBarrier *b = &c->barrier;
double distance;
@@ -1224,7 +1224,7 @@ CursorConstrainCursorHarder(DeviceIntPtr dev, ScreenPtr screen, int mode, int *x
{
CursorScreenPtr cs = GetCursorScreen(screen);
- if (!list_is_empty(&cs->barriers) && !IsFloating(dev) && mode == Relative) {
+ if (!xorg_list_is_empty(&cs->barriers) && !IsFloating(dev) && mode == Relative) {
int ox, oy;
int dir;
struct PointerBarrier *nearest = NULL;
@@ -1285,7 +1285,7 @@ CreatePointerBarrierClient(ScreenPtr screen, ClientPtr client,
ret->barrier.directions &= ~(BarrierPositiveX | BarrierNegativeX);
if (barrier_is_vertical(&ret->barrier))
ret->barrier.directions &= ~(BarrierPositiveY | BarrierNegativeY);
- list_add(&ret->entry, &cs->barriers);
+ xorg_list_add(&ret->entry, &cs->barriers);
}
return ret;
@@ -1364,9 +1364,9 @@ CursorFreeBarrier(void *data, XID id)
cs = GetCursorScreen(screen);
/* find and unlink from the screen private */
- list_for_each_entry(b, &cs->barriers, entry) {
+ xorg_list_for_each_entry(b, &cs->barriers, entry) {
if (b == barrier) {
- list_del(&b->entry);
+ xorg_list_del(&b->entry);
break;
}
}
@@ -1426,7 +1426,7 @@ XFixesCursorInit (void)
cs = (CursorScreenPtr) calloc(1, sizeof (CursorScreenRec));
if (!cs)
return FALSE;
- list_init(&cs->barriers);
+ xorg_list_init(&cs->barriers);
Wrap (cs, pScreen, CloseScreen, CursorCloseScreen);
Wrap (cs, pScreen, DisplayCursor, CursorDisplayCursor);
Wrap (cs, pScreen, ConstrainCursorHarder, CursorConstrainCursorHarder);