summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2012-11-07 15:51:08 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-08 16:59:50 +0100
commit0aafef094df29d754eae683837444e74c4465dce (patch)
tree7eabe4bdb8737e99a4856fc013951183ee8508c4
parent4c1c8207b9ace89d727e3bd98ae77c4282672172 (diff)
Windows: Add missing support for X-buttons.
Autocapture and framestrut event generation didn't handle X-buttons. Task-number: QTBUG-27874 Change-Id: Icfe9dfb9abc9cd506e1875f2b2b4cbc644cff6cd Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Kevin Funk <kevin.funk@kdab.com>
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index c1d9362093..024a273022 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -144,6 +144,10 @@ Qt::MouseButtons QWindowsMouseHandler::queryMouseButtons()
result |= mouseSwapped ? Qt::LeftButton : Qt::RightButton;
if (GetAsyncKeyState(VK_MBUTTON) < 0)
result |= Qt::MidButton;
+ if (GetAsyncKeyState(VK_XBUTTON1) < 0)
+ result |= Qt::XButton1;
+ if (GetAsyncKeyState(VK_XBUTTON2) < 0)
+ result |= Qt::XButton2;
return result;
}
@@ -222,8 +226,9 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
// any button press until release.
if (!platformWindow->hasMouseCapture()
&& (msg.message == WM_LBUTTONDOWN || msg.message == WM_MBUTTONDOWN
- || msg.message == WM_RBUTTONDOWN || msg.message == WM_LBUTTONDBLCLK
- || msg.message == WM_MBUTTONDBLCLK || msg.message == WM_RBUTTONDBLCLK )) {
+ || msg.message == WM_RBUTTONDOWN || msg.message == WM_XBUTTONDOWN
+ || msg.message == WM_LBUTTONDBLCLK || msg.message == WM_MBUTTONDBLCLK
+ || msg.message == WM_RBUTTONDBLCLK || msg.message == WM_XBUTTONDBLCLK)) {
platformWindow->setMouseGrabEnabled(true);
platformWindow->setFlag(QWindowsWindow::AutoMouseCapture);
if (QWindowsContext::verboseEvents)
@@ -231,7 +236,7 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
} else if (platformWindow->hasMouseCapture()
&& platformWindow->testFlag(QWindowsWindow::AutoMouseCapture)
&& (msg.message == WM_LBUTTONUP || msg.message == WM_MBUTTONUP
- || msg.message == WM_RBUTTONUP)) {
+ || msg.message == WM_RBUTTONUP || msg.message == WM_XBUTTONUP)) {
platformWindow->setMouseGrabEnabled(false);
if (QWindowsContext::verboseEvents)
qDebug() << "Releasing automatic mouse capture " << window;