diff --git a/alpscomm.c b/alpscomm.c index 01db0d7..992f4c5 100644 --- a/alpscomm.c +++ b/alpscomm.c @@ -160,10 +160,8 @@ ALPS_process_packet(unsigned char *packet, struct SynapticsHwState *hw) y = y - 256; hw->guest_dx = x; hw->guest_dy = -y; - if (packet[0] & 0x01) - hw->guest_left = 1; - if (packet[0] & 0x02) - hw->guest_right = 1; + hw->guest_left = (packet[0] & 0x01) ? TRUE : FALSE; + hw->quest_right = (packet[0] & 0x02) ? TRUE : FALSE; return; } @@ -178,7 +176,10 @@ ALPS_process_packet(unsigned char *packet, struct SynapticsHwState *hw) y = y - 512; hw->guest_dx = x; hw->guest_dy = -y; - z = 0; + hw->left = packet[2] & 1; + hw->left |= packet[3] & 1; + hw->right = (packet[2] >> 1) & 1; + hw->right |= (packet[3] >> 1) & 1; return; } diff --git a/synaptics.c b/synaptics.c index 8e26c23..7e72453 100644 --- a/synaptics.c +++ b/synaptics.c @@ -1323,6 +1323,12 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState *hw) hw->up |= hw->multi[0]; hw->down |= hw->multi[1]; + if (!para->guestmouse_off) { + hw->left |= hw->guest_left; + hw->middle |= hw->guest_mid; + hw->right |= hw->guest_right; + } + /* 3rd button emulation */ hw->middle |= HandleMidButtonEmulation(priv, hw, &delay); @@ -1369,11 +1375,6 @@ HandleState(LocalDevicePtr local, struct SynapticsHwState *hw) timeleft = ComputeDeltas(priv, hw, edge, &dx, &dy); delay = MIN(delay, timeleft); - if (!para->guestmouse_off) { - hw->left |= hw->guest_left; - hw->middle |= hw->guest_mid; - hw->right |= hw->guest_right; - } buttons = ((hw->left ? 0x01 : 0) | (hw->middle ? 0x02 : 0) | (hw->right ? 0x04 : 0) |