+#undef I3__FILE__
+#define I3__FILE__ "floating.c"
/*
* vim:ts=4:sw=4:expandtab
*
nc->rect.width = max(nc->rect.width, config.floating_minimum_width);
}
- /* add pixels for the decoration */
- /* TODO: don’t add them when the user automatically puts new windows into
- * 1pixel/borderless mode */
- nc->rect.height += deco_height + 2;
- nc->rect.width += 4;
+ /* 3: attach the child to the new parent container. We need to do this
+ * because con_border_style_rect() needs to access con->parent. */
+ con->parent = nc;
+ con->percent = 1.0;
+ con->floating = FLOATING_USER_ON;
+
+ /* 4: set the border style as specified with new_float */
+ if (automatic)
+ con->border_style = config.default_floating_border;
+
+ /* Add pixels for the decoration. */
+ Rect border_style_rect = con_border_style_rect(con);
+
+ nc->rect.height -= border_style_rect.height;
+ nc->rect.width -= border_style_rect.width;
+
+ /* Add some more pixels for the title bar */
+ if(con_border_style(con) == BS_NORMAL)
+ nc->rect.height += deco_height;
/* Honor the X11 border */
nc->rect.height += con->border_width * 2;
DLOG("Floating rect: (%d, %d) with %d x %d\n", nc->rect.x, nc->rect.y, nc->rect.width, nc->rect.height);
- /* 3: attach the child to the new parent container */
- con->parent = nc;
- con->percent = 1.0;
- con->floating = FLOATING_USER_ON;
-
- /* 4: set the border style as specified with new_float */
- if (automatic)
- con->border_style = config.default_floating_border;
-
/* 5: Subtract the deco_height in order to make the floating window appear
* at precisely the position it specified in its original geometry (which
* is what applications might remember). */
confine_to, border_t border, callback_t callback, const void *extra)
{
uint32_t new_x, new_y;
- Rect old_rect;
+ Rect old_rect = { 0, 0, 0, 0 };
if (con != NULL)
memcpy(&old_rect, &(con->rect), sizeof(Rect));