Re: wrong binding of binding of Gtk2::StatusIcon->position_menu() ?



On Thu, 2007-09-06 at 16:49 +0200, Thierry Vignaud wrote:

The binding of Gtk2::StatusIcon->position_menu() looks wrong to me:
the "x" & "y" parameters are there only because C cannot return more
than one value at once.

C/Gtk+ programs give two *pointers* on integers in order to get back
coordinates.

The way it's currently binded is useless in perl. These should be
returned as a list instead!

Well, they are returned.  It's just that they are also supposed to be
passed in.  The signature looks like this:

  ($x, $y, $push_in) = Gtk2::StatusIcon::position_menu($menu, $x, $y, $icon)

The x, y arguments are there because position_menu is supposed to be
usable as a callback for Gtk2::Menu::popup:

  $menu->popup(undef, undef, \&Gtk2::StatusIcon::position_menu, $icon, 0, 0);

And our callback marshaller for that callback type gives you the x, y
pair.  So if Gtk2::StatusIcon::position_menu doesn't take that pair, the
above idiom stops working.

Now that I look at some code and documentation, though, I see that the
callback marshaller is probably in error to pass the x, y pair.  The
docs clearly say that "[t]his is an output parameter" for x and y.

Any suggestions for a solution?

-- 
Bye,
-Torsten




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