diff options
author | Kevin Krammer <kevin.krammer.qnx@kdab.com> | 2012-03-09 07:44:24 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-09 16:15:35 (GMT) |
commit | a641da349ffcd92baea238d06acc7c7b886302c9 (patch) | |
tree | e39f10e5b88993a541ae4115b8fb16de9e684486 /src/plugins | |
parent | bede41701dbd6bb98408f3e1ebbc72b32fa60088 (diff) | |
download | Qt-a641da349ffcd92baea238d06acc7c7b886302c9.zip Qt-a641da349ffcd92baea238d06acc7c7b886302c9.tar.gz Qt-a641da349ffcd92baea238d06acc7c7b886302c9.tar.bz2 |
BlackBerry Plugin: support 8 mouse buttons, instead of just 3.
The mask of possible mouse buttons in QNX provides tracking for the
up/down State of up to 8 mouse buttons. This update adds support
or 2 of buttons which we previously ignored in Qt on this Platform.
Backport of a0933f4d7485d22f38b80c67f79b8d3f721b19a2 in Qt5/qtbase
reduced to the 5 buttons Qt4 has support for
Related to task-number: QTBUG-24682
Change-Id: I4253b96b2d7ed3f806749432b2eb7f884fd0f580
Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Reviewed-by: Rick Stockton <rickstockton@reno-computerhelp.com>
Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/blackberry/qbbeventthread.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/plugins/platforms/blackberry/qbbeventthread.cpp b/src/plugins/platforms/blackberry/qbbeventthread.cpp index 29dc9a7..48c9513 100644 --- a/src/plugins/platforms/blackberry/qbbeventthread.cpp +++ b/src/plugins/platforms/blackberry/qbbeventthread.cpp @@ -436,13 +436,20 @@ void QBBEventThread::handlePointerEvent(screen_event_t event) QPoint localPoint(windowPos[0], windowPos[1]); // Convert buttons. + // Some QNX header files invert 'Right Button versus "Left Button' ('Right' == 0x01). But they also offer a 'Button Swap' bit, + // so we may receive events as shown. (If this is wrong, the fix is easy.) + // QNX Button mask is 8 buttons wide, with a maximum value of 0x80. Qt::MouseButtons buttons = Qt::NoButton; - if (buttonState & 1) + if (buttonState & 0x01) buttons |= Qt::LeftButton; - if (buttonState & 2) + if (buttonState & 0x02) buttons |= Qt::MidButton; - if (buttonState & 4) + if (buttonState & 0x04) buttons |= Qt::RightButton; + if (buttonState & 0x08) + buttons |= Qt::XButton1; + if (buttonState & 0x10) + buttons |= Qt::XButton2; if (w) { // Inject mouse event into Qt only if something has changed. |