[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kscreen] kded: Don't apply configs in a loop
From:       Aleix Pol <null () kde ! org>
Date:       2018-09-26 18:04:43
Message-ID: E1g5EB1-00079r-G8 () code ! kde ! org
[Download RAW message or body]

Git commit 05ebba6b6e6e8f8ed4e5c1d027f6c6a6e9e78e95 by Aleix Pol.
Committed on 26/09/2018 at 18:03.
Pushed by apol into branch 'master'.

Don't apply configs in a loop

Summary:
Loop through all the changed bits then apply at once. It should trigger
less unnecessary visual changes.

Test Plan:
Restarted kded5, restarted the computer too at some point.
Connected and disconnected displays.

Reviewers: broulik

Reviewed By: broulik

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D15767

M  +5    -1    kded/daemon.cpp

https://commits.kde.org/kscreen/05ebba6b6e6e8f8ed4e5c1d027f6c6a6e9e78e95

diff --git a/kded/daemon.cpp b/kded/daemon.cpp
index 04f88a6..7ae950c 100644
--- a/kded/daemon.cpp
+++ b/kded/daemon.cpp
@@ -252,13 +252,17 @@ void KScreenDaemon::configChanged()
     logConfig(m_monitoredConfig);
 
     // Modes may have changed, fix-up current mode id
+    bool changed = false;
     Q_FOREACH(const KScreen::OutputPtr &output, m_monitoredConfig->outputs()) {
         if (output->isConnected() && output->isEnabled() && \
                output->currentMode().isNull()) {
             qCDebug(KSCREEN_KDED) << "Current mode" << output->currentModeId() << \
"invalid, setting preferred mode" << output->preferredModeId();  \
                output->setCurrentModeId(output->preferredModeId());
-            doApplyConfig(m_monitoredConfig);
+            changed = true;
         }
     }
+    if (changed) {
+        doApplyConfig(m_monitoredConfig);
+    }
 
     // Reset timer, delay the writeback
     if (!m_saveTimer) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic