plasma5-workspace/0002-make-sure-all-outputs-are-known.patch
Fabian Vogt 45aa4bd75c - Backport several commits for better multiscreen handling:
* 0001-taskmanagerrulesrc-Add-Rewrite-Rule-for-Google-chrom.patch
  * 0002-make-sure-all-outputs-are-known.patch
  * 0003-Sync-app-config-in-sync-with-applets-config.patch
  * 0004-Avoid-connecting-to-screen-changed-signals-twice.patch
  * 0005-Load-screenpool-at-the-same-time-as-we-connect-to-sc.patch
  * kde#372099,kde#371858,kde#371991,kde#371819,kde#371734
  * boo#1003438

OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/plasma5-workspace?expand=0&rev=276
2016-11-10 12:59:08 +00:00

77 lines
3.1 KiB
Diff

From c89560cb534692ac9344533a207216e219de60d1 Mon Sep 17 00:00:00 2001
From: Marco Martin <notmart@gmail.com>
Date: Wed, 9 Nov 2016 15:54:42 +0100
Subject: [PATCH 2/5] 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
---
shell/screenpool.cpp | 11 +++++++++++
shell/shellcorona.cpp | 8 +++++++-
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/shell/screenpool.cpp b/shell/screenpool.cpp
index 89868e8..011300d 100644
--- a/shell/screenpool.cpp
+++ b/shell/screenpool.cpp
@@ -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()
diff --git a/shell/shellcorona.cpp b/shell/shellcorona.cpp
index 33259da..8189eed 100644
--- a/shell/shellcorona.cpp
+++ b/shell/shellcorona.cpp
@@ -1154,7 +1154,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;
}
}
@@ -1808,6 +1813,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)) {
--
2.10.1