[cairo] Cairo with GTK2 and GTK3

Ken Resander kresander at yahoo.com
Tue Apr 9 07:15:31 PDT 2013



Hi Jonas,

Many thanks for the useful information...

I used the Ubuntu Synaptic Manager to check for GTK2 libraries and found the following:

libgtk2.0-0:i386
libgtk2.0-common
libgtk2.0-0
libgtk2.0-bin

probably needed by Ubuntu apps still based on GTK 2 on my Ubuntu 12.04 LTS.

I requested Synaptic to install libgtk2.0-dev and could then compile and build for GTK 2 by using `pkg-config --cflags gtk+-2.0` and `pkg-config --libs gtk+-2.0` on the command line.

Synaptic manager also found some gtk/gdk 2.0 documentation, libgtk2.0-doc and libgdk-pixbuf2.0-doc and I installed these too. So, there is no conflict having GTK 2 and GTK 3 stuff on the same PC. 

Ken




________________________________
 From: Jonas Kulla <nyocurio at gmail.com>
To: Ken Resander <kresander at yahoo.com> 
Cc: "cairo at cairographics.org" <cairo at cairographics.org> 
Sent: Tuesday, 9 April 2013, 8:50
Subject: Re: [cairo] Cairo with GTK2 and GTK3
 

Hi,



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

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


More information about the cairo mailing list