From c3ef42dad254f6d04cab521c9ae619a46bb84f7a Mon Sep 17 00:00:00 2001 From: Sine Striker <trueful@163.com> Date: ćšć, 21 11æ 2024 21:17:32 +0800 Subject: [PATCH] Fix #151 and a crash bug related to sub frameless window --- src/widgets/widgetwindowagent.cpp | 6 ++++++ share/qmake/QWKCore.pri.in | 4 +++- share/qmake/QWKQuick.pri.in | 6 ++++-- share/qmake/QWKWidgets.pri.in | 6 ++++-- src/core/contexts/win32windowcontext.cpp | 10 ++++------ src/quick/quickwindowagent.cpp | 6 ++++++ 6 files changed, 27 insertions(+), 11 deletions(-) diff --git a/share/qmake/QWKCore.pri.in b/share/qmake/QWKCore.pri.in index 978f9fb..42ce8d2 100644 --- a/share/qmake/QWKCore.pri.in +++ b/share/qmake/QWKCore.pri.in @@ -12,7 +12,7 @@ $$QMAKE_QWK_INSTALL_PREFIX/$$QMAKE_QWK_INSTALL_INCDIR/QWindowKit # Shared link directory - LIBS += \ + QMAKE_QWK_LIB_PATHS += \ "-L$$QMAKE_QWK_INSTALL_PREFIX/$$QMAKE_QWK_INSTALL_LIBDIR" CONFIG(debug, debug|release) { @@ -21,5 +21,7 @@ LIBS += -l@QMAKE_QWK_CORE_NAME_RELEASE@ } + LIBS = $$QMAKE_QWK_LIB_PATHS $$LIBS + @QMAKE_QWK_CORE_STATIC_MACRO@ } \ No newline at end of file diff --git a/share/qmake/QWKQuick.pri.in b/share/qmake/QWKQuick.pri.in index c56f4fe..4ae7f67 100644 --- a/share/qmake/QWKQuick.pri.in +++ b/share/qmake/QWKQuick.pri.in @@ -4,10 +4,12 @@ include($$PWD/QWKCore.pri) CONFIG(debug, debug|release) { - LIBS += -l@QMAKE_QWK_QUICK_NAME_DEBUG@ + LIBS = -l@QMAKE_QWK_QUICK_NAME_DEBUG@ $$LIBS } else { - LIBS += -l@QMAKE_QWK_QUICK_NAME_RELEASE@ + LIBS = -l@QMAKE_QWK_QUICK_NAME_RELEASE@ $$LIBS } + LIBS = $$QMAKE_QWK_LIB_PATHS $$LIBS + @QMAKE_QWK_QUICK_STATIC_MACRO@ } \ No newline at end of file diff --git a/share/qmake/QWKWidgets.pri.in b/share/qmake/QWKWidgets.pri.in index 6976c91..b686719 100644 --- a/share/qmake/QWKWidgets.pri.in +++ b/share/qmake/QWKWidgets.pri.in @@ -4,10 +4,12 @@ include($$PWD/QWKCore.pri) CONFIG(debug, debug|release) { - LIBS += -l@QMAKE_QWK_WIDGETS_NAME_DEBUG@ + LIBS = -l@QMAKE_QWK_WIDGETS_NAME_DEBUG@ $$LIBS } else { - LIBS += -l@QMAKE_QWK_WIDGETS_NAME_RELEASE@ + LIBS = -l@QMAKE_QWK_WIDGETS_NAME_RELEASE@ $$LIBS } + LIBS = $$QMAKE_QWK_LIB_PATHS $$LIBS + @QMAKE_QWK_WIDGETS_STATIC_MACRO@ } \ No newline at end of file diff --git a/src/core/contexts/win32windowcontext.cpp b/src/core/contexts/win32windowcontext.cpp index 8ad7ae8..6d54ad6 100644 --- a/src/core/contexts/win32windowcontext.cpp +++ b/src/core/contexts/win32windowcontext.cpp @@ -827,6 +827,10 @@ return isSystemBorderEnabled() && !isWin11OrGreater(); } + if (key == QStringLiteral("windows-system-border-enabled")) { + return isSystemBorderEnabled(); + } + if (key == QStringLiteral("border-thickness")) { return m_windowId ? int(getWindowFrameBorderThickness(reinterpret_cast<HWND>(m_windowId))) @@ -845,16 +849,10 @@ lastHitTestResult = WindowPart::Outside; lastHitTestResultRaw = HTNOWHERE; - if (!isSystemBorderEnabled()) { - m_delegate->setWindowFlags(m_host, m_delegate->getWindowFlags(m_host) | - Qt::FramelessWindowHint); - } - // If the original window id is valid, remove all resources related if (oldWinId) { removeManagedWindow(reinterpret_cast<HWND>(oldWinId)); } - if (!winId) { return; } diff --git a/src/quick/quickwindowagent.cpp b/src/quick/quickwindowagent.cpp index 5225a09..9270311 100644 --- a/src/quick/quickwindowagent.cpp +++ b/src/quick/quickwindowagent.cpp @@ -50,6 +50,12 @@ #if defined(Q_OS_WINDOWS) && QWINDOWKIT_CONFIG(ENABLE_WINDOWS_SYSTEM_BORDERS) d->setupWindows10BorderWorkaround(); #endif + +#ifdef Q_OS_WINDOWS + if (!windowAttribute(QStringLiteral("windows-system-border-enabled")).toBool()) { + window->setFlag(Qt::FramelessWindowHint); + } +#endif return true; } diff --git a/src/widgets/widgetwindowagent.cpp b/src/widgets/widgetwindowagent.cpp index aa48f79..ea6b22c 100644 --- a/src/widgets/widgetwindowagent.cpp +++ b/src/widgets/widgetwindowagent.cpp @@ -64,6 +64,12 @@ #if defined(Q_OS_WINDOWS) && QWINDOWKIT_CONFIG(ENABLE_WINDOWS_SYSTEM_BORDERS) d->setupWindows10BorderWorkaround(); #endif + +#ifdef Q_OS_WINDOWS + if (!windowAttribute(QStringLiteral("windows-system-border-enabled")).toBool()) { + w->setWindowFlag(Qt::FramelessWindowHint); + } +#endif return true; } -- Gitblit v1.9.1