From f48aa008e992429647968a29ef30d412f1ae379a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 28 Mar 2018 11:22:09 +0200 Subject: Windows QPA: Fix RTL window title bars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a platform option to the plugin (-platform windows:reverse) that enables reverse mode. It sets WS_EX_LAYOUTRTL on RTL windows, forces normal orientation on all HDCs created for the window, fixes ClientToScreen()/ScreenToClient() accordingly and transforms mouse events. [ChangeLog][Platform Specific Changes][Windows] It is now possible to enable RTL mode by passing the option -platform windows:reverse. Fixes: QTBUG-28463 Change-Id: I4d70818b2fd315d4e8d5627eab11ae912c6e77be Reviewed-by: Miikka Heikkinen Reviewed-by: André de la Rocha --- src/plugins/platforms/windows/qwindowscontext.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/plugins/platforms/windows/qwindowscontext.cpp') diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 320b5b1a41..f93d196b20 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -713,7 +713,7 @@ static inline bool findPlatformWindowHelper(const POINT &screenPoint, unsigned c HWND *hwnd, QWindowsWindow **result) { POINT point = screenPoint; - ScreenToClient(*hwnd, &point); + screenToClient(*hwnd, &point); // Returns parent if inside & none matched. const HWND child = ChildWindowFromPointEx(*hwnd, point, cwexFlags); if (!child || child == *hwnd) @@ -1043,7 +1043,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, // For non-client-area messages, these are screen coordinates (as expected // in the MSG structure), otherwise they are client coordinates. if (!(et & QtWindows::NonClientEventFlag)) { - ClientToScreen(msg.hwnd, &msg.pt); + clientToScreen(msg.hwnd, &msg.pt); } } else { GetCursorPos(&msg.pt); @@ -1134,13 +1134,11 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::QuerySizeHints: d->m_creationContext->applyToMinMaxInfo(reinterpret_cast(lParam)); return true; - case QtWindows::ResizeEvent: { - const QSize size(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) - d->m_creationContext->menuHeight); - d->m_creationContext->obtainedGeometry.setSize(size); - } + case QtWindows::ResizeEvent: + d->m_creationContext->obtainedSize = QSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); return true; case QtWindows::MoveEvent: - d->m_creationContext->obtainedGeometry.moveTo(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); + d->m_creationContext->obtainedPos = QPoint(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); return true; case QtWindows::NonClientCreate: if (shouldHaveNonClientDpiScaling(d->m_creationContext->window)) -- cgit v1.2.3