diff --git a/app/dockcorona.cpp b/app/dockcorona.cpp index bfb100cd1..a059f125f 100644 --- a/app/dockcorona.cpp +++ b/app/dockcorona.cpp @@ -311,8 +311,10 @@ void DockCorona::syncDockViews() } bool onPrimary = cont->config().readEntry("onPrimary", true); + Plasma::Types::Location location = (Plasma::Types::Location)((int)cont->config().readEntry("location", (int)Plasma::Types::BottomEdge)); - if ((onPrimary || (m_screenPool->connector(id) == scr->name())) && (!m_dockViews.contains(cont))) { + if (( (onPrimary && freeEdges(qGuiApp->primaryScreen()).contains(location)) || (m_screenPool->connector(id) == scr->name())) + && (!m_dockViews.contains(cont))) { qDebug() << "screen Count signal: view must be added... for:" << scr->name(); addDock(cont); } @@ -359,12 +361,6 @@ void DockCorona::syncDockViews() bool found{false}; foreach (auto scr, qGuiApp->screens()) { - int id = view->containment()->screen(); - - if (id == -1) { - id = view->containment()->lastScreen(); - } - if (scr->name() == view->currentScreen()) { found = true; break; @@ -379,6 +375,11 @@ void DockCorona::syncDockViews() auto viewToDelete = m_dockViews.take(view->containment()); viewToDelete->deleteLater(); } + } else if (view->onPrimary() && !found + && !freeEdges(qGuiApp->primaryScreen()).contains(view->location())){ + qDebug() << "screen Count signal: primary view must be deleted... for:" << view->currentScreen(); + auto viewToDelete = m_dockViews.take(view->containment()); + viewToDelete->deleteLater(); } else { view->reconsiderScreen(); } diff --git a/shell/contents/configuration/BehaviorConfig.qml b/shell/contents/configuration/BehaviorConfig.qml index e19c08224..4587bba47 100644 --- a/shell/contents/configuration/BehaviorConfig.qml +++ b/shell/contents/configuration/BehaviorConfig.qml @@ -130,12 +130,8 @@ PlasmaComponents.Page { if (index === 0) { var succeed = dock.setCurrentScreen("primary"); - if (succeed) { - dock.onPrimary = true; - } else { - console.log("the edge is already occupied!!!"); - acceptedIndex = false; - } + dock.onPrimary = true; + acceptedIndex = true; } else if (index>0 && (index !== find(dock.currentScreen) || dock.onPrimary)) { console.log("current index changed!!! :"+ index); console.log("screen must be changed...");