On Friday 19 March 2010 14:54:27 Rob Hasselbaum wrote:
> On Thu, Mar 18, 2010 at 1:23 PM, Rob Hasselbaum <r...@hasselbaum.net> wrote:
> > On Thu, Mar 18, 2010 at 10:56 AM, Sebastian Kügler <se...@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
_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel

Reply via email to