Re: gtk_widget_show() and the 'size-allocate' signal



Since my latest efforts to minimize the number of "size-allocate"s being
thrown around by holding off on key gtk_widget_show() calls, I'll attempt to
subclass a widget, but I've never made my own custom widget before.

There is a http://www.gtk.org/tutorial/x2312.html tutorial on making your
own widgets but it seems to make a 'subclass' of a widget in GTK using C, I
have to copy the source of a widget and make changes from there.  Where am I
going to get all the necessary source code for a GtkLayout from GTK 2.4?

Using this method, what happens when different versions of GTK are compiled
against or used with my applications?  Will my old custom/'subclass' widget
eventually stop working or create an incompatibility?

I'm also a little foggy on how my custom widget will be able to solve my
problem.  Is it common for people to make custom signals as well, or is that
impossible?


On 3/4/07, David Nečas (Yeti) <yeti physics muni cz> wrote:

On Sat, Mar 03, 2007 at 07:59:10PM -0800, v4r4n wrote:
> When I call gtk_widget_show() on a parent of the parent, the child
widget's
> "size-allocate" signal handler is called before the parent widget's
> "size-allocate" signal handler.  This creates a problem because I was
> expecting my particular parent to be the one that gives the child its
> "size-allocate" signal.
>
> I know GTK normally works from bottom to top, but I thought
"size-allocate"
> was one of the signals that travels from top to bottom...

It works from top to bottom.  However, the size_allocate()
method (or signal handler if you wish) of the container is run
first and it invokes size allocation of its children.
Your "size-allocate" signal handler is run after it, i.e.
when the recusrive allocation is finished.  Obviously you
receive "size-allocate" in bottom to top order.

If you want to override size_allocate() for containes, I
suggest to subclass.

> I'm also having trouble installing all the development source packages I
> need to see what exactly is going on (ubuntu).  All I see are a bunch of
> function calls from libgtk-x11-2.0.so.0 and no source code.

Packages with debugging information have typically -dbg,
-debug or -debuginfo suffix.

I recommend to also (or even instead) build GLib and Gtk+
with --debug=yes from source and install it to
a *NON-SYSTEM* location as this enables one to use the
*_DEBUG facilities:

LD_LIBRARY_PATH=$HOME/.../gtk-debug/lib GTK_DEBUG=geometry myapp...

(hm, I wonder how the `thou shalt not touch Gtk+ source'
types do this)

Yeti


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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]