PS/2 synaptics: minimal clickpad support

Handled as a 1-button mouse. We didn't really support this since the old
Macintosh ADB mouses, so let's see if that code aged well!

Change-Id: Ibed2423023e821ae4ce608f0ddbc5ac32bfbd8f7
This commit is contained in:
Adrien Destugues 2018-05-13 10:42:20 +02:00 committed by Adrien Destugues
parent 258b7d4a8b
commit 79cb8f02d9
2 changed files with 10 additions and 0 deletions

View File

@ -160,6 +160,11 @@ get_synaptics_movment(synaptics_cookie *cookie, mouse_movement *movement)
event.wValue = wValue;
event.gesture = false;
// Clickpad pretends that all clicks on the touchpad are middle clicks.
// Pass them to userspace as left clicks instead.
if (sTouchpadInfo.capClickPad)
event.buttons |= ((event_buffer[0] ^ event_buffer[3]) & 0x01);
if (sTouchpadInfo.capMiddleButton || sTouchpadInfo.capFourButtons)
event.buttons |= ((event_buffer[0] ^ event_buffer[3]) & 0x01) << 2;
@ -249,9 +254,13 @@ query_capability(ps2_dev *dev)
// buttons.
sTouchpadInfo.nExtendedButtons = 0;
sTouchpadInfo.firstExtendedButton = 0;
sTouchpadInfo.capClickPad = false;
return;
}
sTouchpadInfo.capClickPad = (val[0] >> 5 & 1) | (val[1] >> 0 & 1);
TRACE("SYNAPTICS: clickpad %x\n", sTouchpadInfo.capClickPad);
TRACE("SYNAPTICS: extended buttons %2x\n", val[1] >> 4 & 15);
sTouchpadInfo.nExtendedButtons = val[1] >> 4 & 15;
sTouchpadInfo.extendedButtonsState = 0;

View File

@ -49,6 +49,7 @@ typedef struct {
bool capMultiFinger;
bool capPalmDetection;
bool capPassThrough;
bool capClickPad;
uint8 nExtendedButtons;
uint8 firstExtendedButton;