diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-03-09 16:21:40 +0800 |
---|---|---|
committer | Emanuele Aina <emanuele.aina@collabora.com> | 2012-03-12 19:52:07 +0800 |
commit | 532a1f7c653866c50589d37fb20b13e1f71738cf (patch) | |
tree | cd08a38a3128f845dd3acdf6d27641aae9019ec9 | |
parent | 48370f1bead25fff25e3694f4e87d0b33068fdb3 (diff) | |
download | gsoc2013-empathy-532a1f7c653866c50589d37fb20b13e1f71738cf.tar gsoc2013-empathy-532a1f7c653866c50589d37fb20b13e1f71738cf.tar.gz gsoc2013-empathy-532a1f7c653866c50589d37fb20b13e1f71738cf.tar.bz2 gsoc2013-empathy-532a1f7c653866c50589d37fb20b13e1f71738cf.tar.lz gsoc2013-empathy-532a1f7c653866c50589d37fb20b13e1f71738cf.tar.xz gsoc2013-empathy-532a1f7c653866c50589d37fb20b13e1f71738cf.tar.zst gsoc2013-empathy-532a1f7c653866c50589d37fb20b13e1f71738cf.zip |
rounded-rectangle: use the 'draw' signal
Looks like that's the right way to do it since Clutter 1.8
https://bugzilla.gnome.org/show_bug.cgi?id=669673
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | src/empathy-rounded-rectangle.c | 29 |
2 files changed, 23 insertions, 12 deletions
diff --git a/configure.ac b/configure.ac index 70ca49214..6e5caeceb 100644 --- a/configure.ac +++ b/configure.ac @@ -45,9 +45,9 @@ GTK_REQUIRED=3.0.2 AC_DEFINE(GDK_VERSION_MIN_REQUIRED, GDK_VERSION_3_0, [Ignore post 3.0 deprecations]) AC_DEFINE(GDK_VERSION_MAX_REQUIRED, GDK_VERSION_3_0, [Prevent post 3.0 APIs]) -CLUTTER_REQUIRED=1.7.14 -AC_DEFINE(CLUTTER_VERSION_MIN_REQUIRED, CLUTTER_VERSION_1_6, [Ignore post 1.6 deprecations]) -AC_DEFINE(CLUTTER_VERSION_MAX, CLUTTER_VERSION_1_6, [Prevent post 1.6 APIs]) +CLUTTER_REQUIRED=1.8.0 +AC_DEFINE(CLUTTER_VERSION_MIN_REQUIRED, CLUTTER_VERSION_1_8, [Ignore post 1.8 deprecations]) +AC_DEFINE(CLUTTER_VERSION_MAX, CLUTTER_VERSION_1_8, [Prevent post 1.8 APIs]) CLUTTER_GTK_REQUIRED=0.90.3 diff --git a/src/empathy-rounded-rectangle.c b/src/empathy-rounded-rectangle.c index 8e6dab3da..60246151b 100644 --- a/src/empathy-rounded-rectangle.c +++ b/src/empathy-rounded-rectangle.c @@ -37,12 +37,13 @@ struct _EmpathyRoundedRectanglePriv guint border_width; }; -static void -empathy_rounded_rectangle_paint (EmpathyRoundedRectangle *self) +static gboolean +draw_cb (ClutterCairoTexture *canvas, + cairo_t *cr) { + EmpathyRoundedRectangle *self = EMPATHY_ROUNDED_RECTANGLE (canvas); guint width, height; guint tmp_alpha; - cairo_t *cr; #define RADIUS (height / 8.) @@ -55,8 +56,6 @@ empathy_rounded_rectangle_paint (EmpathyRoundedRectangle *self) * self->priv->border_color.alpha / 255; - cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE (self)); - cairo_set_source_rgba (cr, self->priv->border_color.red, self->priv->border_color.green, @@ -84,9 +83,9 @@ empathy_rounded_rectangle_paint (EmpathyRoundedRectangle *self) cairo_close_path (cr); cairo_stroke (cr); - cairo_destroy (cr); #undef RADIUS + return TRUE; } static void @@ -99,8 +98,18 @@ empathy_rounded_rectangle_init (EmpathyRoundedRectangle *self) } static void +empathy_rounded_rectangle_finalize (GObject *object) +{ + G_OBJECT_CLASS (empathy_rounded_rectangle_parent_class)->finalize (object); +} + +static void empathy_rounded_rectangle_class_init (EmpathyRoundedRectangleClass *klass) { + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + + gobject_class->finalize = empathy_rounded_rectangle_finalize; + g_type_class_add_private (klass, sizeof (EmpathyRoundedRectanglePriv)); } @@ -123,8 +132,10 @@ empathy_rounded_rectangle_new (guint width, self->priv->width = width; self->priv->height = height; + g_signal_connect (self, "draw", G_CALLBACK (draw_cb), NULL); + empathy_rounded_rectangle_update_surface_size (self); - empathy_rounded_rectangle_paint (self); + clutter_cairo_texture_invalidate (CLUTTER_CAIRO_TEXTURE (self)); return CLUTTER_ACTOR (self); } @@ -136,7 +147,7 @@ empathy_rounded_rectangle_set_border_width (EmpathyRoundedRectangle *self, self->priv->border_width = border_width; empathy_rounded_rectangle_update_surface_size (self); - empathy_rounded_rectangle_paint (self); + clutter_cairo_texture_invalidate (CLUTTER_CAIRO_TEXTURE (self)); } void @@ -145,5 +156,5 @@ empathy_rounded_rectangle_set_border_color (EmpathyRoundedRectangle *self, { self->priv->border_color = *color; - empathy_rounded_rectangle_paint (self); + clutter_cairo_texture_invalidate (CLUTTER_CAIRO_TEXTURE (self)); } |