diff options
-rw-r--r-- | synaptics.c | 24 | ||||
-rw-r--r-- | synaptics.h | 2 |
2 files changed, 14 insertions, 12 deletions
diff --git a/synaptics.c b/synaptics.c index 9e5abdb..086e73f 100644 --- a/synaptics.c +++ b/synaptics.c @@ -510,6 +510,7 @@ ReadInput(LocalDevicePtr local) double speed, integral; int change; int scroll_up, scroll_down, scroll_left, scroll_right; + int double_click; /* * set blocking to -1 on the first call because we know there is data to @@ -585,6 +586,7 @@ ReadInput(LocalDevicePtr local) } /* Up/Down-button scrolling or middle/double-click */ + double_click = FALSE; if (!para->updown_button_scrolling) { if (down) @@ -594,18 +596,11 @@ ReadInput(LocalDevicePtr local) 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; + if (!priv->prev_up) + double_click = TRUE; } + priv->prev_up = up; + /* reset up/down button events */ up = down = FALSE; } @@ -951,6 +946,13 @@ ReadInput(LocalDevicePtr local) xf86PostButtonEvent(local->dev, FALSE, 7, TRUE, 0, 0); xf86PostButtonEvent(local->dev, FALSE, 7, FALSE, 0, 0); } + if (double_click) { + int i; + for (i = 0; i < 2; i++) { + xf86PostButtonEvent(local->dev, FALSE, 1, !left, 0, 0); + xf86PostButtonEvent(local->dev, FALSE, 1, left, 0, 0); + } + } } } diff --git a/synaptics.h b/synaptics.h index 5c191cd..c45b0fd 100644 --- a/synaptics.h +++ b/synaptics.h @@ -70,7 +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 */ + unsigned int prev_up; /* Previous up button value, for double click emulation */ Bool finger_flag; /* previous finger */ Bool tap, drag, doubletap; /* feature flags */ Bool tap_left, tap_mid, tap_right; /* tapping buttons */ |