[vinagre] Replace gdk_draw_* with cairo calls in panel applet
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vinagre] Replace gdk_draw_* with cairo calls in panel applet
- Date: Sun, 6 Mar 2011 09:32:06 +0000 (UTC)
commit 04d1a13bf11c79db61c643e44e618223d61e9041
Author: Daniel Svensson <dsvensson gmail com>
Date: Sun Sep 12 13:28:43 2010 +0200
Replace gdk_draw_* with cairo calls in panel applet
vinagre/vinagre-applet.c | 32 +++++++++++---------------------
1 files changed, 11 insertions(+), 21 deletions(-)
---
diff --git a/vinagre/vinagre-applet.c b/vinagre/vinagre-applet.c
index 694b3aa..67aa544 100644
--- a/vinagre/vinagre-applet.c
+++ b/vinagre/vinagre-applet.c
@@ -138,19 +138,15 @@ vinagre_applet_check_size (VinagreApplet *applet)
static gboolean
vinagre_applet_draw_cb (VinagreApplet *applet)
{
- gint w, h, bg_type;
+ gint bg_type;
GdkColor color;
- GdkGC *gc;
GdkPixmap *background;
- GtkAllocation allocation;
GdkWindow *window = gtk_widget_get_window (GTK_WIDGET (applet));
+ cairo_t *cr;
if (window == NULL)
return FALSE;
- /* Clear the window so we can draw on it later */
- gdk_window_clear (window);
-
/* retrieve applet size */
vinagre_applet_get_icon (applet);
vinagre_applet_check_size (applet);
@@ -161,33 +157,27 @@ vinagre_applet_draw_cb (VinagreApplet *applet)
if (applet->icon == NULL)
return FALSE;
- gtk_widget_get_allocation (GTK_WIDGET (applet), &allocation);
- w = allocation.width;
- h = allocation.height;
-
- gc = gdk_gc_new (window);
+ cr = gdk_cairo_create (window);
/* draw pixmap background */
bg_type = panel_applet_get_background (PANEL_APPLET (applet), &color, &background);
if (bg_type == PANEL_PIXMAP_BACKGROUND)
{
/* fill with given background pixmap */
- gdk_draw_drawable (window, gc, background, 0, 0, 0, 0, w, h);
+ gdk_cairo_set_source_pixmap (cr, background, 0, 0);
+ cairo_paint (cr);
}
-
+
/* draw color background */
if (bg_type == PANEL_COLOR_BACKGROUND)
{
- gdk_gc_set_rgb_fg_color (gc,&color);
- gdk_gc_set_fill (gc,GDK_SOLID);
- gdk_draw_rectangle (window, gc, TRUE, 0, 0, w, h);
+ gdk_cairo_set_source_color (cr, &color);
+ cairo_fill (cr);
}
- /* draw icon at center */
- gdk_draw_pixbuf (window, gc, applet->icon,
- 0, 0, (w - applet->icon_width)/2, (h - applet->icon_height)/2,
- applet->icon_width, applet->icon_height,
- GDK_RGB_DITHER_NONE, 0, 0);
+ gdk_cairo_set_source_pixbuf (cr, applet->icon, 0, 0);
+ cairo_paint (cr);
+ cairo_destroy (cr);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]