gtk2/image-size-alloc.patch

74 lines
2.0 KiB
Diff

--- /home/mclasen/git.gnome.org/gtk+/gtk/gtkimage.c 2009-06-04 15:18:04.063943764 -0400
+++ gtk+-2.18.3/gtk/gtkimage.c 2009-10-18 01:31:00.705062264 -0400
@@ -45,6 +45,7 @@
gchar *filename;
gint pixel_size;
+ guint need_calc_size : 1;
};
#define GTK_IMAGE_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_IMAGE, GtkImagePrivate))
@@ -1710,6 +1711,7 @@
{
GtkImage *image;
GtkMisc *misc;
+ GtkImagePrivate *priv;
GdkRectangle area, image_bound;
gfloat xalign;
gint x, y, mask_x, mask_y;
@@ -1719,6 +1721,7 @@
image = GTK_IMAGE (widget);
misc = GTK_MISC (widget);
+ priv = GTK_IMAGE_GET_PRIVATE (image);
area = event->area;
@@ -1727,7 +1730,7 @@
* and size_request() if something explicitely forces
* a redraw.
*/
- if (widget->requisition.width == 0 && widget->requisition.height == 0)
+ if (priv->need_calc_size)
gtk_image_calc_size (image);
if (!gdk_rectangle_intersect (&area, &widget->allocation, &area))
@@ -1737,7 +1740,7 @@
xalign = misc->xalign;
else
xalign = 1.0 - misc->xalign;
-
+
x = floor (widget->allocation.x + misc->xpad
+ ((widget->allocation.width - widget->requisition.width) * xalign));
y = floor (widget->allocation.y + misc->ypad
@@ -2149,8 +2152,13 @@
void
gtk_image_clear (GtkImage *image)
{
- gtk_image_reset (image);
+ GtkImagePrivate *priv;
+
+ priv = GTK_IMAGE_GET_PRIVATE (image);
+
+ priv->need_calc_size = 1;
+ gtk_image_reset (image);
gtk_image_update_size (image, 0, 0);
}
@@ -2159,7 +2167,12 @@
{
GtkWidget *widget = GTK_WIDGET (image);
GdkPixbuf *pixbuf = NULL;
-
+ GtkImagePrivate *priv;
+
+ priv = GTK_IMAGE_GET_PRIVATE (image);
+
+ priv->need_calc_size = 0;
+
/* 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