diff options
author | Keith Packard <keithp@keithp.com> | 2010-07-01 23:45:50 -0400 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-07-01 23:45:50 -0400 |
commit | 9fb0785449b287ba1998e08613b3c2102ec24842 (patch) | |
tree | a005fcdcd99a1c83aed235f7b16cf42e372e7dda /dix | |
parent | 48cac27870992f6bde2c48429ff03c0a7606d5c1 (diff) |
Revert "Revert "dix: use the event mask of the grab for TryClientEvents.""
Preparing to merge Peter's branch.
This reverts commit 018c878e9495b21146c8f38617fdd1bf6d8cc73b.
Diffstat (limited to 'dix')
-rw-r--r-- | dix/events.c | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/dix/events.c b/dix/events.c index e1c3d0a02..ae9847c93 100644 --- a/dix/events.c +++ b/dix/events.c @@ -3420,6 +3420,7 @@ CheckPassiveGrabsOnWindow( { DeviceIntPtr gdev; XkbSrvInfoPtr xkbi = NULL; + Mask mask = 0; gdev= grab->modifierDevice; if (grab->grabtype == GRABTYPE_CORE) @@ -3534,6 +3535,9 @@ CheckPassiveGrabsOnWindow( } xE = &core; count = 1; + mask = grab->eventMask; + if (grab->ownerEvents) + mask |= pWin->eventMask; } else if (match & XI2_MATCH) { rc = EventToXI2((InternalEvent*)event, &xE); @@ -3545,6 +3549,34 @@ CheckPassiveGrabsOnWindow( continue; } count = 1; + + /* FIXME: EventToXI2 returns NULL for enter events, so + * dereferencing the event is bad. Internal event types are + * aligned with core events, so the else clause is valid. + * long-term we should use internal events for enter/focus + * as well */ + if (xE) + mask = grab->xi2mask[device->id][((xGenericEvent*)xE)->evtype/8]; + else if (event->type == XI_Enter || event->type == XI_FocusIn) + mask = grab->xi2mask[device->id][event->type/8]; + + if (grab->ownerEvents && wOtherInputMasks(grab->window)) + { + InputClientsPtr icp = + wOtherInputMasks(grab->window)->inputClients; + + while(icp) + { + if (rClient(icp) == rClient(grab)) + { + int evtype = (xE) ? ((xGenericEvent*)xE)->evtype : event->type; + mask |= icp->xi2mask[device->id][evtype/8]; + break; + } + + icp = icp->next; + } + } } else { rc = EventToXI((InternalEvent*)event, &xE, &count); @@ -3555,6 +3587,23 @@ CheckPassiveGrabsOnWindow( "(%d, %d).\n", device->name, event->type, rc); continue; } + mask = grab->eventMask; + if (grab->ownerEvents && wOtherInputMasks(grab->window)) + { + InputClientsPtr icp = + wOtherInputMasks(grab->window)->inputClients; + + while(icp) + { + if (rClient(icp) == rClient(grab)) + { + mask |= icp->mask[device->id]; + break; + } + + icp = icp->next; + } + } } (*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE); @@ -3563,8 +3612,7 @@ CheckPassiveGrabsOnWindow( { FixUpEventFromWindow(device, xE, grab->window, None, TRUE); - TryClientEvents(rClient(grab), device, xE, count, - GetEventFilter(device, xE), + TryClientEvents(rClient(grab), device, xE, count, mask, GetEventFilter(device, xE), grab); } |