[cairo] Cairo with GTK2 and GTK3

Jonas Kulla nyocurio at gmail.com
Tue Apr 9 00:50:38 PDT 2013


2013/4/9 Ken Resander <kresander at yahoo.com>

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

As you correctly read, there is no more "expose-event" signal in GTK3.0,
as it is replaced by "draw".

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

You can read about it
Basically, the clip region is already applied
to the cairo context before signal emission. I think you could query it
explicitly using calls you will find in the cairo docs, but I think for
cases simply drawing and letting cairo take care of clip based
optimizations is the easiest solution.

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

AFAIK, there is absolutely no problem with having two GTK versions
installed in parallel. After all, the library version number takes care of
any collisions. Most people have been running applications with both
versions along side each other for as long as GTK3.0 has been released.

> Ken

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

More information about the cairo mailing list