aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/view.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-05-14 00:20:34 -0400
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2018-05-14 00:20:34 -0400
commit6ff7c5273659061ec4ff2f6c79c69af2d4d165a5 (patch)
tree2736067e8c710a5c276860f135d82c7f49a973e5 /sway/tree/view.c
parentMerge pull request #1960 from RedSoxFan/edge-borders (diff)
downloadsway-6ff7c5273659061ec4ff2f6c79c69af2d4d165a5.tar.gz
sway-6ff7c5273659061ec4ff2f6c79c69af2d4d165a5.tar.zst
sway-6ff7c5273659061ec4ff2f6c79c69af2d4d165a5.zip
Fix titles and detect edges for hide_edge_borders
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 e2cb8a7a..a48a6619 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -93,8 +93,9 @@ void view_autoconfigure(struct sway_view *view) {
93 return; 93 return;
94 } 94 }
95 95
96 struct sway_container *output = container_parent(view->swayc, C_OUTPUT);
97
96 if (view->is_fullscreen) { 98 if (view->is_fullscreen) {
97 struct sway_container *output = container_parent(view->swayc, C_OUTPUT);
98 view_configure(view, 0, 0, output->width, output->height); 99 view_configure(view, 0, 0, output->width, output->height);
99 view->x = view->y = 0; 100 view->x = view->y = 0;
100 return; 101 return;
@@ -106,6 +107,25 @@ void view_autoconfigure(struct sway_view *view) {
106 other_views = container_count_descendants_of_type(ws, C_VIEW) - 1; 107 other_views = container_count_descendants_of_type(ws, C_VIEW) - 1;
107 } 108 }
108 109
110 view->border_top = view->border_bottom = true;
111 view->border_left = view->border_right = true;
112 if (view->swayc->layout != L_FLOATING) {
113 if (config->hide_edge_borders == E_BOTH
114 || config->hide_edge_borders == E_VERTICAL
115 || (config->hide_edge_borders == E_SMART && !other_views)) {
116 view->border_left = view->swayc->x != 0;
117 int right_x = view->swayc->x + view->swayc->width;
118 view->border_right = right_x != output->width;
119 }
120 if (config->hide_edge_borders == E_BOTH
121 || config->hide_edge_borders == E_HORIZONTAL
122 || (config->hide_edge_borders == E_SMART && !other_views)) {
123 view->border_top = view->swayc->y != 0;
124 int bottom_y = view->swayc->y + view->swayc->height;
125 view->border_bottom = bottom_y != output->height;
126 }
127 }
128
109 double x, y, width, height; 129 double x, y, width, height;
110 x = y = width = height = 0; 130 x = y = width = height = 0;
111 switch (view->border) { 131 switch (view->border) {
@@ -116,51 +136,26 @@ void view_autoconfigure(struct sway_view *view) {
116 height = view->swayc->height; 136 height = view->swayc->height;
117 break; 137 break;
118 case B_PIXEL: 138 case B_PIXEL:
119 if (view->swayc->layout > L_VERT 139 x = view->swayc->x + view->border_thickness * view->border_left;
120 || config->hide_edge_borders == E_NONE 140 y = view->swayc->y + view->border_thickness * view->border_top;
121 || config->hide_edge_borders == E_HORIZONTAL 141 width = view->swayc->width
122 || (config->hide_edge_borders == E_SMART && other_views)) { 142 - view->border_thickness * view->border_left
123 x = view->swayc->x + view->border_thickness; 143 - view->border_thickness * view->border_right;
124 width = view->swayc->width - view->border_thickness * 2; 144 height = view->swayc->height
125 } else { 145 - view->border_thickness * view->border_top
126 x = view->swayc->x; 146 - view->border_thickness * view->border_bottom;
127 width = view->swayc->width;
128 }
129 if (view->swayc->layout > L_VERT
130 || config->hide_edge_borders == E_NONE
131 || config->hide_edge_borders == E_VERTICAL
132 || (config->hide_edge_borders == E_SMART && other_views)) {
133 y = view->swayc->y + view->border_thickness;
134 height = view->swayc->height - view->border_thickness * 2;
135 } else {
136 y = view->swayc->y;
137 height = view->swayc->height;
138 }
139 break; 147 break;
140 case B_NORMAL: 148 case B_NORMAL:
141 if (view->swayc->layout > L_VERT 149 // Height is: border + title height + border + view height + border
142 || config->hide_edge_borders == E_NONE 150 x = view->swayc->x + view->border_thickness * view->border_left;
143 || config->hide_edge_borders == E_HORIZONTAL 151 y = view->swayc->y + config->font_height
144 || (config->hide_edge_borders == E_SMART && other_views)) { 152 + view->border_thickness * (view->border_top + 1);
145 x = view->swayc->x + view->border_thickness; 153 width = view->swayc->width
146 width = view->swayc->width - view->border_thickness * 2; 154 - view->border_thickness * view->border_left
147 } else { 155 - view->border_thickness * view->border_right;
148 x = view->swayc->x; 156 height = view->swayc->height - config->font_height
149 width = view->swayc->width; 157 - view->border_thickness * (view->border_top + 1)
150 } 158 - view->border_thickness * view->border_bottom;
151 if (view->swayc->layout > L_VERT
152 || config->hide_edge_borders == E_NONE
153 || config->hide_edge_borders == E_VERTICAL
154 || (config->hide_edge_borders == E_SMART && other_views)) {
155 // Height is: border + title height + border + view height + border
156 y = view->swayc->y + config->font_height
157 + view->border_thickness * 2;
158 height = view->swayc->height - config->font_height
159 - view->border_thickness * 3;
160 } else {
161 y = view->swayc->y;
162 height = view->swayc->height;
163 }
164 break; 159 break;
165 } 160 }
166 161