[Goodies-commits] r3845 - xfce4-fsguard-plugin/trunk/panel-plugin

mmassonnet at gmail.com mmassonnet at gmail.com
Thu Jan 24 11:25:48 CET 2008

On Wed, Jan 23, 2008 at 03:01:55PM -0800, Brian J. Tarricone wrote:
> Hey Mike,
> Mike Massonnet wrote:
> > Modified: xfce4-fsguard-plugin/trunk/panel-plugin/fsguard.c
> > ===================================================================
> > --- xfce4-fsguard-plugin/trunk/panel-plugin/fsguard.c	2008-01-23 21:49:27 UTC (rev 3844)
> > +++ xfce4-fsguard-plugin/trunk/panel-plugin/fsguard.c	2008-01-23 22:22:41 UTC (rev 3845)
> > @@ -71,7 +71,7 @@
> >  {
> >      XfcePanelPlugin    *plugin;
> >      gboolean            seen;
> > -    gint                icon_id;
> > +    volatile gint       icon_id;
> You're almost certainly not using 'volatile' correctly here.  I don't 
> see any use of that var in your code that would require it, and you're 
> only damaging the compiler's ability to do optimisation by using it. 
> Why do you think you need it?

The volatile addition was totally wrong.  I didn't remember it was there
when I commited.

> >      fsguard->icon_id = id;
> > -    size = xfce_panel_plugin_get_size (fsguard->plugin);
> > -    size -= 2 * MAX (fsguard->btn_panel->style->xthickness,
> > -                     fsguard->btn_panel->style->ythickness);
> > +	size = xfce_panel_plugin_get_size (fsguard->plugin);
> > +    size -= 2 + 2 * MAX (fsguard->btn_panel->style->xthickness,
> > +                         fsguard->btn_panel->style->ythickness);
> Better would be to figure out what other gtk style property is causing 
> the extra padding and figure that into your calculations.  We of course 
> have no idea what other themes/theme engines might do while drawing.  My 
> guess would be that, in looking at the thickness of the button, you're 
> forgetting to also look at any padding added around the button (like in 
> the button's container).  These sizing things are so annoying :-( .

And this is driving me nuts.  I can't figure out, but it seems that if I
use an icon from the gtk-stock-items it applies some GTK+ rules as
described in gtk_icon_info_load_icon:
	"Note that the resulting pixbuf may not be exactly this size; an
	icon theme may have icons that differ slightly from their
	nominal sizes, and in addition GTK+ will avoid scaling icons
	that it considers sufficiently close to the requested size or
	for which the source image would have to be scaled up too far.
	(This maintains sharpness.)"
Great for the sharpness, but at some sizes of the panel the top/lower
part misses one or two pixels.  And if I add some extra sizes it still
renders at the same size.  Somehow icons that aren't from the
gtk-stock-items seem to be rendered at a perfect size.

Now about the padding, if I request the size of the button it is indeed
two pixels lower than the panel (therefore the extra minus 2), but
basing the calculation on that value renders icons at very small sizes
at the first panel run.

For now, I will fit with the "size -= 2 + 2 * MAX (foo, bar);" code as
done by other panel plugins :s

> 	-brian


More information about the Xfce4-dev mailing list