From: Fernando Tarlá Cardoso Lemos Date: Sun, 14 Nov 2010 23:25:37 +0000 (-0200) Subject: Get rid of the remaining hardcoded height. X-Git-Tag: tree-pr1~91 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ea1e9b20be2576e918528670d2271caeef4a3fa4;p=i3%2Fi3 Get rid of the remaining hardcoded height. --- diff --git a/src/floating.c b/src/floating.c index 2292d89b..b1e23785 100644 --- a/src/floating.c +++ b/src/floating.c @@ -42,11 +42,15 @@ void floating_enable(Con *con, bool automatic) { x_set_name(nc, name); free(name); + /* find the height for the decorations */ + i3Font *font = load_font(conn, config.font); + int deco_height = font->height + 5; + nc->rect = con->rect; /* add pixels for the decoration */ /* TODO: don’t add them when the user automatically puts new windows into * 1pixel/borderless mode */ - nc->rect.height += 17 + 2; + nc->rect.height += deco_height + 4; nc->rect.width += 4; nc->orientation = NO_ORIENTATION; nc->type = CT_FLOATING_CON; diff --git a/src/handlers.c b/src/handlers.c index 7dd73acb..e8c626e1 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -342,11 +342,14 @@ int handle_configure_request(void *prophs, xcb_connection_t *conn, xcb_configure DLOG("Configure request!\n"); if (con_is_floating(con) && con_is_leaf(con)) { + /* find the height for the decorations */ + i3Font *font = load_font(conn, config.font); + int deco_height = font->height + 5; /* we actually need to apply the size/position changes to the *parent* * container */ Rect bsr = con_border_style_rect(con); if (con->border_style == BS_NORMAL) - bsr.height -= 17; + bsr.height -= deco_height; con = con->parent; DLOG("Container is a floating leaf node, will do that.\n"); if (event->value_mask & XCB_CONFIG_WINDOW_X) { diff --git a/src/render.c b/src/render.c index f8305d54..fcb2a64e 100644 --- a/src/render.c +++ b/src/render.c @@ -104,6 +104,10 @@ void render_con(Con *con) { return; } + /* find the height for the decorations */ + i3Font *font = load_font(conn, config.font); + int deco_height = font->height + 5; + Con *child; TAILQ_FOREACH(child, &(con->nodes_head), nodes) { @@ -136,11 +140,11 @@ void render_con(Con *con) { child->deco_rect.x = child->rect.x - con->rect.x; child->deco_rect.y = child->rect.y - con->rect.y; - child->rect.y += 17; - child->rect.height -= 17; + child->rect.y += deco_height; + child->rect.height -= deco_height; child->deco_rect.width = child->rect.width; - child->deco_rect.height = 17; + child->deco_rect.height = deco_height; } } @@ -151,13 +155,13 @@ void render_con(Con *con) { child->rect.width = rect.width; child->rect.height = rect.height; - child->rect.y += (17 * children); - child->rect.height -= (17 * children); + child->rect.y += (deco_height * children); + child->rect.height -= (deco_height * children); child->deco_rect.x = x - con->rect.x; - child->deco_rect.y = y - con->rect.y + (i * 17); + child->deco_rect.y = y - con->rect.y + (i * deco_height); child->deco_rect.width = child->rect.width; - child->deco_rect.height = 17; + child->deco_rect.height = deco_height; } printf("child at (%d, %d) with (%d x %d)\n",