diff options
author | Orestis Floros <orestisflo@gmail.com> | 2023-09-06 10:56:25 +0200 |
---|---|---|
committer | Michael Stapelberg <stapelberg@users.noreply.github.com> | 2023-09-06 17:24:53 +0200 |
commit | 908c86544b6ef854dbeaa657f4e971db53f9e690 (patch) | |
tree | 760cba0f4eb9ff156e758d77b5b3b1004835d076 /src | |
parent | 82b9821204901e6a3dd4cec5bcd8ef52e5dd12fe (diff) | |
download | i3-908c86544b6ef854dbeaa657f4e971db53f9e690.tar.gz i3-908c86544b6ef854dbeaa657f4e971db53f9e690.zip |
remanage_window: Refactor to make clearer when a swallowing happens
Diffstat (limited to 'src')
-rw-r--r-- | src/manage.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/manage.c b/src/manage.c index a7de243e..aeef703f 100644 --- a/src/manage.c +++ b/src/manage.c @@ -678,27 +678,34 @@ out: free(attr); } -/* - * Remanages a window: performs a swallow check and runs assignments. - * Returns con for the window regardless if it updated. - * - */ -Con *remanage_window(Con *con) { +static Con *placeholder_for_con(Con *con) { /* Make sure this windows hasn't already been swallowed. */ if (con->window->swallowed) { - run_assignments(con->window); - return con; + return NULL; } Match *match; Con *nc = con_for_window(croot, con->window, &match); if (nc == NULL || nc->window == NULL || nc->window == con->window) { - run_assignments(con->window); - return con; + return NULL; } /* Make sure the placeholder that wants to swallow this window didn't spawn * after the window to follow current behavior: adding a placeholder won't * swallow windows currently managed. */ if (nc->window->managed_since > con->window->managed_since) { + return NULL; + } + return nc; +} + +/* + * Remanages a window: performs a swallow check and runs assignments. + * Returns con for the window regardless if it updated. + * + */ +Con *remanage_window(Con *con) { + Con *nc = placeholder_for_con(con); + if (!nc) { + /* The con is not updated, just run assignments */ run_assignments(con->window); return con; } |