dix: don't filter RawEvents if the grab window is not the root window (#53897)

If a XI2.1+ client has a grab on a non-root window, it  must still receive
raw events on the root window.

Test case: register for XI_ButtonPress on window and XI_RawMotion on root.
No raw events are received once the press activates an implicit grab on the
window.

X.Org Bug 53897 <http://bugs.freedesktop.org/show_bug.cgi?id=53897>

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Peter Hutterer 2012-08-22 10:34:07 +10:00
parent 3578cc3c2e
commit 4e13dd9014

View File

@ -2246,7 +2246,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent
* @return TRUE if the event should be discarded, FALSE otherwise.
*/
static BOOL
FilterRawEvents(const ClientPtr client, const GrabPtr grab)
FilterRawEvents(const ClientPtr client, const GrabPtr grab, WindowPtr root)
{
XIClientPtr client_xi_version;
int cmp;
@ -2262,7 +2262,10 @@ FilterRawEvents(const ClientPtr client, const GrabPtr grab)
client_xi_version->minor_version, 2, 0);
/* XI 2.0: if device is grabbed, skip
XI 2.1: if device is grabbed by us, skip, we've already delivered */
return (cmp == 0) ? TRUE : SameClient(grab, client);
if (cmp == 0)
return TRUE;
return (grab->window != root) ? FALSE : SameClient(grab, client);
}
/**
@ -2315,7 +2318,7 @@ DeliverRawEvent(RawDeviceEvent *ev, DeviceIntPtr device)
*/
ic.next = NULL;
if (!FilterRawEvents(rClient(&ic), grab))
if (!FilterRawEvents(rClient(&ic), grab, root))
DeliverEventToInputClients(device, &ic, root, xi, 1,
filter, NULL, &c, &m);
}