summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRick Stockton <rickstockton@reno-computerhelp.com>2012-03-07 16:38:37 -0800
committerQt by Nokia <qt-info@nokia.com>2012-03-08 23:52:34 +0100
commita0933f4d7485d22f38b80c67f79b8d3f721b19a2 (patch)
treedaed8dd685aa33adfe7ef330e647f7e0ac5e0362 /src
parent1e13160a005f9f33cfeb2f2b602756e6627bef58 (diff)
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 for the 5 buttons which we previously ignored in Qt on this Platform. Task-number: QTBUG-24682 Change-Id: I8c1d2b2a5d0deb3b857fb387c242c3792e21ff95 Reviewed-by: Kevin Krammer <kevin.krammer@kdab.com> Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/blackberry/qbbeventthread.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/plugins/platforms/blackberry/qbbeventthread.cpp b/src/plugins/platforms/blackberry/qbbeventthread.cpp
index 547428d1c4..6951921fe9 100644
--- a/src/plugins/platforms/blackberry/qbbeventthread.cpp
+++ b/src/plugins/platforms/blackberry/qbbeventthread.cpp
@@ -380,13 +380,26 @@ 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 x080.
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::ExtraButton1; // AKA 'Qt::BackButton'
+ if (buttonState & 0x10)
+ buttons |= Qt::ExtraButton2; // AKA 'Qt::ForwardButton'
+ if (buttonState & 0x20)
+ buttons |= Qt::ExtraButton3;
+ if (buttonState & 0x40)
+ buttons |= Qt::ExtraButton4;
+ if (buttonState & 0x80)
+ buttons |= Qt::ExtraButton5;
if (w) {
// Inject mouse event into Qt only if something has changed.