From 0f417efe0fb37d03d2c1e98958d4213d263c90c0 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 28 May 2019 14:22:07 +0200 Subject: Windows QPA: Fix QGuiApplication::topLevelAt() with screen recorder applications MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Special applications like screen recorders can create special, invisible windows which are detected by the ChildWindowFromPointEx() as used in QWindowsContext::findPlatformWindowAt(). Fall back to WindowFromPoint() which skips those in case nothing is found. Fixes: QTBUG-40815 Change-Id: Idb5253c412fb4522c844edf5eadedc6e0fad3979 Reviewed-by: André de la Rocha --- src/plugins/platforms/windows/qwindowscontext.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 55e7e32979..e7ac01e411 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; } -- cgit v1.2.3