summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Osterlund <petero2@telia.com>2004-07-30 16:57:51 +0200
committerPeter Osterlund <petero2@telia.com>2006-04-09 04:02:43 +0200
commit347b1564e1a958e26a0caad5cf607a71b191ef54 (patch)
treed671a6b9f2228981c34359dcd9776d7ec5d10831
parenta3bc8d6e5c4bc95e17614191839904824e8557f1 (diff)
Handle guest alps devices in the same way as guest synaptics
devices, so that the hardware state is set correctly also when you use more than one device at the same time.
-rw-r--r--alpscomm.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/alpscomm.c b/alpscomm.c
index cd8b7c0..932be37 100644
--- a/alpscomm.c
+++ b/alpscomm.c
@@ -144,7 +144,10 @@ ALPS_process_packet(unsigned char *packet, struct SynapticsHwState *hw)
{
int x = 0, y = 0, z = 0;
int left = 0, right = 0, middle = 0;
+ int i;
+ /* Handle guest packets */
+ hw->guest_dx = hw->guest_dy = 0;
if ((packet[0] & 0xc8) == 0x08) { /* 3-byte PS/2 packet */
x = packet[1];
if (packet[0] & 0x10)
@@ -165,7 +168,7 @@ ALPS_process_packet(unsigned char *packet, struct SynapticsHwState *hw)
y = (packet[4] & 0x7f) | ((packet[3] & 0x70) << (7-4));
z = packet[5];
- if (z == 127) { /* DualPoint stick is relative, not absolute */
+ if (z == 127) { /* DualPoint stick is relative, not absolute */
if (x > 383)
x = x - 768;
if (y > 255)
@@ -176,6 +179,12 @@ ALPS_process_packet(unsigned char *packet, struct SynapticsHwState *hw)
return;
}
+ /* Handle normal packets */
+ hw->x = hw->y = hw->z = hw->numFingers = hw->fingerWidth = 0;
+ hw->left = hw->right = hw->up = hw->down = hw->middle = FALSE;
+ for (i = 0; i < 8; i++)
+ hw->multi[i] = FALSE;
+
if (z > 0) {
hw->x = x;
hw->y = y;
@@ -220,8 +229,6 @@ ALPSReadHwState(LocalDevicePtr local, struct SynapticsHwInfo *synhw,
if (!ALPS_get_packet(comm, local))
return FALSE;
- memset(hw, 0, sizeof(*hw));
-
ALPS_process_packet(buf, hw);
*hwRet = *hw;