aboutsummaryrefslogtreecommitdiff
path: root/sway/tree/view.c
diff options
context:
space:
mode:
authorBrian Ashworth <bosrsf04@gmail.com>2018-10-01 09:41:15 -0400
committerBrian Ashworth <bosrsf04@gmail.com>2018-10-01 09:41:15 -0400
commit742d1764a6fb1fb9269dc9ffe08319da98f4d7b8 (patch)
tree9a9dbe4dd968f78e728496a33e17bf695c773dcd /sway/tree/view.c
parent51f68e10ad8bd42925dda24d06a6f6fccf3e6a39 (diff)
Fix smart gaps
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r--sway/tree/view.c36
1 files changed, 19 insertions, 17 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index a024f325..3b271159 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -162,6 +162,23 @@ uint32_t view_configure(struct sway_view *view, double lx, double ly, int width,
return 0;
}
+bool view_is_only_visible(struct sway_view *view) {
+ bool only_view = true;
+ struct sway_container *con = view->container;
+ while (con) {
+ enum sway_container_layout layout = container_parent_layout(con);
+ if (layout != L_TABBED && layout != L_STACKED) {
+ list_t *siblings = container_get_siblings(con);
+ if (siblings && siblings->length > 1) {
+ only_view = false;
+ break;
+ }
+ }
+ con = con->parent;
+ }
+ return only_view;
+}
+
void view_autoconfigure(struct sway_view *view) {
if (!view->container->workspace) {
// Hidden in the scratchpad
@@ -178,24 +195,9 @@ void view_autoconfigure(struct sway_view *view) {
}
struct sway_workspace *ws = view->container->workspace;
-
- bool other_views = false;
- if (config->hide_edge_borders == E_SMART) {
- struct sway_container *con = view->container;
- while (con) {
- enum sway_container_layout layout = container_parent_layout(con);
- if (layout != L_TABBED && layout != L_STACKED) {
- list_t *siblings = container_get_siblings(con);
- if (siblings && siblings->length > 1) {
- other_views = true;
- break;
- }
- }
- con = con->parent;
- }
- }
-
struct sway_container *con = view->container;
+ bool other_views = config->hide_edge_borders == E_SMART ?
+ !view_is_only_visible(view) : false;
view->border_top = view->border_bottom = true;
view->border_left = view->border_right = true;