From a718d8d58aeaf10052557c69a14d321b3e1372ce Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Sat, 24 Apr 2021 12:33:40 +0300 Subject: [PATCH] support aboutToQuit application signal on exit --add also shadows to tasks window thumbnails --- app/lattecorona.cpp | 25 ++++++++++++++++--- app/lattecorona.h | 2 ++ .../package/contents/ui/applet/AppletItem.qml | 1 + .../contents/ui/previews/ToolTipInstance.qml | 14 ++++++++++- 4 files changed, 38 insertions(+), 4 deletions(-) diff --git a/app/lattecorona.cpp b/app/lattecorona.cpp index 88da62a6b..0491cabb5 100644 --- a/app/lattecorona.cpp +++ b/app/lattecorona.cpp @@ -111,8 +111,9 @@ Corona::Corona(bool defaultLayoutOnStartup, QString layoutNameOnStartUp, int use m_plasmaGeometries(new PlasmaExtended::ScreenGeometries(this)), m_dialogShadows(new PanelShadows(this, QStringLiteral("dialogs/background"))) { - //! create the window manager + connect(qApp, &QApplication::aboutToQuit, this, &Corona::onAboutToQuit); + //! create the window manager if (KWindowSystem::isPlatformWayland()) { m_wm = new WindowSystem::WaylandInterface(this); } else { @@ -162,7 +163,7 @@ Corona::Corona(bool defaultLayoutOnStartup, QString layoutNameOnStartUp, int use Corona::~Corona() { - m_inQuit = true; + /*m_inQuit = true; //! BEGIN: Give the time to slide-out views when closing m_layoutsManager->synchronizer()->hideAllViews(); @@ -175,7 +176,7 @@ Corona::~Corona() } qDebug() << "Latte Corona - unload: containments ..."; - m_layoutsManager->unload(); + m_layoutsManager->unload();*/ m_plasmaGeometries->deleteLater(); m_wm->deleteLater(); @@ -202,6 +203,24 @@ Corona::~Corona() } } +void Corona::onAboutToQuit() +{ + m_inQuit = true; + + //! BEGIN: Give the time to slide-out views when closing + m_layoutsManager->synchronizer()->hideAllViews(); + m_viewSettingsFactory->deleteLater(); + + m_viewsScreenSyncTimer.stop(); + + if (m_layoutsManager->memoryUsage() == MemoryUsage::SingleLayout) { + cleanConfig(); + } + + qDebug() << "Latte Corona - unload: containments ..."; + m_layoutsManager->unload(); +} + void Corona::load() { if (m_activitiesConsumer && (m_activitiesConsumer->serviceStatus() == KActivities::Consumer::Running) && m_activitiesStarting) { diff --git a/app/lattecorona.h b/app/lattecorona.h index 348c1fb18..725aa7b19 100644 --- a/app/lattecorona.h +++ b/app/lattecorona.h @@ -196,6 +196,8 @@ private slots: void alternativesVisibilityChanged(bool visible); void load(); + void onAboutToQuit(); + void addOutput(QScreen *screen); void primaryOutputChanged(); void screenRemoved(QScreen *screen); diff --git a/containment/package/contents/ui/applet/AppletItem.qml b/containment/package/contents/ui/applet/AppletItem.qml index 005bef1d8..47a75a95c 100644 --- a/containment/package/contents/ui/applet/AppletItem.qml +++ b/containment/package/contents/ui/applet/AppletItem.qml @@ -62,6 +62,7 @@ Item { readonly property bool canFillScreenEdge: communicator.requires.screenEdgeMarginSupported || communicator.indexerIsSupported readonly property bool canFillThickness: applet && applet.hasOwnProperty("constraintHints") && ((applet.constraintHints & PlasmaCore.Types.CanFillArea) === PlasmaCore.Types.CanFillArea); + readonly property bool isMarginsAreaSeparator: applet && applet.hasOwnProperty("constraintHints") && ((applet.constraintHints & PlasmaCore.Types.MarginAreasSeparator) === PlasmaCore.Types.MarginAreasSeparator); diff --git a/plasmoid/package/contents/ui/previews/ToolTipInstance.qml b/plasmoid/package/contents/ui/previews/ToolTipInstance.qml index ae8552725..b07cfd3c3 100644 --- a/plasmoid/package/contents/ui/previews/ToolTipInstance.qml +++ b/plasmoid/package/contents/ui/previews/ToolTipInstance.qml @@ -202,10 +202,22 @@ Column { Loader{ id:previewThumbLoader anchors.fill: parent - anchors.margins: 2 + anchors.margins: Math.max(2, previewShadow.radius) active: LatteCore.WindowSystem.isPlatformX11 || (root.plasma520 && LatteCore.WindowSystem.isPlatformWayland) visible: !albumArtImage.visible && !thumbnailSourceItem.isMinimized source: root.plasma520 && LatteCore.WindowSystem.isPlatformWayland ? "PipeWireThumbnail.qml" : "PlasmaCoreThumbnail.qml" + + DropShadow { + id: previewShadow + anchors.fill: previewThumbLoader.item + visible: previewThumbLoader.item.visible + horizontalOffset: 0 + verticalOffset: Math.round(3 * PlasmaCore.Units.devicePixelRatio) + radius: Math.round(8.0 * PlasmaCore.Units.devicePixelRatio) + samples: Math.round(radius * 1.5) + color: "Black" + source: previewThumbLoader.item + } } ToolTipWindowMouseArea {