From 059b8d798280e1ac351835c6a59e6f91e7ee037d Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Wed, 23 Mar 2022 10:59:24 +0800 Subject: [PATCH] wip Signed-off-by: Yuhang Zhao <2546789017@qq.com> --- src/core/framelesshelper_qt.cpp | 2 +- src/core/framelesshelper_win.cpp | 2 +- src/core/utils.cpp | 4 ++++ src/core/utils_win.cpp | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/core/framelesshelper_qt.cpp b/src/core/framelesshelper_qt.cpp index c8c7254..8671fe7 100644 --- a/src/core/framelesshelper_qt.cpp +++ b/src/core/framelesshelper_qt.cpp @@ -115,7 +115,7 @@ bool FramelessHelperQt::eventFilter(QObject *object, QEvent *event) } const Options options = g_qtHelper()->options.value(window); g_qtHelper()->mutex.unlock(); - if (Utils::isWindowFixedSize(window) || (options & Option::DisableResizing)) { + if (Utils::isWindowFixedSize(window)) { return false; } const auto mouseEvent = static_cast(event); diff --git a/src/core/framelesshelper_win.cpp b/src/core/framelesshelper_win.cpp index 58fc0db..3acb03b 100644 --- a/src/core/framelesshelper_win.cpp +++ b/src/core/framelesshelper_win.cpp @@ -473,7 +473,7 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me // another branch, if you are interested in it, you can give it a // try. - if (Utils::isWindowFixedSize(window) || (options & Option::DisableResizing)) { + if (Utils::isWindowFixedSize(window)) { *result = HTCLIENT; return true; } diff --git a/src/core/utils.cpp b/src/core/utils.cpp index 8b708ff..bf0921a 100644 --- a/src/core/utils.cpp +++ b/src/core/utils.cpp @@ -98,6 +98,10 @@ bool Utils::isWindowFixedSize(const QWindow *window) if (!window) { return false; } + const auto options = qvariant_cast(window->property(kInternalOptionsFlag)); + if (options & Option::DisableResizing) { + return true; + } if (window->flags() & Qt::MSWindowsFixedSizeDialogHint) { return true; } diff --git a/src/core/utils_win.cpp b/src/core/utils_win.cpp index 05c1e6e..67836e8 100644 --- a/src/core/utils_win.cpp +++ b/src/core/utils_win.cpp @@ -520,8 +520,8 @@ void Utils::showSystemMenu(const QWindow *window, const QPoint &pos) return true; }; const bool maxOrFull = (IsMaximized(hWnd) || isFullScreen(reinterpret_cast(hWnd))); + const bool fixedSize = isWindowFixedSize(window); const auto options = qvariant_cast(window->property(kInternalOptionsFlag)); - const bool fixedSize = (isWindowFixedSize(window) || (options & Option::DisableResizing)); if (!setState(SC_RESTORE, (maxOrFull && !fixedSize), true)) { return; }