[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gtk-devel
Subject:    RFC on patch for bug 469278 (Color problem with Mozilla
From:       Attilio Fiandrotti <attilio.fiandrotti () gmail ! com>
Date:       2007-10-29 10:39:17
Message-ID: 4725B855.6030400 () gmail ! com
[Download RAW message or body]

Hi

Some time ago Siddartah posted a patch [1], which has been sitting in 
Gnome BTS for a while now, for an issue that shows up when running 
Mozilla over GTK with DirectFB backend.
I've now revised the patch (attached) and, after a few tests, it seems 
to bring no notceable drawbacks.
Note the patch affects not only the DFB backend but some GDK common 
files as well, so i didn't dare applying it as i'm not really expert in 
GDK internals.
I'm now requesting feedback in order to know if the patch shall be 
applied as it is, applied with modifications or discarded.

regards

Attilio Fiandrotti


[1] http://bugzilla.gnome.org/show_bug.cgi?id=469278

["bug_469278_patch_94121.patch" (text/x-patch)]

Index: gdk/directfb/gdkgc-directfb.c
===================================================================
--- gdk/directfb/gdkgc-directfb.c	(revisione 18951)
+++ gdk/directfb/gdkgc-directfb.c	(copia locale)
@@ -226,9 +226,9 @@
     {
       GdkPixmap *oldpm = private->values.tile;
 
-      if (values->tile)
-        g_assert (GDK_PIXMAP_OBJECT (values->tile)->depth > 1);
+      g_assert (GDK_PIXMAP_OBJECT (values->tile)->depth > 1);
 
+
       private->values.tile = values->tile ? g_object_ref (values->tile) : NULL;
       private->values_mask |= GDK_GC_TILE;
 
Index: gdk/gdkcolor.c
===================================================================
--- gdk/gdkcolor.c	(revisione 18951)
+++ gdk/gdkcolor.c	(copia locale)
@@ -94,7 +94,6 @@
 
   for (i = 0; i < ncolors; i++)
     {
-      colormap->colors[i].pixel = colors[i].pixel;
       colormap->colors[i].red = colors[i].red;
       colormap->colors[i].green = colors[i].green;
       colormap->colors[i].blue = colors[i].blue;
Index: gdk/gdkgc.c
===================================================================
--- gdk/gdkgc.c	(revisione 18951)
+++ gdk/gdkgc.c	(copia locale)
@@ -49,6 +49,14 @@
   
   guint32 fg_pixel;
   guint32 bg_pixel;
+
+  unsigned char fg_red;
+  unsigned char fg_green;
+  unsigned char fg_blue;
+
+  unsigned char bg_red;
+  unsigned char bg_green;
+  unsigned char bg_blue;
 };
 
 #define GDK_GC_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDK_TYPE_GC, GdkGCPrivate))
@@ -75,8 +83,13 @@
   /* These are the default X11 value, which we match. They are clearly
    * wrong for TrueColor displays, so apps have to change them.
    */
-  priv->fg_pixel = 0;
-  priv->bg_pixel = 1;
+  priv->fg_red = 0;
+  priv->fg_green = 0;
+  priv->fg_blue = 0;
+
+  priv->bg_red = 1;
+  priv->bg_green = 1;
+  priv->bg_blue = 1;
 }
 
 /**
@@ -169,9 +182,17 @@
 	g_object_ref (priv->tile);
     }
   if (values_mask & GDK_GC_FOREGROUND)
-    priv->fg_pixel = values->foreground.pixel;
+    {
+      priv->fg_red = values->foreground.red;
+      priv->fg_green = values->foreground.green;
+      priv->fg_blue = values->foreground.blue;
+    } 
   if (values_mask & GDK_GC_BACKGROUND)
-    priv->bg_pixel = values->background.pixel;
+    {
+      priv->bg_red = values->background.red;
+      priv->bg_green = values->background.green;
+      priv->bg_blue = values->background.blue;
+    }
 
   gc->colormap = gdk_drawable_get_colormap (drawable);
   if (gc->colormap)
@@ -310,9 +331,17 @@
 	}
     }
   if (values_mask & GDK_GC_FOREGROUND)
-    priv->fg_pixel = values->foreground.pixel;
+    {
+      priv->fg_red = values->foreground.red;
+      priv->fg_green = values->foreground.green;
+      priv->fg_blue = values->foreground.blue;
+    }
   if (values_mask & GDK_GC_BACKGROUND)
-    priv->bg_pixel = values->background.pixel;
+    {
+      priv->bg_red = values->background.red;	
+      priv->bg_green = values->background.green;	
+      priv->bg_blue = values->background.blue;	
+    }
   
   GDK_GC_GET_CLASS (gc)->set_values (gc, values, values_mask);
 }
@@ -336,7 +365,9 @@
   g_return_if_fail (GDK_IS_GC (gc));
   g_return_if_fail (color != NULL);
 
-  values.foreground = *color;
+  values.foreground.red = color->red;
+  values.foreground.green = color->green;
+  values.foreground.blue = color->blue;
   gdk_gc_set_values (gc, &values, GDK_GC_FOREGROUND);
 }
 
@@ -901,8 +932,13 @@
   if (dst_priv->tile)
     g_object_ref (dst_priv->tile);
 
-  dst_priv->fg_pixel = src_priv->fg_pixel;
-  dst_priv->bg_pixel = src_priv->bg_pixel;
+  dst_priv->fg_red = src_priv->fg_red;
+  dst_priv->fg_green= src_priv->fg_green;
+  dst_priv->fg_blue = src_priv->fg_blue;
+  
+  dst_priv->bg_red = src_priv->bg_red;
+  dst_priv->bg_green = src_priv->bg_green;
+  dst_priv->bg_blue = src_priv->bg_blue;
 }
 
 /**
@@ -1078,9 +1114,11 @@
 		   GdkColor *color)
 {
   GdkGCPrivate *priv = GDK_GC_GET_PRIVATE (gc);
-  
-  color->pixel = priv->bg_pixel;
 
+  color->red = priv->fg_red;
+  color->green = priv->fg_green;
+  color->blue = priv->fg_blue;
+
   if (gc->colormap)
     gdk_colormap_query_color (gc->colormap, priv->fg_pixel, color);
   else
@@ -1093,7 +1131,9 @@
 {
   GdkGCPrivate *priv = GDK_GC_GET_PRIVATE (gc);
   
-  color->pixel = priv->bg_pixel;
+  color->red = priv->bg_red;
+  color->green = priv->bg_green;
+  color->blue = priv->bg_blue;
 
   if (gc->colormap)
     gdk_colormap_query_color (gc->colormap, priv->bg_pixel, color);


_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-devel-list


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic