diff options
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r-- | sway/tree/view.c | 56 |
1 files changed, 46 insertions, 10 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c index afd7eade..c2496f0d 100644 --- a/sway/tree/view.c +++ b/sway/tree/view.c | |||
@@ -100,6 +100,9 @@ void view_autoconfigure(struct sway_view *view) { | |||
100 | return; | 100 | return; |
101 | } | 101 | } |
102 | 102 | ||
103 | struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE); | ||
104 | int other_views = ws->children->length - 1; | ||
105 | |||
103 | double x, y, width, height; | 106 | double x, y, width, height; |
104 | x = y = width = height = 0; | 107 | x = y = width = height = 0; |
105 | switch (view->border) { | 108 | switch (view->border) { |
@@ -110,18 +113,51 @@ void view_autoconfigure(struct sway_view *view) { | |||
110 | height = view->swayc->height; | 113 | height = view->swayc->height; |
111 | break; | 114 | break; |
112 | case B_PIXEL: | 115 | case B_PIXEL: |
113 | x = view->swayc->x + view->border_thickness; | 116 | if (view->swayc->layout > L_VERT |
114 | y = view->swayc->y + view->border_thickness; | 117 | || config->hide_edge_borders == E_NONE |
115 | width = view->swayc->width - view->border_thickness * 2; | 118 | || config->hide_edge_borders == E_HORIZONTAL |
116 | height = view->swayc->height - view->border_thickness * 2; | 119 | || (config->hide_edge_borders == E_SMART && other_views)) { |
120 | x = view->swayc->x + view->border_thickness; | ||
121 | width = view->swayc->width - view->border_thickness * 2; | ||
122 | } else { | ||
123 | x = view->swayc->x; | ||
124 | width = view->swayc->width; | ||
125 | } | ||
126 | if (view->swayc->layout > L_VERT | ||
127 | || config->hide_edge_borders == E_NONE | ||
128 | || config->hide_edge_borders == E_VERTICAL | ||
129 | || (config->hide_edge_borders == E_SMART && other_views)) { | ||
130 | y = view->swayc->y + view->border_thickness; | ||
131 | height = view->swayc->height - view->border_thickness * 2; | ||
132 | } else { | ||
133 | y = view->swayc->y; | ||
134 | height = view->swayc->height; | ||
135 | } | ||
117 | break; | 136 | break; |
118 | case B_NORMAL: | 137 | case B_NORMAL: |
119 | // Height is: border + title height + border + view height + border | 138 | if (view->swayc->layout > L_VERT |
120 | x = view->swayc->x + view->border_thickness; | 139 | || config->hide_edge_borders == E_NONE |
121 | y = view->swayc->y + config->font_height + view->border_thickness * 2; | 140 | || config->hide_edge_borders == E_HORIZONTAL |
122 | width = view->swayc->width - view->border_thickness * 2; | 141 | || (config->hide_edge_borders == E_SMART && other_views)) { |
123 | height = view->swayc->height - config->font_height | 142 | x = view->swayc->x + view->border_thickness; |
124 | - view->border_thickness * 3; | 143 | width = view->swayc->width - view->border_thickness * 2; |
144 | } else { | ||
145 | x = view->swayc->x; | ||
146 | width = view->swayc->width; | ||
147 | } | ||
148 | if (view->swayc->layout > L_VERT | ||
149 | || config->hide_edge_borders == E_NONE | ||
150 | || config->hide_edge_borders == E_VERTICAL | ||
151 | || (config->hide_edge_borders == E_SMART && other_views)) { | ||
152 | // Height is: border + title height + border + view height + border | ||
153 | y = view->swayc->y + config->font_height | ||
154 | + view->border_thickness * 2; | ||
155 | height = view->swayc->height - config->font_height | ||
156 | - view->border_thickness * 3; | ||
157 | } else { | ||
158 | y = view->swayc->y; | ||
159 | height = view->swayc->height; | ||
160 | } | ||
125 | break; | 161 | break; |
126 | } | 162 | } |
127 | 163 | ||