From d9200fcac58a9347decd417c217c18b7e34471ec Mon Sep 17 00:00:00 2001 From: Andre de la Rocha Date: Tue, 13 Nov 2018 20:22:20 +0100 Subject: Windows QPA: Fix broken focus for native child windows This issue was caused by missing logic in the implementation of the pointer message handler, necessary to support "click to focus" for native child windows. Fixes: QTBUG-71352 Change-Id: I2e261caa8dfab096647799ec1e7d781bec40654e Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowspointerhandler.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/plugins/platforms/windows/qwindowspointerhandler.cpp') diff --git a/src/plugins/platforms/windows/qwindowspointerhandler.cpp b/src/plugins/platforms/windows/qwindowspointerhandler.cpp index 4d3e2f71ec..3c7372958f 100644 --- a/src/plugins/platforms/windows/qwindowspointerhandler.cpp +++ b/src/plugins/platforms/windows/qwindowspointerhandler.cpp @@ -467,6 +467,11 @@ bool QWindowsPointerHandler::translateMouseTouchPadEvent(QWindow *window, HWND h keyModifiers, Qt::MouseEventNotSynthesized); return false; // To allow window dragging, etc. } else { + if (eventType == QEvent::MouseButtonPress) { + // Implement "Click to focus" for native child windows (unless it is a native widget window). + if (!window->isTopLevel() && !window->inherits("QWidgetWindow") && QGuiApplication::focusWindow() != window) + window->requestActivate(); + } if (currentWindowUnderPointer != m_windowUnderPointer) { if (m_windowUnderPointer && m_windowUnderPointer == m_currentWindow) { QWindowSystemInterface::handleLeaveEvent(m_windowUnderPointer); -- cgit v1.2.3