diff options
author | Stephen Chandler Paul <thatslyude@gmail.com> | 2014-03-10 18:25:20 -0400 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2014-03-12 11:28:16 +1000 |
commit | 9a419ba01c53a38b4b601f4415801fca29a2b4e2 (patch) | |
tree | 23f96b1b4cede222fad7b2b12bc1daf4922f4580 /src/synaptics.c | |
parent | 2e5c0cf4395a0cf7b024495deab75f4ebe949e9a (diff) |
Replace is_inside_anybutton_area with current_button_area
Signed-off-by: Stephen Chandler Paul <thatslyude@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src/synaptics.c')
-rw-r--r-- | src/synaptics.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/src/synaptics.c b/src/synaptics.c index 3ae67f9..23175b1 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -1022,7 +1022,7 @@ SynapticsReset(SynapticsPrivate * priv) priv->finger_state = FS_UNTOUCHED; priv->last_motion_millis = 0; priv->clickpad_click_millis = 0; - priv->inside_button_area = FALSE; + priv->last_button_area = NO_BUTTON_AREA; priv->tap_state = TS_START; priv->tap_button = 0; priv->tap_button_state = TBS_BUTTON_UP; @@ -1564,12 +1564,15 @@ is_inside_top_or_bottom_button_area(SynapticsParameters * para, int offset, return inside_area; } -static Bool -is_inside_anybutton_area(SynapticsParameters * para, int x, int y) +static enum SoftButtonAreas +current_button_area(SynapticsParameters * para, int x, int y) { - return - is_inside_top_or_bottom_button_area(para, BOTTOM_BUTTON_AREA, x, y) || - is_inside_top_or_bottom_button_area(para, TOP_BUTTON_AREA, x, y); + if (is_inside_top_or_bottom_button_area(para, BOTTOM_BUTTON_AREA, x, y)) + return BOTTOM_BUTTON_AREA; + else if (is_inside_top_or_bottom_button_area(para, TOP_BUTTON_AREA, x, y)) + return TOP_BUTTON_AREA; + else + return NO_BUTTON_AREA; } static CARD32 @@ -3119,13 +3122,15 @@ HandleState(InputInfoPtr pInfo, struct SynapticsHwState *hw, CARD32 now, /* Ignore motion *starting* inside softbuttonareas */ if (priv->finger_state < FS_TOUCHED) - priv->inside_button_area = is_inside_anybutton_area(para, hw->x, hw->y); - /* If we already have a finger down, clear inside_button_area if it goes + priv->last_button_area = current_button_area(para, hw->x, hw->y); + /* If we already have a finger down, clear last_button_area if it goes outside of the softbuttonareas */ - else if (priv->inside_button_area && !is_inside_anybutton_area(para, hw->x, hw->y)) - priv->inside_button_area = FALSE; + else if (priv->last_button_area != NO_BUTTON_AREA && + current_button_area(para, hw->x, hw->y) == NO_BUTTON_AREA) + priv->last_button_area = NO_BUTTON_AREA; - ignore_motion = !using_cumulative_coords && priv->inside_button_area; + ignore_motion = + !using_cumulative_coords && priv->last_button_area != NO_BUTTON_AREA; /* these two just update hw->left, right, etc. */ update_hw_button_state(pInfo, hw, now, &delay); |