summaryrefslogtreecommitdiffstats
path: root/sway/tree/view.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <RyanDwyer@users.noreply.github.com>2018-05-13 11:52:51 +1000
committerLibravatar GitHub <noreply@github.com>2018-05-13 11:52:51 +1000
commit0c96d757d0d5d1762390dd119cbe344e8781c19f (patch)
tree34ca494ccdc42799010a00f495b1d19193f20fe7 /sway/tree/view.c
parentMerge pull request #1967 from emersion/remove-xdg-popup-unmap (diff)
parentMerge branch 'master' into edge-borders (diff)
downloadsway-0c96d757d0d5d1762390dd119cbe344e8781c19f.tar.gz
sway-0c96d757d0d5d1762390dd119cbe344e8781c19f.tar.zst
sway-0c96d757d0d5d1762390dd119cbe344e8781c19f.zip
Merge pull request #1960 from RedSoxFan/edge-borders
Implement hide_edge_borders
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r--sway/tree/view.c59
1 files changed, 49 insertions, 10 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 424c1084..e2cb8a7a 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -100,6 +100,12 @@ void view_autoconfigure(struct sway_view *view) {
100 return; 100 return;
101 } 101 }
102 102
103 int other_views = 1;
104 if (config->hide_edge_borders == E_SMART) {
105 struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE);
106 other_views = container_count_descendants_of_type(ws, C_VIEW) - 1;
107 }
108
103 double x, y, width, height; 109 double x, y, width, height;
104 x = y = width = height = 0; 110 x = y = width = height = 0;
105 switch (view->border) { 111 switch (view->border) {
@@ -110,18 +116,51 @@ void view_autoconfigure(struct sway_view *view) {
110 height = view->swayc->height; 116 height = view->swayc->height;
111 break; 117 break;
112 case B_PIXEL: 118 case B_PIXEL:
113 x = view->swayc->x + view->border_thickness; 119 if (view->swayc->layout > L_VERT
114 y = view->swayc->y + view->border_thickness; 120 || config->hide_edge_borders == E_NONE
115 width = view->swayc->width - view->border_thickness * 2; 121 || config->hide_edge_borders == E_HORIZONTAL
116 height = view->swayc->height - view->border_thickness * 2; 122 || (config->hide_edge_borders == E_SMART && other_views)) {
123 x = view->swayc->x + view->border_thickness;
124 width = view->swayc->width - view->border_thickness * 2;
125 } else {
126 x = view->swayc->x;
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 }
117 break; 139 break;
118 case B_NORMAL: 140 case B_NORMAL:
119 // Height is: border + title height + border + view height + border 141 if (view->swayc->layout > L_VERT
120 x = view->swayc->x + view->border_thickness; 142 || config->hide_edge_borders == E_NONE
121 y = view->swayc->y + config->font_height + view->border_thickness * 2; 143 || config->hide_edge_borders == E_HORIZONTAL
122 width = view->swayc->width - view->border_thickness * 2; 144 || (config->hide_edge_borders == E_SMART && other_views)) {
123 height = view->swayc->height - config->font_height 145 x = view->swayc->x + view->border_thickness;
124 - view->border_thickness * 3; 146 width = view->swayc->width - view->border_thickness * 2;
147 } else {
148 x = view->swayc->x;
149 width = view->swayc->width;
150 }
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 }
125 break; 164 break;
126 } 165 }
127 166