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>
This commit is contained in:
parent
b23e72a772
commit
7cc175c9d6
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user