summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2010-08-03 19:40:26 -0700
committerPeter Hutterer <peter.hutterer@who-t.net>2010-10-13 15:58:04 +1000
commitc360b3eb1deeac51913e7b1286b2767711c541fc (patch)
tree84e98af2a534edfd1f16ecc45cb1fa131390cec2
parent853d7ebfa3e2d281d92890a39010ff5787a00ffd (diff)
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>
-rw-r--r--dix/events.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/dix/events.c b/dix/events.c
index 07f7b1f6b..e03e58c02 100644
--- a/dix/events.c
+++ b/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)