aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix/events.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-04-20 17:07:15 +0200
committermarha <marha@users.sourceforge.net>2012-04-20 17:07:15 +0200
commit0e3699334faf92f508b6c187a261548b656b0dd3 (patch)
tree28d7e84df7b54a3e6f85bf83e38efba937288fd3 /xorg-server/dix/events.c
parentc1194ccd395fdbb23c9ab56bc340ee20a5feeb82 (diff)
downloadvcxsrv-0e3699334faf92f508b6c187a261548b656b0dd3.tar.gz
vcxsrv-0e3699334faf92f508b6c187a261548b656b0dd3.tar.bz2
vcxsrv-0e3699334faf92f508b6c187a261548b656b0dd3.zip
fontconfig libX11 mesa pixman xserver git update 20 april 2012
Diffstat (limited to 'xorg-server/dix/events.c')
-rw-r--r--xorg-server/dix/events.c55
1 files changed, 46 insertions, 9 deletions
diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c
index b9f9cfa3c..9496b6f19 100644
--- a/xorg-server/dix/events.c
+++ b/xorg-server/dix/events.c
@@ -1273,18 +1273,11 @@ ComputeFreezes(void)
event->root_x, event->root_y);
if (!CheckDeviceGrabs(replayDev, event, syncEvents.replayWin)) {
if (IsTouchEvent((InternalEvent *) event)) {
- InternalEvent *events = InitEventList(GetMaximumEventsNum());
- int i, nev;
TouchPointInfoPtr ti =
TouchFindByClientID(replayDev, event->touchid);
BUG_WARN(!ti);
- nev =
- GetTouchOwnershipEvents(events, replayDev, ti,
- XIRejectTouch,
- ti->listeners[0].listener, 0);
- for (i = 0; i < nev; i++)
- mieqProcessDeviceEvent(replayDev, events + i, NULL);
- ProcessInputEvents();
+
+ TouchListenerAcceptReject(replayDev, ti, 0, XIRejectTouch);
}
else if (replayDev->focus &&
!IsPointerEvent((InternalEvent *) event))
@@ -1416,6 +1409,38 @@ ReattachToOldMaster(DeviceIntPtr dev)
}
/**
+ * Update touch records when an explicit grab is activated. Any touches owned by
+ * the grabbing client are updated so the listener state reflects the new grab.
+ */
+static void
+UpdateTouchesForGrab(DeviceIntPtr mouse)
+{
+ int i;
+
+ if (!mouse->touch || mouse->deviceGrab.fromPassiveGrab)
+ return;
+
+ for (i = 0; i < mouse->touch->num_touches; i++) {
+ TouchPointInfoPtr ti = mouse->touch->touches + i;
+ GrabPtr grab = mouse->deviceGrab.grab;
+
+ if (ti->active &&
+ CLIENT_BITS(ti->listeners[0].listener) == grab->resource) {
+ ti->listeners[0].listener = grab->resource;
+ ti->listeners[0].level = grab->grabtype;
+ ti->listeners[0].state = LISTENER_IS_OWNER;
+ ti->listeners[0].window = grab->window;
+
+ if (grab->grabtype == CORE || grab->grabtype == XI ||
+ !xi2mask_isset(grab->xi2mask, mouse, XI_TouchBegin))
+ ti->listeners[0].type = LISTENER_POINTER_GRAB;
+ else
+ ti->listeners[0].type = LISTENER_GRAB;
+ }
+ }
+}
+
+/**
* Activate a pointer grab on the given device. A pointer grab will cause all
* core pointer events of this device to be delivered to the grabbing client only.
* No other device will send core events to the grab client while the grab is
@@ -1464,6 +1489,7 @@ ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
grabinfo->fromPassiveGrab = isPassive;
grabinfo->implicitGrab = autoGrab & ImplicitGrabMask;
PostNewCursor(mouse);
+ UpdateTouchesForGrab(mouse);
CheckGrabForSyncs(mouse, (Bool) grab->pointerMode,
(Bool) grab->keyboardMode);
}
@@ -1480,6 +1506,8 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
DeviceIntPtr dev;
Bool wasImplicit = (mouse->deviceGrab.fromPassiveGrab &&
mouse->deviceGrab.implicitGrab);
+ XID grab_resource = grab->resource;
+ int i;
TouchRemovePointerGrab(mouse);
@@ -1504,6 +1532,15 @@ DeactivatePointerGrab(DeviceIntPtr mouse)
ReattachToOldMaster(mouse);
ComputeFreezes();
+
+ /* If an explicit grab was deactivated, we must remove it from the head of
+ * all the touches' listener lists. */
+ for (i = 0; mouse->touch && i < mouse->touch->num_touches; i++) {
+ TouchPointInfoPtr ti = mouse->touch->touches + i;
+
+ if (ti->active && TouchResourceIsOwner(ti, grab_resource))
+ TouchListenerAcceptReject(mouse, ti, 0, XIRejectTouch);
+ }
}
/**