startup:track background brightness correctly

--plasma is doing some funny stuff in multi-screen
environments by changing screen ids and back and forth
when primary screen is changed. We now take into account
this and when screen plasma pools updates its ids in
any case the wallpapers tracking follows instantly.
work/usta_fix_ecm_version_check
Michail Vourlakos 3 years ago
parent 6750f02d6f
commit 5100deee38

@ -52,6 +52,7 @@ BackgroundCache::BackgroundCache(QObject *parent)
if (!m_pool) {
m_pool = new ScreenPool(this);
connect(m_pool, &ScreenPool::idsChanged, this, &BackgroundCache::reload);
}
reload();

@ -27,8 +27,8 @@ namespace PlasmaExtended {
ScreenPool::ScreenPool(QObject *parent)
: QObject(parent)
{
KSharedConfigPtr plasmaPtr = KSharedConfig::openConfig(PLASMARC);
m_screensGroup = KConfigGroup(plasmaPtr, "ScreenConnectors");
m_plasmarcConfig = KSharedConfig::openConfig(PLASMARC);
m_screensGroup = KConfigGroup(m_plasmarcConfig, "ScreenConnectors");
load();
@ -62,12 +62,14 @@ void ScreenPool::load()
m_connectorForId.clear();
m_idForConnector.clear();
m_plasmarcConfig->reparseConfiguration();
bool updated{false};
for (const auto &screenId : m_screensGroup.keyList()) {
QString screenName = m_screensGroup.readEntry(screenId, QString());
if (screenId != 0) {
int scrId = screenId.toInt();
int scrId = screenId.toInt();
if (scrId != 0) {
insertScreenMapping(scrId, screenName);
if (!connectorForId.contains(scrId) || connectorForId[scrId] != m_connectorForId[scrId]) {

@ -13,6 +13,7 @@
// KDE
#include <KConfigGroup>
#include <KSharedConfig>
namespace Latte {
namespace PlasmaExtended {
@ -42,6 +43,7 @@ private:
QMap<int, QString> m_connectorForId;
QHash<QString, int> m_idForConnector;
KSharedConfig::Ptr m_plasmarcConfig;
KConfigGroup m_screensGroup;
};

Loading…
Cancel
Save