]> Pileus Git - ~andy/gtk/commitdiff
Don't try to use render if we can't get a picture for the drawable. (Fixes
authorOwen Taylor <otaylor@redhat.com>
Thu, 7 Nov 2002 22:27:22 +0000 (22:27 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Thu, 7 Nov 2002 22:27:22 +0000 (22:27 +0000)
Thu Nov  7 17:18:06 2002  Owen Taylor  <otaylor@redhat.com>

        * gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_pixbuf):
        Don't try to use render if we can't get a picture for
        the drawable. (Fixes #97220, reported by
        Jamie Zawinski)

        * gtk/gtkimage.c: Force requisition calculation
        when we get a expose prior to size_request().
        (#91711, reported by Sven Neumann, debugging
        help from Matthias Clasen, Soeren Sandmann)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gdk/x11/gdkdrawable-x11.c
gtk/gtkimage.c

index bed9bc1c8e23488561977c902952967b21f42537..5589d31ebb6cf1f8b5690e1820aa0864d40d3f87 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+Thu Nov  7 17:18:06 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_pixbuf): 
+       Don't try to use render if we can't get a picture for 
+       the drawable. (Fixes #97220, reported by
+       Jamie Zawinski)
+
+       * gtk/gtkimage.c: Force requisition calculation
+       when we get a expose prior to size_request().
+       (#91711, reported by Sven Neumann, debugging
+       help from Matthias Clasen, Soeren Sandmann)
+
 Thu Nov  7 16:45:54 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gdk/x11/gdkx.h: Fix misplaced display_grab()/display_ungrab();
index bed9bc1c8e23488561977c902952967b21f42537..5589d31ebb6cf1f8b5690e1820aa0864d40d3f87 100644 (file)
@@ -1,3 +1,15 @@
+Thu Nov  7 17:18:06 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_pixbuf): 
+       Don't try to use render if we can't get a picture for 
+       the drawable. (Fixes #97220, reported by
+       Jamie Zawinski)
+
+       * gtk/gtkimage.c: Force requisition calculation
+       when we get a expose prior to size_request().
+       (#91711, reported by Sven Neumann, debugging
+       help from Matthias Clasen, Soeren Sandmann)
+
 Thu Nov  7 16:45:54 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gdk/x11/gdkx.h: Fix misplaced display_grab()/display_ungrab();
index bed9bc1c8e23488561977c902952967b21f42537..5589d31ebb6cf1f8b5690e1820aa0864d40d3f87 100644 (file)
@@ -1,3 +1,15 @@
+Thu Nov  7 17:18:06 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_pixbuf): 
+       Don't try to use render if we can't get a picture for 
+       the drawable. (Fixes #97220, reported by
+       Jamie Zawinski)
+
+       * gtk/gtkimage.c: Force requisition calculation
+       when we get a expose prior to size_request().
+       (#91711, reported by Sven Neumann, debugging
+       help from Matthias Clasen, Soeren Sandmann)
+
 Thu Nov  7 16:45:54 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gdk/x11/gdkx.h: Fix misplaced display_grab()/display_ungrab();
index bed9bc1c8e23488561977c902952967b21f42537..5589d31ebb6cf1f8b5690e1820aa0864d40d3f87 100644 (file)
@@ -1,3 +1,15 @@
+Thu Nov  7 17:18:06 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_pixbuf): 
+       Don't try to use render if we can't get a picture for 
+       the drawable. (Fixes #97220, reported by
+       Jamie Zawinski)
+
+       * gtk/gtkimage.c: Force requisition calculation
+       when we get a expose prior to size_request().
+       (#91711, reported by Sven Neumann, debugging
+       help from Matthias Clasen, Soeren Sandmann)
+
 Thu Nov  7 16:45:54 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gdk/x11/gdkx.h: Fix misplaced display_grab()/display_ungrab();
index bed9bc1c8e23488561977c902952967b21f42537..5589d31ebb6cf1f8b5690e1820aa0864d40d3f87 100644 (file)
@@ -1,3 +1,15 @@
+Thu Nov  7 17:18:06 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_pixbuf): 
+       Don't try to use render if we can't get a picture for 
+       the drawable. (Fixes #97220, reported by
+       Jamie Zawinski)
+
+       * gtk/gtkimage.c: Force requisition calculation
+       when we get a expose prior to size_request().
+       (#91711, reported by Sven Neumann, debugging
+       help from Matthias Clasen, Soeren Sandmann)
+
 Thu Nov  7 16:45:54 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gdk/x11/gdkx.h: Fix misplaced display_grab()/display_ungrab();
index bed9bc1c8e23488561977c902952967b21f42537..5589d31ebb6cf1f8b5690e1820aa0864d40d3f87 100644 (file)
@@ -1,3 +1,15 @@
+Thu Nov  7 17:18:06 2002  Owen Taylor  <otaylor@redhat.com>
+
+       * gdk/x11/gdkdrawable-x11.c (gdk_x11_draw_pixbuf): 
+       Don't try to use render if we can't get a picture for 
+       the drawable. (Fixes #97220, reported by
+       Jamie Zawinski)
+
+       * gtk/gtkimage.c: Force requisition calculation
+       when we get a expose prior to size_request().
+       (#91711, reported by Sven Neumann, debugging
+       help from Matthias Clasen, Soeren Sandmann)
+
 Thu Nov  7 16:45:54 2002  Owen Taylor  <otaylor@redhat.com>
 
        * gdk/x11/gdkx.h: Fix misplaced display_grab()/display_ungrab();
