diff options
author | Peter Osterlund <petero2@telia.com> | 2003-12-16 22:42:14 +0100 |
---|---|---|
committer | Peter Osterlund <petero2@telia.com> | 2006-04-09 04:01:33 +0200 |
commit | 14ae2733772d87f6205d46e57672d6acd37666f0 (patch) | |
tree | 68c7782245e53c0b657d16b114478d24e1a0c39f | |
parent | 90f04a3309544d56e0e1ea845276993599f63167 (diff) |
Made tap processing configurable. Patch from Justin Quek
<quek@crhc.uiuc.edu>, cleaned up somewhat by me.
-rw-r--r-- | README | 14 | ||||
-rw-r--r-- | synaptics.c | 38 | ||||
-rw-r--r-- | synaptics.h | 12 | ||||
-rw-r--r-- | synclient.c | 7 |
4 files changed, 65 insertions, 6 deletions
@@ -93,6 +93,20 @@ TouchpadOff Bool If on, the Touchpad is switched off (useful LockedDrags Bool If off, a tap and drag gesture ends when you release the finger. If on, the gesture is active until you tap a second time. +RTCornerButton Int Which mouse button is reported on a right top corner tap + 0=No action, 1=Left Button, 2=Middle Button, 3=Right Button +RBCornerButton Int Which mouse button is reported on a right bottom corner tap + 0=No action, 1=Left Button, 2=Middle Button, 3=Right Button +LTCornerButton Int Which mouse button is reported on a left top corner tap + 0=No action, 1=Left Button, 2=Middle Button, 3=Right Button +LBCornerButton Int Which mouse button is reported on a left bottom corner tap + 0=No action, 1=Left Button, 2=Middle Button, 3=Right Button +TapButton1 Int Which mouse button is reported on a non-corner one-finger tap + 0=No action, 1=Left Button, 2=Middle Button, 3=Right Button +TapButton2 Int Which mouse button is reported on a non-corner two-finger tap + 0=No action, 1=Left Button, 2=Middle Button, 3=Right Button +TapButton3 Int Which mouse button is reported on a non-corner three-finger tap + 0=No action, 1=Left Button, 2=Middle Button, 3=Right Button A tap event happens when the finger is touched and released in a time interval shorter than MaxTapTime, and the touch and release diff --git a/synaptics.c b/synaptics.c index d504295..baaae61 100644 --- a/synaptics.c +++ b/synaptics.c @@ -327,6 +327,13 @@ SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags) priv->synpara->updown_button_scrolling = xf86SetBoolOption(local->options, "UpDownScrolling", TRUE); priv->synpara->touchpad_off = xf86SetBoolOption(local->options, "TouchpadOff", FALSE); priv->synpara->locked_drags = xf86SetBoolOption(local->options, "LockedDrags", FALSE); + priv->synpara->tap_action[RT_TAP] = xf86SetIntOption(local->options, "RTCornerButton", 2); + priv->synpara->tap_action[RB_TAP] = xf86SetIntOption(local->options, "RBCornerButton", 3); + priv->synpara->tap_action[LT_TAP] = xf86SetIntOption(local->options, "LTCornerButton", 0); + priv->synpara->tap_action[LB_TAP] = xf86SetIntOption(local->options, "LBCornerButton", 0); + priv->synpara->tap_action[F1_TAP] = xf86SetIntOption(local->options, "TapButton1", 1); + priv->synpara->tap_action[F2_TAP] = xf86SetIntOption(local->options, "TapButton2", 2); + priv->synpara->tap_action[F3_TAP] = xf86SetIntOption(local->options, "TapButton3", 3); str_par = xf86FindOptionValue(local->options, "MinSpeed"); if ((!str_par) || (xf86sscanf(str_par, "%lf", &priv->synpara->min_speed) != 1)) @@ -763,6 +770,23 @@ SynapticsDetectFinger(SynapticsPrivate *priv, struct SynapticsHwState *hw) return finger; } +static void +ReportTap(SynapticsPrivate *priv, TapEvent tap) +{ + int button = priv->synpara->tap_action[tap]; + switch (button) { + case 1: + priv->tap_left = TRUE; + break; + case 2: + priv->tap_mid = TRUE; + break; + case 3: + priv->tap_right = TRUE; + break; + } +} + /* * React on changes in the hardware state. This function is called every time * the hardware state changes. The return value is used to specify how many @@ -873,35 +897,37 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState* hw) switch (edge) { case RIGHT_TOP_EDGE: DBG(7, ErrorF("right top edge\n")); - priv->tap_mid = TRUE; + ReportTap(priv, RT_TAP); break; case RIGHT_BOTTOM_EDGE: DBG(7, ErrorF("right bottom edge\n")); - priv->tap_right = TRUE; + ReportTap(priv, RB_TAP); break; case LEFT_TOP_EDGE: DBG(7, ErrorF("left top edge\n")); + ReportTap(priv, LT_TAP); break; case LEFT_BOTTOM_EDGE: DBG(7, ErrorF("left bottom edge\n")); + ReportTap(priv, LB_TAP); break; default: DBG(7, ErrorF("no edge\n")); - priv->tap_left = TRUE; + ReportTap(priv, F1_TAP); } } else { switch (priv->finger_count) { case 2: DBG(7, ErrorF("two finger tap\n")); - priv->tap_mid = TRUE; + ReportTap(priv, F2_TAP); break; case 3: DBG(7, ErrorF("three finger tap\n")); - priv->tap_right = TRUE; + ReportTap(priv, F3_TAP); break; default: DBG(7, ErrorF("one finger\n")); - priv->tap_left = TRUE; + ReportTap(priv, F1_TAP); } } } diff --git a/synaptics.h b/synaptics.h index fa67c12..156d66a 100644 --- a/synaptics.h +++ b/synaptics.h @@ -7,6 +7,17 @@ * Public definitions. * Used by driver and the shared memory configurator *****************************************************************************/ +typedef enum { + RT_TAP = 0, /* Right top corner */ + RB_TAP, /* Right bottom corner */ + LT_TAP, /* Left top corner */ + LB_TAP, /* Left bottom corner */ + F1_TAP, /* Non-corner tap, one finger */ + F2_TAP, /* Non-corner tap, two fingers */ + F3_TAP, /* Non-corner tap, three fingers */ + MAX_TAP +} TapEvent; + #define SHM_SYNAPTICS 23947 typedef struct _SynapticsSHM { @@ -42,6 +53,7 @@ typedef struct _SynapticsSHM Bool updown_button_scrolling; /* Up/Down-Button scrolling or middle/double-click */ Bool touchpad_off; /* Switches the Touchpad off*/ Bool locked_drags; /* Enable locked drags */ + int tap_action[MAX_TAP]; /* Button to report on tap events */ } SynapticsSHM; #ifdef SYNAPTICS_PRIVATE diff --git a/synclient.c b/synclient.c index 510bc66..390819d 100644 --- a/synclient.c +++ b/synclient.c @@ -63,6 +63,13 @@ static struct Parameter params[] = { DEFINE_PAR("UpDownScrolling", updown_button_scrolling, PT_BOOL, 0, 1), DEFINE_PAR("TouchpadOff", touchpad_off, PT_BOOL, 0, 1), DEFINE_PAR("LockedDrags", locked_drags, PT_BOOL, 0, 1), + DEFINE_PAR("RTCornerButton", tap_action[RT_TAP], PT_INT, 0, 3), + DEFINE_PAR("RBCornerButton", tap_action[RB_TAP], PT_INT, 0, 3), + DEFINE_PAR("LTCornerButton", tap_action[LT_TAP], PT_INT, 0, 3), + DEFINE_PAR("LBCornerButton", tap_action[LB_TAP], PT_INT, 0, 3), + DEFINE_PAR("TapButton1", tap_action[F1_TAP], PT_INT, 0, 3), + DEFINE_PAR("TapButton2", tap_action[F2_TAP], PT_INT, 0, 3), + DEFINE_PAR("TapButton3", tap_action[F3_TAP], PT_INT, 0, 3), { 0, 0, 0, 0, 0 } }; |