[Xfce4-commits] <ristretto:master> Revert "Make monitor border-color themable"
Stephan Arts
noreply at xfce.org
Mon Nov 28 19:50:01 CET 2011
Updating branch refs/heads/master
to dbde007e00a08572a04fc38d12c72c0a14fc4e7f (commit)
from e202ad2fa4d84fdd29fe3c5374628c61328d479b (commit)
commit dbde007e00a08572a04fc38d12c72c0a14fc4e7f
Author: Stephan Arts <stephan at xfce.org>
Date: Mon Nov 28 19:43:01 2011 +0100
Revert "Make monitor border-color themable"
This reverts commit e202ad2fa4d84fdd29fe3c5374628c61328d479b.
src/monitor_chooser.c | 65 +++++++++++++++++-------------------------------
1 files changed, 23 insertions(+), 42 deletions(-)
diff --git a/src/monitor_chooser.c b/src/monitor_chooser.c
index 1600100..f18b770 100644
--- a/src/monitor_chooser.c
+++ b/src/monitor_chooser.c
@@ -29,7 +29,8 @@
typedef struct {
gint width;
gint height;
- GdkPixbuf *pixbuf;
+
+ cairo_surface_t *image_surface;
} Monitor;
typedef struct {
@@ -74,8 +75,7 @@ static void
cb_rstto_button_press_event (GtkWidget *, GdkEventButton *event);
static void
-paint_monitor ( GtkWidget *widget,
- cairo_t *cr,
+paint_monitor ( cairo_t *cr,
gdouble x,
gdouble y,
gdouble width,
@@ -279,9 +279,7 @@ rstto_monitor_chooser_paint(GtkWidget *widget)
}
label = g_strdup_printf("%d", id+1);
cairo_save (ctx);
- paint_monitor (
- widget,
- ctx,
+ paint_monitor (ctx,
((gdouble)widget->allocation.width/4) - (width/2.0),
((gdouble)widget->allocation.height - height)/2.0,
width,
@@ -310,9 +308,7 @@ rstto_monitor_chooser_paint(GtkWidget *widget)
label = g_strdup_printf("%d", id+1);
cairo_save (ctx);
- paint_monitor (
- widget,
- ctx,
+ paint_monitor (ctx,
((gdouble)widget->allocation.width/2)+
(((gdouble)widget->allocation.width/2)/
(row_width+1))*(id%(row_width)+1)-
@@ -348,9 +344,7 @@ rstto_monitor_chooser_paint(GtkWidget *widget)
width = 200;
}
cairo_save (ctx);
- paint_monitor (
- widget,
- ctx,
+ paint_monitor (ctx,
((gdouble)widget->allocation.width - width)/2.0,
((gdouble)widget->allocation.height - height)/2.0,
width,
@@ -368,8 +362,7 @@ rstto_monitor_chooser_paint(GtkWidget *widget)
}
static void
-paint_monitor ( GtkWidget *widget,
- cairo_t *cr,
+paint_monitor ( cairo_t *cr,
gdouble x,
gdouble y,
gdouble width,
@@ -412,8 +405,6 @@ paint_monitor ( GtkWidget *widget,
/*******************************************/
PangoLayout *layout;
PangoFontDescription *font_description;
- GdkPixbuf *dst_pixbuf = NULL;
- GdkColor *fg_color = &(widget->style->fg[GTK_STATE_NORMAL]);
g_return_if_fail (NULL != monitor);
@@ -429,15 +420,15 @@ paint_monitor ( GtkWidget *widget,
cairo_pattern_add_color_stop_rgb (
monitor_pattern,
0.0,
- ((gdouble)fg_color->red / 65535.0)+0.4,
- ((gdouble)fg_color->green / 65535.0)+0.4,
- ((gdouble)fg_color->blue / 65535.0)+0.4);
+ 0.4,
+ 0.4,
+ 0.4);
cairo_pattern_add_color_stop_rgb (
monitor_pattern,
1.0,
- ((gdouble)fg_color->red / 65535.0)-0.4,
- ((gdouble)fg_color->green / 65535.0)-0.4,
- ((gdouble)fg_color->blue / 65535.0)-0.4);
+ 0.0,
+ 0.0,
+ 0.0);
cairo_new_sub_path (cr);
cairo_arc (
cr,
@@ -542,18 +533,18 @@ paint_monitor ( GtkWidget *widget,
cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0);
cairo_fill_preserve (cr);
- if (monitor->pixbuf)
+ if (monitor->image_surface)
{
cairo_clip_preserve (cr);
- hscale = monitor_width / (gdk_pixbuf_get_width(monitor->pixbuf));
- vscale = monitor_height / (gdk_pixbuf_get_height(monitor->pixbuf));
+ hscale = monitor_width / (cairo_image_surface_get_width(monitor->image_surface));
+ vscale = monitor_height / (cairo_image_surface_get_height(monitor->image_surface));
cairo_scale (cr, hscale, vscale);
- gdk_cairo_set_source_pixbuf (
+ cairo_set_source_surface (
cr,
- monitor->pixbuf,
+ monitor->image_surface,
monitor_x/hscale,
monitor_y/vscale);
cairo_paint(cr);
@@ -562,12 +553,6 @@ paint_monitor ( GtkWidget *widget,
cairo_scale (cr, 1/hscale, 1/vscale);
}
- if (NULL != dst_pixbuf)
- {
- g_object_unref (dst_pixbuf);
- dst_pixbuf = NULL;
- }
-
if (FALSE == active)
{
cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.6);
@@ -654,10 +639,10 @@ rstto_monitor_chooser_add (
}
gint
-rstto_monitor_chooser_set_pixbuf (
+rstto_monitor_chooser_set_image_surface (
RsttoMonitorChooser *chooser,
gint monitor_id,
- GdkPixbuf *pixbuf,
+ cairo_surface_t *surface,
GError **error)
{
Monitor *monitor;
@@ -669,17 +654,13 @@ rstto_monitor_chooser_set_pixbuf (
if (monitor)
{
- if (monitor->pixbuf)
+ if (monitor->image_surface)
{
- g_object_unref (monitor->pixbuf);
+ cairo_surface_destroy(monitor->image_surface);
}
- monitor->pixbuf = pixbuf;
+ monitor->image_surface = surface;
- if (monitor->pixbuf)
- {
- g_object_ref (monitor->pixbuf);
- }
retval = monitor_id;
}
if (GTK_WIDGET_REALIZED (GTK_WIDGET(chooser)))
More information about the Xfce4-commits
mailing list