Re: Strange bug while subclassing Gtk2::Box



muppet wrote:
Jaap Karssenberg said:
Ok, the problem is not that propagate_expose doesn't work, the problem
is that my box object doesn't get expose events in the first place. I
tried adding "expose_mask" for my box object but that didn't help. Any
other suggestions on what should be turned on/off in order to get expose
events ?

SHould you be chaining up in size-allocate or size-request?  Are there any
signals whose propagation you're inhibiting by accident?

Try adding propagate_expose() in a callback for the toplevel window's
expose-event.

Ok, I found the solution: chainging up is required in size_allocate. The strange part remains the question why. I didn't find size_allocate methods in gtkbox or gtkcontainer so which parent closure is actually called here?

A clue might be that even if I send propagate_expose() calls directly from the window's expose event handler the expose events never reach the box widget (they do on 2.8.x (twice, once for the extra handler I added and once for the normal handler) they don't on 2.4.x).

Now there are no diffs in the gtk_container_propagate_expose method between 2.4.14 and 2.8.6. But this method does call gtk_widget_region_intersect which contains some significant diffs.

To cut a long story short with gtk+ < 2.8.x we need the chaining up in order to set the "allocation" attribute of the box object. You can check this by printing out $box->allocation->values. For the working version of the demo script this will return valid coordinates, while the not working version returns -1, -1, 1, 1. Apperently the allocation attribute is set implicitly for gtk+ 2.8.x but needs to be set explicitly for older versions.

B.t.w is there a way to set such attributes (that are not properties) of gtk objects from perl?

Anyway I'll go on with developing zim. When I think I have a stable release I'll release the Gtk2::Ex:: modules to CPAN as a seperate package. I expect this to include HyperTextView (TextView supporting links) HyperTextBuffer (buffer that manages a pod parse tree) and of course PathBar.

Cheers!

--
   )   (     Jaap Karssenberg || Pardus [Larus]                | |0| |
   :   :     http://pardus-larus.student.utwente.nl/~pardus    | | |0|
 )  \ /  (                                                     |0|0|0|
 ",.*'*.,"   Proud owner of "Perl6 Essentials" 1st edition :)  wannabe




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