KDE/kdebase/workspace/plasma/desktop/shell

Marco Martin notmart at gmail.com
Sat Jan 22 21:31:47 CET 2011


SVN commit 1216356 by mart:

when taking an unused containment fail, explicitly create a new one
or we end up reassigning the same over and over again
CCMAIL:plasma-devel at kde.org


 M  +9 -2      activity.cpp  


--- trunk/KDE/kdebase/workspace/plasma/desktop/shell/activity.cpp #1216355:1216356
@@ -151,6 +151,7 @@
 Plasma::Containment* Activity::containmentForScreen(int screen, int desktop)
 {
     Plasma::Containment *containment = m_containments.value(QPair<int,int>(screen, desktop));
+
     if (!containment) {
         kDebug() << "adding containment for" << screen << desktop;
         // first look to see if there are any unnasigned containments that are candidates for
@@ -172,6 +173,7 @@
             // this allows the corona to either grab one for us that already exists matching
             // screen and desktop, or create a new one. this also works regardless of immutability
             containment = PlasmaApp::self()->corona()->containmentForScreen(screen, desktop, m_plugin);
+
             if (!containment || !containment->context()->currentActivityId().isEmpty()) {
                 // possibly a plugin failure, let's go for the default
                 containment = PlasmaApp::self()->corona()->containmentForScreen(screen, desktop, "default");
@@ -189,13 +191,18 @@
                 // we got a containment, but it belongs to some other activity; let's unassign it
                 // from a screen and grab a new one
                 containment->setScreen(0);
-                containment = PlasmaApp::self()->corona()->containmentForScreen(screen, desktop, m_plugin);
+                containment = PlasmaApp::self()->corona()->addContainment(m_plugin);
+
                 if (!containment) {
                     // possibly a plugin failure, let's go for the default
-                    containment = PlasmaApp::self()->corona()->containmentForScreen(screen, desktop, "default");
+                    containment = PlasmaApp::self()->corona()->addContainment("default");
                 }
+
+                if (containment) {
+                    containment->setScreen(screen, desktop);
             }
         }
+        }
 
         if (containment) {
             insertContainment(containment, screen, desktop);


More information about the Plasma-devel mailing list