Re: [xs] Bug with GtkAllocation->width



in gperl_sv_from_value the following code:

g_printerr("[gperl_value_from_sv] type - %d (%s fundamental for %s)\n",
        typ, g_type_name(G_TYPE_FUNDAMENTAL(G_VALUE_TYPE(value))), 
        G_VALUE_TYPE_NAME(value));

generates the following print:

[gperl_value_from_sv] type - 72 (GBoxed fundamental for GdkRectangle)

so it goes into the appropriate branch of the switch. BOXED

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.

i'm looking into it, but this part of the code is new to me. (good
excuse to learn it.)

-rm

On Thu, 2003-05-01 at 18:11, Jörn Reder wrote:
Hi,

I think I found a bug in gtk-perl-xs regarding GtkAllocation. I have a 
small module which can track allocations of selected widgets to apply 
some layout optimizations (e.g. giving cells of independent tables the 
same width). It connects "size-allocate". The callback gets a 
GtkAllocation object. Calling ->width on this object produces an error:

  $widget->signal_connect("size-allocate", sub {
    my ($widget, $alloc) = @_;
    print "width=".$alloc->width;
    1;
  });

gives

  Not an ARRAY reference at .../Gtk2.pm line 127.

There is some confusion with GtkAllocation and GdkRectangle I don't 
really understand, but obviously the ->width method defined in line 127
expects a GdkRectangle object (which is a blessed array reference), but
in my case it's called on a GtkAllocation object (which is a blessed 
scalar reference).

Regards,

Joern




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