From 4b722b91dbef7f8d005bfaec6174faa7cfcaecb4 Mon Sep 17 00:00:00 2001 From: Siarzhuk Zharski Date: Mon, 27 Jun 2011 18:19:45 +0000 Subject: [PATCH] Proper handling of middle mouse event on capFourButtons and capMiddleButton capable touchpads. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42329 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/bus_managers/ps2/movement_maker.h | 3 ++- src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.cpp | 5 +++++ src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/add-ons/kernel/bus_managers/ps2/movement_maker.h b/src/add-ons/kernel/bus_managers/ps2/movement_maker.h index 0d3d95ada8..31692c0291 100644 --- a/src/add-ons/kernel/bus_managers/ps2/movement_maker.h +++ b/src/add-ons/kernel/bus_managers/ps2/movement_maker.h @@ -96,7 +96,8 @@ enum button_ids { kNoButton = 0x00, kLeftButton = 0x01, - kRightButton = 0x02 + kRightButton = 0x02, + kMiddleButton = 0x04 }; diff --git a/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.cpp b/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.cpp index 7986713fac..06232fef04 100644 --- a/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.cpp +++ b/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.cpp @@ -123,6 +123,9 @@ get_synaptics_movment(synaptics_cookie *cookie, mouse_movement *movement) event.wValue = wValue; event.gesture = false; + + if (sTouchpadInfo.capMiddleButton || sTouchpadInfo.capFourButtons) + event.buttons |= ((event_buffer[0] ^ event_buffer[3]) & 0x01) << 2; } else { bool finger = event_buffer[0] >> 5 & 1; if (finger) { @@ -160,6 +163,8 @@ query_capability(ps2_dev *dev) sTouchpadInfo.capExtended = val[0] >> 7 & 1; TRACE("SYNAPTICS: extended mode %2x\n", val[0] >> 7 & 1); + TRACE("SYNAPTICS: middle button %2x\n", val[0] >> 2 & 1); + sTouchpadInfo.capMiddleButton = val[0] >> 2 & 1; TRACE("SYNAPTICS: sleep mode %2x\n", val[2] >> 4 & 1); sTouchpadInfo.capSleep = val[2] >> 4 & 1; TRACE("SYNAPTICS: four buttons %2x\n", val[2] >> 3 & 1); diff --git a/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.h b/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.h index 1483bbd506..d3332e65d5 100644 --- a/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.h +++ b/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.h @@ -43,6 +43,7 @@ typedef struct { uint8 minorVersion; bool capExtended; + bool capMiddleButton; bool capSleep; bool capFourButtons; bool capMultiFinger;