From 5347ed663de57f624abe887dc761949eb7169986 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Fri, 30 Dec 2022 14:14:06 -0600 Subject: [PATCH 01/10] only mark pending resizes as completed checking the configure serial --- dwl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/dwl.c b/dwl.c index 43603db..9b6be9f 100644 --- a/dwl.c +++ b/dwl.c @@ -766,9 +766,7 @@ commitnotify(struct wl_listener *listener, void *data) c->isfloating ? resize(c, c->geom, 1) : arrange(c->mon); /* mark a pending resize as completed */ - if (c->resize && (c->resize <= c->surface.xdg->current.configure_serial - || (c->surface.xdg->current.geometry.width == c->surface.xdg->pending.geometry.width - && c->surface.xdg->current.geometry.height == c->surface.xdg->pending.geometry.height))) + if (c->resize && c->resize <= c->surface.xdg->current.configure_serial) c->resize = 0; } From 6d0e3a51987ebda89193cf52996227110ad7068c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Fri, 30 Dec 2022 14:15:21 -0600 Subject: [PATCH 02/10] check if a client is resizing before checking if it's visible It's not like it's noticeable, but theoretically this is faster --- dwl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwl.c b/dwl.c index 9b6be9f..5189757 100644 --- a/dwl.c +++ b/dwl.c @@ -1834,7 +1834,7 @@ rendermon(struct wl_listener *listener, void *data) /* Render if no XDG clients have an outstanding resize and are visible on * this monitor. */ wl_list_for_each(c, &clients, link) - if (client_is_rendered_on_mon(c, m) && (!c->isfloating && c->resize) && !client_is_stopped(c)) + 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; From e523c2b82b835aa27e6ad5d015ed38d6a5cae0bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Fri, 30 Dec 2022 14:19:47 -0600 Subject: [PATCH 03/10] update comment about client_set_size() as no-op --- dwl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dwl.c b/dwl.c index 5189757..7ae2032 100644 --- a/dwl.c +++ b/dwl.c @@ -1875,7 +1875,7 @@ resize(Client *c, struct wlr_box geo, int interact) wlr_scene_node_set_position(&c->border[2]->node, 0, c->bw); wlr_scene_node_set_position(&c->border[3]->node, c->geom.width - c->bw, c->bw); - /* wlroots makes this a no-op if size hasn't changed */ + /* this is a no-op if size hasn't changed */ c->resize = client_set_size(c, c->geom.width - 2 * c->bw, c->geom.height - 2 * c->bw); } From 72d29f165449a28f84e476803543f30f11e366e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Fri, 30 Dec 2022 14:21:46 -0600 Subject: [PATCH 04/10] add blank lines to make updatemons() more readable --- dwl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dwl.c b/dwl.c index 7ae2032..a0b2ca8 100644 --- a/dwl.c +++ b/dwl.c @@ -2459,9 +2459,12 @@ updatemons(struct wl_listener *listener, void *data) if (m->wlr_output->enabled && !wlr_output_layout_get(output_layout, m->wlr_output)) wlr_output_layout_add_auto(output_layout, m->wlr_output); + /* Now that we update the output layout we can get its box */ wlr_output_layout_get_box(output_layout, NULL, &sgeom); + wlr_scene_rect_set_size(locked_bg, sgeom.width, sgeom.height); + wl_list_for_each(m, &mons, link) { if (!m->wlr_output->enabled) continue; From 71c7e4e1e5d2181d58fba3ce14a4457885523452 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Fri, 30 Dec 2022 14:25:19 -0600 Subject: [PATCH 05/10] also update locked_bg node position in updatemons() --- dwl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dwl.c b/dwl.c index a0b2ca8..f80219d 100644 --- a/dwl.c +++ b/dwl.c @@ -2463,6 +2463,8 @@ updatemons(struct wl_listener *listener, void *data) /* Now that we update the output layout we can get its box */ wlr_output_layout_get_box(output_layout, NULL, &sgeom); + /* Make sure the clients are hidden when dwl is locked */ + wlr_scene_node_set_position(&locked_bg->node, sgeom.x, sgeom.y); wlr_scene_rect_set_size(locked_bg, sgeom.width, sgeom.height); wl_list_for_each(m, &mons, link) { From 56114f700ffabc7f0f69a0f98053cfb629e0d521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Fri, 30 Dec 2022 14:26:53 -0600 Subject: [PATCH 06/10] arrange monitor after updating fullscreen background and lock surfaces --- dwl.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dwl.c b/dwl.c index f80219d..e4ad8cf 100644 --- a/dwl.c +++ b/dwl.c @@ -2476,10 +2476,6 @@ updatemons(struct wl_listener *listener, void *data) wlr_output_layout_get_box(output_layout, m->wlr_output, &(m->m)); wlr_output_layout_get_box(output_layout, m->wlr_output, &(m->w)); wlr_scene_output_set_position(m->scene_output, m->m.x, m->m.y); - /* Calculate the effective monitor geometry to use for clients */ - arrangelayers(m); - /* Don't move clients to the left output when plugging monitors */ - arrange(m); wlr_scene_node_set_position(&m->fullscreen_bg->node, m->m.x, m->m.y); wlr_scene_rect_set_size(m->fullscreen_bg, m->m.width, m->m.height); @@ -2491,6 +2487,11 @@ updatemons(struct wl_listener *listener, void *data) m->m.height); } + /* Calculate the effective monitor geometry to use for clients */ + arrangelayers(m); + /* Don't move clients to the left output when plugging monitors */ + arrange(m); + config_head->state.enabled = 1; config_head->state.mode = m->wlr_output->current_mode; config_head->state.x = m->m.x; From 0b2c33248c57d8d6366f292d421f86f664ca3c67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Fri, 30 Dec 2022 14:29:19 -0600 Subject: [PATCH 07/10] simplify check in urgent() we only care if it returned a client or not --- dwl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dwl.c b/dwl.c index e4ad8cf..1f0db88 100644 --- a/dwl.c +++ b/dwl.c @@ -2523,8 +2523,8 @@ urgent(struct wl_listener *listener, void *data) { struct wlr_xdg_activation_v1_request_activate_event *event = data; Client *c = NULL; - int type = toplevel_from_wlr_surface(event->surface, &c, NULL); - if (type >= 0 && type != LayerShell && c != focustop(selmon)) { + toplevel_from_wlr_surface(event->surface, &c, NULL); + if (c && c != focustop(selmon)) { c->isurgent = 1; printstatus(); } From dbe44e48c8b0434565fa9322fda4d493b0ae25ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Fri, 30 Dec 2022 14:31:56 -0600 Subject: [PATCH 08/10] return early if selmon is not part of the output layout in dirtomon() instead of checking twice --- dwl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dwl.c b/dwl.c index 1f0db88..19bb6ce 100644 --- a/dwl.c +++ b/dwl.c @@ -1168,12 +1168,12 @@ Monitor * dirtomon(enum wlr_direction dir) { struct wlr_output *next; - if (wlr_output_layout_get(output_layout, selmon->wlr_output) - && (next = wlr_output_layout_adjacent_output(output_layout, + if (!wlr_output_layout_get(output_layout, selmon->wlr_output)) + return selmon; + if ((next = wlr_output_layout_adjacent_output(output_layout, dir, selmon->wlr_output, selmon->m.x, selmon->m.y))) return next->data; - if (wlr_output_layout_get(output_layout, selmon->wlr_output) - && (next = wlr_output_layout_farthest_output(output_layout, + if ((next = wlr_output_layout_farthest_output(output_layout, dir ^ (WLR_DIRECTION_LEFT|WLR_DIRECTION_RIGHT), selmon->wlr_output, selmon->m.x, selmon->m.y))) return next->data; From 932c1d45f279a78cac021f7f643fc65460245b64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Fri, 30 Dec 2022 14:45:03 -0600 Subject: [PATCH 09/10] remove `--long` from git-describe command --- config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.mk b/config.mk index 01aad14..36dc49b 100644 --- a/config.mk +++ b/config.mk @@ -1,5 +1,5 @@ _VERSION = 0.4-rc3 -VERSION = `git describe --long --tags --dirty 2>/dev/null || echo $(_VERSION)` +VERSION = `git describe --tags --dirty 2>/dev/null || echo $(_VERSION)` PKG_CONFIG = pkg-config From 8653b276927b6622d3c50f98d05380b27b9b007c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Fri, 30 Dec 2022 14:38:03 -0600 Subject: [PATCH 10/10] bump version to 0.4 --- config.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.mk b/config.mk index 36dc49b..f50156f 100644 --- a/config.mk +++ b/config.mk @@ -1,4 +1,4 @@ -_VERSION = 0.4-rc3 +_VERSION = 0.4 VERSION = `git describe --tags --dirty 2>/dev/null || echo $(_VERSION)` PKG_CONFIG = pkg-config