From 10dfc623478ce21533b1806bf945838c7bce9ea6 Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Tue, 4 Sep 2018 19:38:54 +0300 Subject: [PATCH] on startup explicit dock faulty moving onPrimary --multi-screen fix for explicit docks. There were cases that explicit docks during startup were moving to onprimary screen even though they shouldnt based on the new multi-screens implementation. Bug was tracked down at a faulty series of signals that were overwriting dockView config values to default values and that was creating the fault. -- one more fix for multi-screens, a missing return statement in case an explicit dock is called and its edge at that specific screen is occuppied by an onPrimary one. BUG: 398219 FIXED-IN: 0.8.1 (cherry picked from commit 09fe5e385b4df76afbd342fab61afe6c642aaaf1) --- app/dock/dockview.cpp | 19 ++++++++++++++----- app/layout.cpp | 2 ++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/app/dock/dockview.cpp b/app/dock/dockview.cpp index da3264929..4d9ff2e80 100644 --- a/app/dock/dockview.cpp +++ b/app/dock/dockview.cpp @@ -99,9 +99,13 @@ DockView::DockView(Plasma::Corona *corona, QScreen *targetScreen, bool dockWindo qDebug() << "dock view c++ containment changed 2..."; + //! First load default values from file + restoreConfig(); + + //! Afterwards override that values in case during creation something different is needed setDockWinBehavior(dockWindowBehavior); - restoreConfig(); + //! Check the screen assigned to this dock reconsiderScreen(); if (!m_visibility) { @@ -1928,8 +1932,8 @@ void DockView::saveConfig() return; auto config = this->containment()->config(); - config.writeEntry("onPrimary", m_onPrimary); - config.writeEntry("dockWindowBehavior", m_dockWinBehavior); + config.writeEntry("onPrimary", onPrimary()); + config.writeEntry("dockWindowBehavior", dockWinBehavior()); config.sync(); } @@ -1939,8 +1943,13 @@ void DockView::restoreConfig() return; auto config = this->containment()->config(); - setOnPrimary(config.readEntry("onPrimary", true)); - setDockWinBehavior(config.readEntry("dockWindowBehavior", true)); + m_onPrimary = config.readEntry("onPrimary", true); + m_dockWinBehavior = config.readEntry("dockWindowBehavior", true); + + //! Send changed signals at the end in order to be sure that saveConfig + //! wont rewrite default/invalid values + emit onPrimaryChanged(); + emit dockWinBehaviorChanged(); } //!END configuration functions diff --git a/app/layout.cpp b/app/layout.cpp index c3e46660c..1c39f2f2e 100644 --- a/app/layout.cpp +++ b/app/layout.cpp @@ -911,6 +911,7 @@ void Layout::addDock(Plasma::Containment *containment, bool forceOnPrimary, int if (primaryDockOccupyEdge(containment->location())) { qDebug() << "reject : adding explicit dock, primary dock occupies edge at screen ! : " << connector; + return; } } @@ -973,6 +974,7 @@ void Layout::addDock(Plasma::Containment *containment, bool forceOnPrimary, int //! force this special dock case to become primary //! even though it isnt if (forceOnPrimary) { + qDebug() << "Enforcing onPrimary:true as requested for DockView..."; dockView->setOnPrimary(true); }