summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2014-05-12 13:48:38 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-05-13 12:47:12 +0200
commit7cc175c9d69102c15486ac0506031cb6d09741d3 (patch)
tree725f7b756d464128fe56a6442ecac4a3562de41b /src
parentb23e72a772a5abfdf9784ab80db9a4d620137515 (diff)
Assume unlabelled mouse buttons are default buttons
This patch fixes legacy wheel scrolling for XInput2 drivers that fail to label mouse buttons correctly. Task-number: QTBUG-38937 Change-Id: I659890517e749dc0039489e0b7a8c38be1065d33 Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index efa1691780..64cb33979b 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -148,15 +148,17 @@ void QXcbConnection::initializeXInput2()
}
case XIButtonClass: {
XIButtonClassInfo *bci = reinterpret_cast<XIButtonClassInfo *>(devices[i].classes[c]);
- for (int i=0; i < bci->num_buttons; ++i) {
- const int buttonAtom = qatom(bci->labels[i]);
- if (buttonAtom == QXcbAtom::ButtonWheelUp
- || buttonAtom == QXcbAtom::ButtonWheelDown) {
+ if (bci->num_buttons >= 5) {
+ Atom label4 = bci->labels[3];
+ Atom label5 = bci->labels[4];
+ if ((!label4 || qatom(label4) == QXcbAtom::ButtonWheelUp) && (!label5 || qatom(label5) == QXcbAtom::ButtonWheelDown))
scrollingDevice.legacyOrientations |= Qt::Vertical;
- } else if (buttonAtom == QXcbAtom::ButtonHorizWheelLeft
- || buttonAtom == QXcbAtom::ButtonHorizWheelRight) {
+ }
+ if (bci->num_buttons >= 7) {
+ Atom label6 = bci->labels[5];
+ Atom label7 = bci->labels[6];
+ if ((!label6 || qatom(label6) == QXcbAtom::ButtonHorizWheelLeft) && (!label7 || qatom(label7) == QXcbAtom::ButtonHorizWheelRight))
scrollingDevice.legacyOrientations |= Qt::Horizontal;
- }
}
break;
}