From b9aabb7b1c927320f34b5220d336e53de99a585b Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Thu, 21 Mar 2019 15:42:20 +0200 Subject: [PATCH] multi-screen: find view::screen id in better way --when monitor from an explicit screen was closed there were cases that docks were moved at another monitor from the window manager and that was preventing them to be delete properly. This patch fixes this by considering as valid explicit screen only the one provided by the view BUG: 405687 --- app/layout.cpp | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/app/layout.cpp b/app/layout.cpp index cbbcdea9e..a9b3492b5 100644 --- a/app/layout.cpp +++ b/app/layout.cpp @@ -1505,20 +1505,29 @@ void Layout::syncDockViewsToScreens() //! first step: primary docks must be placed in primary screen free edges foreach (auto containment, m_containments) { if (isLatteContainment(containment)) { - int screenId = containment->screen(); + int screenId = 0; - if (screenId == -1) { - screenId = containment->lastScreen(); + //! valid screen id + if (latteViewExists(containment)) { + screenId = m_latteViews[containment]->positioner()->currentScreenId(); + } else { + screenId = containment->screen(); + + if (screenId == -1) { + screenId = containment->lastScreen(); + } } bool onPrimary{true}; + //! valid onPrimary flag if (latteViewExists(containment)) { onPrimary = m_latteViews[containment]->onPrimary(); } else { onPrimary = containment->config().readEntry("onPrimary", true); } + //! valid location Plasma::Types::Location location = containment->location(); if (onPrimary && !futureDocksLocations[prmScreenName].contains(location)) { @@ -1531,20 +1540,29 @@ void Layout::syncDockViewsToScreens() //! second step: explicit docks must be placed in their screens if the screen edge is free foreach (auto containment, m_containments) { if (isLatteContainment(containment)) { - int screenId = containment->screen(); + int screenId = 0; - if (screenId == -1) { - screenId = containment->lastScreen(); + //! valid screen id + if (latteViewExists(containment)) { + screenId = m_latteViews[containment]->positioner()->currentScreenId(); + } else { + screenId = containment->screen(); + + if (screenId == -1) { + screenId = containment->lastScreen(); + } } bool onPrimary{true}; + //! valid onPrimary flag if (latteViewExists(containment)) { onPrimary = m_latteViews[containment]->onPrimary(); } else { onPrimary = containment->config().readEntry("onPrimary", true); } + //! valid location Plasma::Types::Location location = containment->location(); if (!onPrimary) {