From 0729f18dce85cb79b8aaac325a43dba0c5e96ab3 Mon Sep 17 00:00:00 2001
From: Micah Gorrell <micah.gorrell@venafi.com>
Date: Wed, 24 May 2023 10:20:30 -0600
Subject: Prevent using a wlr_layer_surface after destroying it, due to no
 available outputs

---
 dwl.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/dwl.c b/dwl.c
index b7436bb..1ad3d05 100644
--- a/dwl.c
+++ b/dwl.c
@@ -836,8 +836,10 @@ createlayersurface(struct wl_listener *listener, void *data)
 	if (!wlr_layer_surface->output)
 		wlr_layer_surface->output = selmon ? selmon->wlr_output : NULL;
 
-	if (!wlr_layer_surface->output)
+	if (!wlr_layer_surface->output) {
 		wlr_layer_surface_v1_destroy(wlr_layer_surface);
+		return;
+	}
 
 	layersurface = ecalloc(1, sizeof(LayerSurface));
 	layersurface->type = LayerShell;
-- 
cgit v1.2.3


From 72adab621f27f9daed87ea1b0068679e39fb3f8a Mon Sep 17 00:00:00 2001
From: Leonardo Hernández Hernández <leohdz172@proton.me>
Date: Sat, 8 Apr 2023 14:44:34 -0600
Subject: destroy old client popups when focusing another client

Closes: https://github.com/djpohly/dwl/issues/408
---
 dwl.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/dwl.c b/dwl.c
