On Tue, Jul 21, 2009 at 17:57, Brian Tietz<sdbti...@yahoo.com> wrote:
>
> I noticed that if I create a GtkButton, call gtk_widget_show for the button, 
> then call gtk_widget_size_request, it returns a guesstimate.  With my current 
> theme selection, this turns out to be a few pixels too small.
>
> If I then add it to a container, add the container to a GtkWindow, and show 
> all of them, the GtkButton ends up being notified of what size it really 
> needs to request for the current theme.
>
> Two questions:
>
> 1. Is there a way to force the widget to query the theme before showing the 
> window?  "You don't need to" is a legitimate answer, but I'd like to know the 
> real answer if there is one.

I'm pretty sure you can't do this.  At least, you can't get an
accurate size for a widget until it and all its ancestors are
realized.

> 2. When the window is shown, does the Gtk (perhaps the GtkButton itself) 
> query the display server for the theme information, or does the display 
> server actively send a "theme changed" event?  I suspect the latter since if 
> the user changes themes on the fly, the display server must be able to 
> somehow notify the existing windows that this has occurred.  In either case, 
> how does this work?

GtkWidget::style-set will get emitted on the widget when the theme
information is set (that is, when its GtkStyle becomes valid).  That
will also get emitted after the theme changes.

But, probably more useful for you, GtkWidget::size-allocate will be
emitted when the widget's allocation is ready.

> The "Understanding Metacity Themes" GNOME library documentation doesn't cover 
> this aspect of themes at all - what to expect from the program's point of 
> view.

Not surprising,since metacity themes and gtk themes are unrelated.

     -brian
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to