win: don't use round corner when fullscreen on win11
Fixes: #149 Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
406c801383
commit
c3338cd9b7
|
@ -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<QWindowStateChangeEvent *>(event);
|
||||
if (Utils::windowStatesToWindowState(changeEvent->oldState()) == Qt::WindowFullScreen) {
|
||||
const auto window = qobject_cast<QQuickWindow *>(object);
|
||||
Utils::fixupQtInternals(window->winId());
|
||||
const auto window = qobject_cast<QQuickWindow *>(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<QWindowStateChangeEvent *>(event);
|
||||
if (Utils::windowStatesToWindowState(changeEvent->oldState()) == Qt::WindowFullScreen) {
|
||||
Utils::fixupQtInternals(windowId);
|
||||
if (isWin11OrGreater && roundCorner) {
|
||||
Utils::forceSquareCornersForWindow(windowId, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return QObject::eventFilter(object, event);
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <QtGui/qpainter.h>
|
||||
#include <QtGui/qwindow.h>
|
||||
#include <QtWidgets/qwidget.h>
|
||||
#include <framelessconfig_p.h>
|
||||
#include <micamaterial.h>
|
||||
#include <micamaterial_p.h>
|
||||
#include <utils.h>
|
||||
|
@ -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<QWindowStateChangeEvent *>(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<QWindowStateChangeEvent *>(event);
|
||||
if (Utils::windowStatesToWindowState(changeEvent->oldState()) == Qt::WindowFullScreen) {
|
||||
Utils::fixupQtInternals(windowId);
|
||||
if (isWin11OrGreater && roundCorner) {
|
||||
Utils::forceSquareCornersForWindow(windowId, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue