summaryrefslogtreecommitdiffstats
path: root/sway/tree/view.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-05-14 18:10:54 -0400
committerLibravatar GitHub <noreply@github.com>2018-05-14 18:10:54 -0400
commitf1f54bbc882775d431d14f99355d339ef9dab5a8 (patch)
tree3573981aaa61ac5c86be6ce1e8ecf5e2112b8d5b /sway/tree/view.c
parentMerge pull request #1871 from emersion/kill-wl-shell (diff)
parentMerge branch 'master' into fix-1975 (diff)
downloadsway-f1f54bbc882775d431d14f99355d339ef9dab5a8.tar.gz
sway-f1f54bbc882775d431d14f99355d339ef9dab5a8.tar.zst
sway-f1f54bbc882775d431d14f99355d339ef9dab5a8.zip
Merge pull request #1978 from RedSoxFan/fix-1975
Fix #1975
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r--sway/tree/view.c81
1 files changed, 37 insertions, 44 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index e0e3c110..8da72667 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -120,8 +120,9 @@ void view_autoconfigure(struct sway_view *view) {
120 return; 120 return;
121 } 121 }
122 122
123 struct sway_container *output = container_parent(view->swayc, C_OUTPUT);
124
123 if (view->is_fullscreen) { 125 if (view->is_fullscreen) {
124 struct sway_container *output = container_parent(view->swayc, C_OUTPUT);
125 view_configure(view, 0, 0, output->width, output->height); 126 view_configure(view, 0, 0, output->width, output->height);
126 view->x = view->y = 0; 127 view->x = view->y = 0;
127 return; 128 return;
@@ -133,6 +134,25 @@ void view_autoconfigure(struct sway_view *view) {
133 other_views = container_count_descendants_of_type(ws, C_VIEW) - 1; 134 other_views = container_count_descendants_of_type(ws, C_VIEW) - 1;
134 } 135 }
135 136
137 view->border_top = view->border_bottom = true;
138 view->border_left = view->border_right = true;
139 if (view->swayc->layout != L_FLOATING) {
140 if (config->hide_edge_borders == E_BOTH
141 || config->hide_edge_borders == E_VERTICAL
142 || (config->hide_edge_borders == E_SMART && !other_views)) {
143 view->border_left = view->swayc->x != 0;
144 int right_x = view->swayc->x + view->swayc->width;
145 view->border_right = right_x != output->width;
146 }
147 if (config->hide_edge_borders == E_BOTH
148 || config->hide_edge_borders == E_HORIZONTAL
149 || (config->hide_edge_borders == E_SMART && !other_views)) {
150 view->border_top = view->swayc->y != 0;
151 int bottom_y = view->swayc->y + view->swayc->height;
152 view->border_bottom = bottom_y != output->height;
153 }
154 }
155
136 double x, y, width, height; 156 double x, y, width, height;
137 x = y = width = height = 0; 157 x = y = width = height = 0;
138 switch (view->border) { 158 switch (view->border) {
@@ -143,51 +163,24 @@ void view_autoconfigure(struct sway_view *view) {
143 height = view->swayc->height; 163 height = view->swayc->height;
144 break; 164 break;
145 case B_PIXEL: 165 case B_PIXEL:
146 if (view->swayc->layout > L_VERT 166 x = view->swayc->x + view->border_thickness * view->border_left;
147 || config->hide_edge_borders == E_NONE 167 y = view->swayc->y + view->border_thickness * view->border_top;
148 || config->hide_edge_borders == E_HORIZONTAL 168 width = view->swayc->width
149 || (config->hide_edge_borders == E_SMART && other_views)) { 169 - view->border_thickness * view->border_left
150 x = view->swayc->x + view->border_thickness; 170 - view->border_thickness * view->border_right;
151 width = view->swayc->width - view->border_thickness * 2; 171 height = view->swayc->height
152 } else { 172 - view->border_thickness * view->border_top
153 x = view->swayc->x; 173 - view->border_thickness * view->border_bottom;
154 width = view->swayc->width;
155 }
156 if (view->swayc->layout > L_VERT
157 || config->hide_edge_borders == E_NONE
158 || config->hide_edge_borders == E_VERTICAL
159 || (config->hide_edge_borders == E_SMART && other_views)) {
160 y = view->swayc->y + view->border_thickness;
161 height = view->swayc->height - view->border_thickness * 2;
162 } else {
163 y = view->swayc->y;
164 height = view->swayc->height;
165 }
166 break; 174 break;
167 case B_NORMAL: 175 case B_NORMAL:
168 if (view->swayc->layout > L_VERT 176 // Height is: border + title height + border + view height + border
169 || config->hide_edge_borders == E_NONE 177 x = view->swayc->x + view->border_thickness * view->border_left;
170 || config->hide_edge_borders == E_HORIZONTAL 178 y = view->swayc->y + config->font_height + view->border_thickness * 2;
171 || (config->hide_edge_borders == E_SMART && other_views)) { 179 width = view->swayc->width
172 x = view->swayc->x + view->border_thickness; 180 - view->border_thickness * view->border_left
173 width = view->swayc->width - view->border_thickness * 2; 181 - view->border_thickness * view->border_right;
174 } else { 182 height = view->swayc->height - config->font_height
175 x = view->swayc->x; 183 - view->border_thickness * (2 + view->border_bottom);
176 width = view->swayc->width;
177 }
178 if (view->swayc->layout > L_VERT
179 || config->hide_edge_borders == E_NONE
180 || config->hide_edge_borders == E_VERTICAL
181 || (config->hide_edge_borders == E_SMART && other_views)) {
182 // Height is: border + title height + border + view height + border
183 y = view->swayc->y + config->font_height
184 + view->border_thickness * 2;
185 height = view->swayc->height - config->font_height
186 - view->border_thickness * 3;
187 } else {
188 y = view->swayc->y;
189 height = view->swayc->height;
190 }
191 break; 184 break;
192 } 185 }
193 186