diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-22 08:27:42 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-22 08:27:42 +1000 |
commit | f6c3682c05bce05f00b13b8f469b52923ecd8ddb (patch) | |
tree | 57a109a0bef2b14ecd24a39469d52c70f6933987 /sway/tree | |
parent | 664169fbf1c4e07f17a48b2b801dad9cea31ea4c (diff) |
Use constants for titlebar dimensions
Diffstat (limited to 'sway/tree')
-rw-r--r-- | sway/tree/arrange.c | 12 | ||||
-rw-r--r-- | sway/tree/container.c | 6 | ||||
-rw-r--r-- | sway/tree/view.c | 8 |
3 files changed, 15 insertions, 11 deletions
diff --git a/sway/tree/arrange.c b/sway/tree/arrange.c index b8e07bca..37f4a066 100644 --- a/sway/tree/arrange.c +++ b/sway/tree/arrange.c @@ -88,10 +88,10 @@ static void apply_horiz_layout(struct sway_container *parent) { } size_t parent_offset = 0; if (parent->parent->layout == L_TABBED) { - parent_offset = config->font_height + 8; + parent_offset = container_titlebar_height(); } else if (parent->parent->layout == L_STACKED) { - parent_offset = (config->font_height + 8) - * parent->parent->children->length; + parent_offset = + container_titlebar_height() * parent->parent->children->length; } size_t parent_height = parent->height - parent_offset; @@ -136,10 +136,10 @@ static void apply_vert_layout(struct sway_container *parent) { } size_t parent_offset = 0; if (parent->parent->layout == L_TABBED) { - parent_offset = config->font_height + 8; + parent_offset = container_titlebar_height(); } else if (parent->parent->layout == L_STACKED) { - parent_offset = (config->font_height + 8) - * parent->parent->children->length; + parent_offset = + container_titlebar_height() * parent->parent->children->length; } size_t parent_height = parent->height - parent_offset; diff --git a/sway/tree/container.c b/sway/tree/container.c index 5d88325f..3f30a079 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -510,7 +510,7 @@ static struct sway_container *container_at_tabbed(struct sway_container *parent, struct sway_seat *seat = input_manager_current_seat(input_manager); // Tab titles - int title_height = config->border_thickness * 2 + config->font_height; + int title_height = container_titlebar_height(); if (oy < parent->y + title_height) { int tab_width = parent->width / parent->children->length; int child_index = (ox - parent->x) / tab_width; @@ -847,3 +847,7 @@ void container_notify_child_title_changed(struct sway_container *container) { container_update_title_textures(container); container_notify_child_title_changed(container->parent); } + +size_t container_titlebar_height() { + return config->font_height + TITLEBAR_V_PADDING * 2; +} diff --git a/sway/tree/view.c b/sway/tree/view.c index 1280dc8d..07157818 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c @@ -182,10 +182,10 @@ void view_autoconfigure(struct sway_view *view) { // area. We have to offset the surface y by the height of the title bar, and // disable any top border because we'll always have the title bar. if (view->swayc->parent->layout == L_TABBED) { - y_offset = config->font_height + 8; + y_offset = container_titlebar_height(); view->border_top = 0; } else if (view->swayc->parent->layout == L_STACKED) { - y_offset = (config->font_height + 8) + y_offset = container_titlebar_height() * view->swayc->parent->children->length; view->border_top = 0; } @@ -218,8 +218,8 @@ void view_autoconfigure(struct sway_view *view) { height = view->swayc->height - y_offset - view->border_thickness * view->border_bottom; } else { - y = view->swayc->y + config->font_height + 8; - height = view->swayc->height - config->font_height - 8 + y = view->swayc->y + container_titlebar_height(); + height = view->swayc->height - container_titlebar_height() - view->border_thickness * view->border_bottom; } break; |