[Xfce4-commits] <ristretto:stephan/gtk3> Render themed background-color
Stephan Arts
noreply at xfce.org
Sat May 5 08:46:03 CEST 2012
Updating branch refs/heads/stephan/gtk3
to 7d1fb32a6d69ffca943e6fd449e565f77c00deb0 (commit)
from 7a5f6bca9c8ccb57f60b5519ff16d4fda3e6ac3d (commit)
commit 7d1fb32a6d69ffca943e6fd449e565f77c00deb0
Author: Stephan Arts <stephan at xfce.org>
Date: Sat May 5 08:44:39 2012 +0200
Render themed background-color
src/image_viewer.c | 27 ++++++++++++++++++++-------
src/monitor_chooser.c | 15 +++------------
2 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/src/image_viewer.c b/src/image_viewer.c
index 5e1011f..e339e48 100644
--- a/src/image_viewer.c
+++ b/src/image_viewer.c
@@ -884,6 +884,8 @@ paint_background (
RsttoImageViewer *viewer = RSTTO_IMAGE_VIEWER (widget);
GdkColor *bg_color = NULL;
GdkWindow *window = gtk_widget_get_window (widget);
+ GtkAllocation allocation;
+ GtkStyleContext *context = gtk_widget_get_style_context (widget);
/* Determine if we draw the 'default' background-color,
* or the fullscreen-background-color.
@@ -901,8 +903,16 @@ paint_background (
/* Paint the background-color */
/******************************/
- gdk_cairo_set_source_color ( ctx, bg_color );
- cairo_paint (ctx);
+ if ( NULL != bg_color )
+ {
+ gdk_cairo_set_source_color ( ctx, bg_color );
+ cairo_paint (ctx);
+ }
+ else
+ {
+ gtk_widget_get_allocation (widget, &allocation);
+ gtk_render_background (context, ctx, 0, 0, allocation.width, allocation.height);
+ }
}
static void
@@ -2844,10 +2854,13 @@ cb_rstto_limit_quality_changed (
viewer->priv->limit_quality = g_value_get_boolean (
&val_limit_quality);
- rstto_image_viewer_load_image (
- viewer,
- viewer->priv->file,
- viewer->priv->scale);
+ if (viewer->priv->file)
+ {
+ rstto_image_viewer_load_image (
+ viewer,
+ viewer->priv->file,
+ viewer->priv->scale);
+ }
}
static void
@@ -2887,7 +2900,7 @@ cb_rstto_bgcolor_changed (
}
else
{
- //viewer->priv->bg_color = &(widget->style->bg[GTK_STATE_NORMAL]);
+ viewer->priv->bg_color = NULL;
}
viewer->priv->bg_color_fs = g_value_get_boxed (&val_bg_color_fs);
diff --git a/src/monitor_chooser.c b/src/monitor_chooser.c
index bc5a416..d3c4c8c 100644
--- a/src/monitor_chooser.c
+++ b/src/monitor_chooser.c
@@ -296,19 +296,9 @@ rstto_monitor_chooser_paint(GtkWidget *widget, cairo_t *ctx)
gint id = 0;
gdouble alloc_width = (gdouble)gtk_widget_get_allocated_width (widget);
gdouble alloc_height = (gdouble)gtk_widget_get_allocated_height (widget);
+ GtkStyleContext *context = gtk_widget_get_style_context (widget);
- /*
- gdk_cairo_set_source_color (
- ctx,
- &(widget->style->bg[GTK_STATE_NORMAL]));
- */
- cairo_rectangle (
- ctx,
- 0.0,
- 0.0,
- alloc_width,
- alloc_height);
- cairo_fill (ctx);
+ gtk_render_background (context, ctx, 0, 0, alloc_width, alloc_height);
if (chooser->priv->n_monitors > 1)
{
@@ -476,6 +466,7 @@ paint_monitor ( GtkWidget *widget,
gint text_height = 0.0;
gdouble hscale = 1.0;
gdouble vscale = 1.0;
+ GtkStyleContext *context = gtk_widget_get_style_context (widget);
/*******************************************/
PangoLayout *layout;
More information about the Xfce4-commits
mailing list