restoremon: switch to early return

This commit is contained in:
Eldar Yusupov 2024-04-23 11:09:25 +03:00
parent 8287f9b148
commit 7b3d32fbc3

View File

@ -1,14 +1,14 @@
From 780e5ebcf6decdc8cedb69cf9c93446912903b83 Mon Sep 17 00:00:00 2001 From e42ca1c539437d3098d80983cfe2ad6f938d7a08 Mon Sep 17 00:00:00 2001
From: Eldar Yusupov <eyusupov@gmail.com> From: Eldar Yusupov <eyusupov@gmail.com>
Date: Sun, 17 Mar 2024 19:12:29 +0300 Date: Sun, 17 Mar 2024 19:12:29 +0300
Subject: [PATCH] Restore correct montior for client when it is reattached Subject: [PATCH] Restore correct montior for client when it is reattached
--- ---
dwl.c | 22 +++++++++++++++++++++- dwl.c | 24 ++++++++++++++++++++++--
1 file changed, 21 insertions(+), 1 deletion(-) 1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/dwl.c b/dwl.c diff --git a/dwl.c b/dwl.c
index bf763df..c413be8 100644 index bf763df..d8d8139 100644
--- a/dwl.c --- a/dwl.c
+++ b/dwl.c +++ b/dwl.c
@@ -107,6 +107,7 @@ typedef struct { @@ -107,6 +107,7 @@ typedef struct {
@ -65,13 +65,14 @@ index bf763df..c413be8 100644
{ {
Client *sel = focustop(selmon); Client *sel = focustop(selmon);
- if (sel) - if (sel)
+ if (sel) { - setmon(sel, dirtomon(arg->i), 0);
setmon(sel, dirtomon(arg->i), 0); + if (!sel)
+ free(sel->output); + return;
+ sel->output = strdup(sel->mon->wlr_output->name); + setmon(sel, dirtomon(arg->i), 0);
+ if (sel->output == NULL) { + free(sel->output);
+ die("oom"); + sel->output = strdup(sel->mon->wlr_output->name);
+ } + if (sel->output == NULL) {
+ die("oom");
+ } + }
} }