Revert "Allow events to grabWindows event if the device is not grabbed."

This reverts commit 339b73e710.
Allowing those events can lead to race conditions.

Conflicts:

	dix/events.c
This commit is contained in:
Peter Hutterer 2007-05-15 10:24:22 +09:30
parent 81fc6a128b
commit a8c56372ba
2 changed files with 6 additions and 23 deletions

View File

@ -1881,7 +1881,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
return 0; return 0;
if (!(type & EXTENSION_EVENT_BASE) && if (!(type & EXTENSION_EVENT_BASE) &&
IsInterferingGrab(wClient(pWin), pWin, pDev, pEvents)) IsInterferingGrab(wClient(pWin), pDev, pEvents))
return 0; return 0;
if ( (attempt = TryClientEvents(wClient(pWin), pEvents, count, if ( (attempt = TryClientEvents(wClient(pWin), pEvents, count,
@ -1946,7 +1946,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
{ {
/* core event? check for grab interference */ /* core event? check for grab interference */
if (!(type & EXTENSION_EVENT_BASE) && if (!(type & EXTENSION_EVENT_BASE) &&
IsInterferingGrab(rClient(other), pWin, pDev, pEvents)) IsInterferingGrab(rClient(other), pDev, pEvents))
continue; continue;
if ( (attempt = TryClientEvents(rClient(other), pEvents, count, if ( (attempt = TryClientEvents(rClient(other), pEvents, count,
@ -5666,19 +5666,15 @@ PickKeyboard(ClientPtr client)
/* A client that has one or more core grabs does not get core events from /* 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 * devices it does not have a grab on. Legacy applications behave bad
* otherwise because they are not used to it and the events interfere. * otherwise because they are not used to it and the events interfere.
* The one exception is: if we're about to send an event to a window that is
* specified as grab window, we still do it. This makes popup menus
* half-useable for WMs that don't set the ClientPointer.
* Only applies for core events. * Only applies for core events.
* *
* Return true if a core event from the device would interfere and should not * Return true if a core event from the device would interfere and should not
* be delivered. * be delivered.
*/ */
Bool Bool
IsInterferingGrab(ClientPtr client, WindowPtr win, DeviceIntPtr dev, xEvent* event) IsInterferingGrab(ClientPtr client, DeviceIntPtr dev, xEvent* event)
{ {
DeviceIntPtr it; DeviceIntPtr it = inputInfo.devices;
Bool mayInterfere = FALSE;
if (dev->deviceGrab.grab && SameClient(dev->deviceGrab.grab, client)) if (dev->deviceGrab.grab && SameClient(dev->deviceGrab.grab, client))
return FALSE; return FALSE;
@ -5697,31 +5693,19 @@ IsInterferingGrab(ClientPtr client, WindowPtr win, DeviceIntPtr dev, xEvent* eve
return FALSE; return FALSE;
} }
it = inputInfo.devices;
while(it) while(it)
{ {
if (it != dev) if (it != dev)
{ {
if (it->deviceGrab.grab && SameClient(it->deviceGrab.grab, client)) if (it->deviceGrab.grab && SameClient(it->deviceGrab.grab, client))
{ {
/* there's a client with a grab on some device. return TRUE;
* if we're delivering to the very same window that is
* grabbed (or a child), we're good */
WindowPtr parent = win;
while(parent)
{
if (it->deviceGrab.grab->window == parent)
return FALSE;
parent = parent->parent;
}
mayInterfere = TRUE;
} }
} }
it = it->next; it = it->next;
} }
return mayInterfere; return FALSE;
} }
/** /**

View File

@ -552,7 +552,6 @@ extern DeviceIntPtr PickKeyboard(
extern Bool IsInterferingGrab( extern Bool IsInterferingGrab(
ClientPtr /* client */, ClientPtr /* client */,
WindowPtr /* win */,
DeviceIntPtr /* dev */, DeviceIntPtr /* dev */,
xEvent* /* events */); xEvent* /* events */);