Re: Strange bug while subclassing Gtk2::Box




On Oct 30, 2005, at 2:08 PM, Eduardo M KALINOWSKI wrote:

Jaap Karssenberg wrote:

For zim I'm working on a Gtk2::Ex::PathBar class to implement a path
bar that looks like the one that is found in the gtk filechooser.

Rock.

Now
I have a strange bug. My implementation works perfectly fine on my own
system which runs archlinux.

What versions of gtk+ and Gtk2?

The problem is this: my widget is a subclass of Gtk2::Box which
implements size_request and size_allocate. Now on some systems it
justs works, on other systems it doesn't. When it doesn't the buttons
are allocated but they don't show up in the widget. But they are
there, they are clickable - they just don't show.

The code below reproduces the problem. If you do see the buttons that
means you have one of the systems where it just works, if you see an
empty space try clicking it, you should see output from the buttons
being clicked in your terminal.

I'm running Debian, libgtk2-perl version 1.081, gtk version 2.6.10 and I
don't see the buttons, but indeed they're clickable. I'm using the
default gtk theme.

With the stock gtk+ on FC3 (2.4.14), i see nothing, as you described. Tried using console X and remote X, no difference.

However, with gtk+ 2.8.2 running out of a JHBuild sandbox on the very same machine, i see a series of buttons.

So it's not merely distro differences.

I instrumented your code with some calls to Glib::Object::signal_add_emission_hook() (from Glib 1.10x), ran the code in both sandboxes, and compared the output. For some reason, the older gtk+ (which doesn't show the buttons) does not propagate expose events to the HBox's children, but gtk+ 2.8 does.

Making your MyBox derive from HBox and disabling your do_size_allocate () results in a working example on both versions. You probably want to compare your do_size_allocate() with gtk_hbox_size_allocate() and see what you're doing differently.


--
"the ternary operator makes it a bit less ugly."
    -- kaffee




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