widget: Use gtk_widget_queue_draw() for queueing redraws

This change is necessary because the old code did not accound for corner
cases (like translucent child windows), which could stop
gtk_widget_queue_resize() to not trigger redraws.
This commit is contained in:
Benjamin Otte 2012-09-10 13:50:10 +02:00
parent 554002028c
commit 206aa209ae

View File

@ -642,7 +642,6 @@ static AtkObject* gtk_widget_ref_accessible (AtkImplementor *implementor);
static void gtk_widget_invalidate_widget_windows (GtkWidget *widget,
cairo_region_t *region);
static GdkScreen * gtk_widget_get_screen_unchecked (GtkWidget *widget);
static void gtk_widget_queue_shallow_draw (GtkWidget *widget);
static gboolean gtk_widget_real_can_activate_accel (GtkWidget *widget,
guint signal_id);
@ -4650,7 +4649,7 @@ gtk_widget_queue_resize (GtkWidget *widget)
g_return_if_fail (GTK_IS_WIDGET (widget));
if (gtk_widget_get_realized (widget))
gtk_widget_queue_shallow_draw (widget);
gtk_widget_queue_draw (widget);
_gtk_size_group_queue_resize (widget, 0);
}
@ -4772,29 +4771,6 @@ gtk_widget_invalidate_widget_windows (GtkWidget *widget,
invalidate_predicate, widget);
}
/**
* gtk_widget_queue_shallow_draw:
* @widget: a #GtkWidget
*
* Like gtk_widget_queue_draw(), but only windows owned
* by @widget are invalidated.
**/
static void
gtk_widget_queue_shallow_draw (GtkWidget *widget)
{
GdkRectangle rect;
cairo_region_t *region;
if (!gtk_widget_get_realized (widget))
return;
gtk_widget_get_allocation (widget, &rect);
region = cairo_region_create_rectangle (&rect);
gtk_widget_invalidate_widget_windows (widget, region);
cairo_region_destroy (region);
}
/**
* gtk_widget_size_allocate:
* @widget: a #GtkWidget
@ -5856,7 +5832,7 @@ static gboolean
gtk_widget_real_focus_in_event (GtkWidget *widget,
GdkEventFocus *event)
{
gtk_widget_queue_shallow_draw (widget);
gtk_widget_queue_draw (widget);
return FALSE;
}
@ -5865,7 +5841,7 @@ static gboolean
gtk_widget_real_focus_out_event (GtkWidget *widget,
GdkEventFocus *event)
{
gtk_widget_queue_shallow_draw (widget);
gtk_widget_queue_draw (widget);
return FALSE;
}