From d02f3b0bc32f711bf33a7fd288185963e9e96189 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <zhaoyuhang@rankyee.com> Date: 周二, 05 12月 2023 16:21:28 +0800 Subject: [PATCH] add isFixedSize implementation --- src/core/contexts/win32windowcontext.cpp | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/core/contexts/win32windowcontext.cpp b/src/core/contexts/win32windowcontext.cpp index 49a6d69..67a278f 100644 --- a/src/core/contexts/win32windowcontext.cpp +++ b/src/core/contexts/win32windowcontext.cpp @@ -46,7 +46,8 @@ QSystemLibrary dwmapi(QStringLiteral("dwmapi.dll")); pDwmFlush = reinterpret_cast<decltype(pDwmFlush)>(dwmapi.resolve("DwmFlush")); - pDwmIsCompositionEnabled = reinterpret_cast<decltype(pDwmIsCompositionEnabled)>(dwmapi.resolve("DwmIsCompositionEnabled")); + pDwmIsCompositionEnabled = reinterpret_cast<decltype(pDwmIsCompositionEnabled)>( + dwmapi.resolve("DwmIsCompositionEnabled")); } ~DynamicApis() = default; @@ -175,7 +176,9 @@ if (!hwnd) { return; } - ::SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED); + ::SetWindowPos(hwnd, nullptr, 0, 0, 0, 0, + SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | + SWP_FRAMECHANGED); } static inline quint32 getDpiForWindow(HWND hwnd) { @@ -452,8 +455,8 @@ return ::CallWindowProcW(g_qtWindowProc, hWnd, message, wParam, lParam); } - Win32WindowContext::Win32WindowContext(QWindow *window, WindowItemDelegate *delegate) - : AbstractWindowContext(window, delegate) { + Win32WindowContext::Win32WindowContext(QObject *host, WindowItemDelegate *delegate) + : AbstractWindowContext(host, delegate) { } Win32WindowContext::~Win32WindowContext() { @@ -469,9 +472,12 @@ } bool Win32WindowContext::setup() { - auto winId = m_windowHandle->winId(); + if (!m_windowHandle) { + return false; + } // Install window hook + auto winId = m_windowHandle->winId(); auto hWnd = reinterpret_cast<HWND>(winId); // Store original window proc @@ -1137,7 +1143,7 @@ QPoint qtScenePos = fromNativeLocalPosition( m_windowHandle, QPoint(nativeLocalPos.x, nativeLocalPos.y)); - bool isFixedSize = /*isWindowFixedSize()*/ false; // ### FIXME + bool isFixedSize = m_delegate->isHostSizeFixed(m_host); bool isTitleBar = isInTitleBarDraggableArea(qtScenePos); bool dontOverrideCursor = false; // ### TODO -- Gitblit v1.9.1