summaryrefslogtreecommitdiffstats
path: root/sway/layout.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/layout.c')
-rw-r--r--sway/layout.c76
1 files changed, 75 insertions, 1 deletions
diff --git a/sway/layout.c b/sway/layout.c
index be898c58..a282f36e 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -12,7 +12,7 @@
12#include "focus.h" 12#include "focus.h"
13#include "output.h" 13#include "output.h"
14#include "ipc-server.h" 14#include "ipc-server.h"
15#include "render.h" 15#include "border.h"
16 16
17swayc_t root_container; 17swayc_t root_container;
18list_t *scratchpad; 18list_t *scratchpad;
@@ -427,6 +427,80 @@ void update_geometry(swayc_t *container) {
427 geometry.size.h = ws->y + ws->height - geometry.origin.y; 427 geometry.size.h = ws->y + ws->height - geometry.origin.y;
428 } 428 }
429 } 429 }
430
431 if (swayc_is_fullscreen(container)) {
432 container->border_geometry = (const struct wlc_geometry){0};
433 container->title_bar_geometry = (const struct wlc_geometry){0};
434 } else {
435 // make room for border
436 container->border_geometry = geometry;
437
438 int border_top = container->border_thickness;
439 int border_bottom = container->border_thickness;
440 int border_left = container->border_thickness;
441 int border_right = container->border_thickness;
442
443 // handle hide_edge_borders
444 if (config->hide_edge_borders != E_NONE && gap <= 0) {
445 swayc_t *output = swayc_parent_by_type(container, C_OUTPUT);
446 const struct wlc_size *size = wlc_output_get_resolution(output->handle);
447
448 if (config->hide_edge_borders == E_HORIZONTAL || config->hide_edge_borders == E_BOTH) {
449 if (geometry.origin.x == 0) {
450 border_left = 0;
451 }
452
453 if (geometry.origin.x + geometry.size.w == size->w) {
454 border_right = 0;
455 }
456 }
457
458 if (config->hide_edge_borders == E_VERTICAL || config->hide_edge_borders == E_BOTH) {
459 if (geometry.origin.y == 0) {
460 border_top = 0;
461 }
462
463 if (geometry.origin.y + geometry.size.h == size->h) {
464 border_bottom = 0;
465 }
466 }
467 }
468
469 switch (container->border_type) {
470 case B_NONE:
471 break;
472 case B_PIXEL:
473 geometry.origin.x += border_left;
474 geometry.origin.y += border_top;
475 geometry.size.w -= (border_left + border_right);
476 geometry.size.h -= (border_top + border_bottom);
477 break;
478 case B_NORMAL:
479 {
480 struct wlc_geometry title_bar = {
481 .origin = {
482 .x = container->border_geometry.origin.x,
483 .y = container->border_geometry.origin.y
484 },
485 .size = {
486 .w = container->border_geometry.size.w,
487 .h = config->font_height + 4 // borders + padding
488 }
489 };
490 geometry.origin.x += border_left;
491 geometry.origin.y += title_bar.size.h;
492 geometry.size.w -= (border_left + border_right);
493 geometry.size.h -= (border_bottom + title_bar.size.h);
494 container->title_bar_geometry = title_bar;
495 break;
496 }
497 }
498
499 container->actual_geometry = geometry;
500
501 update_view_border(container);
502 }
503
430 wlc_view_set_geometry(container->handle, 0, &geometry); 504 wlc_view_set_geometry(container->handle, 0, &geometry);
431} 505}
432 506