Let CheckPassiveGrabsOnWindow callers check if device is already grabbed.
CheckDeviceGrabs checked all the ancestors of the window containing this device's pointer even if no new grabs could possibly apply due to the device already being grabbed. ActivateFocusInGrab and ActivateEnterGrab already checked whether they should break an existing grab, and then set up an event that was completely ignored if they didn't actually break the grab. In both cases, just do what we would have done eventually anyway--return FALSE from CheckPassiveGrabsOnWindow's caller--but do it sooner. Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
853d7ebfa3
commit
c360b3eb1d
22
dix/events.c
22
dix/events.c
|
@ -2648,11 +2648,11 @@ ActivateFocusInGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win)
|
|||
BOOL rc = FALSE;
|
||||
DeviceEvent event;
|
||||
|
||||
if (dev->deviceGrab.grab &&
|
||||
dev->deviceGrab.fromPassiveGrab &&
|
||||
dev->deviceGrab.grab->type == XI_Enter)
|
||||
if (dev->deviceGrab.grab)
|
||||
{
|
||||
if (dev->deviceGrab.grab->window == win ||
|
||||
if (!dev->deviceGrab.fromPassiveGrab ||
|
||||
dev->deviceGrab.grab->type != XI_Enter ||
|
||||
dev->deviceGrab.grab->window == win ||
|
||||
IsParent(dev->deviceGrab.grab->window, win))
|
||||
return FALSE;
|
||||
DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab);
|
||||
|
@ -2688,11 +2688,11 @@ ActivateEnterGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win)
|
|||
BOOL rc = FALSE;
|
||||
DeviceEvent event;
|
||||
|
||||
if (dev->deviceGrab.grab &&
|
||||
dev->deviceGrab.fromPassiveGrab &&
|
||||
dev->deviceGrab.grab->type == XI_Enter)
|
||||
if (dev->deviceGrab.grab)
|
||||
{
|
||||
if (dev->deviceGrab.grab->window == win ||
|
||||
if (!dev->deviceGrab.fromPassiveGrab ||
|
||||
dev->deviceGrab.grab->type != XI_Enter ||
|
||||
dev->deviceGrab.grab->window == win ||
|
||||
IsParent(dev->deviceGrab.grab->window, win))
|
||||
return FALSE;
|
||||
DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab);
|
||||
|
@ -3403,9 +3403,6 @@ CheckPassiveGrabsOnWindow(
|
|||
#define XI2_MATCH 0x4
|
||||
int match = 0;
|
||||
|
||||
if (device->deviceGrab.grab)
|
||||
return FALSE;
|
||||
|
||||
if (!grab)
|
||||
return FALSE;
|
||||
/* Fill out the grab details, but leave the type for later before
|
||||
|
@ -3629,6 +3626,9 @@ CheckDeviceGrabs(DeviceIntPtr device, DeviceEvent *event, int checkFirst)
|
|||
&& (device->button->buttonsDown != 1))
|
||||
return FALSE;
|
||||
|
||||
if (device->deviceGrab.grab)
|
||||
return FALSE;
|
||||
|
||||
i = checkFirst;
|
||||
|
||||
if (focus)
|
||||
|
|
Loading…
Reference in New Issue