Hi All,

Here is a diff for the nimbus theme engine which fixes 6514195, 6530991 
and 6453340.
For 6514195, 6530991 the problem was to check for sane image dimensions 
before drawing them,
For 6453340 the problem was that the cached clipping GC mechanism wasn't 
multihead ready.

Here is the diff for spec-files:


Index: base-specs/nimbus.spec
===================================================================
--- base-specs/nimbus.spec      (revision 10875)
+++ base-specs/nimbus.spec      (working copy)
@@ -9,7 +9,7 @@
 #
 Name:         nimbus
 Summary:      Engine for GTK2 Nimbus Theme
-Version:      0.0.4
+Version:      0.0.5
 %define tarball_version %{version}
 Release:      1
 License:      LGPL

Here is the diff from nimbus:


Index: ChangeLog
===================================================================
RCS file: /sgnome/cvsroots/jds/Nimbus/ChangeLog,v
retrieving revision 1.19
diff -u -b -r1.19 ChangeLog
--- ChangeLog    11 Oct 2006 15:11:31 -0000    1.19
+++ ChangeLog    14 Mar 2007 16:21:53 -0000
@@ -1,3 +1,9 @@
+2007-03-14 Erwann Chenede - <erwann.chenede at sun.com>
+
+  * gtk-engine/nimbus_style.c : added sanity checks to fix : 6514195, 
6530991.
+    I've rewritten to caching routine for clipping GC's as it wasn't
+    multihead proof. it fixes 6453340
+
 2006-10-11 Erwann Chenede - <erwann.chenede at sun.com>
 
   * gtk-engine/gtk-2.0/dialog* : changed image size
Index: configure.in
===================================================================
RCS file: /sgnome/cvsroots/jds/Nimbus/configure.in,v
retrieving revision 1.8
diff -u -b -r1.8 configure.in
--- configure.in    11 Oct 2006 15:11:31 -0000    1.8
+++ configure.in    14 Mar 2007 16:21:53 -0000
@@ -2,7 +2,7 @@
 ACLOCAL="$ACLOCAL $ACLOCAL_FLAGS"
 
 AC_INIT(metacity)
-AM_INIT_AUTOMAKE(nimbus, 0.0.4)
+AM_INIT_AUTOMAKE(nimbus, 0.0.5)
 DISTDIR=${PACKAGE}-${VERSION}
 AM_MAINTAINER_MODE
 
Index: gtk-engine/nimbus_style.c
===================================================================
RCS file: /sgnome/cvsroots/jds/Nimbus/gtk-engine/nimbus_style.c,v
retrieving revision 1.16
diff -u -b -r1.16 nimbus_style.c
--- gtk-engine/nimbus_style.c    11 Oct 2006 15:11:31 -0000    1.16
+++ gtk-engine/nimbus_style.c    14 Mar 2007 16:21:53 -0000
@@ -104,22 +104,52 @@
 
 static GtkStyleClass *parent_class;
 