index 54db5a89c2150d7ebefc0684f895e3f03e70f271..7aed12ee9b2363f6e98c59336737a9d5ab7b6434 100644 (file)
@@ -1441,7 +1441,8 @@ gdk_x11_draw_pixbuf (GdkDrawable     *drawable,
 
   if (format_type == FORMAT_NONE ||
       !gdk_pixbuf_get_has_alpha (pixbuf) ||
-      (dither == GDK_RGB_DITHER_MAX && gdk_drawable_get_depth (drawable) != 24))
+      (dither == GDK_RGB_DITHER_MAX && gdk_drawable_get_depth (drawable) != 24) ||
+      gdk_x11_drawable_get_picture (drawable) == None)
     {
       GdkDrawable *wrapper = GDK_DRAWABLE_IMPL_X11 (drawable)->wrapper;
       GDK_DRAWABLE_CLASS (parent_class)->draw_pixbuf (wrapper, gc, pixbuf,
index e9505705a4e27f721806606ca4464c50ebf9a129..9b25a9d87e2856b78f1b60cdc3f924a2426eef55 100644 (file)
@@ -45,6 +45,8 @@ static void gtk_image_size_request (GtkWidget      *widget,
 static void gtk_image_destroy      (GtkObject      *object);
 static void gtk_image_clear        (GtkImage       *image);
 static void gtk_image_reset        (GtkImage       *image);
+static void gtk_image_calc_size    (GtkImage       *image);
+
 static void gtk_image_update_size  (GtkImage       *image,
                                     gint            image_width,
                                     gint            image_height);
@@ -1227,6 +1229,14 @@ gtk_image_expose (GtkWidget      *widget,
       misc = GTK_MISC (widget);
 
       area = event->area;
+
+      /* For stock items and icon sets, we lazily calculate
+       * the size; we might get here between a queue_resize()
+       * and size_request() if something explicitely forces
+       * a redraw.
+       */
+      if (widget->requisition.width == 0 && widget->requisition.height == 0)
+       gtk_image_calc_size (image);
       
       if (!gdk_rectangle_intersect (&area, &widget->allocation, &area))
        return FALSE;
@@ -1591,29 +1601,25 @@ gtk_image_reset (GtkImage *image)
 }
 
 static void
-gtk_image_size_request (GtkWidget      *widget,
-                        GtkRequisition *requisition)
+gtk_image_calc_size (GtkImage *image)
 {
-  GtkImage *image;
+  GtkWidget *widget = GTK_WIDGET (image);
   GdkPixbuf *pixbuf = NULL;
   
-  image = GTK_IMAGE (widget);
-
   /* We update stock/icon set on every size request, because
    * the theme could have affected the size; for other kinds of
    * image, we just update the requisition when the image data
    * is set.
    */
-  
   switch (image->storage_type)
     {
     case GTK_IMAGE_STOCK:
-      pixbuf = gtk_widget_render_icon (GTK_WIDGET (image),
+      pixbuf = gtk_widget_render_icon (widget,
                                        image->data.stock.stock_id,
                                        image->icon_size,
                                        NULL);
       break;
-
+      
     case GTK_IMAGE_ICON_SET:
       pixbuf = gtk_icon_set_render_icon (image->data.icon_set.icon_set,
                                          widget->style,
@@ -1630,11 +1636,22 @@ gtk_image_size_request (GtkWidget      *widget,
 
   if (pixbuf)
     {
-      GTK_WIDGET (image)->requisition.width = gdk_pixbuf_get_width (pixbuf) + GTK_MISC (image)->xpad * 2;
-      GTK_WIDGET (image)->requisition.height = gdk_pixbuf_get_height (pixbuf) + GTK_MISC (image)->ypad * 2;
+      widget->requisition.width = gdk_pixbuf_get_width (pixbuf) + GTK_MISC (image)->xpad * 2;
+      widget->requisition.height = gdk_pixbuf_get_height (pixbuf) + GTK_MISC (image)->ypad * 2;
 
       g_object_unref (pixbuf);
     }
+}
+
+static void
+gtk_image_size_request (GtkWidget      *widget,
+                        GtkRequisition *requisition)
+{
+  GtkImage *image;
+  
+  image = GTK_IMAGE (widget);
+
+  gtk_image_calc_size (image);
 
   /* Chain up to default that simply reads current requisition */
   GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition);
@@ -1651,5 +1668,3 @@ gtk_image_update_size (GtkImage *image,
   if (GTK_WIDGET_VISIBLE (image))
     gtk_widget_queue_resize (GTK_WIDGET (image));
 }
-
-