From 19279aa8484d01b60c06de1abbae9f39864b928e Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Sat, 11 Apr 2020 19:22:08 +0800 Subject: [PATCH] Update. Signed-off-by: Yuhang Zhao <2546789017@qq.com> --- winnativeeventfilter.cpp | 10 ++++++---- winnativeeventfilter.h | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/winnativeeventfilter.cpp b/winnativeeventfilter.cpp index 2bd3cf7..f74f001 100644 --- a/winnativeeventfilter.cpp +++ b/winnativeeventfilter.cpp @@ -1002,12 +1002,14 @@ qreal WinNativeEventFilter::getPreferedNumber(qreal num) { return result; } -void WinNativeEventFilter::updateWindow(HWND handle) { +void WinNativeEventFilter::updateWindow(HWND handle, bool triggerFrameChange) { initWin32Api(); if (handle && m_lpIsWindow(handle)) { - m_lpSetWindowPos(handle, nullptr, 0, 0, 0, 0, - SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | - SWP_NOMOVE | SWP_NOZORDER | SWP_NOOWNERZORDER); + if (triggerFrameChange) { + m_lpSetWindowPos(handle, nullptr, 0, 0, 0, 0, + SWP_FRAMECHANGED | SWP_NOACTIVATE | SWP_NOSIZE | + SWP_NOMOVE | SWP_NOZORDER | SWP_NOOWNERZORDER); + } m_lpRedrawWindow(handle, nullptr, nullptr, RDW_INVALIDATE | RDW_UPDATENOW | RDW_NOCHILDREN); } diff --git a/winnativeeventfilter.h b/winnativeeventfilter.h index 8d7fd3a..f7bd13c 100644 --- a/winnativeeventfilter.h +++ b/winnativeeventfilter.h @@ -94,7 +94,7 @@ public: // window (if the pointer is null, return the system's standard value). static int titlebarHeight(HWND handle); - static void updateWindow(HWND handle); + static void updateWindow(HWND handle, bool triggerFrameChange = true); #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) bool nativeEventFilter(const QByteArray &eventType, void *message,