diff options
author | Jamey Sharp <jamey@minilop.net> | 2010-08-04 11:44:05 -0700 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2010-10-13 15:58:07 +1000 |
commit | 32de0c19075b886c2fc03f6ad73d9c15df1b2309 (patch) | |
tree | 2290fb04eb272a356bf56189e42e89aa11ce5a2b /dix/events.c | |
parent | 1c1811ecafc144151630b3588394e2c345c53aa4 (diff) |
Move replay-window check from ComputeFreezes to CheckDeviceGrabs.
This just simplifies ComputeFreezes, eliminating some duplicated code
and a goto.
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>
Diffstat (limited to 'dix/events.c')
-rw-r--r-- | dix/events.c | 46 |
1 files changed, 19 insertions, 27 deletions
diff --git a/dix/events.c b/dix/events.c index 51a04d526..01cec7bca 100644 --- a/dix/events.c +++ b/dix/events.c @@ -1276,7 +1276,6 @@ static void ComputeFreezes(void) { DeviceIntPtr replayDev = syncEvents.replayDev; - int i; WindowPtr w; GrabPtr grab; DeviceIntPtr dev; @@ -1294,29 +1293,15 @@ ComputeFreezes(void) syncEvents.replayDev = (DeviceIntPtr)NULL; w = XYToWindow(replayDev, event->root_x, event->root_y); - for (i = 0; i < replayDev->spriteInfo->sprite->spriteTraceGood; i++) - { - if (syncEvents.replayWin == - replayDev->spriteInfo->sprite->spriteTrace[i]) - { - if (!CheckDeviceGrabs(replayDev, event, i+1)) { - if (replayDev->focus && !IsPointerEvent((InternalEvent*)event)) - DeliverFocusedEvent(replayDev, (InternalEvent*)event, w); - else - DeliverDeviceEvents(w, (InternalEvent*)event, NullGrab, - NullWindow, replayDev); - } - goto playmore; - } - } - /* must not still be in the same stack */ - if (replayDev->focus && !IsPointerEvent((InternalEvent*)event)) - DeliverFocusedEvent(replayDev, (InternalEvent*)event, w); - else - DeliverDeviceEvents(w, (InternalEvent*)event, NullGrab, - NullWindow, replayDev); + if (!CheckDeviceGrabs(replayDev, event, syncEvents.replayWin)) + { + if (replayDev->focus && !IsPointerEvent((InternalEvent*)event)) + DeliverFocusedEvent(replayDev, (InternalEvent*)event, w); + else + DeliverDeviceEvents(w, (InternalEvent*)event, NullGrab, + NullWindow, replayDev); + } } -playmore: for (dev = inputInfo.devices; dev; dev = dev->next) { if (!dev->deviceGrab.sync.frozen) @@ -3611,7 +3596,7 @@ CheckPassiveGrabsOnWindow( */ Bool -CheckDeviceGrabs(DeviceIntPtr device, DeviceEvent *event, int checkFirst) +CheckDeviceGrabs(DeviceIntPtr device, DeviceEvent *event, WindowPtr ancestor) { int i; WindowPtr pWin = NULL; @@ -3629,7 +3614,15 @@ CheckDeviceGrabs(DeviceIntPtr device, DeviceEvent *event, int checkFirst) if (device->deviceGrab.grab) return FALSE; - i = checkFirst; + i = 0; + if (ancestor) + { + while (i < device->spriteInfo->sprite->spriteTraceGood) + if (device->spriteInfo->sprite->spriteTrace[i++] == ancestor) + break; + if (i == device->spriteInfo->sprite->spriteTraceGood) + return FALSE; + } if (focus) { @@ -3642,8 +3635,7 @@ CheckDeviceGrabs(DeviceIntPtr device, DeviceEvent *event, int checkFirst) if ((focus->win == NoneWin) || (i >= device->spriteInfo->sprite->spriteTraceGood) || - ((i > checkFirst) && - (pWin != device->spriteInfo->sprite->spriteTrace[i-1]))) + (pWin && pWin != device->spriteInfo->sprite->spriteTrace[i-1])) return FALSE; } |