From 59a0e9f0e83d1d17dae16810c53391251937ea32 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Mon, 16 Feb 2009 21:45:18 +0000 Subject: [PATCH] theory: the desktop breakage could happen because the panel overlaps the desktop for a while, making containment()->view() or corona::containmentfordesktop() fails, leaving the desktop view without a containment try to reposition the panel before a vertical movement, it should prevent the panel to go into the desktop for an instant CCBUG:176280 svn path=/trunk/KDE/kdelibs/; revision=927141 --- containment.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/containment.cpp b/containment.cpp index 7b4540eb6..3bc6e20ed 100644 --- a/containment.cpp +++ b/containment.cpp @@ -1177,20 +1177,26 @@ QVariant Containment::itemChange(GraphicsItemChange change, const QVariant &valu { //FIXME if the applet is moved to another containment we need to unfocus it + QVariant newValue = Applet::itemChange(change, value); + if (isContainment() && !ContainmentPrivate::s_positioning && - (change == QGraphicsItem::ItemSceneHasChanged || change == QGraphicsItem::ItemPositionHasChanged)) { - switch (d->type) { - case PanelContainment: - case CustomPanelContainment: - d->positionPanel(); - break; - default: - d->positionContainments(); - break; + (change == QGraphicsItem::ItemSceneChange || change == QGraphicsItem::ItemPositionChange)) { + + //if the position will be actually changed, reposition before the change + if (newValue == value) { + switch (d->type) { + case PanelContainment: + case CustomPanelContainment: + d->positionPanel(); + break; + default: + d->positionContainments(); + break; + } } } - return Applet::itemChange(change, value); + return newValue; } void Containment::enableAction(const QString &name, bool enable)