From 53b2a407af9d1d60cfbb1a42af8546ab0a156d38 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Thu, 6 Oct 2016 15:50:05 +0200 Subject: [PATCH 15/19] save the containment only aftyer switch Summary: during a type switch if the new containment gets saved before getting a view, it will get lastScreen=-1 so the next boot it will create a new containment Test Plan: switched repeatedly between desktop and folderview the config file always got with the correct lastScreen=0 entry Reviewers: #plasma Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D2966 --- shell/shellcorona.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/shell/shellcorona.cpp b/shell/shellcorona.cpp index 1d08cd1..74f6ded 100644 --- a/shell/shellcorona.cpp +++ b/shell/shellcorona.cpp @@ -1562,8 +1562,6 @@ Plasma::Containment *ShellCorona::setContainmentTypeForScreen(int screen, const newCg.writeEntry("activityId", oldContainment->activity()); newContainment->restore(newCg); newContainment->updateConstraints(Plasma::Types::StartupCompletedConstraint); - newContainment->save(newCg); - requestConfigSync(); newContainment->flushPendingConstraintsEvents(); emit containmentAdded(newContainment); @@ -1588,6 +1586,9 @@ Plasma::Containment *ShellCorona::setContainmentTypeForScreen(int screen, const view->rootObject()->setFocus(true, Qt::MouseFocusReason); QTimer::singleShot(2500, oldContainment, &Plasma::Applet::destroy); + //Save now as we now have a screen, so lastScreen will not be -1 + newContainment->save(newCg); + requestConfigSync(); emit availableScreenRectChanged(); return newContainment; -- 2.7.4