theme: Upgrade to use Cairo for painting (changes API)

This commit is in preparation for the work happening in GTK3, which will
use Cairo for drawing exclusively. So it is necessary to move all
drawing code to Cairo. In this commit the "gtk2" code is used for both
gtk2 and gtk3; compatibility with newer versions of gtk3 where different
code is needed will be added subsequently.
For compatibility with older GTK versions, the file gdk2-drawing-utils.h
provides a compatibility layer.

The commit changes the API of libmutter-private.

https://bugzilla.gnome.org/show_bug.cgi?id=630203
This commit is contained in:
Benjamin Otte
2010-09-23 17:35:41 +02:00
parent dc80242e51
commit aa65f94c67
9 changed files with 406 additions and 163 deletions

View File

@ -35,6 +35,8 @@
#define _(x) dgettext (GETTEXT_PACKAGE, x)
#define N_(x) x
#include "gdk2-drawing-utils.h"
/* We need to compute all different button arrangements
* in terms of button location. We don't care about
* different arrangements in terms of button function.
@ -959,6 +961,7 @@ run_theme_benchmark (void)
#define ITERATIONS 100
int client_width;
int client_height;
cairo_t *cr;
int inc;
widget = gtk_window_new (GTK_WINDOW_TOPLEVEL);
@ -1009,10 +1012,11 @@ run_theme_benchmark (void)
client_height + top_height + bottom_height,
-1);
cr = meta_cairo_create (pixmap);
meta_theme_draw_frame (global_theme,
widget,
pixmap,
NULL,
cr,
0, 0,
META_FRAME_TYPE_NORMAL,
get_flags (widget),
@ -1024,6 +1028,7 @@ run_theme_benchmark (void)
meta_preview_get_mini_icon (),
meta_preview_get_icon ());
cairo_destroy (cr);
g_object_unref (G_OBJECT (pixmap));
++i;