diff options
author | 2016-03-30 10:09:08 +0200 | |
---|---|---|
committer | 2016-03-30 10:09:08 +0200 | |
commit | 0af55539a8afe38fa1a1beb6af15b0891030985a (patch) | |
tree | 81d85ab77ff632b2af0c511b94e9479f9abd0e28 /sway/layout.c | |
parent | Update window title when it changes (diff) | |
download | sway-0af55539a8afe38fa1a1beb6af15b0891030985a.tar.gz sway-0af55539a8afe38fa1a1beb6af15b0891030985a.tar.zst sway-0af55539a8afe38fa1a1beb6af15b0891030985a.zip |
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) { | |||
374 | update_visibility(src_op); | 374 | update_visibility(src_op); |
375 | } | 375 | } |
376 | 376 | ||
377 | static void update_border_geometry_floating(swayc_t *c, struct wlc_geometry *geometry) { | ||
378 | struct wlc_geometry g = *geometry; | ||
379 | c->actual_geometry = g; | ||
380 | |||
381 | switch (c->border_type) { | ||
382 | case B_NONE: | ||
383 | break; | ||
384 | case B_PIXEL: | ||
385 | g.origin.x -= c->border_thickness; | ||
386 | g.origin.y -= c->border_thickness; | ||
387 | g.size.w += (c->border_thickness * 2); | ||
388 | g.size.h += (c->border_thickness * 2); | ||
389 | break; | ||
390 | case B_NORMAL: | ||
391 | g.origin.x -= c->border_thickness; | ||
392 | uint32_t title_bar_height = config->font_height + 4; // borders + padding | ||
393 | g.origin.y -= title_bar_height; | ||
394 | g.size.w += (c->border_thickness * 2); | ||
395 | g.size.h += (c->border_thickness + title_bar_height); | ||
396 | |||
397 | struct wlc_geometry title_bar = { | ||
398 | .origin = { | ||
399 | .x = g.origin.x, | ||
400 | .y = g.origin.y | ||
401 | }, | ||
402 | .size = { | ||
403 | .w = g.size.w, | ||
404 | .h = title_bar_height | ||
405 | } | ||
406 | }; | ||
407 | c->title_bar_geometry = title_bar; | ||
408 | break; | ||
409 | } | ||
410 | |||
411 | c->border_geometry = g; | ||
412 | *geometry = c->actual_geometry; | ||
413 | |||
414 | update_view_border(c); | ||
415 | } | ||
416 | |||
377 | void update_geometry(swayc_t *container) { | 417 | void update_geometry(swayc_t *container) { |
378 | if (container->type != C_VIEW) { | 418 | if (container->type != C_VIEW) { |
379 | return; | 419 | return; |
@@ -431,8 +471,9 @@ void update_geometry(swayc_t *container) { | |||
431 | if (swayc_is_fullscreen(container)) { | 471 | if (swayc_is_fullscreen(container)) { |
432 | container->border_geometry = (const struct wlc_geometry){0}; | 472 | container->border_geometry = (const struct wlc_geometry){0}; |
433 | container->title_bar_geometry = (const struct wlc_geometry){0}; | 473 | container->title_bar_geometry = (const struct wlc_geometry){0}; |
434 | } else { | 474 | } else if (container->is_floating) { // allocate border for floating window |
435 | // make room for border | 475 | update_border_geometry_floating(container, &geometry); |
476 | } else if (!container->is_floating) { // allocate border for titled window | ||
436 | container->border_geometry = geometry; | 477 | container->border_geometry = geometry; |
437 | 478 | ||
438 | int border_top = container->border_thickness; | 479 | int border_top = container->border_thickness; |