[gtk+/gtk-2-24] entry: never use GTK_STATE_ACTIVE to paint the background



commit 87115e00a81e9d6a2c4d18106af422765004fe2a
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Jan 25 14:40:22 2013 -0500

    entry: never use GTK_STATE_ACTIVE to paint the background
    
    When state-hint is TRUE, GTK_STATE_ACTIVE was used to paint the entry
    background and frame, since commit
    207f3f8685f21bbade8ae0a6551a0e92d6baad89.
    
    Given that everywhere else in GTK2 - including GtkEntry itself in
    draw_text_with_color() - GTK_STATE_ACTIVE is used for non-toggleable
    widgets to indicate selected but not focused text, this leads to the
    entry painting itself with the wrong background color when focused.
    This is unsolvable from the theme, as changing the ACTIVE background
    color to be the same as NORMAL would give a wrong background to selected
    but not focused text as per above.
    
    This patch avoids using GTK_STATE_ACTIVE to paint GtkEntry's background,
    changing the code so that the widget state is always used instead.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=692554

 gtk/gtkentry.c |    9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 2c9c5a4..aaeb87c 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -3445,12 +3445,7 @@ gtk_entry_expose (GtkWidget      *widget,
   GtkStateType state;
   GtkEntryPrivate *priv = GTK_ENTRY_GET_PRIVATE (entry);
 
-  gtk_widget_style_get (widget, "state-hint", &state_hint, NULL);
-  if (state_hint)
-    state = gtk_widget_has_focus (widget) ?
-      GTK_STATE_ACTIVE : gtk_widget_get_state (widget);
-  else
-    state = gtk_widget_get_state(widget);
+  state = gtk_widget_get_state (widget);
 
   if (widget->window == event->window)
     {
@@ -3497,7 +3492,7 @@ gtk_entry_expose (GtkWidget      *widget,
               height = gdk_window_get_height (icon_info->window);
 
               gtk_paint_flat_box (widget->style, icon_info->window,
-                                  gtk_widget_get_state (widget), GTK_SHADOW_NONE,
+                                  state, GTK_SHADOW_NONE,
                                   NULL, widget, "entry_bg",
                                   0, 0, width, height);
 



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