Wireshark-bugs: [Wireshark-bugs] [Bug 6624] Gtk3 package byte highlighter colour fix
Date: Tue, 29 Nov 2011 08:46:12 -0800 (PST)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=6624

--- Comment #6 from Anders Broman <anders.broman@xxxxxxxxxxxx> 2011-11-29 08:46:12 PST ---
(In reply to comment #5)
> I had the hilighting problem with gtk3.0 too, I just never reported it. I've
> recently update to openSUSE 12.1, which contains gtk+-3.2.1 and ...
> 
> (In reply to comment #3)
> > I can't build with GTK 3.2 I get 
> > implicit declaration of function ‘gtk_vbox_new etc.
> .. which doesn't give me this kind of message/problem. I build using cmake,
> i.e. all the compatibility settings are unset when building with gtk3.
> 

Hi,
I'm building on Ubuntu 11.10 and I guess I'm hit by the "disable deprecated
settings" asb vbox/hbox seems to have been deprecated in GTK 3.2
http://developer.gnome.org/gtk3/stable/GtkVBox.html#gtk-vbox-new

As for the patch I think this version is better we should probably require GTK
3.2 or higer if or when we switch to GTK 3. Please check it in if you think
it's OK.

Index: gtk/main_proto_draw.c                                 
===================================================================
--- gtk/main_proto_draw.c       (revision 40034)                   
+++ gtk/main_proto_draw.c       (working copy)                     
@@ -694,8 +694,10 @@                                               
        GtkStyleContext *context;                                  
        GdkRGBA         *rgba_bg_color;
        GdkRGBA         *rgba_fg_color;
+#if !GTK_CHECK_VERSION(3,2,0)
        GdkColor        bg_color;
        GdkColor        fg_color;
+#endif /* GTK_CHECK_VERSION(3,2,0) */
 #else
        GtkStyle    *style;
 #endif
@@ -715,21 +717,27 @@
     gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(byte_view), FALSE);
     buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(byte_view));
 #if GTK_CHECK_VERSION(3,0,0)
-    context = gtk_widget_get_style_context (GTK_WIDGET(top_level));
-    gtk_style_context_get (context, GTK_STATE_SELECTED,
-                    "background-color", &rgba_bg_color,
-                    NULL);
-    gtk_style_context_get (context, GTK_STATE_SELECTED,
-                    "color", &rgba_fg_color,
-                    NULL);
-       /* Hack */
-       bg_color.red   = rgba_bg_color->red * 65535;
-       bg_color.green = rgba_bg_color->green * 65535;
-       bg_color.blue  = rgba_bg_color->blue * 65535;
+    context = gtk_widget_get_style_context (GTK_WIDGET(byte_view));
+    gtk_style_context_get (context, GTK_STATE_FLAG_SELECTED,
+                    GTK_STYLE_PROPERTY_BACKGROUND_COLOR, &rgba_bg_color,
+                    GTK_STYLE_PROPERTY_COLOR, &rgba_fg_color,
+                     NULL);
+#if GTK_CHECK_VERSION(3,2,0)
+    gtk_text_buffer_create_tag(buf, "plain", "font-desc",
user_font_get_regular(), NULL);
+    gtk_text_buffer_create_tag(buf, "reverse",
+                               "font-desc", user_font_get_regular(),
+                               "foreground-gdk", rgba_fg_color,
+                               "background-gdk", rgba_bg_color,
+                               NULL);
+#else
+    /* Hack */
+    bg_color.red   = rgba_bg_color->red * 65535;
+    bg_color.green = rgba_bg_color->green * 65535;
+    bg_color.blue  = rgba_bg_color->blue * 65535;

-       fg_color.red   = rgba_fg_color->red * 65535;
-       fg_color.green = rgba_fg_color->green * 65535;
-       fg_color.blue  = rgba_fg_color->blue * 65535;
+    fg_color.red   = rgba_fg_color->red * 65535;
+    fg_color.green = rgba_fg_color->green * 65535;
+    fg_color.blue  = rgba_fg_color->blue * 65535;

     gtk_text_buffer_create_tag(buf, "plain", "font-desc",
user_font_get_regular(), NULL);
     gtk_text_buffer_create_tag(buf, "reverse", @@ -737,7 +745,7 @@
                                "foreground-gdk", &fg_color,
                                "background-gdk", &bg_color,
                                NULL);
-
+#endif /* GTK_CHECK_VERSION(3,2,0) */
 #else
     style = gtk_widget_get_style(GTK_WIDGET(top_level));
     gtk_text_buffer_create_tag(buf, "plain", "font-desc",
user_font_get_regular(), NULL);

-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.