instead of announcing new screens and not announcing new containments, announce new containments as well as screen affinity changes and let the host app worry about what to do from there

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=784941
This commit is contained in:
Aaron J. Seigo 2008-03-12 20:41:03 +00:00
parent 6dc52aaa65
commit eb0bf064ab
4 changed files with 32 additions and 6 deletions

View File

@ -834,8 +834,10 @@ void Containment::setScreen(int screen)
} }
} }
int oldScreen = d->screen;
d->screen = screen; d->screen = screen;
updateConstraints(Plasma::ScreenConstraint); updateConstraints(Plasma::ScreenConstraint);
emit screenChanged(oldScreen, screen, this);
} }
void Containment::positionPanel(bool force) void Containment::positionPanel(bool force)

View File

@ -314,6 +314,16 @@ class PLASMA_EXPORT Containment : public Applet
*/ */
void showAddWidgets(); void showAddWidgets();
/**
* This signal indicates that a containment has been newly
* associated (or dissociated) with a physical screen.
*
* @param wasScreen the screen it was associated with
* @param isScreen the screen it is now associated with
* @param containment the containment switching screens
*/
void screenChanged(int wasScreen, int isScreen, Plasma::Containment *containment);
public Q_SLOTS: public Q_SLOTS:
/** /**
* Informs the Corona as to what position it is in. This is informational * Informs the Corona as to what position it is in. This is informational

View File

@ -280,6 +280,7 @@ void Corona::loadApplets(const QString& configName)
containment->updateConstraints(Plasma::StartupCompletedConstraint); containment->updateConstraints(Plasma::StartupCompletedConstraint);
containment->flushUpdatedConstraints(); containment->flushUpdatedConstraints();
emit containmentAdded(containment);
} }
// quick sanity check to ensure we have containments for each screen! // quick sanity check to ensure we have containments for each screen!
@ -438,6 +439,12 @@ Containment* Corona::addContainment(const QString& name, const QVariantList& arg
SIGNAL(launchActivated())); SIGNAL(launchActivated()));
connect(containment, SIGNAL(configNeedsSaving()), connect(containment, SIGNAL(configNeedsSaving()),
SLOT(scheduleConfigSync())); SLOT(scheduleConfigSync()));
connect(containment, SIGNAL(screenChanged(int,int,Plasma::Containment*)),
this, SIGNAL(screenOwnerChanged(int,int,Plasma::Containment*)));
if (!delayedInit) {
emit containmentAdded(containment);
}
return containment; return containment;
} }
@ -525,7 +532,6 @@ void Corona::screenResized(int screen)
Containment* c = addContainment("desktop"); Containment* c = addContainment("desktop");
c->setScreen(screen); c->setScreen(screen);
c->setFormFactor(Plasma::Planar); c->setFormFactor(Plasma::Planar);
emit newScreen(screen);
} }
void Corona::syncConfig() void Corona::syncConfig()

View File

@ -157,12 +157,20 @@ Q_SIGNALS:
void launchActivated(); void launchActivated();
/** /**
* This signal indicates that a new screen is being handled * This signal indicates a new containment has been added to
* at runtime (e.g. after first creation) * the Corona
*
* @param screen the xinerama number of the new screen
*/ */
void newScreen(int screen); void containmentAdded(Plasma::Containment *containment);
/**
* This signal indicates that a containment has been newly
* associated (or dissociated) with a physical screen.
*
* @param wasScreen the screen it was associated with
* @param isScreen the screen it is now associated with
* @param containment the containment switching screens
*/
void screenOwnerChanged(int wasScreen, int isScreen, Plasma::Containment *containment);
protected: protected:
void dragEnterEvent(QGraphicsSceneDragDropEvent* event); void dragEnterEvent(QGraphicsSceneDragDropEvent* event);