From 79732da1ed8cb167440fb047c72cfc0d888a187b Mon Sep 17 00:00:00 2001
From: Jonas Witschel <diabonas@archlinux.org>
Date: Sun, 5 Apr 2020 20:16:52 +0200
Subject: [PATCH] wayland: don't call gdk_wayland_window_configure without
 valid size

Commit 7f12dc2b66bba15b2e1c0ca077fa4ae58962ec0f ("wayland: Postpone
window resize requests until configured") runs
gdk_wayland_window_configure unconditionally even if no valid size is
set. This breaks GtkDialogs, which are not shown any more, and results
in warnings like

gtk_widget_size_allocate(): attempt to allocate widget with width -3 and
height -3

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2574
---
 gdk/wayland/gdkwindow-wayland.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index eba8361b21..2d3e31906e 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -1635,10 +1635,11 @@ gdk_wayland_window_handle_configure (GdkWindow *window,
     }
   else
     {
-      gdk_wayland_window_configure (window,
-                                    impl->unconfigured_width,
-                                    impl->unconfigured_height,
-                                    impl->scale);
+      if (impl->unconfigured_width > 0 && impl->unconfigured_height > 0)
+        gdk_wayland_window_configure (window,
+                                      impl->unconfigured_width,
+                                      impl->unconfigured_height,
+                                      impl->scale);
     }
 
   if (fixed_size)
-- 
2.24.1

