From 29787ec29cfa579e5bbf896dee093931a9f1385f Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 19 Aug 2014 14:45:45 +0200 Subject: Detect wrongly labelled wheel buttons A mouse device with both missing labels and a wrongly placed label on the mouse wheel buttons have been spotted. This patch makes the XInput2 code even more lenient to better match legacy systems that always assumed button 4 and 5 are mapped that way. Task-number: QTBUG-40806 Change-Id: I7cc52f3d9c54e15e6f3ddcc2bdeb1bb8e0ac9eca Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index e21db89a20..4986e85728 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -164,7 +164,10 @@ void QXcbConnection::xi2SetupDevices() 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)) + // Some drivers have no labels on the wheel buttons, some have no label on just one and some have no label on + // button 4 and the wrong one on button 5. So we just check that they are not labelled with unrelated buttons. + if ((!label4 || qatom(label4) == QXcbAtom::ButtonWheelUp || qatom(label4) == QXcbAtom::ButtonWheelDown) && + (!label5 || qatom(label5) == QXcbAtom::ButtonWheelUp || qatom(label5) == QXcbAtom::ButtonWheelDown)) scrollingDevice.legacyOrientations |= Qt::Vertical; } if (bci->num_buttons >= 7) { -- cgit v1.2.3