From 9765f0aec54515df4e0d5ebb3b36e9f95b718d33 Mon Sep 17 00:00:00 2001 From: tsic404 Date: Fri, 29 Mar 2024 13:44:35 +0800 Subject: [PATCH] fix: dock became normal window not set window flag, and init shell window when kwin effect is ready log: as title --- frame/layershell/x11dlayershellemulation.cpp | 4 ---- shell/appletloader.cpp | 18 ++++++++++++++++-- shell/main.cpp | 5 ++++- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/frame/layershell/x11dlayershellemulation.cpp b/frame/layershell/x11dlayershellemulation.cpp index 24d74fc2b..26a52ba83 100644 --- a/frame/layershell/x11dlayershellemulation.cpp +++ b/frame/layershell/x11dlayershellemulation.cpp @@ -23,7 +23,6 @@ LayerShellEmulation::LayerShellEmulation(QWindow* window, QObject *parent) , m_window(window) , m_dlayerShellWindow(DLayerShellWindow::get(m_window)) { - m_window->setFlag(Qt::FramelessWindowHint); onLayerChanged(); connect(m_dlayerShellWindow, &DLayerShellWindow::layerChanged, this, &LayerShellEmulation::onLayerChanged); @@ -59,7 +58,6 @@ void LayerShellEmulation::onLayerChanged() auto xcbWindow = dynamic_cast(m_window->handle()); switch (m_dlayerShellWindow->layer()) { case DLayerShellWindow::LayerBackground: { - m_window->setFlags(m_window->flags() & ~Qt::WindowStaysOnBottomHint); xcbWindow->setWindowType(QNativeInterface::Private::QXcbWindow::Desktop); break; } @@ -70,7 +68,6 @@ void LayerShellEmulation::onLayerChanged() break; } case DLayerShellWindow::LayerTop: { - m_window->setFlags(m_window->flags() & ~Qt::WindowStaysOnBottomHint); xcbWindow->setWindowType(QNativeInterface::Private::QXcbWindow::Dock); break; } @@ -78,7 +75,6 @@ void LayerShellEmulation::onLayerChanged() // on deepin Notification will be influenced by exclusionZone, // while plasma works all right, maybe deepin kwin bug? // FIXME: fix above - m_window->setFlags(m_window->flags() & ~Qt::WindowStaysOnBottomHint); xcbWindow->setWindowType(QNativeInterface::Private::QXcbWindow::Notification); break; } diff --git a/shell/appletloader.cpp b/shell/appletloader.cpp index a7fb18c63..034f881dd 100644 --- a/shell/appletloader.cpp +++ b/shell/appletloader.cpp @@ -14,9 +14,11 @@ #include #include #include +#include DS_BEGIN_NAMESPACE DCORE_USE_NAMESPACE; +DGUI_USE_NAMESPACE Q_LOGGING_CATEGORY(dsLoaderLog, "dde.shell.loader") @@ -126,8 +128,20 @@ void DAppletLoaderPrivate::doCreateRootObject(DApplet *applet) Q_EMIT q->failed(); } }); - if (!engine->create()) { - engine->deleteLater(); + + // FIXME: kwin load slowly make blur or other effets not ready, should in dtk to ensure effects loaded + if (DWindowManagerHelper::instance()->hasNoTitlebar()) { + if (!engine->create()) { + engine->deleteLater(); + } + } else { + QObject::connect(DWindowManagerHelper::instance(), &DWindowManagerHelper::hasNoTitlebarChanged, applet, [engine, applet] () { + if (DWindowManagerHelper::instance()->hasNoTitlebar()) { + if (!engine->create()) { + engine->deleteLater(); + } + } + }); } } diff --git a/shell/main.cpp b/shell/main.cpp index 0709f9839..6f5055d71 100644 --- a/shell/main.cpp +++ b/shell/main.cpp @@ -147,7 +147,10 @@ int main(int argc, char *argv[]) } AppletManager manager(pluginIds); - manager.exec(); + + QMetaObject::invokeMethod(&a, [&manager](){ + manager.exec(); + }, Qt::QueuedConnection); QObject::connect(qApp, &QCoreApplication::aboutToQuit, qApp, [&manager]() { qCInfo(dsLog) << "Exit dde-shell.";