Input: Simplify CheckPassiveGrabsOnWindow loop

Instead of a mega never-ending if branch with no else, just continue
to the next iteration of the loop if the conditions aren't met - pretty
much entirely reindentation.

Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Daniel Stone 2011-01-19 20:42:10 +00:00 committed by Peter Hutterer
parent 00ba884556
commit 70cef8d8ba

View File

@ -3430,7 +3430,7 @@ CheckPassiveGrabsOnWindow(
DeviceIntPtr gdev; DeviceIntPtr gdev;
XkbSrvInfoPtr xkbi = NULL; XkbSrvInfoPtr xkbi = NULL;
xEvent *xE = NULL; xEvent *xE = NULL;
xEvent core; int count, rc;
gdev= grab->modifierDevice; gdev= grab->modifierDevice;
if (grab->grabtype == GRABTYPE_CORE) if (grab->grabtype == GRABTYPE_CORE)
@ -3478,12 +3478,10 @@ CheckPassiveGrabsOnWindow(
match = CORE_MATCH; match = CORE_MATCH;
} }
if (match && (!grab->confineTo || if (!match || (grab->confineTo &&
(grab->confineTo->realized && (!grab->confineTo->realized ||
BorderSizeNotEmpty(device, grab->confineTo)))) !BorderSizeNotEmpty(device, grab->confineTo))))
{ continue;
int rc, count = 0;
xEvent *xE = NULL;
grabinfo = &device->deviceGrab; grabinfo = &device->deviceGrab;
/* In some cases a passive core grab may exist, but the client /* In some cases a passive core grab may exist, but the client
@ -3534,29 +3532,28 @@ CheckPassiveGrabsOnWindow(
} }
else if (!GetXIType(event) && !GetCoreType(event)) else if (!GetXIType(event) && !GetCoreType(event))
{ {
ErrorF("Event type %d in CheckPassiveGrabsOnWindow is" ErrorF("Event type %d in CheckPassiveGrabsOnWindow is neither"
" neither XI 1.x nor core\n", event->any.type); " XI 1.x nor core\n", event->any.type);
return NULL; return NULL;
} }
/* The only consumers of corestate are Xi 1.x and core events, /* The only consumers of corestate are Xi 1.x and core events, which
* which are guaranteed to come from DeviceEvents. */ * are guaranteed to come from DeviceEvents. */
if (match & (XI_MATCH | CORE_MATCH)) if (match & (XI_MATCH | CORE_MATCH))
{ {
event->device_event.corestate &= 0x1f00; event->device_event.corestate &= 0x1f00;
event->device_event.corestate |= event->device_event.corestate |= tempGrab.modifiersDetail.exact &
tempGrab.modifiersDetail.exact & (~0x1f00); (~0x1f00);
} }
if (match & CORE_MATCH) if (match & CORE_MATCH)
{ {
rc = EventToCore((InternalEvent*)event, &xE, &count); rc = EventToCore(event, &xE, &count);
if (rc != Success) if (rc != Success)
{ {
if (rc != BadMatch) if (rc != BadMatch)
ErrorF("[dix] %s: core conversion failed in CPGFW " ErrorF("[dix] %s: core conversion failed in CPGFW "
"(%d, %d).\n", device->name, event->any.type, "(%d, %d).\n", device->name, event->any.type, rc);
rc);
continue; continue;
} }
} else if (match & XI2_MATCH) } else if (match & XI2_MATCH)
@ -3566,8 +3563,7 @@ CheckPassiveGrabsOnWindow(
{ {
if (rc != BadMatch) if (rc != BadMatch)
ErrorF("[dix] %s: XI2 conversion failed in CPGFW " ErrorF("[dix] %s: XI2 conversion failed in CPGFW "
"(%d, %d).\n", device->name, event->any.type, "(%d, %d).\n", device->name, event->any.type, rc);
rc);
continue; continue;
} }
count = 1; count = 1;
@ -3578,8 +3574,7 @@ CheckPassiveGrabsOnWindow(
{ {
if (rc != BadMatch) if (rc != BadMatch)
ErrorF("[dix] %s: XI conversion failed in CPGFW " ErrorF("[dix] %s: XI conversion failed in CPGFW "
"(%d, %d).\n", device->name, event->any.type, "(%d, %d).\n", device->name, event->any.type, rc);
rc);
continue; continue;
} }
} }
@ -3607,7 +3602,6 @@ CheckPassiveGrabsOnWindow(
free(xE); free(xE);
return grab; return grab;
} }
}
return NULL; return NULL;
#undef CORE_MATCH #undef CORE_MATCH
#undef XI_MATCH #undef XI_MATCH