From 44fb5dcfc81f60d5e61a936a0008378b0751184f Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 11 Feb 2009 07:25:57 +0000 Subject: [PATCH] Fix rendering of icons in some cases svn path=/trunk/; revision=22308 --- ChangeLog | 9 +++++++++ gtk/gtkentry.c | 30 ++++++++++++++++++++++-------- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 233b49d887..ca5d28c7ac 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2009-02-11 Matthias Clasen + + Bug 571249 – Icons are not drawn properly when initial widget + state is insensitive + + * gtk/gtkentry.c (gtk_entry_ensure_pixbuf): Render icons + in normal state, regardless of the entrys state. Reported by + Enrico Tröger. + 2009-02-11 Matthias Clasen * gtk/gtkfilechooserbutton.c: Don't emit the file-set signal diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 36bcee6bf4..04ae129fc7 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -6252,6 +6252,7 @@ gtk_entry_ensure_pixbuf (GtkEntry *entry, GtkSettings *settings; gint width, height; GtkIconInfo *info; + gint state; if (!icon_info || icon_info->pixbuf) return; @@ -6262,10 +6263,13 @@ gtk_entry_ensure_pixbuf (GtkEntry *entry, case GTK_IMAGE_PIXBUF: break; case GTK_IMAGE_STOCK: + state = GTK_WIDGET_STATE (entry); + GTK_WIDGET_STATE (entry) = GTK_STATE_NORMAL; icon_info->pixbuf = gtk_widget_render_icon (GTK_WIDGET (entry), icon_info->stock_id, GTK_ICON_SIZE_MENU, NULL); + GTK_WIDGET_STATE (entry) = state; break; case GTK_IMAGE_ICON_NAME: @@ -6285,10 +6289,15 @@ gtk_entry_ensure_pixbuf (GtkEntry *entry, 0, NULL); if (icon_info->pixbuf == NULL) - icon_info->pixbuf = gtk_widget_render_icon (GTK_WIDGET (entry), - GTK_STOCK_MISSING_IMAGE, - GTK_ICON_SIZE_MENU, - NULL); + { + state = GTK_WIDGET_STATE (entry); + GTK_WIDGET_STATE (entry) = GTK_STATE_NORMAL; + icon_info->pixbuf = gtk_widget_render_icon (GTK_WIDGET (entry), + GTK_STOCK_MISSING_IMAGE, + GTK_ICON_SIZE_MENU, + NULL); + GTK_WIDGET_STATE (entry) = state; + } } break; @@ -6314,10 +6323,15 @@ gtk_entry_ensure_pixbuf (GtkEntry *entry, } if (icon_info->pixbuf == NULL) - icon_info->pixbuf = gtk_widget_render_icon (GTK_WIDGET (entry), - GTK_STOCK_MISSING_IMAGE, - GTK_ICON_SIZE_MENU, - NULL); + { + state = GTK_WIDGET_STATE (entry); + GTK_WIDGET_STATE (entry) = GTK_STATE_NORMAL; + icon_info->pixbuf = gtk_widget_render_icon (GTK_WIDGET (entry), + GTK_STOCK_MISSING_IMAGE, + GTK_ICON_SIZE_MENU, + NULL); + GTK_WIDGET_STATE (entry) = state; + } } break;