mirror of
https://github.com/swaywm/sway.git
synced 2024-11-24 00:41:28 +00:00
container: Only give a titlebar height for normal borders
Closes: https://github.com/swaywm/sway/issues/7409
This commit is contained in:
parent
dcb142bf5e
commit
375eb9abb9
|
@ -193,7 +193,7 @@ void container_update_representation(struct sway_container *container);
|
||||||
/**
|
/**
|
||||||
* Return the height of a regular title bar.
|
* 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,
|
void floating_calculate_constraints(int *min_width, int *max_width,
|
||||||
int *min_height, int *max_height);
|
int *min_height, int *max_height);
|
||||||
|
|
|
@ -288,7 +288,7 @@ static void arrange_container(struct sway_container *con,
|
||||||
static void arrange_children(enum sway_container_layout layout, list_t *children,
|
static void arrange_children(enum sway_container_layout layout, list_t *children,
|
||||||
struct sway_container *active, struct wlr_scene_tree *content,
|
struct sway_container *active, struct wlr_scene_tree *content,
|
||||||
int width, int height, int gaps) {
|
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) {
|
if (layout == L_TABBED) {
|
||||||
struct sway_container *first = children->length == 1 ?
|
struct sway_container *first = children->length == 1 ?
|
||||||
|
@ -389,7 +389,7 @@ static void arrange_container(struct sway_container *con,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (con->view) {
|
if (con->view) {
|
||||||
int border_top = container_titlebar_height();
|
int border_top = container_titlebar_height(con);
|
||||||
int border_width = con->current.border_thickness;
|
int border_width = con->current.border_thickness;
|
||||||
|
|
||||||
if (title_bar && con->current.border != B_NORMAL) {
|
if (title_bar && con->current.border != B_NORMAL) {
|
||||||
|
|
|
@ -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 wlr_cursor *cursor, struct wlr_box *title_box, bool *after) {
|
||||||
struct sway_container *con = node->sway_container;
|
struct sway_container *con = node->sway_container;
|
||||||
struct sway_node *parent = &con->pending.parent->node;
|
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;
|
struct wlr_box box;
|
||||||
int n_children, avoid_index;
|
int n_children, avoid_index;
|
||||||
enum sway_container_layout layout =
|
enum sway_container_layout layout =
|
||||||
|
|
|
@ -68,7 +68,7 @@ static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec) {
|
||||||
}
|
}
|
||||||
double border_height = 0.0;
|
double border_height = 0.0;
|
||||||
if (con->current.border == B_NORMAL) {
|
if (con->current.border == B_NORMAL) {
|
||||||
border_height += container_titlebar_height();
|
border_height += container_titlebar_height(con);
|
||||||
border_height += state->border_thickness;
|
border_height += state->border_thickness;
|
||||||
} else if (con->current.border == B_PIXEL) {
|
} else if (con->current.border == B_PIXEL) {
|
||||||
border_height += state->border_thickness * 2;
|
border_height += state->border_thickness * 2;
|
||||||
|
|
|
@ -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->y = c->pending.y - c->pending.workspace->y;
|
||||||
}
|
}
|
||||||
deco_rect->width = c->pending.width;
|
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 (!container_is_floating(c)) {
|
||||||
if (parent_layout == L_TABBED) {
|
if (parent_layout == L_TABBED) {
|
||||||
|
|
|
@ -176,7 +176,7 @@ static void apply_tabbed_layout(list_t *children, struct wlr_box *parent) {
|
||||||
}
|
}
|
||||||
for (int i = 0; i < children->length; ++i) {
|
for (int i = 0; i < children->length; ++i) {
|
||||||
struct sway_container *child = children->items[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.x = parent->x;
|
||||||
child->pending.y = parent->y + parent_offset;
|
child->pending.y = parent->y + parent_offset;
|
||||||
child->pending.width = parent->width;
|
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) {
|
for (int i = 0; i < children->length; ++i) {
|
||||||
struct sway_container *child = children->items[i];
|
struct sway_container *child = children->items[i];
|
||||||
int parent_offset = child->view ? 0 :
|
int parent_offset = child->view ? 0 :
|
||||||
container_titlebar_height() * children->length;
|
container_titlebar_height(child) * children->length;
|
||||||
child->pending.x = parent->x;
|
child->pending.x = parent->x;
|
||||||
child->pending.y = parent->y + parent_offset;
|
child->pending.y = parent->y + parent_offset;
|
||||||
child->pending.width = parent->width;
|
child->pending.width = parent->width;
|
||||||
|
|
|
@ -332,7 +332,7 @@ void container_arrange_title_bar(struct sway_container *con) {
|
||||||
enum alignment title_align = config->title_align;
|
enum alignment title_align = config->title_align;
|
||||||
int marks_buffer_width = 0;
|
int marks_buffer_width = 0;
|
||||||
int width = con->title_width;
|
int width = con->title_width;
|
||||||
int height = container_titlebar_height();
|
int height = container_titlebar_height(con);
|
||||||
|
|
||||||
pixman_region32_t text_area;
|
pixman_region32_t text_area;
|
||||||
pixman_region32_init(&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) {
|
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;
|
return config->font_height + config->titlebar_v_padding * 2;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void floating_calculate_constraints(int *min_width, int *max_width,
|
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) {
|
if (con->pending.border != B_CSD && !con->pending.fullscreen_mode) {
|
||||||
border_width = con->pending.border_thickness * (con->pending.border != B_NONE);
|
border_width = con->pending.border_thickness * (con->pending.border != B_NONE);
|
||||||
top = con->pending.border == B_NORMAL ?
|
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;
|
con->pending.x = con->pending.content_x - border_width;
|
||||||
|
|
|
@ -316,10 +316,10 @@ void view_autoconfigure(struct sway_view *view) {
|
||||||
if (show_titlebar) {
|
if (show_titlebar) {
|
||||||
enum sway_container_layout layout = container_parent_layout(con);
|
enum sway_container_layout layout = container_parent_layout(con);
|
||||||
if (layout == L_TABBED) {
|
if (layout == L_TABBED) {
|
||||||
y_offset = container_titlebar_height();
|
y_offset = container_titlebar_height(con);
|
||||||
con->pending.border_top = false;
|
con->pending.border_top = false;
|
||||||
} else if (layout == L_STACKED) {
|
} 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;
|
con->pending.border_top = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -356,8 +356,8 @@ void view_autoconfigure(struct sway_view *view) {
|
||||||
height = con->pending.height - y_offset
|
height = con->pending.height - y_offset
|
||||||
- con->pending.border_thickness * con->pending.border_bottom;
|
- con->pending.border_thickness * con->pending.border_bottom;
|
||||||
} else {
|
} else {
|
||||||
y = con->pending.y + container_titlebar_height();
|
y = con->pending.y + container_titlebar_height(con);
|
||||||
height = con->pending.height - container_titlebar_height()
|
height = con->pending.height - container_titlebar_height(con)
|
||||||
- con->pending.border_thickness * con->pending.border_bottom;
|
- con->pending.border_thickness * con->pending.border_bottom;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue