diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2010-05-06 15:21:39 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2010-05-10 13:33:48 +1000 |
commit | 1b612c0bbcd8b287ac4f7cb8ba3354b0e0a63949 (patch) | |
tree | 2d3ff9f7a50033bd9e5cfd0901ce4f264c986f85 | |
parent | 9076f06b1b70a92ab582ce68a73fdaa169dfe69f (diff) |
Factor out updating the hardware state.
No functional changes.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
-rw-r--r-- | src/synaptics.c | 55 |
1 files changed, 32 insertions, 23 deletions
diff --git a/src/synaptics.c b/src/synaptics.c index 38155a1..5d5ca89 100644 --- a/src/synaptics.c +++ b/src/synaptics.c @@ -2127,6 +2127,37 @@ adjust_state_from_scrollbuttons(const LocalDevicePtr local, struct SynapticsHwSt } static void +update_hw_button_state(const LocalDevicePtr local, struct SynapticsHwState *hw, int *delay) +{ + SynapticsPrivate *priv = (SynapticsPrivate *) (local->private); + SynapticsParameters *para = &priv->synpara; + + /* Treat the first two multi buttons as up/down for now. */ + hw->up |= hw->multi[0]; + hw->down |= hw->multi[1]; + + if (!para->guestmouse_off) { + hw->left |= hw->guest_left; + hw->middle |= hw->guest_mid; + hw->right |= hw->guest_right; + } + + /* 3rd button emulation */ + hw->middle |= HandleMidButtonEmulation(priv, hw, delay); + + /* Fingers emulate other buttons */ + if(hw->left && hw->numFingers >= 1){ + HandleClickWithFingers(para, hw); + } + + /* Two finger emulation */ + if (hw->numFingers == 1 && hw->z >= para->emulate_twofinger_z && + hw->fingerWidth >= para->emulate_twofinger_w) { + hw->numFingers = 2; + } +} + +static void post_button_click(const LocalDevicePtr local, const int button) { xf86PostButtonEvent(local->dev, FALSE, button, TRUE, 0, 0); @@ -2177,29 +2208,7 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState *hw) if (para->touchpad_off == 1) return delay; - /* Treat the first two multi buttons as up/down for now. */ - hw->up |= hw->multi[0]; - hw->down |= hw->multi[1]; - - if (!para->guestmouse_off) { - hw->left |= hw->guest_left; - hw->middle |= hw->guest_mid; - hw->right |= hw->guest_right; - } - - /* 3rd button emulation */ - hw->middle |= HandleMidButtonEmulation(priv, hw, &delay); - - /* Fingers emulate other buttons */ - if(hw->left && hw->numFingers >= 1){ - HandleClickWithFingers(para, hw); - } - - /* Two finger emulation */ - if (hw->numFingers == 1 && hw->z >= para->emulate_twofinger_z && - hw->fingerWidth >= para->emulate_twofinger_w) { - hw->numFingers = 2; - } + update_hw_button_state(local, hw, &delay); double_click = adjust_state_from_scrollbuttons(local, hw); |