diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-20 15:34:08 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-05-21 20:16:56 +1000 |
commit | 5ab4930185d32c5ac1adbf56f7b74525a2bab98d (patch) | |
tree | b81bf4c3de475720770c567639f0d9459a307fe9 /sway/tree/view.c | |
parent | Use class or app_id in tree representation (diff) | |
download | sway-5ab4930185d32c5ac1adbf56f7b74525a2bab98d.tar.gz sway-5ab4930185d32c5ac1adbf56f7b74525a2bab98d.tar.zst sway-5ab4930185d32c5ac1adbf56f7b74525a2bab98d.zip |
Fix tab border issues
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r-- | sway/tree/view.c | 35 |
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) { | |||
167 | 167 | ||
168 | double x, y, width, height; | 168 | double x, y, width, height; |
169 | x = y = width = height = 0; | 169 | x = y = width = height = 0; |
170 | double y_offset = 0; | ||
171 | |||
172 | // In a tabbed or stacked container, the swayc's y is the top of the title | ||
173 | // area. We have to offset the surface y by the height of the title bar, and | ||
174 | // disable any top border because we'll always have the title bar. | ||
175 | if (view->swayc->parent->layout == L_TABBED) { | ||
176 | y_offset = config->border_thickness * 2 + config->font_height; | ||
177 | view->border_top = 0; | ||
178 | } else if (view->swayc->parent->layout == L_STACKED) { | ||
179 | y_offset = config->border_thickness * 2 + config->font_height; | ||
180 | y_offset *= view->swayc->parent->children->length; | ||
181 | view->border_top = 0; | ||
182 | } | ||
183 | |||
170 | switch (view->border) { | 184 | switch (view->border) { |
171 | case B_NONE: | 185 | case B_NONE: |
172 | x = view->swayc->x; | 186 | x = view->swayc->x; |
173 | y = view->swayc->y; | 187 | y = view->swayc->y + y_offset; |
174 | width = view->swayc->width; | 188 | width = view->swayc->width; |
175 | height = view->swayc->height; | 189 | height = view->swayc->height - y_offset; |
176 | break; | 190 | break; |
177 | case B_PIXEL: | 191 | case B_PIXEL: |
178 | x = view->swayc->x + view->border_thickness * view->border_left; | 192 | x = view->swayc->x + view->border_thickness * view->border_left; |
179 | y = view->swayc->y + view->border_thickness * view->border_top; | 193 | y = view->swayc->y + view->border_thickness * view->border_top + y_offset; |
180 | width = view->swayc->width | 194 | width = view->swayc->width |
181 | - view->border_thickness * view->border_left | 195 | - view->border_thickness * view->border_left |
182 | - view->border_thickness * view->border_right; | 196 | - view->border_thickness * view->border_right; |
183 | height = view->swayc->height | 197 | height = view->swayc->height - y_offset |
184 | - view->border_thickness * view->border_top | 198 | - view->border_thickness * view->border_top |
185 | - view->border_thickness * view->border_bottom; | 199 | - view->border_thickness * view->border_bottom; |
186 | break; | 200 | break; |
187 | case B_NORMAL: | 201 | case B_NORMAL: |
188 | // Height is: border + title height + border + view height + border | 202 | // Height is: border + title height + border + view height + border |
189 | x = view->swayc->x + view->border_thickness * view->border_left; | 203 | x = view->swayc->x + view->border_thickness * view->border_left; |
190 | y = view->swayc->y + config->font_height + view->border_thickness * 2; | ||
191 | width = view->swayc->width | 204 | width = view->swayc->width |
192 | - view->border_thickness * view->border_left | 205 | - view->border_thickness * view->border_left |
193 | - view->border_thickness * view->border_right; | 206 | - view->border_thickness * view->border_right; |
194 | height = view->swayc->height - config->font_height | 207 | if (y_offset) { |
195 | - view->border_thickness * (2 + view->border_bottom); | 208 | y = view->swayc->y + y_offset; |
209 | height = view->swayc->height - y_offset | ||
210 | - view->border_thickness * view->border_bottom; | ||
211 | } else { | ||
212 | y = view->swayc->y + config->font_height + view->border_thickness * 2 | ||
213 | + y_offset; | ||
214 | height = view->swayc->height - config->font_height | ||
215 | - view->border_thickness * (2 + view->border_bottom); | ||
216 | } | ||
196 | break; | 217 | break; |
197 | } | 218 | } |
198 | 219 | ||