diff options
author | Mikkel Oscar Lyderik <mikkeloscar@gmail.com> | 2016-03-30 10:09:08 +0200 |
---|---|---|
committer | Mikkel Oscar Lyderik <mikkeloscar@gmail.com> | 2016-03-30 10:09:08 +0200 |
commit | 0af55539a8afe38fa1a1beb6af15b0891030985a (patch) | |
tree | 81d85ab77ff632b2af0c511b94e9479f9abd0e28 /sway/layout.c | |
parent | 6fa6c27f3d5f0f49a050cda6c952ad2595e25f32 (diff) |
Fix borders with floating windows
Diffstat (limited to 'sway/layout.c')
-rw-r--r-- | sway/layout.c | 45 |
1 files changed, 43 insertions, 2 deletions
diff --git a/sway/layout.c b/sway/layout.c index a282f36e..3f271caf 100644 --- a/sway/layout.c +++ b/sway/layout.c @@ -374,6 +374,46 @@ void move_workspace_to(swayc_t* workspace, swayc_t* destination) { update_visibility(src_op); } +static void update_border_geometry_floating(swayc_t *c, struct wlc_geometry *geometry) { + struct wlc_geometry g = *geometry; + c->actual_geometry = g; + + switch (c->border_type) { + case B_NONE: + break; + case B_PIXEL: + g.origin.x -= c->border_thickness; + g.origin.y -= c->border_thickness; + g.size.w += (c->border_thickness * 2); + g.size.h += (c->border_thickness * 2); + break; + case B_NORMAL: + g.origin.x -= c->border_thickness; + uint32_t title_bar_height = config->font_height + 4; // borders + padding + g.origin.y -= title_bar_height; + g.size.w += (c->border_thickness * 2); + g.size.h += (c->border_thickness + title_bar_height); + + struct wlc_geometry title_bar = { + .origin = { + .x = g.origin.x, + .y = g.origin.y + }, + .size = { + .w = g.size.w, + .h = title_bar_height + } + }; + c->title_bar_geometry = title_bar; + break; + } + + c->border_geometry = g; + *geometry = c->actual_geometry; + + update_view_border(c); +} + void update_geometry(swayc_t *container) { if (container->type != C_VIEW) { return; @@ -431,8 +471,9 @@ void update_geometry(swayc_t *container) { if (swayc_is_fullscreen(container)) { container->border_geometry = (const struct wlc_geometry){0}; container->title_bar_geometry = (const struct wlc_geometry){0}; - } else { - // make room for border + } else if (container->is_floating) { // allocate border for floating window + update_border_geometry_floating(container, &geometry); + } else if (!container->is_floating) { // allocate border for titled window container->border_geometry = geometry; int border_top = container->border_thickness; |