Revert "dix: use the event mask of the grab for TryClientEvents."
Behaviour of earlier X servers was to deliver the ButtonPress event
unconditionally, regardless of the actual event mask being set. Thus, a
GrabButton event will always deliver the button press event, a GrabKey
always the key press event, etc. Same goes for XI and XI2.
Reproducible with a simple client requesting a button grab in the form of:
XGrabButton(dpy, AnyButton, AnyModifier, win, True, ButtonReleaseMask,
GrabModeAsync, GrabModeAsync, None, None);
On servers before MPX/XI2, the client will receive a button press and
release event. On current servers, the client receives only the release.
Clients that expect the press event to be delivered unconditionally may
leave the user with a stuck grab.
XTS test results for XGrabButton are identical with and without this patch.
This reverts commit 48585bd1e3
.
Conflicts:
dix/events.c
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
3b3c77b870
commit
018c878e94
52
dix/events.c
52
dix/events.c
|
@ -3420,7 +3420,6 @@ CheckPassiveGrabsOnWindow(
|
||||||
{
|
{
|
||||||
DeviceIntPtr gdev;
|
DeviceIntPtr gdev;
|
||||||
XkbSrvInfoPtr xkbi = NULL;
|
XkbSrvInfoPtr xkbi = NULL;
|
||||||
Mask mask = 0;
|
|
||||||
|
|
||||||
gdev= grab->modifierDevice;
|
gdev= grab->modifierDevice;
|
||||||
if (grab->grabtype == GRABTYPE_CORE)
|
if (grab->grabtype == GRABTYPE_CORE)
|
||||||
|
@ -3535,9 +3534,6 @@ CheckPassiveGrabsOnWindow(
|
||||||
}
|
}
|
||||||
xE = &core;
|
xE = &core;
|
||||||
count = 1;
|
count = 1;
|
||||||
mask = grab->eventMask;
|
|
||||||
if (grab->ownerEvents)
|
|
||||||
mask |= pWin->eventMask;
|
|
||||||
} else if (match & XI2_MATCH)
|
} else if (match & XI2_MATCH)
|
||||||
{
|
{
|
||||||
rc = EventToXI2((InternalEvent*)event, &xE);
|
rc = EventToXI2((InternalEvent*)event, &xE);
|
||||||
|
@ -3549,34 +3545,6 @@ CheckPassiveGrabsOnWindow(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
count = 1;
|
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
|
} else
|
||||||
{
|
{
|
||||||
rc = EventToXI((InternalEvent*)event, &xE, &count);
|
rc = EventToXI((InternalEvent*)event, &xE, &count);
|
||||||
|
@ -3587,23 +3555,6 @@ CheckPassiveGrabsOnWindow(
|
||||||
"(%d, %d).\n", device->name, event->type, rc);
|
"(%d, %d).\n", device->name, event->type, rc);
|
||||||
continue;
|
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);
|
(*grabinfo->ActivateGrab)(device, grab, currentTime, TRUE);
|
||||||
|
@ -3612,7 +3563,8 @@ CheckPassiveGrabsOnWindow(
|
||||||
{
|
{
|
||||||
FixUpEventFromWindow(device, xE, grab->window, None, TRUE);
|
FixUpEventFromWindow(device, xE, grab->window, None, TRUE);
|
||||||
|
|
||||||
TryClientEvents(rClient(grab), device, xE, count, mask,
|
TryClientEvents(rClient(grab), device, xE, count,
|
||||||
|
GetEventFilter(device, xE),
|
||||||
GetEventFilter(device, xE), grab);
|
GetEventFilter(device, xE), grab);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user