Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
widget: Add brute force method to propagate clip
When a gtk_widget_queue_allocate() on some widget increases the clip,
widget->parent's clip was not updated. This appraoch naively just
unions widget's new clip with widget->parent's clip.

This of course only works if widget and parent share the same GDK
window. In the cases where they don't we can't do anything and need a
better fix.

Fixes label-text-shadow-changes-modify-clip.ui reftest.
  • Loading branch information
Benjamin Otte committed Mar 2, 2016
1 parent 05d1437 commit 3e06942
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions gtk/gtkwidget.c
Expand Up @@ -15520,6 +15520,23 @@ gtk_widget_set_clip (GtkWidget *widget,
#endif /* G_ENABLE_DEBUG */

priv->clip = *clip;

while (priv->parent &&
_gtk_widget_get_window (widget) == _gtk_widget_get_window (priv->parent))
{
GtkWidgetPrivate *parent_priv = priv->parent->priv;
GdkRectangle union_rect;

gdk_rectangle_union (&priv->clip,
&parent_priv->clip,
&union_rect);

if (gdk_rectangle_equal (&parent_priv->clip, &union_rect))
break;

parent_priv->clip = union_rect;
priv = parent_priv;
}
}

/*
Expand Down

0 comments on commit 3e06942

Please sign in to comment.