Commit bb822a33 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

ScreenPool: Ensure that primaryScreenChanged is emitted always after screenAdded

On Wayland, the primary screen notification and
QGuiApplication::screenAdded signals are desync. The primary output
watcher addresses that by emitting its primaryOutputNameChanged() signal
when the corresponding QGuiApplication::screenAdded() signal is emitted.

However, since the primary output watcher processes the screenAdded
signal before ScreenPool, it can emit the
ScreenPool::primaryScreenChanged signal before ScreenPool::screenAdded
signal that can confuse the ShellCorona.
parent d2e3f679
Pipeline #217136 passed with stage
in 8 minutes and 54 seconds
......@@ -26,10 +26,13 @@ using namespace std::chrono_literals;
ScreenPool::ScreenPool(const KSharedConfig::Ptr &config, QObject *parent)
: QObject(parent)
, m_configGroup(KConfigGroup(config, QStringLiteral("ScreenConnectors")))
, m_primaryWatcher(new PrimaryOutputWatcher(this))
connect(qGuiApp, &QGuiApplication::screenAdded, this, &ScreenPool::handleScreenAdded);
connect(qGuiApp, &QGuiApplication::screenRemoved, this, &ScreenPool::handleScreenRemoved);
// Note that the ScreenPool must process the QGuiApplication::screenAdded signal
// before the primary output watcher.
m_primaryWatcher = new PrimaryOutputWatcher(this);
connect(m_primaryWatcher, &PrimaryOutputWatcher::primaryOutputNameChanged, this, &ScreenPool::handlePrimaryOutputNameChanged);
......@@ -83,7 +83,7 @@ private:
QTimer m_reconsiderOutputsTimer;
QTimer m_configSaveTimer;
PrimaryOutputWatcher *const m_primaryWatcher;
PrimaryOutputWatcher *m_primaryWatcher;
friend QDebug operator<<(QDebug d, const ScreenPool *pool);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment