diff options
author | Liang Qi <liang.qi@qt.io> | 2019-06-07 13:12:57 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2019-06-07 13:19:27 +0200 |
commit | 9967a011eaae8988b10e56fde0f2ab8b6bab90ac (patch) | |
tree | 353b932414a8d9d94a418e84068550b0a2376b37 /src/plugins/platforms/windows | |
parent | 91ab70d17f892f3ff6b2019632fda3920d045dcb (diff) | |
parent | 99636127d10f96d8313bc26030cabf9841381914 (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Conflicts:
qmake/generators/makefile.cpp
src/plugins/platforms/cocoa/qcocoaintegration.h
src/plugins/platforms/cocoa/qcocoaintegration.mm
Done-With: Jörg Bornemann <joerg.bornemann@qt.io>
Change-Id: I5a61e161784cc6f947abe370aab8f2971a9cbe78
Diffstat (limited to 'src/plugins/platforms/windows')
5 files changed, 21 insertions, 9 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 55e7e32979..76747b7956 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -749,6 +749,12 @@ QWindowsWindow *QWindowsContext::findPlatformWindowAt(HWND parent, QWindowsWindow *result = nullptr; const POINT screenPoint = { screenPointIn.x(), screenPointIn.y() }; while (findPlatformWindowHelper(screenPoint, cwex_flags, this, &parent, &result)) {} + // QTBUG-40815: ChildWindowFromPointEx() can hit on special windows from + // screen recorder applications like ScreenToGif. Fall back to WindowFromPoint(). + if (result == nullptr) { + if (const HWND window = WindowFromPoint(screenPoint)) + result = findPlatformWindow(window); + } return result; } @@ -925,7 +931,7 @@ bool QWindowsContext::systemParametersInfo(unsigned action, unsigned param, void bool QWindowsContext::systemParametersInfoForScreen(unsigned action, unsigned param, void *out, const QPlatformScreen *screen) { - return systemParametersInfo(action, param, out, screen ? screen->logicalDpi().first : 0); + return systemParametersInfo(action, param, out, screen ? unsigned(screen->logicalDpi().first) : 0u); } bool QWindowsContext::systemParametersInfoForWindow(unsigned action, unsigned param, void *out, @@ -944,7 +950,8 @@ bool QWindowsContext::nonClientMetrics(NONCLIENTMETRICS *ncm, unsigned dpi) bool QWindowsContext::nonClientMetricsForScreen(NONCLIENTMETRICS *ncm, const QPlatformScreen *screen) { - return nonClientMetrics(ncm, screen ? screen->logicalDpi().first : 0); + const int dpi = screen ? qRound(screen->logicalDpi().first) : 0; + return nonClientMetrics(ncm, unsigned(dpi)); } bool QWindowsContext::nonClientMetricsForWindow(NONCLIENTMETRICS *ncm, const QPlatformWindow *win) diff --git a/src/plugins/platforms/windows/qwindowspointerhandler.cpp b/src/plugins/platforms/windows/qwindowspointerhandler.cpp index fd3d711470..8b88007949 100644 --- a/src/plugins/platforms/windows/qwindowspointerhandler.cpp +++ b/src/plugins/platforms/windows/qwindowspointerhandler.cpp @@ -269,7 +269,10 @@ static Qt::MouseButtons queryMouseButtons() static QWindow *getWindowUnderPointer(QWindow *window, QPoint globalPos) { - QWindow *currentWindowUnderPointer = QWindowsScreen::windowAt(globalPos, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT); + QWindowsWindow *platformWindow = static_cast<QWindowsWindow *>(window->handle()); + + QWindow *currentWindowUnderPointer = platformWindow->hasMouseCapture() ? + QWindowsScreen::windowAt(globalPos, CWP_SKIPINVISIBLE | CWP_SKIPTRANSPARENT) : window; while (currentWindowUnderPointer && currentWindowUnderPointer->flags() & Qt::WindowTransparentForInput) currentWindowUnderPointer = currentWindowUnderPointer->parent(); diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index b28a113ce6..cc0f3c1a6e 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -91,7 +91,7 @@ static bool monitorData(HMONITOR hMonitor, QWindowsScreenData *data) } else { if (const HDC hdc = CreateDC(info.szDevice, nullptr, nullptr, nullptr)) { const QDpi dpi = monitorDPI(hMonitor); - data->dpi = dpi.first ? dpi : deviceDPI(hdc); + data->dpi = dpi.first > 0 ? dpi : deviceDPI(hdc); data->depth = GetDeviceCaps(hdc, BITSPIXEL); data->format = data->depth == 16 ? QImage::Format_RGB16 : QImage::Format_RGB32; data->physicalSizeMM = QSizeF(GetDeviceCaps(hdc, HORZSIZE), GetDeviceCaps(hdc, VERTSIZE)); diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 043b2b7bbe..38d0f4d979 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -851,10 +851,12 @@ static QSize toNativeSizeConstrained(QSize dip, const QWindow *w) { if (QHighDpiScaling::isActive()) { const qreal factor = QHighDpiScaling::factor(w); - if (dip.width() > 0 && dip.width() < QWINDOWSIZE_MAX) - dip.rwidth() *= factor; - if (dip.height() > 0 && dip.height() < QWINDOWSIZE_MAX) - dip.rheight() *= factor; + if (!qFuzzyCompare(factor, qreal(1))) { + if (dip.width() > 0 && dip.width() < QWINDOWSIZE_MAX) + dip.setWidth(qRound(qreal(dip.width()) * factor)); + if (dip.height() > 0 && dip.height() < QWINDOWSIZE_MAX) + dip.setHeight(qRound(qreal(dip.height()) * factor)); + } } return dip; } diff --git a/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp b/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp index 7980826b49..ab04384616 100644 --- a/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp +++ b/src/plugins/platforms/windows/uiautomation/qwindowsuiautils.cpp @@ -114,7 +114,7 @@ void setVariantBool(bool value, VARIANT *variant) void setVariantDouble(double value, VARIANT *variant) { variant->vt = VT_R8; - variant->boolVal = value; + variant->dblVal = value; } BSTR bStrFromQString(const QString &value) |