[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/workspace/plasma/desktop/shell
From:       Aaron J. Seigo <aseigo () kde ! org>
Date:       2011-01-11 19:18:36
Message-ID: 20110111191836.A69C7AC8B2 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1213830 by aseigo:

use Corona::contaimentForScreen always to avoid problems with locked setups
BUG:262850


 M  +23 -19    activity.cpp  
 M  +0 -1      activity.h  


--- trunk/KDE/kdebase/workspace/plasma/desktop/shell/activity.cpp #1213829:1213830
@@ -176,36 +176,40 @@
                 // possibly a plugin failure, let's go for the default
                 containment = \
PlasmaApp::self()->corona()->containmentForScreen(screen, desktop, "default");  }
+
             //we don't want to steal contaiments from other activities
-            if (!containment || \
                !containment->context()->currentActivityId().isEmpty()) {
-                // possibly a plugin failure, let's go for the default
-                containment = PlasmaApp::self()->corona()->addContainment(m_plugin);
-                if (containment) {
-                    containment->setScreen(screen, desktop);
+            if (!containment) {
+                // we failed to even get the default; we're screwed.
+                Q_ASSERT(false);
+                return 0;
                 }
-            }
-            //last hope, create a new one
+
+            if (!containment->context()->currentActivityId().isEmpty() &&
+                containment->context()->currentActivityId() != m_id) {
+                // 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);  if \
(!containment) {  // possibly a plugin failure, let's go for the default
-                containment = \
                PlasmaApp::self()->corona()->addContainment("default");
-                containment->setScreen(screen, desktop);
+                    containment = \
PlasmaApp::self()->corona()->containmentForScreen(screen, desktop, "default");  }
         }
+        }
 
-        Q_ASSERT(containment);
+        if (containment) {
         insertContainment(containment, screen, desktop);
         PlasmaApp::self()->corona()->requestConfigSync();
     }
+    } else if (containment->screen() != screen || containment->desktop() != desktop) \
{ +        // ensure the containment _also_ knows which screen we think it is on;
+        // can happen when swapping between activities without stopping them first
+        containment->setScreen(screen, desktop);
+    }
 
     return containment;
 }
 
-void Activity::activateContainment(int screen, int desktop)
-{
-    Plasma::Containment *c = containmentForScreen(screen, desktop);
-    c->setScreen(screen, desktop);
-}
-
 void Activity::activate()
 {
     KActivityController().setCurrentActivity(m_id);
@@ -229,10 +233,10 @@
     for (int screen = 0; screen < numScreens; ++screen) {
         if (numDesktops > 0) {
             for (int desktop = 0; desktop < numDesktops; ++desktop) {
-                activateContainment(screen, desktop);
+                containmentForScreen(screen, desktop);
             }
         } else {
-            activateContainment(screen, -1);
+            containmentForScreen(screen, -1);
         }
     }
 }
@@ -304,7 +308,7 @@
     const QString name = "activities/" + m_id;
     KConfig external(name, KConfig::SimpleConfig, "appdata");
 
-    //apparently this magic turns a kconfig into a kconfiggroup
+    //passing an empty string for the group name turns a kconfig into a kconfiggroup
     KConfigGroup group = external.group(QString());
     PlasmaApp::self()->corona()->exportLayout(group, m_containments.values());
 
--- trunk/KDE/kdebase/workspace/plasma/desktop/shell/activity.h #1213829:1213830
@@ -139,7 +139,6 @@
     void closed();
 
 private:
-    void activateContainment(int screen, int desktop);
     void insertContainment(Plasma::Containment* cont, bool force=false);
     void insertContainment(Plasma::Containment* containment, int screen, int \
desktop);  void checkScreens();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic