remove on primary docks on special cases

--primary docks are removed when their edge is
occupied in the new primary screen and their
current screen is destroyed. Also they are added
when the screen edge is available
pull/1/head
Michail Vourlakos 8 years ago
parent 74770a9f37
commit 5421b976fa

@ -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();
}

@ -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...");

Loading…
Cancel
Save