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
v0.6
Michail Vourlakos 8 years ago
parent f4ac1436f4
commit 94504032c7

@ -311,8 +311,10 @@ void DockCorona::syncDockViews()
} }
bool onPrimary = cont->config().readEntry("onPrimary", true); 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(); qDebug() << "screen Count signal: view must be added... for:" << scr->name();
addDock(cont); addDock(cont);
} }
@ -359,12 +361,6 @@ void DockCorona::syncDockViews()
bool found{false}; bool found{false};
foreach (auto scr, qGuiApp->screens()) { foreach (auto scr, qGuiApp->screens()) {
int id = view->containment()->screen();
if (id == -1) {
id = view->containment()->lastScreen();
}
if (scr->name() == view->currentScreen()) { if (scr->name() == view->currentScreen()) {
found = true; found = true;
break; break;
@ -379,6 +375,11 @@ void DockCorona::syncDockViews()
auto viewToDelete = m_dockViews.take(view->containment()); auto viewToDelete = m_dockViews.take(view->containment());
viewToDelete->deleteLater(); 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 { } else {
view->reconsiderScreen(); view->reconsiderScreen();
} }

@ -130,12 +130,8 @@ PlasmaComponents.Page {
if (index === 0) { if (index === 0) {
var succeed = dock.setCurrentScreen("primary"); var succeed = dock.setCurrentScreen("primary");
if (succeed) { dock.onPrimary = true;
dock.onPrimary = true; acceptedIndex = true;
} else {
console.log("the edge is already occupied!!!");
acceptedIndex = false;
}
} else if (index>0 && (index !== find(dock.currentScreen) || dock.onPrimary)) { } else if (index>0 && (index !== find(dock.currentScreen) || dock.onPrimary)) {
console.log("current index changed!!! :"+ index); console.log("current index changed!!! :"+ index);
console.log("screen must be changed..."); console.log("screen must be changed...");

Loading…
Cancel
Save