dix: Check if client has a grab on any other device before mouse/kbd
event is delivered to the client. Client's don't cope well with receiving core events from other devices when having a grab on a pointer or keyboard.
This commit is contained in:
parent
ceca5670fe
commit
b3b2a6a0d4
|
@ -131,7 +131,6 @@ FreeCursor(pointer value, XID cid)
|
||||||
}
|
}
|
||||||
FreeCursorBits(pCurs->bits);
|
FreeCursorBits(pCurs->bits);
|
||||||
xfree( pCurs);
|
xfree( pCurs);
|
||||||
MPXDBG("freeing memory for cursor\n");
|
|
||||||
return(Success);
|
return(Success);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
57
dix/events.c
57
dix/events.c
|
@ -1706,6 +1706,12 @@ DeliverEventsToWindow(DeviceIntPtr pDev, register WindowPtr pWin, xEvent
|
||||||
if (filter != CantBeFiltered &&
|
if (filter != CantBeFiltered &&
|
||||||
!((wOtherEventMasks(pWin)|pWin->eventMask) & filter))
|
!((wOtherEventMasks(pWin)|pWin->eventMask) & filter))
|
||||||
return 0;
|
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,
|
if ( (attempt = TryClientEvents(wClient(pWin), pEvents, count,
|
||||||
pWin->eventMask, filter, grab)) )
|
pWin->eventMask, filter, grab)) )
|
||||||
{
|
{
|
||||||
|
@ -1734,6 +1740,11 @@ DeliverEventsToWindow(DeviceIntPtr pDev, register WindowPtr pWin, xEvent
|
||||||
other = (InputClients *)wOtherClients(pWin);
|
other = (InputClients *)wOtherClients(pWin);
|
||||||
for (; other; other = other->next)
|
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,
|
if ( (attempt = TryClientEvents(rClient(other), pEvents, count,
|
||||||
other->mask[mskidx], filter, grab)) )
|
other->mask[mskidx], filter, grab)) )
|
||||||
{
|
{
|
||||||
|
@ -4905,3 +4916,49 @@ PickKeyboard(ClientPtr client)
|
||||||
return inputInfo.keyboard;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -609,6 +609,11 @@ extern DeviceIntPtr PickPointer(
|
||||||
extern DeviceIntPtr PickKeyboard(
|
extern DeviceIntPtr PickKeyboard(
|
||||||
ClientPtr /* client */);
|
ClientPtr /* client */);
|
||||||
|
|
||||||
|
extern Bool IsInterferingGrab(
|
||||||
|
ClientPtr /* client */,
|
||||||
|
DeviceIntPtr /* dev */,
|
||||||
|
xEvent* /* events */);
|
||||||
|
|
||||||
#ifdef PANORAMIX
|
#ifdef PANORAMIX
|
||||||
extern void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff);
|
extern void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue