summaryrefslogtreecommitdiffstats
path: root/sway/tree/view.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r--sway/tree/view.c35
1 files changed, 14 insertions, 21 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 2870d4f5..1a98c5f2 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -13,6 +13,7 @@
13#include "log.h" 13#include "log.h"
14#include "sway/criteria.h" 14#include "sway/criteria.h"
15#include "sway/commands.h" 15#include "sway/commands.h"
16#include "sway/desktop/transaction.h"
16#include "sway/ipc-server.h" 17#include "sway/ipc-server.h"
17#include "sway/output.h" 18#include "sway/output.h"
18#include "sway/input/seat.h" 19#include "sway/input/seat.h"
@@ -224,15 +225,13 @@ void view_autoconfigure(struct sway_view *view) {
224 x = y = width = height = 0; 225 x = y = width = height = 0;
225 double y_offset = 0; 226 double y_offset = 0;
226 227
227 // In a tabbed or stacked container, the swayc's y is the top of the title 228 // In a tabbed or stacked container, the swayc's y is the bottom of the
228 // area. We have to offset the surface y by the height of the title bar, and 229 // title area. We have to disable any top border because the title bar is
229 // disable any top border because we'll always have the title bar. 230 // rendered by the parent.
230 if (con->parent->layout == L_TABBED) { 231 if (con->parent->layout == L_TABBED || con->parent->layout == L_STACKED) {
231 y_offset = container_titlebar_height();
232 view->border_top = false;
233 } else if (con->parent->layout == L_STACKED) {
234 y_offset = container_titlebar_height() * con->parent->children->length;
235 view->border_top = false; 232 view->border_top = false;
233 } else {
234 y_offset = container_titlebar_height();
236 } 235 }
237 236
238 enum sway_container_border border = view->border; 237 enum sway_container_border border = view->border;
@@ -243,17 +242,17 @@ void view_autoconfigure(struct sway_view *view) {
243 switch (border) { 242 switch (border) {
244 case B_NONE: 243 case B_NONE:
245 x = con->x; 244 x = con->x;
246 y = con->y + y_offset; 245 y = con->y;
247 width = con->width; 246 width = con->width;
248 height = con->height - y_offset; 247 height = con->height;
249 break; 248 break;
250 case B_PIXEL: 249 case B_PIXEL:
251 x = con->x + view->border_thickness * view->border_left; 250 x = con->x + view->border_thickness * view->border_left;
252 y = con->y + view->border_thickness * view->border_top + y_offset; 251 y = con->y + view->border_thickness * view->border_top;
253 width = con->width 252 width = con->width
254 - view->border_thickness * view->border_left 253 - view->border_thickness * view->border_left
255 - view->border_thickness * view->border_right; 254 - view->border_thickness * view->border_right;
256 height = con->height - y_offset 255 height = con->height
257 - view->border_thickness * view->border_top 256 - view->border_thickness * view->border_top
258 - view->border_thickness * view->border_bottom; 257 - view->border_thickness * view->border_bottom;
259 break; 258 break;
@@ -263,15 +262,9 @@ void view_autoconfigure(struct sway_view *view) {
263 width = con->width 262 width = con->width
264 - view->border_thickness * view->border_left 263 - view->border_thickness * view->border_left
265 - view->border_thickness * view->border_right; 264 - view->border_thickness * view->border_right;
266 if (y_offset) { 265 y = con->y + y_offset;
267 y = con->y + y_offset; 266 height = con->height - y_offset
268 height = con->height - y_offset 267 - view->border_thickness * view->border_bottom;
269 - view->border_thickness * view->border_bottom;
270 } else {
271 y = con->y + container_titlebar_height();
272 height = con->height - container_titlebar_height()
273 - view->border_thickness * view->border_bottom;
274 }
275 break; 268 break;
276 } 269 }
277 270