When activating an explicit grab, update owning listener
Pointer passive grabs may be changed by the grabbing client. This allows for a selecting client to change an implicit grab to an active grab, which is the mechanism used for pop-up windows like application menus. We need to do the same thing with touches. If the grabbing client is the owner of a touch sequence, change the listener record to reflect the new grab. If the grabbing client is not the owner, nothing changes for the touch. Signed-off-by: Chase Douglas <chase.douglas@canonical.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
ef64b5ee97
commit
2efbed23c2
33
dix/events.c
33
dix/events.c
|
@ -1408,6 +1408,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
|
* 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.
|
* core pointer events of this device to be delivered to the grabbing client only.
|
||||||
|
@ -1457,6 +1489,7 @@ ActivatePointerGrab(DeviceIntPtr mouse, GrabPtr grab,
|
||||||
grabinfo->fromPassiveGrab = isPassive;
|
grabinfo->fromPassiveGrab = isPassive;
|
||||||
grabinfo->implicitGrab = autoGrab & ImplicitGrabMask;
|
grabinfo->implicitGrab = autoGrab & ImplicitGrabMask;
|
||||||
PostNewCursor(mouse);
|
PostNewCursor(mouse);
|
||||||
|
UpdateTouchesForGrab(mouse);
|
||||||
CheckGrabForSyncs(mouse, (Bool) grab->pointerMode,
|
CheckGrabForSyncs(mouse, (Bool) grab->pointerMode,
|
||||||
(Bool) grab->keyboardMode);
|
(Bool) grab->keyboardMode);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue