summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRick Stockton <rickstockton@reno-computerhelp.com>2012-02-29 23:56:34 -0800
committerQt by Nokia <qt-info@nokia.com>2012-03-02 10:03:16 +0100
commitd505886dd696d0f01bb64cbc7a1191d960d4d060 (patch)
tree5a9f69f915ff5bdadc031a24ff5d45099e06b62d /src
parent93ee903da7b10326b40bc43d5f5c659d527e8814 (diff)
Support 16+4 mouse buttons within the generic/evdevmouse plugin.
The Kernel's evdev module is capable of presenting up to 16 mouse buttons, plus wheel events (UP, DOWN, LEFT, and RIGHT). This patch updates our Plugin, so that it tranlates all of those button numbers into corresponding MouseEvent Qt::MouseButton values. Task-number: QTBUG-24590 Change-Id: Ib8cbb9500280c76f06a51ce95095e22ae84de1c6 Reviewed-by: Laszlo Agocs <laszlo.p.agocs@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/generic/evdevmouse/qevdevmouse.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/src/plugins/generic/evdevmouse/qevdevmouse.cpp b/src/plugins/generic/evdevmouse/qevdevmouse.cpp
index 0b72123c02..be779c68a5 100644
--- a/src/plugins/generic/evdevmouse/qevdevmouse.cpp
+++ b/src/plugins/generic/evdevmouse/qevdevmouse.cpp
@@ -176,12 +176,27 @@ void QEvdevMouseHandler::readMouseData()
sendMouseEvent();
pendingMouseEvent = false;
- } else if (data->type == EV_KEY && data->code >= BTN_LEFT && data->code <= BTN_MIDDLE) {
+ } else if (data->type == EV_KEY && data->code >= BTN_LEFT && data->code <= BTN_JOYSTICK) {
Qt::MouseButton button = Qt::NoButton;
+ // BTN_LEFT == 0x110 in kernel's input.h
+ // The range of possible mouse buttons ends just before BTN_JOYSTICK, value 0x120.
switch (data->code) {
- case BTN_LEFT: button = Qt::LeftButton; break;
- case BTN_MIDDLE: button = Qt::MidButton; break;
- case BTN_RIGHT: button = Qt::RightButton; break;
+ case 0x110: button = Qt::LeftButton; break; // BTN_LEFT
+ case 0x111: button = Qt::RightButton; break;
+ case 0x112: button = Qt::MiddleButton; break;
+ case 0x113: button = Qt::ExtraButton1; break; // AKA Qt::BackButton
+ case 0x114: button = Qt::ExtraButton2; break; // AKA Qt::ForwardButton
+ case 0x115: button = Qt::ExtraButton3; break; // AKA Qt::TaskButton
+ case 0x116: button = Qt::ExtraButton4; break;
+ case 0x117: button = Qt::ExtraButton5; break;
+ case 0x118: button = Qt::ExtraButton6; break;
+ case 0x119: button = Qt::ExtraButton7; break;
+ case 0x11a: button = Qt::ExtraButton8; break;
+ case 0x11b: button = Qt::ExtraButton9; break;
+ case 0x11c: button = Qt::ExtraButton10; break;
+ case 0x11d: button = Qt::ExtraButton11; break;
+ case 0x11e: button = Qt::ExtraButton12; break;
+ case 0x11f: button = Qt::ExtraButton13; break;
}
if (data->value)
m_buttons |= button;