From bc03db3759e0d8644e626adcbda066ccb2c30062 Mon Sep 17 00:00:00 2001 From: Zhao Yuhang <2546789017@qq.com> Date: 周日, 09 2月 2025 17:28:30 +0800 Subject: [PATCH] fix compilation error for old qt versions --- CMakeLists.txt | 2 +- src/core/contexts/win32windowcontext.cpp | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 57d5e8d..9f5d54e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.19) -project(QWindowKit VERSION 1.3.1.0 LANGUAGES CXX) +project(QWindowKit VERSION 1.3.2.0 LANGUAGES CXX) # ---------------------------------- # Build Options diff --git a/src/core/contexts/win32windowcontext.cpp b/src/core/contexts/win32windowcontext.cpp index 204b4b0..775f2ca 100644 --- a/src/core/contexts/win32windowcontext.cpp +++ b/src/core/contexts/win32windowcontext.cpp @@ -2021,13 +2021,17 @@ // and align it with the upper-left corner of our new client area". const auto clientRect = wParam ? &(reinterpret_cast<LPNCCALCSIZE_PARAMS>(lParam))->rgrc[0] : reinterpret_cast<LPRECT>(lParam); - [[maybe_unused]] const auto& d3dFlickerReducer = qScopeGuard([this]() { + [[maybe_unused]] const auto& flickerReducer = qScopeGuard([this]() { // When we receive this message, it means the window size has changed // already, and it seems this message always come before any client // area size notifications (eg. WM_WINDOWPOSCHANGED and WM_SIZE). Let - // D3D paint immediately to let user see the latest result as soon as - // possible. - if (m_windowHandle && m_windowHandle->surfaceType() == QSurface::Direct3DSurface + // D3D/VK paint immediately to let user see the latest result as soon + // as possible. + const auto& isTargetSurface = [](const QSurface::SurfaceType st){ + return st != QSurface::RasterSurface && st != QSurface::OpenGLSurface + && st != QSurface::RasterGLSurface && st != QSurface::OpenVGSurface; + }; + if (m_windowHandle && isTargetSurface(m_windowHandle->surfaceType()) && isDwmCompositionEnabled() && DynamicApis::instance().pDwmFlush) { DynamicApis::instance().pDwmFlush(); } -- Gitblit v1.9.1