From e6af5d49ae76142a8bbdf5d8b4967189af3b2f15 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Mon, 13 Apr 1998 00:20:17 +0000 Subject: Set a flag so instead of clearing the area in advance. That looked Sun Apr 12 20:09:40 1998 Owen Taylor * gtk/gtklabel.[ch] (gtk_label_expose): Set a flag so instead of clearing the area in advance. That looked _really_ bad. * gtk/gtkcontainer.c (gtk_container_class_init): Changed "focus" to RUN_LAST. * gtk/gtkentry.c (gtk_entry_realize): Fixed place where allocation was used where requisition was meant. (Found by David J N Begley ) * gtk/gtkwindow.c (gtk_window_set_default): Fixed assertion in when setting default to NULL> ("Damon Chaplin" ) * gtk/gtkwidget.c (gtk_widget_unparent): Unset the default widget on the toplevel, if necessary. Sun Apr 12 02:04:21 1998 Owen Taylor * gtk/gtkpreview.c: Removed unecessary and harmful htons/ntohs when storing properties. (X does the byte swapping itself) --- gtk/gtklabel.c | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'gtk/gtklabel.c') diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 77d738f291..e9f1558c99 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -139,6 +139,7 @@ gtk_label_init (GtkLabel *label) label->label = NULL; label->row = NULL; label->jtype = GTK_JUSTIFY_CENTER; + label->needs_clear = 0; gtk_label_set (label, ""); } @@ -311,6 +312,23 @@ gtk_label_expose (GtkWidget *widget, gdk_gc_set_clip_rectangle (widget->style->white_gc, &event->area); gdk_gc_set_clip_rectangle (widget->style->fg_gc[state], &event->area); + /* We clear the whole allocation here so that if a partial + * expose is triggered we don't just clear part and mess up + * when the queued redraw comes along. (There will always + * be a complete queued redraw when the needs_clear flag + * is set.) + */ + if (label->needs_clear) + { + gdk_window_clear_area (widget->window, + widget->allocation.x, + widget->allocation.y, + widget->allocation.width, + widget->allocation.height); + + label->needs_clear = FALSE; + } + x = widget->allocation.x + misc->xpad + (widget->allocation.width - widget->requisition.width) * misc->xalign + 0.5; @@ -377,25 +395,13 @@ static void gtk_label_state_changed (GtkWidget *widget, guint previous_state) { - if (GTK_WIDGET_NO_WINDOW (widget) && - GTK_WIDGET_DRAWABLE (widget)) - gdk_window_clear_area (widget->window, - widget->allocation.x, - widget->allocation.y, - widget->allocation.width, - widget->allocation.height); + GTK_LABEL (widget)->needs_clear = 1; } static void gtk_label_style_set (GtkWidget *widget, GtkStyle *previous_style) { - if (GTK_WIDGET_NO_WINDOW (widget) && - GTK_WIDGET_DRAWABLE (widget)) - gdk_window_clear_area (widget->window, - widget->allocation.x, - widget->allocation.y, - widget->allocation.width, - widget->allocation.height); + GTK_LABEL (widget)->needs_clear = 1; } -- cgit v1.2.1