summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Osterlund <petero2@telia.com>2004-02-25 18:31:07 +0100
committerPeter Osterlund <petero2@telia.com>2006-04-09 04:01:49 +0200
commit8307eaaced6e8192f0119b27cf9db091e4941352 (patch)
treed7d757862642b7e7e3709a891053083b9e465a2a
parentec6c36c16d5f7093f194595607bc9d2e1d114f5f (diff)
Added support for middle mouse buttons. (Some ALPS touchpads
have them.)
-rw-r--r--linux_input.h1
-rw-r--r--synaptics.c7
-rw-r--r--synaptics.h2
-rw-r--r--synclient.c9
4 files changed, 14 insertions, 5 deletions
diff --git a/linux_input.h b/linux_input.h
index c5b70e8..73f2b75 100644
--- a/linux_input.h
+++ b/linux_input.h
@@ -38,6 +38,7 @@ struct input_id {
#define BTN_LEFT 0x110
#define BTN_RIGHT 0x111
+#define BTN_MIDDLE 0x112
#define BTN_FORWARD 0x115
#define BTN_BACK 0x116
#define BTN_0 0x100
diff --git a/synaptics.c b/synaptics.c
index ab1fdb4..bc5280e 100644
--- a/synaptics.c
+++ b/synaptics.c
@@ -864,6 +864,7 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState* hw)
para->down = hw->down;
for (i = 0; i < 8; i++)
para->multi[i] = hw->multi[i];
+ para->middle = hw->middle;
para->guest_left = hw->guest_left;
para->guest_mid = hw->guest_mid;
para->guest_right = hw->guest_right;
@@ -880,6 +881,7 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState* hw)
/* 3rd button emulation */
mid = HandleMidButtonEmulation(priv, hw, &delay);
+ mid |= hw->middle;
/* Up/Down button scrolling or middle/double click */
double_click = FALSE;
@@ -1436,6 +1438,9 @@ SynapticsParseEventData(LocalDevicePtr local, SynapticsPrivate *priv,
case BTN_RIGHT:
hw->right = v;
break;
+ case BTN_MIDDLE:
+ hw->middle = v;
+ break;
case BTN_FORWARD:
hw->up = v;
break;
@@ -1548,7 +1553,7 @@ SynapticsParseRawPacket(LocalDevicePtr local, SynapticsPrivate *priv,
/* Handle normal packets */
hw->x = hw->y = hw->z = hw->numFingers = hw->fingerWidth = 0;
- hw->left = hw->right = hw->up = hw->down = FALSE;
+ hw->left = hw->right = hw->up = hw->down = hw->middle = FALSE;
for (i = 0; i < 8; i++)
hw->multi[i] = FALSE;
diff --git a/synaptics.h b/synaptics.h
index e43202b..1dc8bc9 100644
--- a/synaptics.h
+++ b/synaptics.h
@@ -28,6 +28,7 @@ typedef struct _SynapticsSHM
int fingerWidth; /* finger width value */
int left, right, up, down; /* left/right/up/down buttons */
Bool multi[8];
+ Bool middle;
int guest_left, guest_mid, guest_right; /* guest device buttons */
int guest_dx, guest_dy; /* guest device movement */
@@ -83,6 +84,7 @@ struct SynapticsHwState {
Bool down;
Bool multi[8];
+ Bool middle; /* Some ALPS touchpads have a middle button */
Bool guest_left; /* guest device */
Bool guest_mid;
diff --git a/synclient.c b/synclient.c
index eb1891c..9683857 100644
--- a/synclient.c
+++ b/synclient.c
@@ -173,6 +173,7 @@ static int is_equal(SynapticsSHM* s1, SynapticsSHM* s2)
(s1->right == s2->right) &&
(s1->up == s2->up) &&
(s1->down == s2->down) &&
+ (s1->middle == s2->middle) &&
(s1->guest_left == s2->guest_left) &&
(s1->guest_mid == s2->guest_mid) &&
(s1->guest_right == s2->guest_right) &&
@@ -200,18 +201,18 @@ static void monitor(SynapticsSHM* synshm, int delay)
SynapticsSHM cur = *synshm;
if (!is_equal(&old, &cur)) {
if (!header) {
- printf("%8s %4s %4s %3s %s %2s %2s %s %s %s %8s "
+ printf("%8s %4s %4s %3s %s %2s %2s %s %s %s %s %8s "
"%2s %2s %2s %3s %3s\n",
- "time", "x", "y", "z", "f", "w", "l", "r", "u", "d",
+ "time", "x", "y", "z", "f", "w", "l", "r", "u", "d", "m",
"multi", "gl", "gm", "gr", "gdx", "gdy");
header = 20;
}
header--;
- printf("%8.3f %4d %4d %3d %d %2d %2d %d %d %d %d%d%d%d%d%d%d%d "
+ printf("%8.3f %4d %4d %3d %d %2d %2d %d %d %d %d %d%d%d%d%d%d%d%d "
"%2d %2d %2d %3d %3d\n",
get_time() - t0,
cur.x, cur.y, cur.z, cur.numFingers, cur.fingerWidth,
- cur.left, cur.right, cur.up, cur.down,
+ cur.left, cur.right, cur.up, cur.down, cur.middle,
cur.multi[0], cur.multi[1], cur.multi[2], cur.multi[3],
cur.multi[4], cur.multi[5], cur.multi[6], cur.multi[7],
cur.guest_left, cur.guest_mid, cur.guest_right,