aboutsummaryrefslogtreecommitdiff
path: root/sway/tree/view.c
diff options
context:
space:
mode:
authorRyan Dwyer <RyanDwyer@users.noreply.github.com>2018-10-02 08:57:55 +1000
committerGitHub <noreply@github.com>2018-10-02 08:57:55 +1000
commitb542c5413efdbbe0bbf3be0196fe566b8c6bb07f (patch)
tree6b9f56b3700dda60efdaff4446fc684009490b5b /sway/tree/view.c
parent9956a1a9ab7141da813e8db63adb7b800958400b (diff)
parent82559c16c701aa912b341ecbbd116c2992c5e698 (diff)
Merge pull request #2739 from RedSoxFan/fix-2653
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;