diff --git a/containment.cpp b/containment.cpp index 738045ebb..a48eaecfe 100644 --- a/containment.cpp +++ b/containment.cpp @@ -613,17 +613,25 @@ void Containment::setFormFactor(FormFactor formFactor) } //kDebug() << "switching FF to " << formFactor; - FormFactor was = d->formFactor; d->formFactor = formFactor; if (isContainment() && - was != formFactor && - (d->type == PanelContainment || - d->type == CustomPanelContainment)) { + (d->type == PanelContainment || d->type == CustomPanelContainment)) { // we are a panel and we have chaged our orientation d->positionPanel(true); } + if (d->toolBox) { + if (d->formFactor == Vertical) { + d->toolBox->setCorner(ToolBox::Bottom); + //defaults to horizontal + } else if (QApplication::layoutDirection() == Qt::RightToLeft) { + d->toolBox->setCorner(ToolBox::Left); + } else { + d->toolBox->setCorner(ToolBox::Right); + } + } + updateConstraints(Plasma::FormFactorConstraint); KConfigGroup c = config(); @@ -807,11 +815,9 @@ void Containment::setScreen(int newScreen, int newDesktop) if (d->type == DesktopContainment || d->type >= CustomContainment) { // we want to listen to changes in work area if our screen changes if (d->screen < 0 && newScreen > -1) { - connect(KWindowSystem::self(), SIGNAL(workAreaChanged()), - this, SLOT(positionToolBox())); + connect(KWindowSystem::self(), SIGNAL(workAreaChanged()), this, SLOT(positionToolBox())); } else if (newScreen < 0) { - disconnect(KWindowSystem::self(), SIGNAL(workAreaChanged()), - this, SLOT(positionToolBox())); + disconnect(KWindowSystem::self(), SIGNAL(workAreaChanged()), this, SLOT(positionToolBox())); } if (newScreen > -1 && corona()) { @@ -1649,17 +1655,6 @@ void ContainmentPrivate::containmentConstraintsEvent(Plasma::Constraints constra } if (constraints & Plasma::FormFactorConstraint) { - if (toolBox) { - if (q->formFactor() == Vertical) { - toolBox->setCorner(ToolBox::Bottom); - //defaults to horizontal - } else if (QApplication::layoutDirection() == Qt::RightToLeft) { - toolBox->setCorner(ToolBox::Left); - } else { - toolBox->setCorner(ToolBox::Right); - } - } - foreach (Applet *applet, applets) { applet->updateConstraints(Plasma::FormFactorConstraint); } @@ -1853,7 +1848,7 @@ void ContainmentPrivate::positionPanel(bool force) } //TODO: research how non-Horizontal, non-Vertical (e.g. Planar) panels behave here - bool horiz = q->formFactor() == Plasma::Horizontal; + bool horiz = formFactor == Plasma::Horizontal; qreal bottom = horiz ? 0 : VERTICAL_STACKING_OFFSET; qreal lastHeight = 0; @@ -1901,12 +1896,11 @@ void ContainmentPrivate::positionPanel(bool force) newPos = QPointF(bottom + q->size().width(), -INTER_CONTAINMENT_MARGIN - q->size().height()); } - ContainmentPrivate::s_positioning = true; if (p != newPos) { + ContainmentPrivate::s_positioning = true; q->setPos(newPos); - emit q->geometryChanged(); + ContainmentPrivate::s_positioning = false; } - ContainmentPrivate::s_positioning = false; } } // Plasma namespace diff --git a/private/toolbox.cpp b/private/toolbox.cpp index 2eb489b24..b72a3554b 100644 --- a/private/toolbox.cpp +++ b/private/toolbox.cpp @@ -446,7 +446,8 @@ void ToolBox::reposition() return; } - if (d->containment->containmentType() == Containment::PanelContainment) { + if (d->containment->containmentType() == Containment::PanelContainment || + d->containment->containmentType() == Containment::CustomPanelContainment) { QRectF rect = boundingRect(); if (d->containment->formFactor() == Vertical) { setCorner(ToolBox::Bottom); @@ -464,7 +465,8 @@ void ToolBox::reposition() setCorner(ToolBox::Right); } } - //kDebug() << pos(); + + //kDebug() << "got ourselves a panel containment, moving to" << pos(); } else if (d->containment->corona()) { //kDebug() << "desktop";