From 8957cb2682d874403c3ee08c98bfd544a60c6da4 Mon Sep 17 00:00:00 2001 From: Andre de la Rocha Date: Wed, 3 Apr 2019 14:18:20 +0200 Subject: [PATCH 1/4] Windows QPA: Fix mouse button reported in non-client events The current mouse buttons state was being retrieved from WPARAM for all mouse messages. However, for non-client messages this parameter contains unrelated information, which resulted in non-client events reporting incorrect button state. Changing it to retrieve state using GetAsyncKeyState() for non-client messages, like in the legacy mouse handler implementation. Fixes: QTBUG-74649 Change-Id: Ia246164208707072e584dd521697e9d31d3e65ad Reviewed-by: Friedemann Kleint --- .../windows/qwindowspointerhandler.cpp | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowspointerhandler.cpp b/src/plugins/platforms/windows/qwindowspointerhandler.cpp index f1960f1585..2673c04c48 100644 --- a/src/plugins/platforms/windows/qwindowspointerhandler.cpp +++ b/src/plugins/platforms/windows/qwindowspointerhandler.cpp @@ -250,6 +250,23 @@ static Qt::MouseButtons mouseButtonsFromKeyState(WPARAM keyState) return result; } +static Qt::MouseButtons queryMouseButtons() +{ + Qt::MouseButtons result = Qt::NoButton; + const bool mouseSwapped = GetSystemMetrics(SM_SWAPBUTTON); + if (GetAsyncKeyState(VK_LBUTTON) < 0) + result |= mouseSwapped ? Qt::RightButton: Qt::LeftButton; + if (GetAsyncKeyState(VK_RBUTTON) < 0) + 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; +} + static QWindow *getWindowUnderPointer(QWindow *window, QPoint globalPos) { QWindow *currentWindowUnderPointer = QWindowsScreen::windowAt(globalPos, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT); @@ -681,7 +698,6 @@ bool QWindowsPointerHandler::translateMouseEvent(QWindow *window, } const Qt::KeyboardModifiers keyModifiers = QWindowsKeyMapper::queryKeyboardModifiers(); - const Qt::MouseButtons mouseButtons = mouseButtonsFromKeyState(msg.wParam); QWindow *currentWindowUnderPointer = getWindowUnderPointer(window, globalPos); if (et == QtWindows::MouseWheelEvent) @@ -709,7 +725,8 @@ bool QWindowsPointerHandler::translateMouseEvent(QWindow *window, const MouseEvent mouseEvent = eventFromMsg(msg); if (mouseEvent.type >= QEvent::NonClientAreaMouseMove && mouseEvent.type <= QEvent::NonClientAreaMouseButtonDblClick) { - QWindowSystemInterface::handleFrameStrutMouseEvent(window, localPos, globalPos, mouseButtons, + const Qt::MouseButtons nonclientButtons = queryMouseButtons(); + QWindowSystemInterface::handleFrameStrutMouseEvent(window, localPos, globalPos, nonclientButtons, mouseEvent.button, mouseEvent.type, keyModifiers, source); return false; // Allow further event processing } @@ -725,6 +742,8 @@ bool QWindowsPointerHandler::translateMouseEvent(QWindow *window, return true; } + const Qt::MouseButtons mouseButtons = mouseButtonsFromKeyState(msg.wParam); + handleCaptureRelease(window, currentWindowUnderPointer, hwnd, mouseEvent.type, mouseButtons); handleEnterLeave(window, currentWindowUnderPointer, globalPos); From 4451c86dfd134f35795383bf632f161629a720e4 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 27 Mar 2019 19:30:58 +0000 Subject: [PATCH 2/4] Doc-fixes in QRandomGenerator::bounded(int...) They return int, not quint32. Change-Id: I9879b58cccf9ea324ea1fc0c567a9d30b82fa44d Reviewed-by: Thiago Macieira (cherry picked from commit 6ed2ea86db63c72a38a60543da5a95d3543d39b1) --- src/corelib/global/qrandom.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/corelib/global/qrandom.cpp b/src/corelib/global/qrandom.cpp index 6195c324e7..90df8653a7 100644 --- a/src/corelib/global/qrandom.cpp +++ b/src/corelib/global/qrandom.cpp @@ -930,7 +930,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel */ /*! - \fn quint32 QRandomGenerator::bounded(int highest) + \fn int QRandomGenerator::bounded(int highest) \overload Generates one random 32-bit quantity in the range between 0 (inclusive) and @@ -957,7 +957,6 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel \snippet code/src_corelib_global_qrandom.cpp 14 - Note that this function cannot be used to obtain values in the full 32-bit range of quint32. Instead, use generate(). @@ -965,7 +964,7 @@ inline QRandomGenerator::SystemGenerator &QRandomGenerator::SystemGenerator::sel */ /*! - \fn quint32 QRandomGenerator::bounded(int lowest, int highest) + \fn int QRandomGenerator::bounded(int lowest, int highest) \overload Generates one random 32-bit quantity in the range between \a lowest From f5da03ae78d1ae5f6cbd997c69711b9b7f13aab1 Mon Sep 17 00:00:00 2001 From: Antti Kokko Date: Mon, 1 Apr 2019 13:35:31 +0300 Subject: [PATCH 3/4] Add changes file for Qt 5.12.3 Edited-By: Thiago Macieira Change-Id: I26354551e7d3a6573bad0aa3851055f482a9a242 Reviewed-by: Thiago Macieira Reviewed-by: Lars Knoll --- dist/changes-5.12.3 | 82 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 dist/changes-5.12.3 diff --git a/dist/changes-5.12.3 b/dist/changes-5.12.3 new file mode 100644 index 0000000000..e6636fc153 --- /dev/null +++ b/dist/changes-5.12.3 @@ -0,0 +1,82 @@ +Qt 5.12.3 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.12.0 through 5.12.2. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +https://doc.qt.io/qt-5/index.html + +The Qt version 5.12 series is binary compatible with the 5.11.x series. +Applications compiled for 5.11 will continue to run with 5.12. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Third-Party Code * +**************************************************************************** + + - Changed classification of the wintab license from Public Domain to + Custom. + +**************************************************************************** +* QtCore * +**************************************************************************** + + - Event system: + * [QTBUG-72438] Fixed a possible race condition on Windows that would + cause an interrupted event loop to be stuck until more events were + posted. + + - Logging system: + * [QTBUG-74359] Fixed the compilation of qCDebug("", ...) when debug + output was disabled. + + - QCollator: + * [QTBUG-74209] Fixed a bug that caused QCompare to incorrect return a + sorting order on Windows if the Win32 API failed. + + - QDateTime / QTimeZone: + * [QTBUG-74614] Fixed handling of timezones that contain no DST + transitions. + + - QProcess: + * [QTBUG-73778] Fixed a crash when calling closeWriteChannel() on Windows. + +**************************************************************************** +* QtSql * +**************************************************************************** + + - When cross-compiling pg_config, mysql_config are not looked up in PATH + anymore. Pass -psql_config path/to/pg_config or -mysql_config + path/to/mysql_config to explicitly enable PSQL or MySQL in this setup. + +**************************************************************************** +* Platform Specific Changes * +**************************************************************************** + + - Android: + * Text fields with ImhNoPredictiveText set are no longer working around + keyboards that disregard this setting. To enforce the workaround, the + environment variable + QT_ANDROID_ENABLE_WORKAROUND_TO_DISABLE_PREDICTIVE_TEXT should be set. + + * [QTBUG-74029] Added entries in the AndroidManifest.xml for specific + portrait and landscape splash screens. If one is present for the current + orientation, it will be preferred over the generic one. + + - Linux: + * [QTBUG-74526] Changed the way we use the statx() system call to use a + fallback mechanism provided by the GNU C library. This should allow Qt + applications that are compiled with glibc >= 2.28 to run even on kernels + older than 4.11. + + - Windows: + * [QTBUG-74062] Fixed QToolTip pop-ups and QComboBox animation pop-ups + being off by a few pixels on Windows 10. + From 534df5a33bd6a3d0d00194212cf868a9ef57bd53 Mon Sep 17 00:00:00 2001 From: Dmitry Kazakov Date: Thu, 28 Mar 2019 18:33:44 +0300 Subject: [PATCH 4/4] Fix QTabletEvent::uniqueId() when Qt uses WinInk A new 'pointerId' is assigned to the stylus every time it enters tablet's proximity. But applications expect this ID be constant, at least during one application run. Therefore, it needs to use 'sourceDevice' instead. Basically, WinInk doesn't have an ability to distinguich two different styluses connected to the same tablet. We cannot do anything about it, it is supported only in WinTab. Task-number: QTBUG-74700 Change-Id: I8328f1e5102b037b370082e69e965ab68b487882 Reviewed-by: Andre de la Rocha --- .../platforms/windows/qwindowspointerhandler.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/windows/qwindowspointerhandler.cpp b/src/plugins/platforms/windows/qwindowspointerhandler.cpp index 2673c04c48..9a8b5d5121 100644 --- a/src/plugins/platforms/windows/qwindowspointerhandler.cpp +++ b/src/plugins/platforms/windows/qwindowspointerhandler.cpp @@ -548,7 +548,7 @@ bool QWindowsPointerHandler::translatePenEvent(QWindow *window, HWND hwnd, QtWin if (!QWindowsContext::user32dll.getPointerDeviceRects(penInfo->pointerInfo.sourceDevice, &pRect, &dRect)) return false; - const quint32 pointerId = penInfo->pointerInfo.pointerId; + const qint64 sourceDevice = (qint64)penInfo->pointerInfo.sourceDevice; const QPoint globalPos = QPoint(penInfo->pointerInfo.ptPixelLocation.x, penInfo->pointerInfo.ptPixelLocation.y); const QPoint localPos = QWindowsGeometryHint::mapFromGlobal(hwnd, globalPos); const QPointF hiResGlobalPos = QPointF(dRect.left + qreal(penInfo->pointerInfo.ptHimetricLocation.x - pRect.left) @@ -564,7 +564,7 @@ bool QWindowsPointerHandler::translatePenEvent(QWindow *window, HWND hwnd, QtWin if (QWindowsContext::verbose > 1) qCDebug(lcQpaEvents).noquote().nospace() << showbase - << __FUNCTION__ << " pointerId=" << pointerId + << __FUNCTION__ << " sourceDevice=" << sourceDevice << " globalPos=" << globalPos << " localPos=" << localPos << " hiResGlobalPos=" << hiResGlobalPos << " message=" << hex << msg.message << " flags=" << hex << penInfo->pointerInfo.pointerFlags; @@ -587,7 +587,7 @@ bool QWindowsPointerHandler::translatePenEvent(QWindow *window, HWND hwnd, QtWin switch (msg.message) { case WM_POINTERENTER: { - QWindowSystemInterface::handleTabletEnterProximityEvent(device, type, pointerId); + QWindowSystemInterface::handleTabletEnterProximityEvent(device, type, sourceDevice); m_windowUnderPointer = window; // The local coordinates may fall outside the window. // Wait until the next update to send the enter event. @@ -600,12 +600,12 @@ bool QWindowsPointerHandler::translatePenEvent(QWindow *window, HWND hwnd, QtWin m_windowUnderPointer = nullptr; m_currentWindow = nullptr; } - QWindowSystemInterface::handleTabletLeaveProximityEvent(device, type, pointerId); + QWindowSystemInterface::handleTabletLeaveProximityEvent(device, type, sourceDevice); break; case WM_POINTERDOWN: case WM_POINTERUP: case WM_POINTERUPDATE: { - QWindow *target = QGuiApplicationPrivate::tabletDevicePoint(pointerId).target; // Pass to window that grabbed it. + QWindow *target = QGuiApplicationPrivate::tabletDevicePoint(sourceDevice).target; // Pass to window that grabbed it. if (!target && m_windowUnderPointer) target = m_windowUnderPointer; if (!target) @@ -624,7 +624,7 @@ bool QWindowsPointerHandler::translatePenEvent(QWindow *window, HWND hwnd, QtWin QWindowSystemInterface::handleTabletEvent(target, localPos, hiResGlobalPos, device, type, mouseButtons, pressure, xTilt, yTilt, tangentialPressure, rotation, z, - pointerId, keyModifiers); + sourceDevice, keyModifiers); return false; // Allow mouse messages to be generated. } }