diff --git a/src/floating.c b/src/floating.c index f455739c..f416160a 100644 --- a/src/floating.c +++ b/src/floating.c @@ -78,6 +78,14 @@ void toggle_floating_mode(xcb_connection_t *conn, Client *client, bool automatic LOG("Re-inserted the client into the matrix.\n"); con->currently_focused = client; + /* Ensure that it is below all floating clients */ + Client *first_floating = TAILQ_FIRST(&(client->workspace->floating_clients)); + if (first_floating != TAILQ_END(&(client->workspace->floating_clients))) { + LOG("Setting below floating\n"); + uint32_t values[] = { first_floating->frame, XCB_STACK_MODE_BELOW }; + xcb_configure_window(conn, client->frame, XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE, values); + } + render_container(conn, con); xcb_flush(conn); diff --git a/src/manage.c b/src/manage.c index dfbe12cc..827c05ca 100644 --- a/src/manage.c +++ b/src/manage.c @@ -374,12 +374,8 @@ void reparent_window(xcb_connection_t *conn, xcb_window_t child, SLIST_INSERT_HEAD(&(new->container->workspace->focus_stack), new, focus_clients); /* Ensure that it is below all floating clients */ - Client *first_floating; - SLIST_FOREACH(first_floating, &(new->container->workspace->focus_stack), focus_clients) - if (first_floating->floating >= FLOATING_AUTO_ON) - break; - - if (first_floating != SLIST_END(&(new->container->workspace->focus_stack))) { + Client *first_floating = TAILQ_FIRST(&(new->workspace->floating_clients)); + if (first_floating != TAILQ_END(&(new->workspace->floating_clients))) { LOG("Setting below floating\n"); uint32_t values[] = { first_floating->frame, XCB_STACK_MODE_BELOW }; xcb_configure_window(conn, new->frame, XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE, values);