Commit b8d3e09b authored by Marco Martin's avatar Marco Martin

make sure all outputs are known

at startup, if a screen id is missing from the screenpool mapping
containment::screen() will return -1 for a moment in the startup
phase even if it has a valid lastScreen

populate mappings of eventual missing stuff at screenpool ctor

make sure destroyed containments don't get assigned a view

reviewed-by: David Edmundson

CCBUG:372099
CCBUG:371858
CCBUG:371991
CCBUG:371819
CCBUG:371734
parent 7c443aa5
......@@ -51,6 +51,17 @@ ScreenPool::ScreenPool(KSharedConfig::Ptr config, QObject *parent)
m_configGroup.deleteEntry(key);
}
}
// if there are already connected unknown screens, map those
// all needs to be populated as soon as possible, otherwise
// containment->screen() will return an incorrect -1
// at startup, if it' asked before corona::addOutput()
// is performed, driving to the creation of a new containment
for (QScreen* screen : qGuiApp->screens()) {
if (!m_idForConnector.contains(screen->name())) {
insertScreenMapping(firstAvailableId(), screen->name());
}
}
}
ScreenPool::~ScreenPool()
......
......@@ -1178,7 +1178,12 @@ Plasma::Containment *ShellCorona::createContainmentForActivity(const QString& ac
{
if (m_desktopContainments.contains(activity)) {
for (Plasma::Containment *cont : m_desktopContainments.value(activity)) {
if (cont->screen() == screenNum && cont->activity() == activity) {
//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
//to be destroyed
if (!cont->destroyed() && cont->screen() == screenNum && cont->activity() == activity) {
return cont;
}
}
......@@ -1832,6 +1837,7 @@ int ShellCorona::screenForContainment(const Plasma::Containment *containment) co
// qDebug() << "ShellCorona screenForContainment: " << containment << " Last screen is " << containment->lastScreen();
for (auto screen : qGuiApp->screens()) {
// containment->lastScreen() == m_screenPool->id(screen->name()) to check if the lastScreen refers to a screen that exists/it's known
if (containment->lastScreen() == m_screenPool->id(screen->name()) &&
(containment->activity() == m_activityController->currentActivity() ||
containment->containmentType() == Plasma::Types::PanelContainment || containment->containmentType() == Plasma::Types::CustomPanelContainment)) {
......
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