widget: Make gtk_widget_real_realize() stricter

But in turn, also allow it to work on widgets with their own surface.

This way, we can chain up from everywhere and won't have to export
gtk_widget_set_realized().
This commit is contained in:
Benjamin Otte 2018-04-11 02:38:00 +02:00
parent 0af5316f00
commit 5c51a302a4

View File

@ -8755,14 +8755,18 @@ gtk_widget_real_realize (GtkWidget *widget)
{
GtkWidgetPrivate *priv = widget->priv;
g_assert (!_gtk_widget_get_has_surface (widget));
gtk_widget_set_realized (widget, TRUE);
if (priv->parent)
if (_gtk_widget_get_has_surface (widget))
{
g_assert (priv->surface != NULL);
}
else
{
g_assert (priv->parent);
priv->surface = gtk_widget_get_parent_surface (widget);
g_object_ref (priv->surface);
}
gtk_widget_set_realized (widget, TRUE);
}
/*****************************************