1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-30 14:50:12 +03:00

fix #635,never add primary dock over an explicit

--the addDock code now checks if at the primary screen
in the specific edge there is already assigned an explicit
dock. In that case it doesnt add that primary dock
This commit is contained in:
Michail Vourlakos 2017-07-30 13:08:08 +03:00
parent 1e4f98b4ae
commit 7d4344637c
2 changed files with 23 additions and 0 deletions

View File

@ -866,6 +866,12 @@ void DockCorona::addDock(Plasma::Containment *containment, int expDockScreen)
qDebug() << "adding dock rejected, screen not available : " << connector;
return;
}
} else if (onPrimary) {
if (explicitDockOccupyEdge(primaryScreenId(), containment->location())) {
//we must check that an onPrimary dock should never catch up the same edge on
//the same screen with an explicit dock
return;
}
}
qDebug() << "Adding dock for container...";
@ -911,6 +917,22 @@ void DockCorona::addDock(Plasma::Containment *containment, int expDockScreen)
emit docksCountChanged();
}
bool DockCorona::explicitDockOccupyEdge(int screen, Plasma::Types::Location location) const
{
foreach (auto containment, containments()) {
bool onPrimary = containment->config().readEntry("onPrimary", true);
int id = containment->lastScreen();
Plasma::Types::Location contLocation = containment->location();
if (!onPrimary && id == screen && contLocation == location) {
return true;
}
}
return false;
}
void DockCorona::recreateDock(Plasma::Containment *containment)
{
//! give the time to config window to close itself first and then recreate the dock

View File

@ -125,6 +125,7 @@ private:
bool appletExists(uint containmentId, uint appletId) const;
bool containmentExists(uint id) const;
bool explicitDockOccupyEdge(int screen, Plasma::Types::Location location)const;
bool heuresticForLoadingDockWithTasks();
int noOfDocks();
int primaryScreenId() const;