aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-02-13 08:50:32 +0100
committermarha <marha@users.sourceforge.net>2012-02-13 08:50:32 +0100
commit179ebdfaf7fe0a0017054c052b76210eeff084a9 (patch)
tree5daa6e5583ced6a6b12b03e12c16ef2acedb5b5c /xorg-server/dix
parent535951cba015f2a2b63292e0ca983d0d6e736b71 (diff)
parenteaa70945cb3f1a432b8c505ecede9ebc7769f36d (diff)
downloadvcxsrv-179ebdfaf7fe0a0017054c052b76210eeff084a9.tar.gz
vcxsrv-179ebdfaf7fe0a0017054c052b76210eeff084a9.tar.bz2
vcxsrv-179ebdfaf7fe0a0017054c052b76210eeff084a9.zip
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'xorg-server/dix')
-rw-r--r--xorg-server/dix/events.c36
-rw-r--r--xorg-server/dix/inpututils.c3
-rw-r--r--xorg-server/dix/touch.c73
3 files changed, 87 insertions, 25 deletions
diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c
index 626fd23dd..781d27f36 100644
--- a/xorg-server/dix/events.c
+++ b/xorg-server/dix/events.c
@@ -1125,8 +1125,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);
@@ -1186,13 +1186,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);
}
/**
@@ -1213,10 +1213,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);
@@ -1300,7 +1300,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)
@@ -4272,7 +4272,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
@@ -4289,16 +4288,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)
{
@@ -5399,9 +5397,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;
+}