diff --git a/src/quick/framelessquickhelper.cpp b/src/quick/framelessquickhelper.cpp index a6b5731..606d133 100644 --- a/src/quick/framelessquickhelper.cpp +++ b/src/quick/framelessquickhelper.cpp @@ -462,16 +462,29 @@ bool FramelessQuickHelperPrivate::eventFilter(QObject *object, QEvent *event) return false; } #ifdef Q_OS_WINDOWS - if (!object->isWindowType()) { + if (!object->isWindowType() || (event->type() != QEvent::WindowStateChange)) { return QObject::eventFilter(object, event); } - if (event->type() != QEvent::WindowStateChange) { - return QObject::eventFilter(object, event); - } - const auto changeEvent = static_cast(event); - if (Utils::windowStatesToWindowState(changeEvent->oldState()) == Qt::WindowFullScreen) { - const auto window = qobject_cast(object); - Utils::fixupQtInternals(window->winId()); + const auto window = qobject_cast(object); + const WId windowId = window->winId(); + static const bool isWin11OrGreater = Utils::isWindowsVersionOrGreater(WindowsVersion::_11_21H2); + const bool roundCorner = FramelessConfig::instance()->isSet(Option::WindowUseRoundCorners); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) + if (Utils::windowStatesToWindowState(window->windowStates()) == Qt::WindowFullScreen) { +#else + if (window->windowState() == Qt::WindowFullScreen) { +#endif + if (isWin11OrGreater && roundCorner) { + Utils::forceSquareCornersForWindow(windowId, true); + } + } else { + const auto changeEvent = static_cast(event); + if (Utils::windowStatesToWindowState(changeEvent->oldState()) == Qt::WindowFullScreen) { + Utils::fixupQtInternals(windowId); + if (isWin11OrGreater && roundCorner) { + Utils::forceSquareCornersForWindow(windowId, false); + } + } } #endif return QObject::eventFilter(object, event); diff --git a/src/widgets/widgetssharedhelper.cpp b/src/widgets/widgetssharedhelper.cpp index 5bb51fc..ea610e4 100644 --- a/src/widgets/widgetssharedhelper.cpp +++ b/src/widgets/widgetssharedhelper.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -149,9 +150,21 @@ void WidgetsSharedHelper::changeEventHandler(QEvent *event) QMetaObject::invokeMethod(m_targetWidget, "normalChanged"); QMetaObject::invokeMethod(m_targetWidget, "zoomedChanged"); #ifdef Q_OS_WINDOWS - const auto changeEvent = static_cast(event); - if (Utils::windowStatesToWindowState(changeEvent->oldState()) == Qt::WindowFullScreen) { - Utils::fixupQtInternals(m_targetWidget->winId()); + const WId windowId = m_targetWidget->winId(); + static const bool isWin11OrGreater = Utils::isWindowsVersionOrGreater(WindowsVersion::_11_21H2); + const bool roundCorner = FramelessConfig::instance()->isSet(Option::WindowUseRoundCorners); + if (Utils::windowStatesToWindowState(m_targetWidget->windowState()) == Qt::WindowFullScreen) { + if (isWin11OrGreater && roundCorner) { + Utils::forceSquareCornersForWindow(windowId, true); + } + } else { + const auto changeEvent = static_cast(event); + if (Utils::windowStatesToWindowState(changeEvent->oldState()) == Qt::WindowFullScreen) { + Utils::fixupQtInternals(windowId); + if (isWin11OrGreater && roundCorner) { + Utils::forceSquareCornersForWindow(windowId, false); + } + } } #endif }