diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-12-07 13:57:25 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-12-13 13:24:08 +1000 |
commit | d253a262c2c690357a4db7e235c48ab5dd0b77f8 (patch) | |
tree | bbf6d269be4cf006c70d82365b4e219314b9821c /dix | |
parent | 97d79dd740ed1ac4eb02b0d4135850f953716278 (diff) |
dix: split core grab interference check into helper function
No functional changes.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'dix')
-rw-r--r-- | dix/events.c | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/dix/events.c b/dix/events.c index 349d9b4e7..4d80358b5 100644 --- a/dix/events.c +++ b/dix/events.c @@ -3727,6 +3727,30 @@ ActivatePassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event) return TRUE; } +static BOOL +CoreGrabInterferes(DeviceIntPtr device, GrabPtr grab) +{ + DeviceIntPtr other; + BOOL interfering = FALSE; + + for (other = inputInfo.devices; other; other = other->next) + { + GrabPtr othergrab = other->deviceGrab.grab; + if (othergrab && othergrab->grabtype == GRABTYPE_CORE && + SameClient(grab, rClient(othergrab)) && + ((IsPointerDevice(grab->device) && + IsPointerDevice(othergrab->device)) || + (IsKeyboardDevice(grab->device) && + IsKeyboardDevice(othergrab->device)))) + { + interfering = TRUE; + break; + } + } + + return interfering; +} + /** * Check an individual grab against an event to determine if a passive grab * should be activated. @@ -3806,9 +3830,6 @@ CheckPassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event, if (grab->grabtype == GRABTYPE_CORE) { - DeviceIntPtr other; - BOOL interfering = FALSE; - /* A passive grab may have been created for a different device than it is assigned to at this point in time. Update the grab's device and modifier device to reflect the @@ -3822,21 +3843,7 @@ CheckPassiveGrab(DeviceIntPtr device, GrabPtr grab, InternalEvent *event, grab->modifierDevice = GetMaster(device, MASTER_KEYBOARD); } - for (other = inputInfo.devices; other; other = other->next) - { - GrabPtr othergrab = other->deviceGrab.grab; - if (othergrab && othergrab->grabtype == GRABTYPE_CORE && - SameClient(grab, rClient(othergrab)) && - ((IsPointerDevice(grab->device) && - IsPointerDevice(othergrab->device)) || - (IsKeyboardDevice(grab->device) && - IsKeyboardDevice(othergrab->device)))) - { - interfering = TRUE; - break; - } - } - if (interfering) + if (CoreGrabInterferes(device, grab)) return FALSE; } |