Re: Unwrapped gtk+ API



On Sat, 2010-04-24 at 22:21 +0200, Torsten Schoenfeld wrote:
If anyone is looking for a challenge, we also still need bindings for 
the offscreen window stuff:

The first patch change the way damage events are blessed, they were
blessed as Gtk2::Gdk::Event::Damage but it doesn't have the ->area
method. Damage events are really just expose events. Similar cases in
Gtk2::Gdk::Event use a common package and are distinguished by using
->type. As we can't rename Gtk2::Gdk::Event::Expose, I chose to use it
as the common package and bless damage event as a
Gtk2::Gdk::Event::Expose.

The second patch wrap the offscreen gdkwindow stuff.
I'm wondering if offscreen gdkwindows should be in their own package.
I also added a small comment to gdk_window_geometry_changed, as though
it can be used with normal gdkwindows, it seems it is only useful for
offscreen ones.
I haven't found a way to test the from-embedder/to-embedder marshaller.

The third patch contains 3 examples for offscreen gdkwindows.
Two are inspired from the the gtk examples, the reflection one has small
differences, I significantly expanded the rotation example to make it
much more fun and generic by using the same matrix for nearly
everything. (btw a $matrix->copy could be nice, I've used
$matrix->multiply( Cairo::Matrix->init_identity ) instead.)
And I've added a third example that simply scale the widget to the size
of the window.
I don't know if all 3 examples should be included.

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. 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.

One thing I haven't managed to do, is make it work if the child of the
offscreen-using container is added/replaced after the container is
realized.

Quentin

Attachment: 0001-make-Damage-Event-a-Gtk2-Gdk-Event-Expose-object.patch
Description: Text Data

Attachment: 0002-wrap-offscreen_window-functions.patch
Description: Text Data

Attachment: 0003-add-offscreen-examples.patch
Description: Text Data



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