+static gboolean check_sane_pixbuf_value (int src_x, int src_y, int 
width, int height, GdkPixbuf *pixbuf)
+{
+  /*printf ("checking src_x = %d, int src_y = %d, int width = %d, int 
height = %d , pixbuf->height = %d, pixbuf->width = %d\n",
+      src_x, src_y, width, height, gdk_pixbuf_get_width (pixbuf), 
gdk_pixbuf_get_height (pixbuf));*/
+
+  if (!(width >= 0 && height >= 0))
+    {
+      /* printf (" (%d >= 0 && %d >= 0) is false\n", width, height); */
+      return FALSE;
+    }
+  if (!(src_x >= 0 && src_x + width <= gdk_pixbuf_get_width (pixbuf)))
+    {
+      /* printf (" (%d >= 0 && %d + %d <= %d) is false\n", src_x , 
src_x,  width , gdk_pixbuf_get_width (pixbuf)); */
+      return FALSE;
+    }
+  if (!(src_y >= 0 && src_y + height <= gdk_pixbuf_get_height (pixbuf)))
+    {
+      /* printf (" (%d >= 0 && %d + %d <= %d) is false\n", src_y, 
src_y,  height, gdk_pixbuf_get_height (pixbuf)); */
+      return FALSE;
+    }
+  return TRUE;
+}
 static GdkGC *
 get_clipping_gc (GdkWindow* window, GdkRectangle *clip)
 {
-  static GdkGC *clipping_gc = NULL;
-  if (clip)
-    {
-      if (!clipping_gc)
-    clipping_gc = gdk_gc_new (window);
+  GdkGC *gc;
+  static GSList *clipping_gc_list = NULL;
+  GSList* tmp = clipping_gc_list;
      
-      gdk_gc_set_clip_rectangle (clipping_gc, clip);
-      return clipping_gc;
+  while (tmp)
+    {
+      gc = (GdkGC *) tmp->data;
+      if (gdk_gc_get_screen (gc) ==
+      gdk_drawable_get_screen (GDK_DRAWABLE (window)))
+    {
+      gdk_gc_set_clip_rectangle (gc, clip);
+      return gc;
     }
-  return NULL;
+      tmp = tmp->next;
+    }
+  gc =  gdk_gc_new (window);
+  gdk_gc_set_clip_rectangle (gc, clip);
+  clipping_gc_list = g_slist_append (clipping_gc_list, gc);
+  return gc;
 }
  
-
 static GtkWidget *print_ancestors (GtkWidget *widget)
 {
   GtkWidget *tmp;
@@ -1143,6 +1173,8 @@
   if ((state_type != GTK_STATE_INSENSITIVE) && drop_shadow && draw_bottom)
     {
       nimbus_init_button_drop_shadow (rc, state_type, width);
+
+      if (check_sane_pixbuf_value (0, 0, width - (bottom_left_c_w + 
bottom_right_c_w),  gdk_pixbuf_get_height (rc->drop_shadow[state_type]), 
rc->drop_shadow[state_type]))
       gdk_draw_pixbuf (window,
                get_clipping_gc (window, area),
                rc->drop_shadow[state_type],
@@ -1218,7 +1250,6 @@
            gdk_pixbuf_get_width (progress->corner_bottom_left),
            gdk_pixbuf_get_height (progress->corner_bottom_left),
            GDK_RGB_DITHER_NONE,0,0);
-
   gdk_draw_pixbuf (window,             
            get_clipping_gc (window, area),
            progress->corner_bottom_right,
@@ -1230,6 +1261,7 @@
            GDK_RGB_DITHER_NONE,0,0);
   /* lines */
  
+  if (check_sane_pixbuf_value (0, 0, gdk_pixbuf_get_width 
(progress->border_left), height - 1, progress->border_left))
   gdk_draw_pixbuf (window,             
            get_clipping_gc (window, area),
            progress->border_left,
@@ -1240,6 +1272,8 @@
            height - 1,
            GDK_RGB_DITHER_NONE,0,0);
 
+  if (check_sane_pixbuf_value (0,0, gdk_pixbuf_get_width 
(progress->border_right), height - 1, progress->border_right))
+
   gdk_draw_pixbuf (window,             
            get_clipping_gc (window, area),
            progress->border_right,
@@ -1250,6 +1284,8 @@
            height - 1,
            GDK_RGB_DITHER_NONE,0,0);
 
+
+  if (check_sane_pixbuf_value (0,0,width + 1,  gdk_pixbuf_get_height 
(progress->border_top),  progress->border_top))
   gdk_draw_pixbuf (window,             
            get_clipping_gc (window, area),
            progress->border_top,
@@ -1260,6 +1296,7 @@
            gdk_pixbuf_get_height (progress->border_top),
            GDK_RGB_DITHER_NONE,0,0);
 
+  if (check_sane_pixbuf_value (0,0, width + 1,   gdk_pixbuf_get_height 
(progress->border_bottom), progress->border_bottom))
   gdk_draw_pixbuf (window,             
            get_clipping_gc (window, area),
            progress->border_bottom,


-- 
              Erwann Ch?ned?,
 Desktop Group, Sun Microsystems, Grenoble
 Phone  : +33 476 188 358       ext: 38358
[ I speak for myself, not for my employer ]



Reply via email to