index 1ad3d05..aec7427 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1203,7 +1203,9 @@ void
 focusclient(Client *c, int lift)
 {
 	struct wlr_surface *old = seat->keyboard_state.focused_surface;
-	int i, unused_lx, unused_ly;
+	int i, unused_lx, unused_ly, old_client_type;
+	Client *old_c = NULL;
+	LayerSurface *old_l = NULL;
 
 	if (locked)
 		return;
@@ -1215,6 +1217,12 @@ focusclient(Client *c, int lift)
 	if (c && client_surface(c) == old)
 		return;
 
+	if ((old_client_type = toplevel_from_wlr_surface(old, &old_c, &old_l)) == XDGShell) {
+		struct wlr_xdg_popup *popup, *tmp;
+		wl_list_for_each_safe(popup, tmp, &old_c->surface.xdg->popups, link)
+			wlr_xdg_popup_destroy(popup);
+	}
+
 	/* Put the new client atop the focus stack and select its monitor */
 	if (c && !client_is_unmanaged(c)) {
 		wl_list_remove(&c->flink);
@@ -1235,19 +1243,17 @@ focusclient(Client *c, int lift)
 		/* If an overlay is focused, don't focus or activate the client,
 		 * but only update its position in fstack to render its border with focuscolor
 		 * and focus it after the overlay is closed. */
-		Client *w = NULL;
-		LayerSurface *l = NULL;
-		int type = toplevel_from_wlr_surface(old, &w, &l);
-		if (type == LayerShell && wlr_scene_node_coords(&l->scene->node, &unused_lx, &unused_ly)
-				&& l->layer_surface->current.layer >= ZWLR_LAYER_SHELL_V1_LAYER_TOP) {
+		if (old_client_type == LayerShell && wlr_scene_node_coords(
+					&old_l->scene->node, &unused_lx, &unused_ly)
+				&& old_l->layer_surface->current.layer >= ZWLR_LAYER_SHELL_V1_LAYER_TOP) {
 			return;
-		} else if (w && w == exclusive_focus && client_wants_focus(w)) {
+		} else if (old_c && old_c == exclusive_focus && client_wants_focus(old_c)) {
 			return;
 		/* Don't deactivate old client if the new one wants focus, as this causes issues with winecfg
 		 * and probably other clients */
-		} else if (w && !client_is_unmanaged(w) && (!c || !client_wants_focus(c))) {
+		} else if (old_c && !client_is_unmanaged(old_c) && (!c || !client_wants_focus(c))) {
 			for (i = 0; i < 4; i++)
-				wlr_scene_rect_set_color(w->border[i], bordercolor);
+				wlr_scene_rect_set_color(old_c->border[i], bordercolor);
 
 			client_activate_surface(old, 0);
 		}
-- 
cgit v1.2.3


From a5e45924edeaeb9b763cdc75fd4ec413b2ec2ab5 Mon Sep 17 00:00:00 2001
From: Leonardo Hernández Hernández <leohdz172@proton.me>
Date: Sun, 28 May 2023 00:20:20 -0600
Subject: remove note about contact me for patch issues

I am no longer able to spend much time developing dwl let alone maintaining
other's patches :)
---
 .github/ISSUE_TEMPLATE/bug_report.md | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
index 6b60803..cd9bd8d 100644
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -14,9 +14,4 @@ wlroots version:
 <!--
 Only report bugs that can be reproduced on the main line
 Report patch issues to their respective authors
-If the patch author doesn't respond within a reasonable time, email me:
-
-Leonardo Hernández Hernández <leohdz172@protonmail.com>
-
-but note that I'm NOT making any promises
 -->
-- 
cgit v1.2.3


From f8884ffc2b7a4c0401f0a6710b679cd18b6b097d Mon Sep 17 00:00:00 2001
From: Nikita Ivanov <nikita.vyach.ivanov@gmail.com>
Date: Sun, 28 May 2023 19:09:38 +0200
Subject: Set XCURSOR_SIZE

---
 dwl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/dwl.c b/dwl.c
index aec7427..cd27c7c 100644
--- a/dwl.c
+++ b/dwl.c
@@ -2260,6 +2260,7 @@ setup(void)
 	 * images are available at all scale factors on the screen (necessary for
 	 * HiDPI support). Scaled cursors will be loaded with each output. */
 	cursor_mgr = wlr_xcursor_manager_create(NULL, 24);
+	setenv("XCURSOR_SIZE", "24", 1);
 
 	/*
 	 * wlr_cursor *only* displays an image on screen. It does not move around
-- 
cgit v1.2.3


From 3d98907b98e2ff978cc30614b739f1f4b8f7f8c7 Mon Sep 17 00:00:00 2001
From: Leonardo Hernández Hernández <leohdz172@proton.me>
Date: Thu, 25 May 2023 22:19:29 -0600
Subject: send frame done even if output commit fails

Bug: https://github.com/djpohly/dwl/issues/420
Fixes: https://github.com/djpohly/dwl/issues/353
---
 dwl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dwl.c b/dwl.c
index cd27c7c..02c761c 100644
--- a/dwl.c
+++ b/dwl.c
@@ -1895,8 +1895,8 @@ rendermon(struct wl_listener *listener, void *data)
 	wl_list_for_each(c, &clients, link)
 		if (c->resize && !c->isfloating && client_is_rendered_on_mon(c, m) && !client_is_stopped(c))
 			goto skip;
-	if (!wlr_scene_output_commit(m->scene_output))
-		return;
+	wlr_scene_output_commit(m->scene_output);
+
 skip:
 	/* Let clients know a frame has been rendered */
 	clock_gettime(CLOCK_MONOTONIC, &now);
-- 
cgit v1.2.3


From 9b9b79b35ebaed7a5897f748c51b2d5c4ec1ddfe Mon Sep 17 00:00:00 2001
From: Leonardo Hernández Hernández <leohdz172@proton.me>
Date: Thu, 25 May 2023 22:20:12 -0600
Subject: activate lock surface in updatemons

Fixes an issue when swaylock does not receive input after turn off and then
turn on the outputs
---
 dwl.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dwl.c b/dwl.c
index 02c761c..918852e 100644
--- a/dwl.c
+++ b/dwl.c
@@ -2572,9 +2572,12 @@ updatemons(struct wl_listener *listener, void *data)
 		wl_list_for_each(c, &clients, link)
 			if (!c->mon && client_is_mapped(c))
 				setmon(c, selmon, c->tags);
-		if (selmon->lock_surface)
+		focusclient(focustop(selmon), 1);
+		if (selmon->lock_surface) {
 			client_notify_enter(selmon->lock_surface->surface,
 					wlr_seat_get_keyboard(seat));
+			client_activate_surface(selmon->lock_surface->surface, 1);
+		}
 	}
 
 	wlr_output_manager_v1_set_configuration(output_mgr, config);
-- 
cgit v1.2.3