summaryrefslogtreecommitdiffstats
path: root/sway/tree/view.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r--sway/tree/view.c83
1 files changed, 39 insertions, 44 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 2fdb14a2..a485e902 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -97,8 +97,9 @@ void view_autoconfigure(struct sway_view *view) {
97 return; 97 return;
98 } 98 }
99 99
100 struct sway_container *output = container_parent(view->swayc, C_OUTPUT);
101
100 if (view->is_fullscreen) { 102 if (view->is_fullscreen) {
101 struct sway_container *output = container_parent(view->swayc, C_OUTPUT);
102 view_configure(view, 0, 0, output->width, output->height); 103 view_configure(view, 0, 0, output->width, output->height);
103 view->x = view->y = 0; 104 view->x = view->y = 0;
104 return; 105 return;
@@ -110,6 +111,25 @@ void view_autoconfigure(struct sway_view *view) {
110 other_views = container_count_descendants_of_type(ws, C_VIEW) - 1; 111 other_views = container_count_descendants_of_type(ws, C_VIEW) - 1;
111 } 112 }
112 113
114 view->border_top = view->border_bottom = true;
115 view->border_left = view->border_right = true;
116 if (view->swayc->layout != L_FLOATING) {
117 if (config->hide_edge_borders == E_BOTH
118 || config->hide_edge_borders == E_VERTICAL
119 || (config->hide_edge_borders == E_SMART && !other_views)) {
120 view->border_left = view->swayc->x != 0;
121 int right_x = view->swayc->x + view->swayc->width;
122 view->border_right = right_x != output->width;
123 }
124 if (config->hide_edge_borders == E_BOTH
125 || config->hide_edge_borders == E_HORIZONTAL
126 || (config->hide_edge_borders == E_SMART && !other_views)) {
127 view->border_top = view->swayc->y != 0;
128 int bottom_y = view->swayc->y + view->swayc->height;
129 view->border_bottom = bottom_y != output->height;
130 }
131 }
132
113 double x, y, width, height; 133 double x, y, width, height;
114 x = y = width = height = 0; 134 x = y = width = height = 0;
115 switch (view->border) { 135 switch (view->border) {
@@ -120,51 +140,26 @@ void view_autoconfigure(struct sway_view *view) {
120 height = view->swayc->height; 140 height = view->swayc->height;
121 break; 141 break;
122 case B_PIXEL: 142 case B_PIXEL:
123 if (view->swayc->layout > L_VERT 143 x = view->swayc->x + view->border_thickness * view->border_left;
124 || config->hide_edge_borders == E_NONE 144 y = view->swayc->y + view->border_thickness * view->border_top;
125 || config->hide_edge_borders == E_HORIZONTAL 145 width = view->swayc->width
126 || (config->hide_edge_borders == E_SMART && other_views)) { 146 - view->border_thickness * view->border_left
127 x = view->swayc->x + view->border_thickness; 147 - view->border_thickness * view->border_right;
128 width = view->swayc->width - view->border_thickness * 2; 148 height = view->swayc->height
129 } else { 149 - view->border_thickness * view->border_top
130 x = view->swayc->x; 150 - view->border_thickness * view->border_bottom;
131 width = view->swayc->width;
132 }
133 if (view->swayc->layout > L_VERT
134 || config->hide_edge_borders == E_NONE
135 || config->hide_edge_borders == E_VERTICAL
136 || (config->hide_edge_borders == E_SMART && other_views)) {
137 y = view->swayc->y + view->border_thickness;
138 height = view->swayc->height - view->border_thickness * 2;
139 } else {
140 y = view->swayc->y;
141 height = view->swayc->height;
142 }
143 break; 151 break;
144 case B_NORMAL: 152 case B_NORMAL:
145 if (view->swayc->layout > L_VERT 153 // Height is: border + title height + border + view height + border
146 || config->hide_edge_borders == E_NONE 154 x = view->swayc->x + view->border_thickness * view->border_left;
147 || config->hide_edge_borders == E_HORIZONTAL 155 y = view->swayc->y + config->font_height
148 || (config->hide_edge_borders == E_SMART && other_views)) { 156 + view->border_thickness * (view->border_top + 1);
149 x = view->swayc->x + view->border_thickness; 157 width = view->swayc->width
150 width = view->swayc->width - view->border_thickness * 2; 158 - view->border_thickness * view->border_left
151 } else { 159 - view->border_thickness * view->border_right;
152 x = view->swayc->x; 160 height = view->swayc->height - config->font_height
153 width = view->swayc->width; 161 - view->border_thickness * (view->border_top + 1)
154 } 162 - view->border_thickness * view->border_bottom;
155 if (view->swayc->layout > L_VERT
156 || config->hide_edge_borders == E_NONE
157 || config->hide_edge_borders == E_VERTICAL
158 || (config->hide_edge_borders == E_SMART && other_views)) {
159 // Height is: border + title height + border + view height + border
160 y = view->swayc->y + config->font_height
161 + view->border_thickness * 2;
162 height = view->swayc->height - config->font_height
163 - view->border_thickness * 3;
164 } else {
165 y = view->swayc->y;
166 height = view->swayc->height;
167 }
168 break; 163 break;
169 } 164 }
170 165