From 68c6319e3fdb46aabc47595f85faef25cb20873a Mon Sep 17 00:00:00 2001 From: Guido Cella Date: Tue, 15 Sep 2026 15:24:27 +0200 Subject: [PATCH] Revert "reduce nesting in commitnotify()" This reverts commit c824886b8ce6a249c608e3a04bf251e4b32206c1. --- dwl.c | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/dwl.c b/dwl.c index bb010d8..44d57ab 100644 --- a/dwl.c +++ b/dwl.c @@ -933,28 +933,29 @@ commitnotify(struct wl_listener *listener, void *data) { Client *c = wl_container_of(listener, c, commit); - if (!c->surface.xdg->initial_commit) + if (c->surface.xdg->initial_commit) { + /* + * Get the monitor this client will be rendered on + * Note that if the user set a rule in which the client is placed on + * a different monitor based on its title, this will likely select + * a wrong monitor. + */ + applyrules(c); + if (c->mon) { + client_set_scale(client_surface(c), c->mon->wlr_output->scale); + } + setmon(c, NULL, 0); /* Make sure to reapply rules in mapnotify() */ + + wlr_xdg_toplevel_set_wm_capabilities(c->surface.xdg->toplevel, + WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN); + if (c->decoration) + requestdecorationmode(&c->set_decoration_mode, c->decoration); + wlr_xdg_toplevel_set_size(c->surface.xdg->toplevel, 0, 0); + if (!c->isfloating) + client_set_tiled(c, WLR_EDGE_TOP | WLR_EDGE_BOTTOM | WLR_EDGE_LEFT | + WLR_EDGE_RIGHT); return; - - /* - * Get the monitor this client will be rendered on - * Note that if the user set a rule in which the client is placed on - * a different monitor based on its title, this will likely select - * a wrong monitor. - */ - applyrules(c); - if (c->mon) - client_set_scale(client_surface(c), c->mon->wlr_output->scale); - setmon(c, NULL, 0); /* Make sure to reapply rules in mapnotify() */ - - wlr_xdg_toplevel_set_wm_capabilities(c->surface.xdg->toplevel, - WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN); - if (c->decoration) - requestdecorationmode(&c->set_decoration_mode, c->decoration); - wlr_xdg_toplevel_set_size(c->surface.xdg->toplevel, 0, 0); - if (!c->isfloating) - client_set_tiled(c, WLR_EDGE_TOP | WLR_EDGE_BOTTOM | WLR_EDGE_LEFT | - WLR_EDGE_RIGHT); + } } void