[gtk+] Fix dark theme issues in the print dialog
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Fix dark theme issues in the print dialog
- Date: Sun, 6 Oct 2013 03:06:21 +0000 (UTC)
commit 66445fec1d3f92f27d079685acf5990064a04216
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Oct 5 23:02:54 2013 -0400
Fix dark theme issues in the print dialog
The dimensions in the n-up illustration were not using the
color of the style for drawing.
https://bugzilla.gnome.org/show_bug.cgi?id=709420
gtk/gtkprintunixdialog.c | 25 +++++++++++++++++--------
1 files changed, 17 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c
index 7e74a00..33d447d 100644
--- a/gtk/gtkprintunixdialog.c
+++ b/gtk/gtkprintunixdialog.c
@@ -2553,6 +2553,7 @@ draw_page_cb (GtkWidget *widget,
gdouble pos_x, pos_y;
gint pages_per_sheet;
gboolean ltr = TRUE;
+ GtkStateFlags state;
orientation = gtk_page_setup_get_orientation (priv->page_setup);
landscape =
@@ -2562,6 +2563,7 @@ draw_page_cb (GtkWidget *widget,
number_up_layout = dialog_get_number_up_layout (dialog);
width = gtk_widget_get_allocated_width (widget);
height = gtk_widget_get_allocated_height (widget);
+ state = gtk_widget_get_state_flags (widget);
cairo_save (cr);
@@ -2652,19 +2654,19 @@ draw_page_cb (GtkWidget *widget,
shadow_offset = 3;
- gtk_style_context_get_color (context, 0, &color);
+ gtk_style_context_get_color (context, state, &color);
cairo_set_source_rgba (cr, color.red, color.green, color.blue, 0.5);
cairo_rectangle (cr, shadow_offset + 1, shadow_offset + 1, w, h);
cairo_fill (cr);
- gtk_style_context_get_background_color (context, 0, &color);
+ gtk_style_context_get_background_color (context, state, &color);
gdk_cairo_set_source_rgba (cr, &color);
cairo_rectangle (cr, 1, 1, w, h);
cairo_fill (cr);
cairo_set_line_width (cr, 1.0);
cairo_rectangle (cr, 0.5, 0.5, w + 1, h + 1);
- gtk_style_context_get_color (context, 0, &color);
+ gtk_style_context_get_color (context, state, &color);
gdk_cairo_set_source_rgba (cr, &color);
cairo_stroke (cr);
@@ -2807,6 +2809,10 @@ draw_page_cb (GtkWidget *widget,
if (page_setup != NULL)
{
+ PangoContext *pango_c = NULL;
+ PangoFontDescription *pango_f = NULL;
+ gint font_size = 12 * PANGO_SCALE;
+
pos_x += 1;
pos_y += 1;
@@ -2824,15 +2830,11 @@ draw_page_cb (GtkWidget *widget,
cairo_restore (cr);
cairo_save (cr);
- layout = pango_cairo_create_layout (cr);
+ layout = pango_cairo_create_layout (cr);
font = pango_font_description_new ();
pango_font_description_set_family (font, "sans");
- PangoContext *pango_c = NULL;
- PangoFontDescription *pango_f = NULL;
- gint font_size = 12 * PANGO_SCALE;
-
pango_c = gtk_widget_get_pango_context (widget);
if (pango_c != NULL)
{
@@ -2866,6 +2868,8 @@ draw_page_cb (GtkWidget *widget,
cairo_translate (cr, pos_x + w + shadow_offset + 2 * RULER_DISTANCE,
(height - layout_h / PANGO_SCALE) / 2);
+ gtk_style_context_get_color (context, state, &color);
+ gdk_cairo_set_source_rgba (cr, &color);
pango_cairo_show_layout (cr, layout);
cairo_restore (cr);
@@ -2883,6 +2887,8 @@ draw_page_cb (GtkWidget *widget,
cairo_translate (cr, (width - layout_w / PANGO_SCALE) / 2,
pos_y + h + shadow_offset + 2 * RULER_DISTANCE);
+ gtk_style_context_get_color (context, state, &color);
+ gdk_cairo_set_source_rgba (cr, &color);
pango_cairo_show_layout (cr, layout);
g_object_unref (layout);
@@ -2891,6 +2897,9 @@ draw_page_cb (GtkWidget *widget,
cairo_set_line_width (cr, 1);
+ gtk_style_context_get_color (context, state, &color);
+ gdk_cairo_set_source_rgba (cr, &color);
+
if (ltr)
{
cairo_move_to (cr, pos_x - RULER_DISTANCE, pos_y);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]