window: Properly detect if size allocation is needed

Instead of looking at the allocation, just look at the alloc_needed
widget flag that tracks if an allocation is needed.
This commit is contained in:
Benjamin Otte 2019-02-12 02:20:36 +01:00
parent 07722582ef
commit 2ba928e142

View File

@ -6385,13 +6385,8 @@ gtk_window_realize (GtkWidget *widget)
if (!priv->client_decorated && gtk_window_should_use_csd (window))
create_decoration (widget);
_gtk_widget_get_allocation (widget, &allocation);
/* ensure widget tree is properly size allocated */
if (allocation.x == -1 &&
allocation.y == -1 &&
allocation.width == 1 &&
allocation.height == 1)
if (_gtk_widget_get_alloc_needed (widget))
{
GdkRectangle request;
@ -6408,16 +6403,15 @@ gtk_window_realize (GtkWidget *widget)
g_return_if_fail (!_gtk_widget_get_realized (widget));
}
_gtk_widget_get_allocation (widget, &allocation);
if (priv->hardcoded_surface)
{
surface = priv->hardcoded_surface;
_gtk_widget_get_allocation (widget, &allocation);
gdk_surface_resize (surface, allocation.width, allocation.height);
}
else
{
_gtk_widget_get_allocation (widget, &allocation);
switch (priv->type)
{
case GTK_WINDOW_TOPLEVEL: