X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Ffloating.c;h=a99d0970f356156abbd29e96a4167e7185ece558;hb=37e2b5822658af39be932af9184457337bf163fe;hp=080413347899b4d36007d990dae0196f86af729d;hpb=4cba9fcbdab1487459014dbf8882f5f34e61435e;p=i3%2Fi3 diff --git a/src/floating.c b/src/floating.c index 08041334..a99d0970 100644 --- a/src/floating.c +++ b/src/floating.c @@ -59,7 +59,7 @@ static void floating_set_hint_atom(Con *con, bool floating) { xcb_flush(conn); } -/** +/* * Called when a floating window is created or resized. * This function resizes the window if its size is higher or lower than the * configured maximum/minimum size, respectively. @@ -96,6 +96,18 @@ void floating_check_size(Con *floating_con) { floating_con->rect.height += border_rect.height; } + if (focused_con->window->max_width) { + floating_con->rect.width -= border_rect.width; + floating_con->rect.width = min(floating_con->rect.width, focused_con->window->max_width); + floating_con->rect.width += border_rect.width; + } + + if (focused_con->window->max_height) { + floating_con->rect.height -= border_rect.height; + floating_con->rect.height = min(floating_con->rect.height, focused_con->window->max_height); + floating_con->rect.height += border_rect.height; + } + if (focused_con->window->height_increment && floating_con->rect.height >= focused_con->window->base_height + border_rect.height) { floating_con->rect.height -= focused_con->window->base_height + border_rect.height; @@ -246,7 +258,7 @@ void floating_enable(Con *con, bool automatic) { Con *parent = con->parent; /* clear the pointer before calling tree_close_internal in which the memory is freed */ con->parent = NULL; - tree_close_internal(parent, DONT_KILL_WINDOW, false, false); + tree_close_internal(parent, DONT_KILL_WINDOW, false); } char *name; @@ -366,13 +378,17 @@ void floating_disable(Con *con, bool automatic) { } Con *ws = con_get_workspace(con); + if (con_is_internal(ws)) { + LOG("Can't disable floating for container in internal workspace.\n"); + return; + } Con *tiling_focused = con_descend_tiling_focused(ws); if (tiling_focused->type == CT_WORKSPACE) { Con *parent = con->parent; con_detach(con); con->parent = NULL; - tree_close_internal(parent, DONT_KILL_WINDOW, true, false); + tree_close_internal(parent, DONT_KILL_WINDOW, true); con_attach(con, tiling_focused, false); con->percent = 0.0; con_fix_percent(con->parent); @@ -883,13 +899,17 @@ bool floating_reposition(Con *con, Rect newrect) { con->rect = newrect; - floating_maybe_reassign_ws(con); + bool reassigned = floating_maybe_reassign_ws(con); /* If this is a scratchpad window, don't auto center it from now on. */ if (con->scratchpad_state == SCRATCHPAD_FRESH) con->scratchpad_state = SCRATCHPAD_CHANGED; - tree_render(); + /* Workspace change will already result in a tree_render. */ + if (!reassigned) { + render_con(con, false); + x_push_node(con); + } return true; }