aboutsummaryrefslogtreecommitdiff
path: root/sway/tree
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-05-20 15:34:08 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-05-21 20:16:56 +1000
commit5ab4930185d32c5ac1adbf56f7b74525a2bab98d (patch)
treeb81bf4c3de475720770c567639f0d9459a307fe9 /sway/tree
parent4672cb7ccfcba0c628e4f04cc1abcad7d769bb3d (diff)
downloadsway-5ab4930185d32c5ac1adbf56f7b74525a2bab98d.tar.xz
Fix tab border issues
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/view.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 51316507..64597c02 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -167,32 +167,53 @@ void view_autoconfigure(struct sway_view *view) {
double x, y, width, height;
x = y = width = height = 0;
+ double y_offset = 0;
+
+ // In a tabbed or stacked container, the swayc's y is the top of the title
+ // 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->border_thickness * 2 + config->font_height;
+ view->border_top = 0;
+ } else if (view->swayc->parent->layout == L_STACKED) {
+ y_offset = config->border_thickness * 2 + config->font_height;
+ y_offset *= view->swayc->parent->children->length;
+ view->border_top = 0;
+ }
+
switch (view->border) {
case B_NONE:
x = view->swayc->x;
- y = view->swayc->y;
+ y = view->swayc->y + y_offset;
width = view->swayc->width;
- height = view->swayc->height;
+ height = view->swayc->height - y_offset;
break;
case B_PIXEL:
x = view->swayc->x + view->border_thickness * view->border_left;
- y = view->swayc->y + view->border_thickness * view->border_top;
+ y = view->swayc->y + view->border_thickness * view->border_top + y_offset;
width = view->swayc->width
- view->border_thickness * view->border_left
- view->border_thickness * view->border_right;
- height = view->swayc->height
+ height = view->swayc->height - y_offset
- view->border_thickness * view->border_top
- view->border_thickness * view->border_bottom;
break;
case B_NORMAL:
// Height is: border + title height + border + view height + border
x = view->swayc->x + view->border_thickness * view->border_left;
- y = view->swayc->y + config->font_height + view->border_thickness * 2;
width = view->swayc->width
- view->border_thickness * view->border_left
- view->border_thickness * view->border_right;
- height = view->swayc->height - config->font_height
- - view->border_thickness * (2 + view->border_bottom);
+ if (y_offset) {
+ y = view->swayc->y + y_offset;
+ height = view->swayc->height - y_offset
+ - view->border_thickness * view->border_bottom;
+ } else {
+ y = view->swayc->y + config->font_height + view->border_thickness * 2
+ + y_offset;
+ height = view->swayc->height - config->font_height
+ - view->border_thickness * (2 + view->border_bottom);
+ }
break;
}