Detecting when PopupApplet is iconified
Sebastian Kügler
sebas at kde.org
Fri Mar 19 15:03:23 CET 2010
On Friday 19 March 2010 14:54:27 Rob Hasselbaum wrote:
> On Thu, Mar 18, 2010 at 1:23 PM, Rob Hasselbaum <rob at hasselbaum.net> wrote:
> > On Thu, Mar 18, 2010 at 10:56 AM, Sebastian Kügler <sebas at kde.org> wrote:
> >> You can, because you can find out if it's on the desktop by calling
> >> formFactor().
> >
> > Ahh, OK, so if the form factor is either Horizontal or Vertical, it's
> > guaranteed that the applet is a panel icon?
>
> Here is the code I ended up with. Seems to work:
>
> bool MyApplet::isOpen() const {
> if (formFactor() == Plasma::Horizontal || formFactor() ==
> Plasma::Vertical) {
> return isPopupShowing();
> } else {
> return true;
> }
> }
Thinking of it, the minimum size of the graphicsWidget() might also be interesting
here, since an applet is iconified if the minimum size of the graphics widget inside
does not fit. In fact, the formFactor() might not matter at all. (Haven't checked the
code though.)
I think the heuristics for this would be more complicated, but in general, it might
be a good idea to quiesce dataengines as long as no *visible* applet is connected.
Note that the painting itself shouldn't happen more often than necessary, as the
paint event is only triggered when the applet is actually visible. (Right?)
--
sebas
http://www.kde.org | http://vizZzion.org | GPG Key ID: 9119 0EF9
More information about the Plasma-devel
mailing list