mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 02:20:30 +01:00
fallback: change a list of if conditions to a switch statement
This used to do a lot more but now it can be handled as simple switch statement. Bonus: we get to log a bug if we ever get here in NONE state. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
e55c54e2b9
commit
da0a630f14
1 changed files with 12 additions and 3 deletions
|
|
@ -825,23 +825,32 @@ fallback_handle_state(struct fallback_dispatch *dispatch,
|
|||
if (!slot->dirty)
|
||||
continue;
|
||||
|
||||
if (slot->state == SLOT_STATE_BEGIN) {
|
||||
switch (slot->state) {
|
||||
case SLOT_STATE_BEGIN:
|
||||
sent = fallback_flush_mt_down(dispatch,
|
||||
device,
|
||||
i,
|
||||
time);
|
||||
slot->state = SLOT_STATE_UPDATE;
|
||||
} else if (slot->state == SLOT_STATE_UPDATE) {
|
||||
break;
|
||||
case SLOT_STATE_UPDATE:
|
||||
sent = fallback_flush_mt_motion(dispatch,
|
||||
device,
|
||||
i,
|
||||
time);
|
||||
} else if (slot->state == SLOT_STATE_END) {
|
||||
break;
|
||||
case SLOT_STATE_END:
|
||||
sent = fallback_flush_mt_up(dispatch,
|
||||
device,
|
||||
i,
|
||||
time);
|
||||
slot->state = SLOT_STATE_NONE;
|
||||
break;
|
||||
case SLOT_STATE_NONE:
|
||||
/* touch arbitration may swallow the begin,
|
||||
* so we may get updates for a touch still
|
||||
* in NONE state */
|
||||
break;
|
||||
}
|
||||
|
||||
slot->dirty = false;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue