aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2011-10-26 13:09:30 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-11-11 15:50:36 +1000
commit9411749f76c31a8054ded62a6fb767c8135b4d4e (patch)
treec263455992e7ba25ace32a26fb3965a6a9aa6d5d
parentSimplify a condition, only the event type differs here (diff)
downloadxf86-input-evdev-9411749f76c31a8054ded62a6fb767c8135b4d4e.tar.gz
xf86-input-evdev-9411749f76c31a8054ded62a6fb767c8135b4d4e.tar.bz2
xf86-input-evdev-9411749f76c31a8054ded62a6fb767c8135b4d4e.zip
Replace open_slot/close_slot with a SlotState enum
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--src/evdev.c11
-rw-r--r--src/evdev.h9
2 files changed, 12 insertions, 8 deletions
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