Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 7154fb68 authored by David Edmundson's avatar David Edmundson

Load screenpool at the same time as we connect to screenchanged signals

Summary:
Otherwise we have a gap during load (waiting querying kactivities))
between screen pool being created and us connecting to the screen
changed signals, which in turn are used to update screen pool.

In particular the primary screen can get out of sync between the current
state and the screen pool.

Test Plan: Based on Christopher Feck's research and initial patch

Reviewers: #plasma

Subscribers: mart, rwooninck, fvogt, cfeck, plasma-devel

Tags: #plasma

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

    CCBUG:372099
    CCBUG:371858
    CBUG:371991
    CCBUG:371819
    CCBUG:371734
parent 8a472f17
......@@ -51,6 +51,7 @@ void ScreenPoolTest::initTestCase()
cg.deleteGroup();
cg.sync();
m_screenPool = new ScreenPool(KSharedConfig::openConfig(), this);
m_screenPool->load();
}
void ScreenPoolTest::cleanupTestCase()
......
......@@ -30,6 +30,14 @@ ScreenPool::ScreenPool(KSharedConfig::Ptr config, QObject *parent)
connect(&m_configSaveTimer, &QTimer::timeout, this, [this](){
m_configGroup.sync();
});
}
void ScreenPool::load()
{
m_primaryConnector = QString();
m_connectorForId.clear();
m_idForConnector.clear();
QScreen *primary = qGuiApp->primaryScreen();
if (primary) {
m_primaryConnector = primary->name();
......
......@@ -33,6 +33,7 @@ class ScreenPool : public QObject {
public:
ScreenPool(KSharedConfig::Ptr config, QObject *parent = nullptr);
void load();
~ScreenPool() override;
QString primaryConnector() const;
......
......@@ -627,6 +627,8 @@ void ShellCorona::load()
disconnect(m_activityController, &KActivities::Controller::serviceStatusChanged, this, &ShellCorona::load);
m_screenPool->load();
//TODO: a kconf_update script is needed
QString configFileName(QStringLiteral("plasma-") + m_shell + QStringLiteral("-appletsrc"));
......@@ -1184,7 +1186,7 @@ Plasma::Containment *ShellCorona::createContainmentForActivity(const QString& ac
//in the case of a corrupt config file
//with multiple containments with same lastScreen
//it can happen two insertContainment happen for
//the same screen, leading to the old containment
//the same screen, leading to the old containment
//to be destroyed
if (!cont->destroyed() && cont->screen() == screenNum && cont->activity() == activity) {
return cont;
......
Markdown is supported
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