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 | Implement stacked layout (diff) | |
download | sway-f6c3682c05bce05f00b13b8f469b52923ecd8ddb.tar.gz sway-f6c3682c05bce05f00b13b8f469b52923ecd8ddb.tar.zst sway-f6c3682c05bce05f00b13b8f469b52923ecd8ddb.zip |
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) { | |||
88 | } | 88 | } |
89 | size_t parent_offset = 0; | 89 | size_t parent_offset = 0; |
90 | if (parent->parent->layout == L_TABBED) { | 90 | if (parent->parent->layout == L_TABBED) { |
91 | parent_offset = config->font_height + 8; | 91 | parent_offset = container_titlebar_height(); |
92 | } else if (parent->parent->layout == L_STACKED) { | 92 | } else if (parent->parent->layout == L_STACKED) { |
93 | parent_offset = (config->font_height + 8) | 93 | parent_offset = |
94 | * parent->parent->children->length; | 94 | container_titlebar_height() * parent->parent->children->length; |
95 | } | 95 | } |
96 | size_t parent_height = parent->height - parent_offset; | 96 | size_t parent_height = parent->height - parent_offset; |
97 | 97 | ||
@@ -136,10 +136,10 @@ static void apply_vert_layout(struct sway_container *parent) { | |||
136 | } | 136 | } |
137 | size_t parent_offset = 0; | 137 | size_t parent_offset = 0; |
138 | if (parent->parent->layout == L_TABBED) { | 138 | if (parent->parent->layout == L_TABBED) { |
139 | parent_offset = config->font_height + 8; | 139 | parent_offset = container_titlebar_height(); |
140 | } else if (parent->parent->layout == L_STACKED) { | 140 | } else if (parent->parent->layout == L_STACKED) { |
141 | parent_offset = (config->font_height + 8) | 141 | parent_offset = |
142 | * parent->parent->children->length; | 142 | container_titlebar_height() * parent->parent->children->length; |
143 | } | 143 | } |
144 | size_t parent_height = parent->height - parent_offset; | 144 | size_t parent_height = parent->height - parent_offset; |
145 | 145 | ||
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, | |||
510 | struct sway_seat *seat = input_manager_current_seat(input_manager); | 510 | struct sway_seat *seat = input_manager_current_seat(input_manager); |
511 | 511 | ||
512 | // Tab titles | 512 | // Tab titles |
513 | int title_height = config->border_thickness * 2 + config->font_height; | 513 | int title_height = container_titlebar_height(); |
514 | if (oy < parent->y + title_height) { | 514 | if (oy < parent->y + title_height) { |
515 | int tab_width = parent->width / parent->children->length; | 515 | int tab_width = parent->width / parent->children->length; |
516 | int child_index = (ox - parent->x) / tab_width; | 516 | int child_index = (ox - parent->x) / tab_width; |
@@ -847,3 +847,7 @@ void container_notify_child_title_changed(struct sway_container *container) { | |||
847 | container_update_title_textures(container); | 847 | container_update_title_textures(container); |
848 | container_notify_child_title_changed(container->parent); | 848 | container_notify_child_title_changed(container->parent); |
849 | } | 849 | } |
850 | |||
851 | size_t container_titlebar_height() { | ||
852 | return config->font_height + TITLEBAR_V_PADDING * 2; | ||
853 | } | ||
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) { | |||
182 | // area. We have to offset the surface y by the height of the title bar, and | 182 | // area. We have to offset the surface y by the height of the title bar, and |
183 | // disable any top border because we'll always have the title bar. | 183 | // disable any top border because we'll always have the title bar. |
184 | if (view->swayc->parent->layout == L_TABBED) { | 184 | if (view->swayc->parent->layout == L_TABBED) { |
185 | y_offset = config->font_height + 8; | 185 | y_offset = container_titlebar_height(); |
186 | view->border_top = 0; | 186 | view->border_top = 0; |
187 | } else if (view->swayc->parent->layout == L_STACKED) { | 187 | } else if (view->swayc->parent->layout == L_STACKED) { |
188 | y_offset = (config->font_height + 8) | 188 | y_offset = container_titlebar_height() |
189 | * view->swayc->parent->children->length; | 189 | * view->swayc->parent->children->length; |
190 | view->border_top = 0; | 190 | view->border_top = 0; |
191 | } | 191 | } |
@@ -218,8 +218,8 @@ void view_autoconfigure(struct sway_view *view) { | |||
218 | height = view->swayc->height - y_offset | 218 | height = view->swayc->height - y_offset |
219 | - view->border_thickness * view->border_bottom; | 219 | - view->border_thickness * view->border_bottom; |
220 | } else { | 220 | } else { |
221 | y = view->swayc->y + config->font_height + 8; | 221 | y = view->swayc->y + container_titlebar_height(); |
222 | height = view->swayc->height - config->font_height - 8 | 222 | height = view->swayc->height - container_titlebar_height() |
223 | - view->border_thickness * view->border_bottom; | 223 | - view->border_thickness * view->border_bottom; |
224 | } | 224 | } |
225 | break; | 225 | break; |