From 668022bc906fc7ba4d2092d260fbd10304fec29f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
 <leohdz172@proton.me>
Date: Fri, 5 Jan 2024 11:12:34 -0600
Subject: don't send configure events to uninitialized xdg-toplevels

---
 dwl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/dwl.c b/dwl.c
index 5ab5a0a..7fb1b88 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1578,8 +1578,9 @@ maximizenotify(struct wl_listener *listener, void *data)
 	 * protocol version
 	 * wlr_xdg_surface_schedule_configure() is used to send an empty reply. */
 	Client *c = wl_container_of(listener, c, maximize);
-	if (wl_resource_get_version(c->surface.xdg->toplevel->resource)
-			< XDG_TOPLEVEL_WM_CAPABILITIES_SINCE_VERSION)
+	if (c->surface.xdg->initialized
+			&& wl_resource_get_version(c->surface.xdg->toplevel->resource)
+					< XDG_TOPLEVEL_WM_CAPABILITIES_SINCE_VERSION)
 		wlr_xdg_surface_schedule_configure(c->surface.xdg);
 }
 
-- 
cgit v1.2.3