1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-01-27 06:03:51 +03:00

update screenpool api

This commit is contained in:
Michail Vourlakos 2021-02-17 12:24:36 +02:00
parent 864a3520f2
commit 41ebee5a71
5 changed files with 16 additions and 15 deletions

View File

@ -488,7 +488,7 @@ QRect Corona::screenGeometry(int id) const
QString screenName;
if (m_screenPool->hasId(id)) {
if (m_screenPool->hasScreenId(id)) {
screenName = m_screenPool->connector(id);
}

View File

@ -809,12 +809,12 @@ void GenericLayout::addView(Plasma::Containment *containment, bool forceOnPrimar
Plasma::Types::Location edge = containment->location();
QString connector = m_corona->screenPool()->hasId(id) ? m_corona->screenPool()->connector(id) : "";
QString connector = m_corona->screenPool()->hasScreenId(id) ? m_corona->screenPool()->connector(id) : "";
qDebug() << "Adding view - containment id:" << containment->id() << " ,screen :" << id << " - " << connector
<< " ,onprimary:" << onPrimary << " - " << " edge:" << edge << " ,screenName:" << qGuiApp->primaryScreen()->name() << " ,forceOnPrimary:" << forceOnPrimary;
if (occupied && m_corona->screenPool()->hasId(id) && (*occupied).contains(connector) && (*occupied)[connector].contains(edge)) {
if (occupied && m_corona->screenPool()->hasScreenId(id) && (*occupied).contains(connector) && (*occupied)[connector].contains(edge)) {
qDebug() << "Rejected : adding view because the edge is already occupied by a higher priority view ! : " << (*occupied)[connector][edge];
return;
}
@ -823,7 +823,7 @@ void GenericLayout::addView(Plasma::Containment *containment, bool forceOnPrimar
qDebug() << "Add view - connector : " << connector;
bool found{false};
if (m_corona->screenPool()->hasId(id)) {
if (m_corona->screenPool()->hasScreenId(id)) {
for (const auto scr : qGuiApp->screens()) {
if (scr && scr->name() == connector) {
found = true;
@ -1283,7 +1283,7 @@ Layout::ViewsMap GenericLayout::validViewsMap(Layout::ViewsMap *occupiedMap)
if (!onPrimary) {
QString expScreenName = m_corona->screenPool()->connector(screenId);
if (m_corona->screenPool()->screenExists(screenId) && !map[expScreenName].contains(location)) {
if (m_corona->screenPool()->isScreenActive(screenId) && !map[expScreenName].contains(location)) {
explicitMap[expScreenName][location] << containment->id();
}
}
@ -1535,7 +1535,7 @@ QString GenericLayout::reportHtml(const ScreenPool *screenPool)
screenStr = "<font color='green'>" + screenStr + "</font>";
}
if (!viewsData[i].onPrimary) {
if (!screenPool->hasId(viewsData[i].screenId)) {
if (!screenPool->hasScreenId(viewsData[i].screenId)) {
screenStr = "<font color='red'><i>[" + QString::number(viewsData[i].screenId) + "]</i></font>";
unknownScreens << QString("[" + QString::number(viewsData[i].screenId) + "]");

View File

@ -122,7 +122,7 @@ void ScreenGeometries::updateGeometries()
qDebug() << " PLASMA SCREEN GEOMETRIES, SCREEN :: " << scrId << " - " << scrName;
if (m_corona->screenPool()->hasId(scrId)) {
if (m_corona->screenPool()->hasScreenId(scrId)) {
QRect availableRect = m_corona->availableScreenRectWithCriteria(scrId,
QString(),
m_ignoreModes,

View File

@ -115,7 +115,7 @@ QString ScreenPool::reportHtml(const QList<int> &assignedScreens) const
int scrId = id(connector);
bool hasViews = assignedScreens.contains(scrId);
bool primary = m_lastPrimaryConnector == connector;
bool secondary = !primary && screenExists(scrId);
bool secondary = !primary && isScreenActive(scrId);
report += "<tr>";
@ -257,15 +257,15 @@ QList <int> ScreenPool::knownIds() const
return m_connectorForId.keys();
}
bool ScreenPool::hasId(int id) const
bool ScreenPool::hasScreenId(int screenId) const
{
return ((id!=-1) && knownIds().contains(id));
return ((screenId!=-1) && knownIds().contains(screenId));
}
bool ScreenPool::screenExists(int id) const
bool ScreenPool::isScreenActive(int screenId) const
{
if (id != -1 && knownIds().contains(id)) {
QString scrName = connector(id);
if (hasScreenId(screenId)) {
QString scrName = connector(screenId);
for (const auto scr : qGuiApp->screens()) {
if (scr->name() == scrName) {

View File

@ -46,8 +46,8 @@ public:
void load();
~ScreenPool() override;
bool hasId(int id) const;
bool screenExists(int id) const;
bool hasScreenId(int screenId) const;
bool isScreenActive(int screenId) const;
int primaryScreenId() const;
void insertScreenMapping(int id, const QString &connector);
@ -79,6 +79,7 @@ private:
KConfigGroup m_configGroup;
//! used to workaround a bug under X11 when primary screen changes and no screenChanged signal is emitted
QString m_lastPrimaryConnector;
//order is important
QMap<int, QString> m_connectorForId;
QHash<QString, int> m_idForConnector;