diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2010-12-08 14:02:17 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2010-12-09 10:03:26 +1000 |
commit | aba8133c9c5a50753c388d76407868ac69f4134b (patch) | |
tree | 66e8e5b120503103d80b8fd438ba4e062b67159f /dix/getevents.c | |
parent | 2c70b650b342378898064cf27e2f95c4b2e53d24 (diff) |
dix: clear up an overly convoluted if statement.
No functional changes, just improves readability. This statement had things
added to/removed from it for a few server releases while the input event
queue was revamped. What made sense once is now mainly confusing.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'dix/getevents.c')
-rw-r--r-- | dix/getevents.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/dix/getevents.c b/dix/getevents.c index 25889de46..9feb2166b 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -1104,17 +1104,25 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons, if (!pDev->enabled) return 0; - ms = GetTimeInMillis(); /* before pointer update to help precision */ - - if (!scr || !pDev->valuator || - (type != MotionNotify && type != ButtonPress && type != ButtonRelease) || - (type != MotionNotify && !pDev->button) || - ((type == ButtonPress || type == ButtonRelease) && !buttons)) + if (!scr || !pDev->valuator) return 0; - if (type == MotionNotify && - (!mask_in || valuator_mask_num_valuators(mask_in) <= 0)) - return 0; + switch (type) + { + case MotionNotify: + if (!mask_in || valuator_mask_num_valuators(mask_in) <= 0) + return 0; + break; + case ButtonPress: + case ButtonRelease: + if (!pDev->button || !buttons) + return 0; + break; + default: + return 0; + } + + ms = GetTimeInMillis(); /* before pointer update to help precision */ events = UpdateFromMaster(events, pDev, DEVCHANGE_POINTER_EVENT, &num_events); |