summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--PARAMETER3
-rw-r--r--synaptics.c30
-rw-r--r--synaptics.h2
3 files changed, 34 insertions, 1 deletions
diff --git a/PARAMETER b/PARAMETER
index aab36b7..d01d0f0 100644
--- a/PARAMETER
+++ b/PARAMETER
@@ -14,3 +14,6 @@ Repeater String repeater device
MinSpeed Float min. Speed-factor
MaxSpeed Float max. Speed-factor
AccelFactor Float acceleration-factor
+UpDownScrolling Bool If on, the up/down buttons generate button 4/5 events.
+ If off, the up button generates a double click and
+ the down button generates a button 2 event.
diff --git a/synaptics.c b/synaptics.c
index c5d33a2..9e5abdb 100644
--- a/synaptics.c
+++ b/synaptics.c
@@ -225,6 +225,8 @@ SynapticsPreInit(InputDriverPtr drv, IDevPtr dev, int flags)
priv->synpara->scroll_dist_horiz = xf86SetIntOption(local->options, "HorizScrollDelta", 100);
priv->synpara->edge_motion_speed = xf86SetIntOption(local->options, "EdgeMotionSpeed", 40);
priv->synpara->repeater = xf86SetStrOption(local->options, "Repeater", NULL);
+ priv->synpara->updown_button_scrolling = xf86SetBoolOption(local->options, "UpDownScrolling", TRUE);
+
str_par = xf86FindOptionValue(local->options, "MinSpeed");
if((!str_par) || (xf86sscanf(str_par, "%lf", &priv->synpara->min_speed) != 1))
priv->synpara->min_speed=0.02;
@@ -582,6 +584,32 @@ ReadInput(LocalDevicePtr local)
left = right = FALSE;
}
+ /* Up/Down-button scrolling or middle/double-click */
+ if (!para->updown_button_scrolling)
+ {
+ if (down)
+ { /* map down-button to middle-button */
+ mid = TRUE;
+ }
+
+ if (up)
+ { /* up-button generates double-click */
+ switch (DIFF_TIME(priv->count_packet, priv->count_double_click))
+ { /* double click sequenz */
+ case 1: left = TRUE; break;
+ case 2: left = FALSE; break;
+ case 3: left = TRUE; break;
+ default: left = FALSE;
+ }
+ }
+ else
+ {
+ priv->count_double_click = priv->count_packet;
+ }
+ /* reset up/down button events */
+ up = down = FALSE;
+ }
+
/* finger detection thru pressure an threshold */
finger = (((z > para->finger_high) && !priv->finger_flag) ||
((z > para->finger_low) && priv->finger_flag));
@@ -878,7 +906,7 @@ ReadInput(LocalDevicePtr local)
/* repeat timer for up/down buttons */
/* when you press a button the packets will only send for a second, so
we have to use a timer for repeating */
- if(up || down)
+ if((up || down) && para->updown_button_scrolling)
{
if(!priv->repeat_timer)
{
diff --git a/synaptics.h b/synaptics.h
index c627786..5c191cd 100644
--- a/synaptics.h
+++ b/synaptics.h
@@ -40,6 +40,7 @@ typedef struct _SynapticsSHM {
double min_speed, max_speed, accl; /* movement parameters */
int edge_motion_speed; /* Edge motion speed when dragging */
char* repeater; /* Repeater on or off */
+ Bool updown_button_scrolling; /* Up/Down-Button scrolling or middle/double-click */
} SynapticsSHM, *SynapticsSHMPtr;
typedef struct _SynapticsPrivateRec
@@ -69,6 +70,7 @@ typedef struct _SynapticsPrivateRec
unsigned int count_packet; /* packet counter */
unsigned int count_packet_tapping; /* packet counter for tapping */
unsigned int count_button_delay; /* button delay for 3rd button emulation */
+ unsigned int count_double_click; /* counter for double click */
Bool finger_flag; /* previous finger */
Bool tap, drag, doubletap; /* feature flags */
Bool tap_left, tap_mid, tap_right; /* tapping buttons */