1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-09 16:58:16 +03:00

fix plasma geometries publish in multi-screen

--when a screen becomes inactive then its last values
for available rect and reqions should also be removed
from the recorded values.
This commit is contained in:
Michail Vourlakos 2020-03-24 15:59:36 +02:00
parent e951aa67b2
commit 25cfd25477
2 changed files with 12 additions and 4 deletions

View File

@ -113,11 +113,15 @@ void ScreenGeometries::updateGeometries()
QStringList availableScreenNames;
qDebug() << " PLASMA SCREEN GEOMETRIES, LAST AVAILABLE SCREEN RECTS :: " << m_lastAvailableRect;
//! check for available geometries changes
for (QScreen *screen : qGuiApp->screens()) {
QString scrName = screen->name();
int scrId = m_corona->screenPool()->id(screen->name());
qDebug() << " PLASMA SCREEN GEOMETRIES, SCREEN :: " << scrId << " - " << scrName;
if (m_corona->screenPool()->hasId(scrId)) {
QRect availableRect = m_corona->availableScreenRectWithCriteria(scrId,
QString(),
@ -141,7 +145,7 @@ void ScreenGeometries::updateGeometries()
if (m_forceGeometryBroadcast || (!m_lastAvailableRect.contains(scrName) || m_lastAvailableRect[scrName] != availableRect)) {
m_lastAvailableRect[scrName] = availableRect;
plasmaStrutsIface.call("setAvailableScreenRect", LATTESERVICE, scrName, availableRect);
qDebug() << " PLASMA SCREEN GEOMETRIES AVAILABLE RECT :: " << screen->name() << " : " << availableRect;
qDebug() << " PLASMA SCREEN GEOMETRIES, AVAILABLE RECT :: " << screen->name() << " : " << availableRect;
}
if (m_forceGeometryBroadcast) {
@ -158,7 +162,7 @@ void ScreenGeometries::updateGeometries()
}
plasmaStrutsIface.call("setAvailableScreenRegion", LATTESERVICE, scrName, QVariant::fromValue(rects));
qDebug() << " PLASMA SCREEN GEOMETRIES AVAILABLE REGION :: " << screen->name() << " : " << availableRegion;
qDebug() << " PLASMA SCREEN GEOMETRIES, AVAILABLE REGION :: " << screen->name() << " : " << availableRegion;
}
}
@ -170,7 +174,11 @@ void ScreenGeometries::updateGeometries()
if (!screenIsActive(lastScrName)) {
//! screen became inactive and its geometries could be unpublished
plasmaStrutsIface.call("setAvailableScreenRect", LATTESERVICE, lastScrName, QRect());
plasmaStrutsIface.call("setAvailableScreenRegion", LATTESERVICE, lastScrName, QRegion());
plasmaStrutsIface.call("setAvailableScreenRegion", LATTESERVICE, lastScrName, QVariant::fromValue(QList<QRect>()));
m_lastAvailableRect.remove(lastScrName);
m_lastAvailableRegion.remove(lastScrName);
qDebug() << " PLASMA SCREEN GEOMETRIES, INACTIVE SCREEN :: " << lastScrName;
}
}

View File

@ -295,7 +295,7 @@ QList <int> ScreenPool::knownIds() const
bool ScreenPool::hasId(int id) const
{
return ((id!=-1) && m_connectorForId.keys().contains(id));
return ((id!=-1) && knownIds().contains(id));
}
bool ScreenPool::screenExists(int id) const