diff options
author | Liang Qi <liang.qi@qt.io> | 2019-06-14 11:56:56 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2019-06-14 13:45:18 +0200 |
commit | b1a216649ec064412160638dd00195cd47c567aa (patch) | |
tree | a4134415a3849cfb857942e698514be9da18924f /src/plugins/platforms/windows/qwindowscontext.cpp | |
parent | 2e20ae3c1b57169497f6f3904623be4f5e617e12 (diff) | |
parent | 1632786f00875d23c7d111cbb29dedaa35c1c8c2 (diff) |
Merge remote-tracking branch 'origin/5.13' into dev
Conflicts:
qmake/generators/makefile.cpp
qmake/generators/unix/unixmake2.cpp
src/corelib/thread/qthread_unix.cpp
tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp
Change-Id: I1df0d4ba20685de7f9300bf07458c13376493408
Diffstat (limited to 'src/plugins/platforms/windows/qwindowscontext.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowscontext.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index f7897336c9..f3a7c78f73 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -317,6 +317,8 @@ QWindowsContext::~QWindowsContext() OleUninitialize(); d->m_screenManager.clearScreens(); // Order: Potentially calls back to the windows. + if (d->m_displayContext) + ReleaseDC(nullptr, d->m_displayContext); m_instance = nullptr; } @@ -749,6 +751,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 +933,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 +952,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) |