[cairo] Cairo with GTK2 and GTK3

Ken Resander kresander at yahoo.com
Tue Apr 9 00:32:08 PDT 2013


I am a cairo newbie on Ubuntu 12.04 LTS using GTK+3.0.

I have read 'Changes that need to be done at the time of the switch' at Gnome Dev Centre which explains what is new for GTK+3.0. It mentions that "expose-event" signal has been replaced by a new "draw" signal. That is very clear, but I have seen examples in other forums of expose event used together with gtk_drawing_area_new, so I tried using it too:

...
darea = gtk_drawing_area_new();
gtk_container_add(GTK_CONTAINER(window), darea);
g_signal_connect(G_OBJECT(darea), "expose-event",
                    G_CALLBACK(on_expose_event), &h);

It compiled and built but generated 
(gv:2938): GLib-GObject-WARNING **: /build/buildd/glib2.0-2.32.3/./gobject/gsignal.c:2455: signal `expose-event' is invalid for instance `0x78d020' when executing the g_signal_connect. (0x78d020 refers to darea). That suggests that expose event does not work/is not available for GTK+3.0. Is this so?

Event handlers for expose-event have a GdkEventExpose *event parameter that allows 'regions' to be updated. The draw handler does not have this parameter. Has updating regions been dropped in GTK+3.0 or can it be done in some other way? If so, where can I read about it?

GTK+3.0 came with Ubuntu 12.04LTS. I will also need to support GTK+2. Can GTK 3 and GTK 2 coexist on the same Ubuntu/Linux PC, for example as different shared object libraries or do I need to use two PCs? 

I could build GTK3-only and GTK2-only versions or build a combined version that switches on gtk version as needed. Pros and cons?

Ken
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20130409/ad655904/attachment.html>


More information about the cairo mailing list