mirror of
https://github.com/X11Libre/xserver.git
synced 2026-10-22 01:20:26 +00:00
Xi: Add SetClientPointer request handling.
This commit is contained in:
parent
b3b2a6a0d4
commit
07806f4081
7 changed files with 170 additions and 64 deletions
72
dix/events.c
72
dix/events.c
|
|
@ -1706,12 +1706,6 @@ DeliverEventsToWindow(DeviceIntPtr pDev, register WindowPtr pWin, xEvent
|
|||
if (filter != CantBeFiltered &&
|
||||
!((wOtherEventMasks(pWin)|pWin->eventMask) & filter))
|
||||
return 0;
|
||||
|
||||
/* core event? check for grab interference */
|
||||
if (!(type & EXTENSION_EVENT_BASE) &&
|
||||
IsInterferingGrab(wClient(pWin), pDev, pEvents))
|
||||
return 0;
|
||||
|
||||
if ( (attempt = TryClientEvents(wClient(pWin), pEvents, count,
|
||||
pWin->eventMask, filter, grab)) )
|
||||
{
|
||||
|
|
@ -1740,11 +1734,6 @@ DeliverEventsToWindow(DeviceIntPtr pDev, register WindowPtr pWin, xEvent
|
|||
other = (InputClients *)wOtherClients(pWin);
|
||||
for (; other; other = other->next)
|
||||
{
|
||||
/* core event? check for grab interference */
|
||||
if (!(type & EXTENSION_EVENT_BASE) &&
|
||||
IsInterferingGrab(rClient(other), pDev, pEvents))
|
||||
continue;
|
||||
|
||||
if ( (attempt = TryClientEvents(rClient(other), pEvents, count,
|
||||
other->mask[mskidx], filter, grab)) )
|
||||
{
|
||||
|
|
@ -4861,11 +4850,22 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the client pointer for the given client. Second parameter setter could
|
||||
* be used in the future to determine access rights. Unused for now.
|
||||
*/
|
||||
_X_EXPORT Bool
|
||||
SetClientPointer(ClientPtr client, ClientPtr setter, DeviceIntPtr device)
|
||||
{
|
||||
client->clientPtr = device;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* PickPointer will pick an appropriate pointer for the given client.
|
||||
*
|
||||
* If a client pointer is set, it will pick the client pointer, otherwise the
|
||||
* first available pointer in the list. If no physical device is attached, it
|
||||
* will pick the core pointer.
|
||||
* will pick the core pointer, but will not store it on the client.
|
||||
*/
|
||||
_X_EXPORT DeviceIntPtr
|
||||
PickPointer(ClientPtr client)
|
||||
|
|
@ -4887,7 +4887,7 @@ PickPointer(ClientPtr client)
|
|||
if (!it)
|
||||
{
|
||||
ErrorF("Picking VCP\n");
|
||||
client->clientPtr = inputInfo.pointer;
|
||||
return inputInfo.pointer;
|
||||
}
|
||||
}
|
||||
return client->clientPtr;
|
||||
|
|
@ -4916,49 +4916,3 @@ PickKeyboard(ClientPtr client)
|
|||
return inputInfo.keyboard;
|
||||
}
|
||||
|
||||
/* A client that has one or more core grabs does not get core events from
|
||||
* devices it does not have a grab on. Legacy applications behave bad
|
||||
* otherwise because they are not used to it and the events interfere.
|
||||
* Only applies for core events.
|
||||
*
|
||||
* Return true if a core event from the device would interfere and should not
|
||||
* be delivered.
|
||||
*/
|
||||
Bool
|
||||
IsInterferingGrab(ClientPtr client, DeviceIntPtr dev, xEvent* event)
|
||||
{
|
||||
DeviceIntPtr it = inputInfo.devices;
|
||||
|
||||
if (dev->coreGrab.grab && SameClient(dev->coreGrab.grab, client))
|
||||
return FALSE;
|
||||
|
||||
switch(event->u.u.type)
|
||||
{
|
||||
case KeyPress:
|
||||
case KeyRelease:
|
||||
case ButtonPress:
|
||||
case ButtonRelease:
|
||||
case MotionNotify:
|
||||
case EnterNotify:
|
||||
case LeaveNotify:
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
while(it)
|
||||
{
|
||||
if (it != dev)
|
||||
{
|
||||
if (it->coreGrab.grab && SameClient(it->coreGrab.grab, client))
|
||||
{
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
}
|
||||
it = it->next;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue