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



commit 3eef59c52276f4cd5120323990d95d5966fb5fd7
Author: Rui Matos <tiagomatos gmail com>
Date:   Tue Dec 13 20:34:40 2011 +0000

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

 gtk/gtkcellrenderertext.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcellrenderertext.c b/gtk/gtkcellrenderertext.c
index c5eed2e..82507f3 100644
--- a/gtk/gtkcellrenderertext.c
+++ b/gtk/gtkcellrenderertext.c
@@ -1797,11 +1797,15 @@ gtk_cell_renderer_text_render (GtkCellRenderer      *cell,
   gint y_offset = 0;
   gint xpad, ypad;
   PangoRectangle rect;
+  GtkStateFlags state = 0;
 
   layout = get_layout (celltext, widget, cell_area, flags);
   get_size (cell, widget, cell_area, layout, &x_offset, &y_offset, NULL, NULL);
   context = gtk_widget_get_style_context (widget);
 
+  state = gtk_style_context_get_state (context);
+  state |= (gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_WINDOW_UNFOCUSED);
+
   if (priv->background_set && (flags & GTK_CELL_RENDERER_SELECTED) == 0)
     {
       gdk_cairo_rectangle (cr, background_area);
@@ -1825,11 +1829,16 @@ gtk_cell_renderer_text_render (GtkCellRenderer      *cell,
   gdk_cairo_rectangle (cr, cell_area);
   cairo_clip (cr);
 
+  gtk_style_context_save (context);
+  gtk_style_context_set_state (context, state);
+
   gtk_render_layout (context, cr,
                      cell_area->x + x_offset + xpad,
                      cell_area->y + y_offset + ypad,
                      layout);
 
+  gtk_style_context_restore (context);
+
   cairo_restore (cr);
 
   g_object_unref (layout);



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