[gtk+/wip/window-unfocused-fixes: 11/13] cellrendererprogress: Set GTK_STATE_FLAG_WINDOW_UNFOCUSED on draw



commit acd9e3da7e1ad8a7f2460f3f8fa86161a87bdb9f
Author: Rui Matos <tiagomatos gmail com>
Date:   Tue Dec 13 20:33:37 2011 +0000

    cellrendererprogress: Set GTK_STATE_FLAG_WINDOW_UNFOCUSED on draw
    
    https://bugzilla.gnome.org/show_bug.cgi?id=666126

 gtk/gtkcellrendererprogress.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcellrendererprogress.c b/gtk/gtkcellrendererprogress.c
index cb72adb..5788300 100644
--- a/gtk/gtkcellrendererprogress.c
+++ b/gtk/gtkcellrendererprogress.c
@@ -555,10 +555,13 @@ gtk_cell_renderer_progress_render (GtkCellRenderer      *cell,
   gint xpad, ypad;
   GdkRectangle clip;
   gboolean is_rtl;
+  GtkStateFlags state = 0;
 
   context = gtk_widget_get_style_context (widget);
   is_rtl = gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL;
 
+  state |= (gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_WINDOW_UNFOCUSED);
+
   gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
   x = cell_area->x + xpad;
   y = cell_area->y + ypad;
@@ -566,6 +569,7 @@ gtk_cell_renderer_progress_render (GtkCellRenderer      *cell,
   h = cell_area->height - ypad * 2;
 
   gtk_style_context_save (context);
+  gtk_style_context_set_state (context, state);
   gtk_style_context_add_class (context, GTK_STYLE_CLASS_TROUGH);
 
   gtk_render_background (context, cr, x, y, w, h);
@@ -622,6 +626,7 @@ gtk_cell_renderer_progress_render (GtkCellRenderer      *cell,
     }
 
   gtk_style_context_save (context);
+  gtk_style_context_set_state (context, state);
   gtk_style_context_add_class (context, GTK_STYLE_CLASS_PROGRESSBAR);
 
   if (bar_size > 0)
@@ -654,6 +659,7 @@ gtk_cell_renderer_progress_render (GtkCellRenderer      *cell,
       cairo_clip (cr);
 
       gtk_style_context_save (context);
+      gtk_style_context_set_state (context, state);
       gtk_style_context_add_class (context, GTK_STYLE_CLASS_PROGRESSBAR);
 
       gtk_render_layout (context, cr,
@@ -664,6 +670,7 @@ gtk_cell_renderer_progress_render (GtkCellRenderer      *cell,
       cairo_restore (cr);
 
       gtk_style_context_save (context);
+      gtk_style_context_set_state (context, state);
       gtk_style_context_add_class (context, GTK_STYLE_CLASS_TROUGH);
 
       if (bar_position > start)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]