diff --git a/src/plasma/containment.cpp b/src/plasma/containment.cpp index 6e6bcc2d5..c490dc8b7 100644 --- a/src/plasma/containment.cpp +++ b/src/plasma/containment.cpp @@ -217,9 +217,7 @@ void Containment::restore(KConfigGroup &group) setLocation((Plasma::Location)group.readEntry("location", (int)d->location)); setFormFactor((Plasma::FormFactor)group.readEntry("formfactor", (int)d->formFactor)); //kDebug() << "setScreen from restore"; - d->lastScreen = group.readEntry("lastScreen", d->lastScreen); - d->lastDesktop = group.readEntry("lastDesktop", d->lastDesktop); - d->setScreen(group.readEntry("screen", d->screen), group.readEntry("desktop", d->desktop), false); + d->setScreen(group.readEntry("screen", d->screen)); d->activityId = group.readEntry("activityId", QString()); flushPendingConstraintsEvents(); @@ -305,9 +303,6 @@ void Containment::save(KConfigGroup &g) const } group.writeEntry("screen", d->screen); - group.writeEntry("lastScreen", d->lastScreen); - group.writeEntry("desktop", d->desktop); - group.writeEntry("lastDesktop", d->lastDesktop); group.writeEntry("formfactor", (int)d->formFactor); group.writeEntry("location", (int)d->location); group.writeEntry("activityId", d->activityId); @@ -496,9 +491,9 @@ QList Containment::applets() const return d->applets; } -void Containment::setScreen(int newScreen, int newDesktop) +void Containment::setScreen(int newScreen) { - d->setScreen(newScreen, newDesktop); + d->setScreen(newScreen); } int Containment::screen() const diff --git a/src/plasma/containment.h b/src/plasma/containment.h index ca2214727..b96afddfa 100644 --- a/src/plasma/containment.h +++ b/src/plasma/containment.h @@ -219,7 +219,7 @@ class PLASMA_EXPORT Containment : public Applet * if it is not serving as the desktop for any screen * @param desktop the virtual desktop to also associate this this screen with */ - void setScreen(int screen, int desktop = -1); + void setScreen(int screen); /** * @return the screen number this containment is serving as the desktop for diff --git a/src/plasma/corona.cpp b/src/plasma/corona.cpp index 10537c59b..cb6d9738d 100644 --- a/src/plasma/corona.cpp +++ b/src/plasma/corona.cpp @@ -215,7 +215,7 @@ QList Corona::importLayout(const KConfigGroup &conf) return d->importLayout(conf, true); } -Containment *Corona::containmentForScreen(int screen, int desktop) const +Containment *Corona::containmentForScreen(int screen) const { foreach (Containment *containment, d->containments) { if (containment->screen() == screen && @@ -228,17 +228,16 @@ Containment *Corona::containmentForScreen(int screen, int desktop) const return 0; } -Containment *Corona::containmentForScreen(int screen, int desktop, +Containment *Corona::containmentForScreen(int screen, const QString &defaultPluginIfNonExistent, const QVariantList &defaultArgs) { - Containment *containment = containmentForScreen(screen, desktop); + Containment *containment = containmentForScreen(screen); if (!containment && !defaultPluginIfNonExistent.isEmpty()) { // screen requests are allowed to bypass immutability - if (screen >= 0 && screen < numScreens() && - desktop >= -1 && desktop < KWindowSystem::numberOfDesktops()) { + if (screen >= 0 && screen < numScreens()) { containment = d->addContainment(defaultPluginIfNonExistent, defaultArgs, 0); if (containment) { - containment->setScreen(screen, desktop); + containment->setScreen(screen); } } } diff --git a/src/plasma/corona.h b/src/plasma/corona.h index 96e04275e..b7aead416 100644 --- a/src/plasma/corona.h +++ b/src/plasma/corona.h @@ -113,7 +113,7 @@ public: * @param desktop the virtual desktop) to locate; if < 0 then it will * simply return the first Containment associated with screen */ - Containment *containmentForScreen(int screen, int desktop = -1) const; + Containment *containmentForScreen(int screen) const; /** * Returns the Containment for a given physical screen and desktop, creating one @@ -127,7 +127,7 @@ public: * @param defaultArgs optional arguments to pass in when creating a Containment if needed * @since 4.6 */ - Containment *containmentForScreen(int screen, int desktop, + Containment *containmentForScreen(int screen, const QString &defaultPluginIfNonExistent, const QVariantList &defaultArgs = QVariantList()); diff --git a/src/plasma/private/containment_p.cpp b/src/plasma/private/containment_p.cpp index 54e3a1043..f032f894e 100644 --- a/src/plasma/private/containment_p.cpp +++ b/src/plasma/private/containment_p.cpp @@ -185,7 +185,7 @@ void ContainmentPrivate::addAppletActions(KMenu &desktopMenu, Applet *applet, QE } } -void ContainmentPrivate::setScreen(int newScreen, int newDesktop, bool preventInvalidDesktops) +void ContainmentPrivate::setScreen(int newScreen) { // What we want to do in here is: // * claim the screen as our own @@ -211,12 +211,7 @@ void ContainmentPrivate::setScreen(int newScreen, int newDesktop, bool preventIn newScreen = -1; } - // -1 == All desktops - if (newDesktop < -1 || (preventInvalidDesktops && newDesktop > KWindowSystem::numberOfDesktops() - 1)) { - newDesktop = -1; - } - - //kDebug() << activity() << "setting screen to " << newScreen << newDesktop << "and type is" << type; + //kDebug() << activity() << "setting screen to " << newScreen << "and type is" << type; Containment *swapScreensWith(0); const bool isDesktopContainment = type == Containment::DesktopContainment || @@ -224,7 +219,7 @@ void ContainmentPrivate::setScreen(int newScreen, int newDesktop, bool preventIn if (isDesktopContainment) { if (newScreen > -1) { // sanity check to make sure someone else doesn't have this screen already! - Containment *currently = corona->containmentForScreen(newScreen, newDesktop); + Containment *currently = corona->containmentForScreen(newScreen); if (currently && currently != q) { #ifndef NDEBUG kDebug() << "currently is on screen" << currently->screen() @@ -232,44 +227,34 @@ void ContainmentPrivate::setScreen(int newScreen, int newDesktop, bool preventIn << "and is" << currently->activity() << (QObject*)currently << "i'm" << (QObject*)q; #endif - currently->setScreen(-1, -1); + currently->setScreen(-1); swapScreensWith = currently; } } } - int oldDesktop = desktop; - desktop = newDesktop; - int oldScreen = screen; screen = newScreen; q->updateConstraints(Plasma::ScreenConstraint); - if (oldScreen != newScreen || oldDesktop != newDesktop) { + if (oldScreen != newScreen) { /* #ifndef NDEBUG kDebug() << "going to signal change for" << q #endif - << ", old screen & desktop:" << oldScreen << oldDesktop + << ", old screen & desktop:" << oldScreen << ", new:" << screen << desktop; */ KConfigGroup c = q->config(); c.writeEntry("screen", screen); - c.writeEntry("desktop", desktop); - if (newScreen != -1) { - lastScreen = newScreen; - lastDesktop = newDesktop; - c.writeEntry("lastScreen", lastScreen); - c.writeEntry("lastDesktop", lastDesktop); - } emit q->configNeedsSaving(); emit q->screenChanged(oldScreen, newScreen, q); } if (swapScreensWith) { //kDebug() << "setScreen due to swap, part 2"; - swapScreensWith->setScreen(oldScreen, oldDesktop); + swapScreensWith->setScreen(oldScreen); } checkRemoveAction(); diff --git a/src/plasma/private/containment_p.h b/src/plasma/private/containment_p.h index 08786cf22..1c9cf48cf 100644 --- a/src/plasma/private/containment_p.h +++ b/src/plasma/private/containment_p.h @@ -53,9 +53,6 @@ public: formFactor(Planar), location(Floating), screen(-1), // no screen - lastScreen(-1), - desktop(-1), // all desktops - lastDesktop(-1), type(Containment::NoContainmentType), drawWallpaper(false), containmentActionsSource(Global) @@ -74,7 +71,7 @@ public: void triggerShowAddWidgets(); void requestConfiguration(); void checkStatus(Plasma::ItemStatus status); - void setScreen(int newScreen, int newDesktop, bool preventInvalidDesktops = true); + void setScreen(int newScreen); /** * Called when constraints have been updated on this containment to provide @@ -126,9 +123,6 @@ public: QString wallpaper; QHash localActionPlugins; int screen; - int lastScreen; - int desktop; - int lastDesktop; QList toolBoxActions; QString activityId; Containment::Type type; diff --git a/src/shell/desktopcorona.cpp b/src/shell/desktopcorona.cpp index 2deac8f95..e978249bc 100644 --- a/src/shell/desktopcorona.cpp +++ b/src/shell/desktopcorona.cpp @@ -93,7 +93,7 @@ void DesktopCorona::checkScreen(int screen, bool signalWhenExists) //TODO: restore activities //Activity *currentActivity = activity(m_activityController->currentActivity()); //ensure the desktop(s) have a containment and view - checkDesktop(/*currentActivity,*/ signalWhenExists, screen, -1); + checkDesktop(/*currentActivity,*/ signalWhenExists, screen); //ensure the panels get views too @@ -112,9 +112,9 @@ void DesktopCorona::checkScreen(int screen, bool signalWhenExists) } } -void DesktopCorona::checkDesktop(/*Activity *activity,*/ bool signalWhenExists, int screen, int desktop) +void DesktopCorona::checkDesktop(/*Activity *activity,*/ bool signalWhenExists, int screen) { - Plasma::Containment *c = /*activity->*/containmentForScreen(screen, desktop); + Plasma::Containment *c = /*activity->*/containmentForScreen(screen); //TODO: remove following when activities are restored if (!c) { @@ -125,7 +125,7 @@ void DesktopCorona::checkDesktop(/*Activity *activity,*/ bool signalWhenExists, return; } - c->setScreen(screen, desktop); + c->setScreen(screen); if (screen >= 0 || m_views.count() >= screen + 1) { m_views[screen]->setContainment(c); } else { diff --git a/src/shell/desktopcorona.h b/src/shell/desktopcorona.h index e7a3ba095..983a63a9f 100644 --- a/src/shell/desktopcorona.h +++ b/src/shell/desktopcorona.h @@ -56,7 +56,7 @@ public: */ void checkScreen(int screen, bool signalWhenExists = false); - void checkDesktop(/*Activity *activity,*/ bool signalWhenExists, int screen, int desktop); + void checkDesktop(/*Activity *activity,*/ bool signalWhenExists, int screen); int numScreens() const; QRect screenGeometry(int id) const;