Re: [xs] Bug with GtkAllocation->width



On Thu, 2003-05-01 at 19:19, Ross McFarland wrote:
Dumper of the parameters passed to the callback in perl show what's
expected at this point, that the parameter is assumed to be
GtkRectangle.

$VAR1 = bless( do{\(my $o = 136665064)}, 'Gtk2::Button' );
$VAR2 = bless( do{\(my $o = 136910080)}, 'Gtk2::Gdk::Rectangle' );
Not an ARRAY reference at ..//Gtk2.pm line 127.

*sigh*  more evil side-effects of my well-intentioned-but-poorly-done
change in the GdkRectangle representation.  there's a strange
relationship between GtkAllocation and GdkRectangle (in the C headers,
GtkAllocation is typedef'd to GdkRectangle, but there is no type id for
the allocation structure) which made the whole thing confusing in the
first place.  the switch in representations broke this because of the
lack of a type id for GdkAllocation.  that's why the allocation object
in the callback is blessed as a rectangle.  (short of creating a new
type id at the binding level, there's no way around that, but it doesn't
matter because there are no methods for allocation that rectangle
doesn't supply.)

so, i've just committed to CVS a reversal of the GdkRectangle mess. 
GdkRectangles are once again a proper boxed type; but i added the
->values function from gtk2-perl which retrieves the members as a list,
and you have the ->x, ->y, ->width, ->height accessors, and a ->new to
create them (which didn't exist before the list representation).

my latest rationalization:  as a boxed type, the cost of creating a
wrapper is two SVs, one IV containing the pointer and one blessed RV
pointing to the IV.  the cost of creating a list is four SVs, an AV, and
an RV; using the wrapper methods just slow things down.  so the boxed
representation is faster and more efficient, and since you will tend to
just create a new one with new values instead of modifying values in an
existing one, they won't seem so foreign in perl (not sure i completely
believe this, but what the hey).


sorry for the API churn.  i promise i won't mess with rectangle anymore.

-- 
muppet <scott at asofyet dot org>




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