Get rid of the remaining hardcoded height.

next
Fernando Tarlá Cardoso Lemos 2010-11-14 21:25:37 -02:00 committed by Michael Stapelberg
parent 69f29b2b8e
commit ea1e9b20be
3 changed files with 20 additions and 9 deletions

View File

@ -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: dont 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;

View File

@ -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) {

View File

@ -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",