[Xfce4-commits] <midori:master> Use cairo to draw static throbber and avoid unused code paths
Christian Dywan
noreply at xfce.org
Thu Oct 14 21:18:04 CEST 2010
Updating branch refs/heads/master
to 18946b10b2631985bb12d6e04a3ff95b15d2ac50 (commit)
from 54d037f689719a0f877b03d313dc3b670a17afb3 (commit)
commit 18946b10b2631985bb12d6e04a3ff95b15d2ac50
Author: Christian Dywan <christian at twotoasts.de>
Date: Thu Oct 14 20:59:47 2010 +0200
Use cairo to draw static throbber and avoid unused code paths
katze/katze-throbber.c | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/katze/katze-throbber.c b/katze/katze-throbber.c
index 6dcbbac..66e133e 100644
--- a/katze/katze-throbber.c
+++ b/katze/katze-throbber.c
@@ -855,14 +855,8 @@ static gboolean
katze_throbber_expose_event (GtkWidget* widget,
GdkEventExpose* event)
{
- gint ax, ay;
KatzeThrobber* throbber = KATZE_THROBBER (widget);
- #if HAVE_SPINNER
- if (throbber->animated)
- return GTK_WIDGET_CLASS (katze_throbber_parent_class)->expose_event (widget, event);
- #endif
-
if (G_UNLIKELY (!throbber->width || !throbber->height))
return TRUE;
@@ -873,6 +867,9 @@ katze_throbber_expose_event (GtkWidget* widget,
if (!throbber->animated && (throbber->static_pixbuf
|| throbber->static_icon_name || throbber->static_stock_id))
{
+ gint ax, ay;
+ cairo_t* cr;
+
if (G_UNLIKELY (!throbber->static_pixbuf && throbber->static_icon_name))
{
icon_theme_changed (KATZE_THROBBER (widget));
@@ -902,13 +899,17 @@ katze_throbber_expose_event (GtkWidget* widget,
katze_throbber_aligned_coords (widget, &ax, &ay);
- gdk_draw_pixbuf (event->window, NULL, throbber->static_pixbuf,
- 0, 0, ax, ay,
- throbber->width, throbber->height,
- GDK_RGB_DITHER_NONE, 0, 0);
+ cr = gdk_cairo_create (gtk_widget_get_window (widget));
+ gdk_cairo_set_source_pixbuf (cr, throbber->static_pixbuf, ax, ay);
+ cairo_paint (cr);
+ cairo_destroy (cr);
}
else
{
+ #if HAVE_SPINNER
+ if (throbber->animated)
+ return GTK_WIDGET_CLASS (katze_throbber_parent_class)->expose_event (widget, event);
+ #else
gint cols, rows;
if (G_UNLIKELY (throbber->icon_name && !throbber->pixbuf))
@@ -969,6 +970,7 @@ katze_throbber_expose_event (GtkWidget* widget,
g_object_notify (G_OBJECT (throbber), "pixbuf");
g_object_thaw_notify (G_OBJECT (throbber));
}
+ #endif
}
return TRUE;
More information about the Xfce4-commits
mailing list