From 55437fafb607edb4e5da7a826e745d8c9ae2b949 Mon Sep 17 00:00:00 2001 From: Jason Stubbs Date: Sat, 22 Dec 2007 07:35:42 +0000 Subject: [PATCH] Notify applets when their LocationConstraint has changed. Also, don't bother emitting geometryChanged() and doing an update() if the geometry hasn't actually changed. svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=751543 --- applet.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/applet.cpp b/applet.cpp index 044923c28..461f8e8a0 100644 --- a/applet.cpp +++ b/applet.cpp @@ -1300,6 +1300,8 @@ QVariant Applet::itemChange(GraphicsItemChange change, const QVariant &value) void Applet::setGeometry(const QRectF& geometry) { + Plasma::Constraints updatedConstraints(0); + if (geometry.size().width() > 0 && geometry.size().height() > 0 && size() != geometry.size()) { prepareGeometryChange(); qreal width = qBound(minimumSize().width(), geometry.size().width(), maximumSize().width()); @@ -1315,12 +1317,19 @@ void Applet::setGeometry(const QRectF& geometry) managingLayout()->invalidate(); } - updateConstraints(Plasma::SizeConstraint); + updatedConstraints |= Plasma::SizeConstraint; } - setPos(geometry.topLeft()); - emit geometryChanged(); - update(); + if (geometry.topLeft() != pos()) { + setPos(geometry.topLeft()); + updatedConstraints |= Plasma::LocationConstraint; + } + + if (updatedConstraints) { + updateConstraints(updatedConstraints); + emit geometryChanged(); + update(); + } } void Applet::setIsContainment(bool isContainment)