summaryrefslogtreecommitdiff
path: root/gtk/gtkpixmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'gtk/gtkpixmap.c')
-rw-r--r--gtk/gtkpixmap.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gtk/gtkpixmap.c b/gtk/gtkpixmap.c
index eec55f0bf0..f9045807c6 100644
--- a/gtk/gtkpixmap.c
+++ b/gtk/gtkpixmap.c
@@ -73,6 +73,7 @@ gtk_pixmap_init (GtkPixmap *pixmap)
pixmap->pixmap = NULL;
pixmap->mask = NULL;
+ pixmap->needs_clear = FALSE;
}
GtkWidget*
@@ -133,6 +134,15 @@ gtk_pixmap_set (GtkPixmap *pixmap,
}
if (GTK_WIDGET_VISIBLE (pixmap))
{
+ /* If we aren't drawing the entire area, clear first */
+ if (GTK_WIDGET_DRAWABLE (pixmap) &&
+ ((mask != NULL) ||
+ (GTK_WIDGET (pixmap)->requisition.width != oldwidth) ||
+ (GTK_WIDGET (pixmap)->requisition.height != oldheight)))
+ {
+ pixmap->needs_clear = TRUE;
+ }
+
if ((GTK_WIDGET (pixmap)->requisition.width != oldwidth) ||
(GTK_WIDGET (pixmap)->requisition.height != oldheight))
gtk_widget_queue_resize (GTK_WIDGET (pixmap));
@@ -183,6 +193,17 @@ gtk_pixmap_expose (GtkWidget *widget,
pixmap = GTK_PIXMAP (widget);
misc = GTK_MISC (widget);
+ if (pixmap->needs_clear)
+ {
+ gdk_window_clear_area (GTK_WIDGET (pixmap)->window,
+ GTK_WIDGET (pixmap)->allocation.x,
+ GTK_WIDGET (pixmap)->allocation.y,
+ GTK_WIDGET (pixmap)->allocation.width,
+ GTK_WIDGET (pixmap)->allocation.height);
+
+ pixmap->needs_clear = FALSE;
+ }
+
x = (widget->allocation.x * (1.0 - misc->xalign) +
(widget->allocation.x + widget->allocation.width
- (widget->requisition.width - misc->xpad * 2)) *