From 9411749f76c31a8054ded62a6fb767c8135b4d4e Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 26 Oct 2011 13:09:30 +1000 Subject: Replace open_slot/close_slot with a SlotState enum Signed-off-by: Peter Hutterer --- src/evdev.c | 11 +++++------ src/evdev.h | 9 +++++++-- 2 files changed, 12 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/evdev.c b/src/evdev.c index 97da9c8..b55a0aa 100644 --- a/src/evdev.c +++ b/src/evdev.c @@ -709,9 +709,9 @@ EvdevProcessTouch(InputInfoPtr pInfo) if (pEvdev->cur_slot < 0 || !pEvdev->mt_mask) return; - if (pEvdev->close_slot) + if (pEvdev->slot_state == SLOTSTATE_CLOSE) type = XI_TouchEnd; - else if (pEvdev->open_slot) + else if (pEvdev->slot_state == SLOTSTATE_OPEN) type = XI_TouchBegin; else type = XI_TouchUpdate; @@ -719,8 +719,7 @@ EvdevProcessTouch(InputInfoPtr pInfo) EvdevQueueTouchEvent(pInfo, pEvdev->cur_slot, pEvdev->mt_mask, type); - pEvdev->close_slot = 0; - pEvdev->open_slot = 0; + pEvdev->slot_state = SLOTSTATE_EMPTY; valuator_mask_zero(pEvdev->mt_mask); } @@ -736,9 +735,9 @@ EvdevProcessTouchEvent(InputInfoPtr pInfo, struct input_event *ev) pEvdev->cur_slot = ev->value; } else if (ev->code == ABS_MT_TRACKING_ID) { if (ev->value >= 0) - pEvdev->open_slot = 1; + pEvdev->slot_state = SLOTSTATE_OPEN; else - pEvdev->close_slot = 1; + pEvdev->slot_state = SLOTSTATE_CLOSE; } else { map = pEvdev->axis_map[ev->code] - pEvdev->num_vals; valuator_mask_set(pEvdev->mt_mask, map, ev->value); diff --git a/src/evdev.h b/src/evdev.h index c588b5d..165aea4 100644 --- a/src/evdev.h +++ b/src/evdev.h @@ -100,6 +100,12 @@ enum fkeymode { FKEYMODE_MMKEYS, /* function keys send multimedia keys */ }; +enum SlotState { + SLOTSTATE_OPEN = 8, + SLOTSTATE_CLOSE, + SLOTSTATE_EMPTY, +}; + /* axis specific data for wheel emulation */ typedef struct { int up_button; @@ -144,8 +150,7 @@ typedef struct { #ifdef MULTITOUCH ValuatorMask *mt_mask; int cur_slot; - BOOL close_slot; - BOOL open_slot; + enum SlotState slot_state; struct mtdev *mtdev; #endif -- cgit v1.2.3