aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOrestis Floros <orestisflo@gmail.com>2023-09-06 10:56:25 +0200
committerOrestis Floros <orestisflo@gmail.com>2023-09-06 11:03:01 +0200
commitc9893592be2e141a86e32824d824d2d1f84ecd91 (patch)
tree760cba0f4eb9ff156e758d77b5b3b1004835d076
parent7637613e871f0b2213149aaef2e1901c4a5c603a (diff)
downloadi3-for-window-urgent.tar.gz
i3-for-window-urgent.zip
remanage_window: Refactor to make clearer when a swallowing happensfor-window-urgent
-rw-r--r--src/manage.c27
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;
}