From 85cb69d28fce35e98e9d66906fcd58cfb55841a7 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Mon, 27 Jul 2009 20:14:38 +0000 Subject: [PATCH] save the background hints in two vars when they are set, use the second to restore the ones that were decided before the formfactor change. i.e. no more need to set again and again the hints in formFactorConstraints svn path=/trunk/KDE/kdelibs/; revision=1003180 --- applet.cpp | 12 +++++++----- private/applet_p.h | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/applet.cpp b/applet.cpp index eff4edfce..5a6728fc5 100644 --- a/applet.cpp +++ b/applet.cpp @@ -835,6 +835,7 @@ void Applet::setBackgroundHints(const BackgroundHints hints) } d->backgroundHints = hints; + d->preferredBackgroundHints = hints; //Draw the standard background? if ((hints & StandardBackground) || (hints & TranslucentBackground)) { @@ -1130,11 +1131,11 @@ void Applet::flushPendingConstraintsEvents() if (c & Plasma::FormFactorConstraint) { FormFactor f = formFactor(); if (!d->isContainment && f != Vertical && f != Horizontal) { - setBackgroundHints(d->backgroundHints | StandardBackground); - } else if(d->backgroundHints & StandardBackground) { - setBackgroundHints(d->backgroundHints ^ StandardBackground); - } else if(d->backgroundHints & TranslucentBackground) { - setBackgroundHints(d->backgroundHints ^ TranslucentBackground); + setBackgroundHints(d->preferredBackgroundHints); + } else { + BackgroundHints hints = d->preferredBackgroundHints; + setBackgroundHints(NoBackground); + d->preferredBackgroundHints = hints; } if (d->failed) { @@ -2191,6 +2192,7 @@ AppletPrivate::AppletPrivate(KService::Ptr service, int uniqueID, Applet *applet : appletId(uniqueID), q(applet), backgroundHints(Applet::NoBackground), + preferredBackgroundHints(Applet::StandardBackground), aspectRatioMode(Plasma::KeepAspectRatio), immutability(Mutable), appletDescription(service), diff --git a/private/applet_p.h b/private/applet_p.h index 6c0473543..3b23190d0 100644 --- a/private/applet_p.h +++ b/private/applet_p.h @@ -113,6 +113,7 @@ public: // applet attributes Applet::BackgroundHints backgroundHints; + Applet::BackgroundHints preferredBackgroundHints; Plasma::AspectRatioMode aspectRatioMode; ImmutabilityType immutability;