dix: add dixClientForGrab()
Helper function for retrieving the owning client of a grab. It's an actual function, so callers don't need access to internal knowledge (definition of GrabRec, clients[] array, ...) Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
d697618c16
commit
0ca0c334d8
|
@ -1119,7 +1119,7 @@ ActivateEarlyAccept(DeviceIntPtr dev, TouchPointInfoPtr ti)
|
||||||
ti->listeners[0].type != TOUCH_LISTENER_POINTER_GRAB);
|
ti->listeners[0].type != TOUCH_LISTENER_POINTER_GRAB);
|
||||||
BUG_RETURN(!grab);
|
BUG_RETURN(!grab);
|
||||||
|
|
||||||
client = rClient(grab);
|
client = dixClientForGrab(grab);
|
||||||
|
|
||||||
if (TouchAcceptReject(client, dev, XIAcceptTouch, ti->client_id,
|
if (TouchAcceptReject(client, dev, XIAcceptTouch, ti->client_id,
|
||||||
ti->listeners[0].window->drawable.id, &error) != Success)
|
ti->listeners[0].window->drawable.id, &error) != Success)
|
||||||
|
@ -1371,7 +1371,7 @@ RetrieveTouchDeliveryData(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
||||||
|
|
||||||
BUG_RETURN_VAL(!*grab, FALSE);
|
BUG_RETURN_VAL(!*grab, FALSE);
|
||||||
|
|
||||||
*client = rClient(*grab);
|
*client = dixClientForGrab(*grab);
|
||||||
*win = (*grab)->window;
|
*win = (*grab)->window;
|
||||||
*mask = (*grab)->xi2mask;
|
*mask = (*grab)->xi2mask;
|
||||||
}
|
}
|
||||||
|
@ -1454,7 +1454,7 @@ DeliverTouchEmulatedEvent(DeviceIntPtr dev, TouchPointInfoPtr ti,
|
||||||
if (grab) {
|
if (grab) {
|
||||||
win = grab->window;
|
win = grab->window;
|
||||||
xi2mask = grab->xi2mask;
|
xi2mask = grab->xi2mask;
|
||||||
client = rClient(grab);
|
client = dixClientForGrab(grab);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2284,7 +2284,7 @@ RetrieveGestureDeliveryData(DeviceIntPtr dev, InternalEvent *ev, GestureListener
|
||||||
|
|
||||||
BUG_RETURN_VAL(!*grab, FALSE);
|
BUG_RETURN_VAL(!*grab, FALSE);
|
||||||
|
|
||||||
*client = rClient(*grab);
|
*client = dixClientForGrab(*grab);
|
||||||
*win = (*grab)->window;
|
*win = (*grab)->window;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
20
dix/events.c
20
dix/events.c
|
@ -3827,7 +3827,7 @@ ActivatePassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event,
|
||||||
FixUpEventFromWindow(pSprite, xE, grab->window, None, TRUE);
|
FixUpEventFromWindow(pSprite, xE, grab->window, None, TRUE);
|
||||||
|
|
||||||
/* XXX: XACE? */
|
/* XXX: XACE? */
|
||||||
TryClientEvents(rClient(grab), device, xE, count,
|
TryClientEvents(dixClientForGrab(grab), device, xE, count,
|
||||||
GetEventFilter(device, xE),
|
GetEventFilter(device, xE),
|
||||||
GetEventFilter(device, xE), grab);
|
GetEventFilter(device, xE), grab);
|
||||||
}
|
}
|
||||||
|
@ -3867,7 +3867,7 @@ CoreGrabInterferes(DeviceIntPtr device, GrabPtr grab)
|
||||||
GrabPtr othergrab = other->deviceGrab.grab;
|
GrabPtr othergrab = other->deviceGrab.grab;
|
||||||
|
|
||||||
if (othergrab && othergrab->grabtype == CORE &&
|
if (othergrab && othergrab->grabtype == CORE &&
|
||||||
SameClient(grab, rClient(othergrab)) &&
|
SameClient(grab, dixClientForGrab(othergrab)) &&
|
||||||
((IsPointerDevice(grab->device) &&
|
((IsPointerDevice(grab->device) &&
|
||||||
IsPointerDevice(othergrab->device)) ||
|
IsPointerDevice(othergrab->device)) ||
|
||||||
(IsKeyboardDevice(grab->device) &&
|
(IsKeyboardDevice(grab->device) &&
|
||||||
|
@ -4326,10 +4326,10 @@ DeliverOneGrabbedEvent(InternalEvent *event, DeviceIntPtr dev,
|
||||||
if (rc == Success) {
|
if (rc == Success) {
|
||||||
FixUpEventFromWindow(pSprite, xE, grab->window, None, TRUE);
|
FixUpEventFromWindow(pSprite, xE, grab->window, None, TRUE);
|
||||||
if (XaceHookSendAccess(NullClient, dev, grab->window, xE, count) ||
|
if (XaceHookSendAccess(NullClient, dev, grab->window, xE, count) ||
|
||||||
XaceHookReceiveAccess(rClient(grab), grab->window, xE, count))
|
XaceHookReceiveAccess(dixClientForGrab(grab), grab->window, xE, count))
|
||||||
deliveries = 1; /* don't send, but pretend we did */
|
deliveries = 1; /* don't send, but pretend we did */
|
||||||
else if (level != CORE || !IsInterferingGrab(rClient(grab), dev, xE)) {
|
else if (level != CORE || !IsInterferingGrab(dixClientForGrab(grab), dev, xE)) {
|
||||||
deliveries = TryClientEvents(rClient(grab), dev,
|
deliveries = TryClientEvents(dixClientForGrab(grab), dev,
|
||||||
xE, count, mask, filter, grab);
|
xE, count, mask, filter, grab);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4683,7 +4683,7 @@ CoreEnterLeaveEvent(DeviceIntPtr mouse,
|
||||||
if (grab) {
|
if (grab) {
|
||||||
mask = (pWin == grab->window) ? grab->eventMask : 0;
|
mask = (pWin == grab->window) ? grab->eventMask : 0;
|
||||||
if (grab->ownerEvents)
|
if (grab->ownerEvents)
|
||||||
mask |= EventMaskForClient(pWin, rClient(grab));
|
mask |= EventMaskForClient(pWin, dixClientForGrab(grab));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mask = pWin->eventMask | wOtherEventMasks(pWin);
|
mask = pWin->eventMask | wOtherEventMasks(pWin);
|
||||||
|
@ -4711,7 +4711,7 @@ CoreEnterLeaveEvent(DeviceIntPtr mouse,
|
||||||
|
|
||||||
if ((mask & GetEventFilter(mouse, &event))) {
|
if ((mask & GetEventFilter(mouse, &event))) {
|
||||||
if (grab)
|
if (grab)
|
||||||
TryClientEvents(rClient(grab), mouse, &event, 1, mask,
|
TryClientEvents(dixClientForGrab(grab), mouse, &event, 1, mask,
|
||||||
GetEventFilter(mouse, &event), grab);
|
GetEventFilter(mouse, &event), grab);
|
||||||
else
|
else
|
||||||
DeliverEventsToWindow(mouse, pWin, &event, 1,
|
DeliverEventsToWindow(mouse, pWin, &event, 1,
|
||||||
|
@ -4722,7 +4722,7 @@ CoreEnterLeaveEvent(DeviceIntPtr mouse,
|
||||||
xKeymapEvent ke = {
|
xKeymapEvent ke = {
|
||||||
.type = KeymapNotify
|
.type = KeymapNotify
|
||||||
};
|
};
|
||||||
ClientPtr client = grab ? rClient(grab) : dixClientForWindow(pWin);
|
ClientPtr client = grab ? dixClientForGrab(grab) : dixClientForWindow(pWin);
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
rc = XaceHookDeviceAccess(client, keybd, DixReadAccess);
|
rc = XaceHookDeviceAccess(client, keybd, DixReadAccess);
|
||||||
|
@ -4730,7 +4730,7 @@ CoreEnterLeaveEvent(DeviceIntPtr mouse,
|
||||||
memcpy((char *) &ke.map[0], (char *) &keybd->key->down[1], 31);
|
memcpy((char *) &ke.map[0], (char *) &keybd->key->down[1], 31);
|
||||||
|
|
||||||
if (grab)
|
if (grab)
|
||||||
TryClientEvents(rClient(grab), keybd, (xEvent *) &ke, 1,
|
TryClientEvents(dixClientForGrab(grab), keybd, (xEvent *) &ke, 1,
|
||||||
mask, KeymapStateMask, grab);
|
mask, KeymapStateMask, grab);
|
||||||
else
|
else
|
||||||
DeliverEventsToWindow(mouse, pWin, (xEvent *) &ke, 1,
|
DeliverEventsToWindow(mouse, pWin, (xEvent *) &ke, 1,
|
||||||
|
@ -4804,7 +4804,7 @@ DeviceEnterLeaveEvent(DeviceIntPtr mouse,
|
||||||
Mask mask;
|
Mask mask;
|
||||||
|
|
||||||
mask = xi2mask_isset(grab->xi2mask, mouse, type);
|
mask = xi2mask_isset(grab->xi2mask, mouse, type);
|
||||||
TryClientEvents(rClient(grab), mouse, (xEvent *) event, 1, mask, 1,
|
TryClientEvents(dixClientForGrab(grab), mouse, (xEvent *) event, 1, mask, 1,
|
||||||
grab);
|
grab);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
10
dix/lookup.c
10
dix/lookup.c
|
@ -7,6 +7,9 @@
|
||||||
#include <dix-config.h>
|
#include <dix-config.h>
|
||||||
|
|
||||||
#include "dix/dix_priv.h"
|
#include "dix/dix_priv.h"
|
||||||
|
#include "dix/resource_priv.h"
|
||||||
|
#include "include/input.h"
|
||||||
|
#include "include/inputstr.h"
|
||||||
#include "include/windowstr.h"
|
#include "include/windowstr.h"
|
||||||
|
|
||||||
ClientPtr dixClientForWindow(WindowPtr pWin) {
|
ClientPtr dixClientForWindow(WindowPtr pWin) {
|
||||||
|
@ -15,3 +18,10 @@ ClientPtr dixClientForWindow(WindowPtr pWin) {
|
||||||
|
|
||||||
return clients[CLIENT_ID(pWin->drawable.id)];
|
return clients[CLIENT_ID(pWin->drawable.id)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ClientPtr dixClientForGrab(GrabPtr pGrab) {
|
||||||
|
if (!pGrab)
|
||||||
|
return NullClient;
|
||||||
|
|
||||||
|
return clients[CLIENT_ID(pGrab->resource)];
|
||||||
|
}
|
||||||
|
|
|
@ -18,4 +18,15 @@
|
||||||
*/
|
*/
|
||||||
ClientPtr dixClientForWindow(WindowPtr pWin);
|
ClientPtr dixClientForWindow(WindowPtr pWin);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief retrieve client that owns given grab
|
||||||
|
*
|
||||||
|
* XIDs carry the ID of the client who created/owns the resource in upper bits.
|
||||||
|
* (every client so is assigned a range of XIDs it may use for resource creation)
|
||||||
|
*
|
||||||
|
* @param GrabPtr to the grab whose owning client shall be retrieved
|
||||||
|
* @return pointer to ClientRec structure or NullClient (NULL)
|
||||||
|
*/
|
||||||
|
ClientPtr dixClientForGrab(GrabPtr pGrab);
|
||||||
|
|
||||||
#endif /* _XSERVER_DIX_RESOURCE_PRIV_H */
|
#endif /* _XSERVER_DIX_RESOURCE_PRIV_H */
|
||||||
|
|
Loading…
Reference in New Issue