ignore systrays at multi-screen considerations

--if a dock/panel was containing a systray there
was a chance that the systray was messing the
calculations for adding/removing docks based on
the screen and edges changes
pull/2/head
Michail Vourlakos 7 years ago
parent b2f1f98b57
commit 285a2f8764

@ -861,11 +861,9 @@ void Layout::addDock(Plasma::Containment *containment, bool forceOnPrimary, int
return; return;
} }
auto metadata = containment->kPackage().metadata();
qDebug() << "step 1..."; qDebug() << "step 1...";
if (metadata.pluginId() != "org.kde.latte.containment") if (!isLatteContainment(containment))
return; return;
qDebug() << "step 2..."; qDebug() << "step 2...";
@ -1423,9 +1421,7 @@ QList<Plasma::Containment *> Layout::importLayoutFile(QString file)
//QList<Plasma::Containment *> systrays; //QList<Plasma::Containment *> systrays;
foreach (auto containment, newContainments) { foreach (auto containment, newContainments) {
KPluginMetaData meta = containment->kPackage().metadata(); if (isLatteContainment(containment)) {
if (meta.pluginId() == "org.kde.latte.containment") {
qDebug() << "new latte containment id: " << containment->id(); qDebug() << "new latte containment id: " << containment->id();
importedDocks << containment; importedDocks << containment;
} }
@ -1499,44 +1495,49 @@ void Layout::syncDockViewsToScreens()
//! first step: primary docks must be placed in primary screen free edges //! first step: primary docks must be placed in primary screen free edges
foreach (auto containment, m_containments) { foreach (auto containment, m_containments) {
int screenId = containment->screen(); if (isLatteContainment(containment)) {
int screenId = containment->screen();
if (screenId == -1) { if (screenId == -1) {
screenId = containment->lastScreen(); screenId = containment->lastScreen();
} }
bool onPrimary = containment->config().readEntry("onPrimary", true); bool onPrimary = containment->config().readEntry("onPrimary", true);
Plasma::Types::Location location = static_cast<Plasma::Types::Location>((int)containment->config().readEntry("location", (int)Plasma::Types::BottomEdge)); Plasma::Types::Location location = static_cast<Plasma::Types::Location>((int)containment->config().readEntry("location", (int)Plasma::Types::BottomEdge));
if (onPrimary && !futureDocksLocations[prmScreenName].contains(location)) { if (onPrimary && !futureDocksLocations[prmScreenName].contains(location)) {
futureDocksLocations[prmScreenName].append(location); futureDocksLocations[prmScreenName].append(location);
futureShownViews.append(containment->id()); futureShownViews.append(containment->id());
}
} }
} }
//! second step: explicit docks must be placed in their screens if the screen edge is free //! second step: explicit docks must be placed in their screens if the screen edge is free
foreach (auto containment, m_containments) { foreach (auto containment, m_containments) {
int screenId = containment->screen(); if (isLatteContainment(containment)) {
int screenId = containment->screen();
if (screenId == -1) { if (screenId == -1) {
screenId = containment->lastScreen(); screenId = containment->lastScreen();
} }
bool onPrimary = containment->config().readEntry("onPrimary", true); bool onPrimary = containment->config().readEntry("onPrimary", true);
Plasma::Types::Location location = static_cast<Plasma::Types::Location>((int)containment->config().readEntry("location", (int)Plasma::Types::BottomEdge)); Plasma::Types::Location location = static_cast<Plasma::Types::Location>((int)containment->config().readEntry("location", (int)Plasma::Types::BottomEdge));
if (!onPrimary) { if (!onPrimary) {
QString expScreenName = m_corona->screenPool()->connector(screenId); QString expScreenName = m_corona->screenPool()->connector(screenId);
if (m_corona->screenPool()->screenExists(screenId) && !futureDocksLocations[expScreenName].contains(location)) { if (m_corona->screenPool()->screenExists(screenId) && !futureDocksLocations[expScreenName].contains(location)) {
futureDocksLocations[expScreenName].append(location); futureDocksLocations[expScreenName].append(location);
futureShownViews.append(containment->id()); futureShownViews.append(containment->id());
}
} }
} }
} }
qDebug() << "PRIMARY SCREEN :: " << prmScreenName; qDebug() << "PRIMARY SCREEN :: " << prmScreenName;
qDebug() << "DOCKVIEWS MUST BE PRESENT AT :: " << futureDocksLocations; qDebug() << "DOCKVIEWS MUST BE PRESENT AT :: " << futureDocksLocations;
qDebug() << "FUTURESHOWNVIEWS MUST BE :: " << futureShownViews;
//! add views //! add views
foreach (auto containment, m_containments) { foreach (auto containment, m_containments) {
@ -1547,7 +1548,7 @@ void Layout::syncDockViewsToScreens()
} }
if (!dockViewExists(containment) && futureShownViews.contains(containment->id())) { if (!dockViewExists(containment) && futureShownViews.contains(containment->id())) {
qDebug() << "syncDockViewsToScreens: view must be added... for:" << m_corona->screenPool()->connector(screenId); qDebug() << "syncDockViewsToScreens: view must be added... for containment:" << containment->id() << " at screen:" << m_corona->screenPool()->connector(screenId);
addDock(containment); addDock(containment);
} }
} }
@ -1555,7 +1556,7 @@ void Layout::syncDockViewsToScreens()
//! remove views //! remove views
foreach (auto view, m_dockViews) { foreach (auto view, m_dockViews) {
if (view->containment() && !futureShownViews.contains(view->containment()->id())) { if (view->containment() && !futureShownViews.contains(view->containment()->id())) {
qDebug() << "syncDockViewsToScreens: view must be deleted... for:" << view->currentScreen(); qDebug() << "syncDockViewsToScreens: view must be deleted... for containment:" << view->containment()->id() << " at screen:" << view->currentScreen();
auto viewToDelete = m_dockViews.take(view->containment()); auto viewToDelete = m_dockViews.take(view->containment());
viewToDelete->disconnectSensitiveSignals(); viewToDelete->disconnectSensitiveSignals();
viewToDelete->deleteLater(); viewToDelete->deleteLater();
@ -1808,7 +1809,7 @@ bool Layout::explicitDockOccupyEdge(int screen, Plasma::Types::Location location
} }
foreach (auto containment, m_containments) { foreach (auto containment, m_containments) {
if (containment->pluginMetaData().pluginId() == "org.kde.latte.containment") { if (isLatteContainment(containment)) {
bool onPrimary = containment->config().readEntry("onPrimary", true); bool onPrimary = containment->config().readEntry("onPrimary", true);
int id = containment->lastScreen(); int id = containment->lastScreen();
Plasma::Types::Location contLocation = containment->location(); Plasma::Types::Location contLocation = containment->location();
@ -1829,7 +1830,7 @@ bool Layout::primaryDockOccupyEdge(Plasma::Types::Location location) const
} }
foreach (auto containment, m_containments) { foreach (auto containment, m_containments) {
if (containment->pluginMetaData().pluginId() == "org.kde.latte.containment") { if (isLatteContainment(containment)) {
bool onPrimary = containment->config().readEntry("onPrimary", true); bool onPrimary = containment->config().readEntry("onPrimary", true);
Plasma::Types::Location contLocation = containment->location(); Plasma::Types::Location contLocation = containment->location();
@ -1842,6 +1843,19 @@ bool Layout::primaryDockOccupyEdge(Plasma::Types::Location location) const
return false; return false;
} }
bool Layout::isLatteContainment(Plasma::Containment *containment) const
{
if (!containment) {
return false;
}
if (containment->pluginMetaData().pluginId() == "org.kde.latte.containment") {
return true;
}
return false;
}
int Layout::noDocksWithTasks() const int Layout::noDocksWithTasks() const
{ {
if (!m_corona) { if (!m_corona) {

@ -188,6 +188,9 @@ private:
bool explicitDockOccupyEdge(int screen, Plasma::Types::Location location) const; bool explicitDockOccupyEdge(int screen, Plasma::Types::Location location) const;
bool primaryDockOccupyEdge(Plasma::Types::Location location) const; bool primaryDockOccupyEdge(Plasma::Types::Location location) const;
//! Check if a containment is a latte dock/panel
bool isLatteContainment(Plasma::Containment *containment) const;
bool kwin_disabledMaximizedBorders() const; bool kwin_disabledMaximizedBorders() const;
void kwin_setDisabledMaximizedBorders(bool disable); void kwin_setDisabledMaximizedBorders(bool disable);

Loading…
Cancel
Save