mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-28 18:50:40 +03:00
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 (cherry picked from commit 285a2f87643f9b0387d4364ae6e3a53dceb9fe24)
This commit is contained in:
parent
7f97714e2b
commit
72f7d3c4f1
@ -861,11 +861,9 @@ void Layout::addDock(Plasma::Containment *containment, bool forceOnPrimary, int
|
||||
return;
|
||||
}
|
||||
|
||||
auto metadata = containment->kPackage().metadata();
|
||||
|
||||
qDebug() << "step 1...";
|
||||
|
||||
if (metadata.pluginId() != "org.kde.latte.containment")
|
||||
if (!isLatteContainment(containment))
|
||||
return;
|
||||
|
||||
qDebug() << "step 2...";
|
||||
@ -1423,9 +1421,7 @@ QList<Plasma::Containment *> Layout::importLayoutFile(QString file)
|
||||
//QList<Plasma::Containment *> systrays;
|
||||
|
||||
foreach (auto containment, newContainments) {
|
||||
KPluginMetaData meta = containment->kPackage().metadata();
|
||||
|
||||
if (meta.pluginId() == "org.kde.latte.containment") {
|
||||
if (isLatteContainment(containment)) {
|
||||
qDebug() << "new latte containment id: " << containment->id();
|
||||
importedDocks << containment;
|
||||
}
|
||||
@ -1499,44 +1495,49 @@ void Layout::syncDockViewsToScreens()
|
||||
|
||||
//! first step: primary docks must be placed in primary screen free edges
|
||||
foreach (auto containment, m_containments) {
|
||||
int screenId = containment->screen();
|
||||
if (isLatteContainment(containment)) {
|
||||
int screenId = containment->screen();
|
||||
|
||||
if (screenId == -1) {
|
||||
screenId = containment->lastScreen();
|
||||
}
|
||||
if (screenId == -1) {
|
||||
screenId = containment->lastScreen();
|
||||
}
|
||||
|
||||
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));
|
||||
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));
|
||||
|
||||
if (onPrimary && !futureDocksLocations[prmScreenName].contains(location)) {
|
||||
futureDocksLocations[prmScreenName].append(location);
|
||||
futureShownViews.append(containment->id());
|
||||
if (onPrimary && !futureDocksLocations[prmScreenName].contains(location)) {
|
||||
futureDocksLocations[prmScreenName].append(location);
|
||||
futureShownViews.append(containment->id());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//! second step: explicit docks must be placed in their screens if the screen edge is free
|
||||
foreach (auto containment, m_containments) {
|
||||
int screenId = containment->screen();
|
||||
if (isLatteContainment(containment)) {
|
||||
int screenId = containment->screen();
|
||||
|
||||
if (screenId == -1) {
|
||||
screenId = containment->lastScreen();
|
||||
}
|
||||
if (screenId == -1) {
|
||||
screenId = containment->lastScreen();
|
||||
}
|
||||
|
||||
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));
|
||||
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));
|
||||
|
||||
if (!onPrimary) {
|
||||
QString expScreenName = m_corona->screenPool()->connector(screenId);
|
||||
if (!onPrimary) {
|
||||
QString expScreenName = m_corona->screenPool()->connector(screenId);
|
||||
|
||||
if (m_corona->screenPool()->screenExists(screenId) && !futureDocksLocations[expScreenName].contains(location)) {
|
||||
futureDocksLocations[expScreenName].append(location);
|
||||
futureShownViews.append(containment->id());
|
||||
if (m_corona->screenPool()->screenExists(screenId) && !futureDocksLocations[expScreenName].contains(location)) {
|
||||
futureDocksLocations[expScreenName].append(location);
|
||||
futureShownViews.append(containment->id());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
qDebug() << "PRIMARY SCREEN :: " << prmScreenName;
|
||||
qDebug() << "DOCKVIEWS MUST BE PRESENT AT :: " << futureDocksLocations;
|
||||
qDebug() << "FUTURESHOWNVIEWS MUST BE :: " << futureShownViews;
|
||||
|
||||
//! add views
|
||||
foreach (auto containment, m_containments) {
|
||||
@ -1547,7 +1548,7 @@ void Layout::syncDockViewsToScreens()
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -1555,7 +1556,7 @@ void Layout::syncDockViewsToScreens()
|
||||
//! remove views
|
||||
foreach (auto view, m_dockViews) {
|
||||
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());
|
||||
viewToDelete->disconnectSensitiveSignals();
|
||||
viewToDelete->deleteLater();
|
||||
@ -1808,7 +1809,7 @@ bool Layout::explicitDockOccupyEdge(int screen, Plasma::Types::Location location
|
||||
}
|
||||
|
||||
foreach (auto containment, m_containments) {
|
||||
if (containment->pluginMetaData().pluginId() == "org.kde.latte.containment") {
|
||||
if (isLatteContainment(containment)) {
|
||||
bool onPrimary = containment->config().readEntry("onPrimary", true);
|
||||
int id = containment->lastScreen();
|
||||
Plasma::Types::Location contLocation = containment->location();
|
||||
@ -1829,7 +1830,7 @@ bool Layout::primaryDockOccupyEdge(Plasma::Types::Location location) const
|
||||
}
|
||||
|
||||
foreach (auto containment, m_containments) {
|
||||
if (containment->pluginMetaData().pluginId() == "org.kde.latte.containment") {
|
||||
if (isLatteContainment(containment)) {
|
||||
bool onPrimary = containment->config().readEntry("onPrimary", true);
|
||||
Plasma::Types::Location contLocation = containment->location();
|
||||
|
||||
@ -1842,6 +1843,19 @@ bool Layout::primaryDockOccupyEdge(Plasma::Types::Location location) const
|
||||
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
|
||||
{
|
||||
if (!m_corona) {
|
||||
|
@ -188,6 +188,9 @@ private:
|
||||
bool explicitDockOccupyEdge(int screen, 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;
|
||||
void kwin_setDisabledMaximizedBorders(bool disable);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user