diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-08-28 10:03:52 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-28 10:03:52 -0400 |
commit | 83230435f72dd73838bd064c22268ef4ee25e3e6 (patch) | |
tree | 7cdac6c37f6ad87c056690bdeac3d5ea0489668d /sway/tree/view.c | |
parent | 98ef29c22878c256dea5b4f0d1eaf556bfcb145f (diff) | |
parent | 126a82f14ff47925c7f88523ed9abe0ae9aeb7e8 (diff) | |
download | sway-83230435f72dd73838bd064c22268ef4ee25e3e6.tar.xz |
Merge pull request #2511 from RyanDwyer/refactor-arrange
Prepare arrange code for type safe arguments
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r-- | sway/tree/view.c | 35 |
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 @@ #include "log.h" #include "sway/criteria.h" #include "sway/commands.h" +#include "sway/desktop/transaction.h" #include "sway/ipc-server.h" #include "sway/output.h" #include "sway/input/seat.h" @@ -224,15 +225,13 @@ void view_autoconfigure(struct sway_view *view) { x = y = width = height = 0; double y_offset = 0; - // In a tabbed or stacked container, the swayc's y is the top of the title - // area. We have to offset the surface y by the height of the title bar, and - // disable any top border because we'll always have the title bar. - if (con->parent->layout == L_TABBED) { - y_offset = container_titlebar_height(); - view->border_top = false; - } else if (con->parent->layout == L_STACKED) { - y_offset = container_titlebar_height() * con->parent->children->length; + // In a tabbed or stacked container, the swayc's y is the bottom of the + // title area. We have to disable any top border because the title bar is + // rendered by the parent. + if (con->parent->layout == L_TABBED || con->parent->layout == L_STACKED) { view->border_top = false; + } else { + y_offset = container_titlebar_height(); } enum sway_container_border border = view->border; @@ -243,17 +242,17 @@ void view_autoconfigure(struct sway_view *view) { switch (border) { case B_NONE: x = con->x; - y = con->y + y_offset; + y = con->y; width = con->width; - height = con->height - y_offset; + height = con->height; break; case B_PIXEL: x = con->x + view->border_thickness * view->border_left; - y = con->y + view->border_thickness * view->border_top + y_offset; + y = con->y + view->border_thickness * view->border_top; width = con->width - view->border_thickness * view->border_left - view->border_thickness * view->border_right; - height = con->height - y_offset + height = con->height - view->border_thickness * view->border_top - view->border_thickness * view->border_bottom; break; @@ -263,15 +262,9 @@ void view_autoconfigure(struct sway_view *view) { width = con->width - view->border_thickness * view->border_left - view->border_thickness * view->border_right; - if (y_offset) { - y = con->y + y_offset; - height = con->height - y_offset - - view->border_thickness * view->border_bottom; - } else { - y = con->y + container_titlebar_height(); - height = con->height - container_titlebar_height() - - view->border_thickness * view->border_bottom; - } + y = con->y + y_offset; + height = con->height - y_offset + - view->border_thickness * view->border_bottom; break; } |