diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-06-22 15:55:23 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2012-06-22 15:55:23 +1000 |
commit | 33c5bfc702645e603312aeb5380c53afeaad1dce (patch) | |
tree | e265f47f0e49090d46f55d39ec448fe4966fc224 /src/eventcomm.c | |
parent | 0e222876d7da7acbaaf955c2e7b7efdf3549bde9 (diff) |
eventcomm: simplify conditions
As of 3f9794a8a0f019a4b153941c9ec1927c7797ce6f, slot_index is always >= 0
when we get to either of these conditions.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
Diffstat (limited to 'src/eventcomm.c')
-rw-r--r-- | src/eventcomm.c | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/src/eventcomm.c b/src/eventcomm.c index f6c9070..84f929f 100644 --- a/src/eventcomm.c +++ b/src/eventcomm.c @@ -557,14 +557,8 @@ EventProcessTouchEvent(InputInfoPtr pInfo, struct SynapticsHwState *hw, if (ev->value >= 0) { hw->slot_state[slot_index] = SLOTSTATE_OPEN; proto_data->num_touches++; - - if (slot_index >= 0) - valuator_mask_copy(hw->mt_mask[slot_index], - proto_data->last_mt_vals[slot_index]); - else - xf86IDrvMsg(pInfo, X_WARNING, - "Attempted to copy values from out-of-range " - "slot, touch events may be incorrect.\n"); + valuator_mask_copy(hw->mt_mask[slot_index], + proto_data->last_mt_vals[slot_index]); } else if (hw->slot_state[slot_index] != SLOTSTATE_EMPTY) { hw->slot_state[slot_index] = SLOTSTATE_CLOSE; @@ -572,22 +566,19 @@ EventProcessTouchEvent(InputInfoPtr pInfo, struct SynapticsHwState *hw, } } else { + ValuatorMask *mask = proto_data->last_mt_vals[slot_index]; int map = proto_data->axis_map[ev->code - ABS_MT_TOUCH_MAJOR]; + int last_val = valuator_mask_get(mask, map); valuator_mask_set(hw->mt_mask[slot_index], map, ev->value); - if (slot_index >= 0) { - ValuatorMask *mask = proto_data->last_mt_vals[slot_index]; - int last_val = valuator_mask_get(mask, map); - - if (EventTouchSlotPreviouslyOpen(priv, slot_index)) { - if (ev->code == ABS_MT_POSITION_X) - hw->cumulative_dx += ev->value - last_val; - else if (ev->code == ABS_MT_POSITION_Y) - hw->cumulative_dy += ev->value - last_val; - } - - valuator_mask_set(mask, map, ev->value); + if (EventTouchSlotPreviouslyOpen(priv, slot_index)) { + if (ev->code == ABS_MT_POSITION_X) + hw->cumulative_dx += ev->value - last_val; + else if (ev->code == ABS_MT_POSITION_Y) + hw->cumulative_dy += ev->value - last_val; } + + valuator_mask_set(mask, map, ev->value); } } } |