Wireshark-dev: [Wireshark-dev] Patch for bug 1164 (was: Could someone with OS X check ...)
From: Stephen Fisher <stephentfisher@xxxxxxxxx>
Date: Fri, 20 Oct 2006 15:14:11 -0700
On Sun, Sep 24, 2006 at 08:30:27PM -0700, Stephen Fisher wrote:

> Could someone with OS X check if they have the same problem as I do.  
> When I go into the View -> Color Filters -> Edit Color Filter, the 
> text color is always black even when the foreground is set to another 
> color.  This makes text on black backgrounds invisible.  I'm not 
> experiencing this problem on Windows.

Attached is a fix for this problem (bug 1164) which has been confirmed 
on my MacOS X and FreeBSD boxes as well as Stig's OS X machine.  I'm 
also seeing the problem on the latest Windows builds, but don't have a 
compiler setup to test it there.


Steve

Index: gtk/color_edit_dlg.c
===================================================================
--- gtk/color_edit_dlg.c	(revision 19619)
+++ gtk/color_edit_dlg.c	(working copy)
@@ -177,11 +177,7 @@
 
     style = gtk_style_copy(gtk_widget_get_style(filt_name_entry));
     color_t_to_gdkcolor(&style->base[GTK_STATE_NORMAL], &colorf->bg_color);
-#if GTK_MAJOR_VERSION < 2
-    color_t_to_gdkcolor(&style->fg[GTK_STATE_NORMAL], &colorf->fg_color);
-#else
     color_t_to_gdkcolor(&style->text[GTK_STATE_NORMAL], &colorf->fg_color);
-#endif
     gtk_widget_set_style(filt_name_entry, style);
 
     gtk_box_pack_start (GTK_BOX (filter_name_hbox), filt_name_entry, TRUE, TRUE, 0);
@@ -199,12 +195,6 @@
     SIGNAL_CONNECT(filt_text_entry, "changed", filter_te_syntax_check_cb, NULL);
     gtk_entry_set_text(GTK_ENTRY(filt_text_entry), colorf->filter_text);
 
-#if 0
-    style = gtk_style_copy(gtk_widget_get_style(filt_text_entry));
-    style->base[GTK_STATE_NORMAL] = colorf->bg_color;
-    style->fg[GTK_STATE_NORMAL]   = colorf->fg_color;
-#endif
-    gtk_widget_set_style(filt_text_entry, style);
     gtk_style_unref(style);
     gtk_box_pack_start (GTK_BOX (filter_string_hbox), filt_text_entry, TRUE, TRUE, 0);
     gtk_tooltips_set_tip (tooltips, filt_text_entry, ("This is the editable text of the filter"), NULL);
@@ -371,11 +361,7 @@
 
     style = gtk_widget_get_style(filt_name_entry);
     new_bg_color = style->base[GTK_STATE_NORMAL];
-#if GTK_MAJOR_VERSION < 2
-    new_fg_color = style->fg[GTK_STATE_NORMAL];
-#else
     new_fg_color = style->text[GTK_STATE_NORMAL];
-#endif
 
     filter_name = g_strdup(gtk_entry_get_text(GTK_ENTRY(filt_name_entry)));
     filter_text = g_strdup(gtk_entry_get_text(GTK_ENTRY(filt_text_entry)));
@@ -590,13 +576,9 @@
 	style = gtk_style_copy(gtk_widget_get_style(filt_name_entry));
 	if (is_bg)
 	  style->base[GTK_STATE_NORMAL] = new_color;
-#if GTK_MAJOR_VERSION < 2
-	else
-	  style->fg[GTK_STATE_NORMAL] = new_color;
-#else
         else
 	  style->text[GTK_STATE_NORMAL] = new_color;
-#endif
+
 	gtk_widget_set_style(filt_name_entry, style);
 	gtk_style_unref(style);
   }