Re: Unwrapped gtk+ API

On 13.05.2010 18:25, Quentin Sculo wrote:
gdk_window_set_user_data (widget->window, widget);

I don't think there is a way to get the address of widget in perl.
( no luck with get_pointer )

There is: Glib::Object::get_pointer(). But note that when you call get_pointer() on a Gtk2::Widget, you will get Gtk2::Widget::get_pointer().

This works in all of your offscreen examples:


And by the way, it would be nice if there was a way to get the widget
of a gdkwindow (to be able to pick a widget with the mouse for
example), the only way I know of doing that is iterating through all
the widgets, and it would not work with gdkwindows that are not a
$widget->window. Also it would make accessing the widget's data from
the gdkwindow from-embedder/to-embedder callback much cleaner.

I don't think any such API exists in gdk, does it?

they use gdk_window_get_user_data, for example gtk_get_event_widget
returns the result of gdk_window_get_user_data
( again, no luck using Glib::Object->new_from_pointer )

I think this does work. Maybe when you tried it you hit the same problem I just described above? For example, this is true:

$object == Glib::Object->new_from_pointer(

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