diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 93f6bfbb..9a9e9ed8 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h @@ -193,7 +193,7 @@ void container_update_representation(struct sway_container *container); /** * Return the height of a regular title bar. */ -size_t container_titlebar_height(void); +size_t container_titlebar_height(struct sway_container *container); void floating_calculate_constraints(int *min_width, int *max_width, int *min_height, int *max_height); diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index 042141ab..266a841b 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c @@ -288,7 +288,7 @@ static void arrange_container(struct sway_container *con, static void arrange_children(enum sway_container_layout layout, list_t *children, struct sway_container *active, struct wlr_scene_tree *content, int width, int height, int gaps) { - int title_bar_height = container_titlebar_height(); + int title_bar_height = container_titlebar_height(active); if (layout == L_TABBED) { struct sway_container *first = children->length == 1 ? @@ -389,7 +389,7 @@ static void arrange_container(struct sway_container *con, } if (con->view) { - int border_top = container_titlebar_height(); + int border_top = container_titlebar_height(con); int border_width = con->current.border_thickness; if (title_bar && con->current.border != B_NORMAL) { diff --git a/sway/input/seatop_move_tiling.c b/sway/input/seatop_move_tiling.c index c525b77a..b983f49e 100644 --- a/sway/input/seatop_move_tiling.c +++ b/sway/input/seatop_move_tiling.c @@ -118,7 +118,7 @@ static bool split_titlebar(struct sway_node *node, struct sway_container *avoid, struct wlr_cursor *cursor, struct wlr_box *title_box, bool *after) { struct sway_container *con = node->sway_container; struct sway_node *parent = &con->pending.parent->node; - int title_height = container_titlebar_height(); + int title_height = container_titlebar_height(con); struct wlr_box box; int n_children, avoid_index; enum sway_container_layout layout = diff --git a/sway/input/seatop_resize_floating.c b/sway/input/seatop_resize_floating.c index bec86e33..da6e22f1 100644 --- a/sway/input/seatop_resize_floating.c +++ b/sway/input/seatop_resize_floating.c @@ -68,7 +68,7 @@ static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec) { } double border_height = 0.0; if (con->current.border == B_NORMAL) { - border_height += container_titlebar_height(); + border_height += container_titlebar_height(con); border_height += state->border_thickness; } else if (con->current.border == B_PIXEL) { border_height += state->border_thickness * 2; diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 81ca3483..46593381 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c @@ -549,7 +549,7 @@ static void get_deco_rect(struct sway_container *c, struct wlr_box *deco_rect) { deco_rect->y = c->pending.y - c->pending.workspace->y; } deco_rect->width = c->pending.width; - deco_rect->height = container_titlebar_height(); + deco_rect->height = container_titlebar_height(c); if (!container_is_floating(c)) { if (parent_layout == L_TABBED) { diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c index d4003fe6..e0d22ec5 100644 --- a/sway/tree/arrange.c +++ b/sway/tree/arrange.c @@ -176,7 +176,7 @@ static void apply_tabbed_layout(list_t *children, struct wlr_box *parent) { } for (int i = 0; i < children->length; ++i) { struct sway_container *child = children->items[i]; - int parent_offset = child->view ? 0 : container_titlebar_height(); + int parent_offset = child->view ? 0 : container_titlebar_height(child); child->pending.x = parent->x; child->pending.y = parent->y + parent_offset; child->pending.width = parent->width; @@ -191,7 +191,7 @@ static void apply_stacked_layout(list_t *children, struct wlr_box *parent) { for (int i = 0; i < children->length; ++i) { struct sway_container *child = children->items[i]; int parent_offset = child->view ? 0 : - container_titlebar_height() * children->length; + container_titlebar_height(child) * children->length; child->pending.x = parent->x; child->pending.y = parent->y + parent_offset; child->pending.width = parent->width; diff --git a/sway/tree/container.c b/sway/tree/container.c index 9224b4fb..e734025e 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -332,7 +332,7 @@ void container_arrange_title_bar(struct sway_container *con) { enum alignment title_align = config->title_align; int marks_buffer_width = 0; int width = con->title_width; - int height = container_titlebar_height(); + int height = container_titlebar_height(con); pixman_region32_t text_area; pixman_region32_init(&text_area); @@ -721,8 +721,13 @@ void container_update_representation(struct sway_container *con) { } } -size_t container_titlebar_height(void) { - return config->font_height + config->titlebar_v_padding * 2; +size_t container_titlebar_height(struct sway_container *con) { + if(con != NULL && con->pending.border == B_NORMAL) + { + return config->font_height + config->titlebar_v_padding * 2; + } else { + return 0; + } } void floating_calculate_constraints(int *min_width, int *max_width, @@ -977,7 +982,7 @@ void container_set_geometry_from_content(struct sway_container *con) { if (con->pending.border != B_CSD && !con->pending.fullscreen_mode) { border_width = con->pending.border_thickness * (con->pending.border != B_NONE); top = con->pending.border == B_NORMAL ? - container_titlebar_height() : border_width; + container_titlebar_height(con) : border_width; } con->pending.x = con->pending.content_x - border_width; diff --git a/sway/tree/view.c b/sway/tree/view.c index 35b4b73f..171cef41 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -316,10 +316,10 @@ void view_autoconfigure(struct sway_view *view) { if (show_titlebar) { enum sway_container_layout layout = container_parent_layout(con); if (layout == L_TABBED) { - y_offset = container_titlebar_height(); + y_offset = container_titlebar_height(con); con->pending.border_top = false; } else if (layout == L_STACKED) { - y_offset = container_titlebar_height() * siblings->length; + y_offset = container_titlebar_height(con) * siblings->length; con->pending.border_top = false; } } @@ -356,8 +356,8 @@ void view_autoconfigure(struct sway_view *view) { height = con->pending.height - y_offset - con->pending.border_thickness * con->pending.border_bottom; } else { - y = con->pending.y + container_titlebar_height(); - height = con->pending.height - container_titlebar_height() + y = con->pending.y + container_titlebar_height(con); + height = con->pending.height - container_titlebar_height(con) - con->pending.border_thickness * con->pending.border_bottom; } break;