summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2012-11-15 10:32:31 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-15 10:45:29 +0100
commitaeb566db73a2526e22145af17f6b5ed927eb6fbb (patch)
tree6673442a339b094c18b8a498b74dba7c3bd7da23 /src
parent0a334b2180f311a06231176574713775756147b8 (diff)
Windows: Fix autocapture for multiple buttons
Automatic capture of mouse events on button press was released when the first button was released, even if multiple buttons were pressed. Changed it so that the capture is released when the last button is released. Task-number: QTBUG-28007 Change-Id: Icee59aacaf0ba947820c40cb7ede00193ff46a14 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/platforms/windows/qwindowsmousehandler.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
index 0fb67d0e98..2f624c3e16 100644
--- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp
+++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp
@@ -189,6 +189,7 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
}
QWindowsWindow *platformWindow = static_cast<QWindowsWindow *>(window->handle());
+ const Qt::MouseButtons buttons = keyStateToMouseButtons((int)msg.wParam);
// If the window was recently resized via mouse doubleclick on the frame or title bar,
// we don't get WM_LBUTTONDOWN or WM_LBUTTONDBLCLK for the second click,
@@ -199,7 +200,7 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
if (msg.message == WM_LBUTTONDOWN || msg.message == WM_LBUTTONDBLCLK) {
m_leftButtonDown = true;
} else {
- const bool actualLeftDown = keyStateToMouseButtons((int)msg.wParam) & Qt::LeftButton;
+ const bool actualLeftDown = buttons & Qt::LeftButton;
if (!m_leftButtonDown && actualLeftDown) {
// Autocapture the mouse for current window to and ignore further events until release.
// Capture is necessary so we don't get WM_MOUSELEAVEs to confuse matters.
@@ -236,7 +237,8 @@ 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_XBUTTONUP)) {
+ || msg.message == WM_RBUTTONUP || msg.message == WM_XBUTTONUP)
+ && !buttons) {
platformWindow->setMouseGrabEnabled(false);
if (QWindowsContext::verboseEvents)
qDebug() << "Releasing automatic mouse capture " << window;
@@ -299,8 +301,7 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
m_windowUnderMouse = currentWindowUnderMouse;
}
- QWindowSystemInterface::handleMouseEvent(window, winEventPosition, globalPosition,
- keyStateToMouseButtons((int)msg.wParam),
+ QWindowSystemInterface::handleMouseEvent(window, winEventPosition, globalPosition, buttons,
QWindowsKeyMapper::queryKeyboardModifiers());
return true;
}