Re: Unwrapped gtk+ API
- From: Quentin Sculo <squentin free fr>
- To: gtk-perl-list gnome org
- Subject: Re: Unwrapped gtk+ API
- Date: Thu, 13 May 2010 18:25:52 +0200
On Thu, 2010-05-13 at 16:24 +0200, Torsten Schoenfeld wrote:
Thanks for the review, I'll make the change.
One thing I'm wondering, I've used
$offscreen->set_user_data($self->window->get_user_data);
to "attach" the offscreen window to its widget (so that the widget
receive the expose events). GdkWindows use their user_data to hold a
reference to its widget. It's the only way I found to do that, and
though it works fine, maybe there should be a better way.
What does the C code do to achieve that, and what is missing from the
bindings to make it possible in Perl?
see :
http://library.gnome.org/devel/gdk/unstable/gdk-Windows.html#gdk-window-get-user-data
http://library.gnome.org/devel/gdk/unstable/gdk-Windows.html#gdk-window-set-user-data
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 )
Setting the gdkwindow user data is pretty much an obligation when using
gdkwindows created from perl, though if the widget already has a
gdkwindow (created by gtk) the trick I used will work.
(btw there is a bug in gdkwindow creation :
https://bugzilla.gnome.org/show_bug.cgi?id=616655)
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 )
Quentin
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]