summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/container.h3
-rw-r--r--include/layout.h1
-rw-r--r--sway/container.c12
-rw-r--r--sway/layout.c1
-rw-r--r--sway/workspace.c17
5 files changed, 18 insertions, 16 deletions
diff --git a/include/container.h b/include/container.h
index a54e016a..dd934be6 100644
--- a/include/container.h
+++ b/include/container.h
@@ -68,4 +68,7 @@ swayc_t *destroy_view(swayc_t *view);
68swayc_t *find_container(swayc_t *container, bool (*test)(swayc_t *view, void *data), void *data); 68swayc_t *find_container(swayc_t *container, bool (*test)(swayc_t *view, void *data), void *data);
69void container_map(swayc_t *, void (*f)(swayc_t *, void *), void *); 69void container_map(swayc_t *, void (*f)(swayc_t *, void *), void *);
70 70
71//Mappings
72void set_view_visibility(swayc_t *view, void *data);
73
71#endif 74#endif
diff --git a/include/layout.h b/include/layout.h
index 38a1f24b..a7f43fda 100644
--- a/include/layout.h
+++ b/include/layout.h
@@ -22,6 +22,7 @@ void arrange_windows(swayc_t *container, int width, int height);
22void unfocus_all(swayc_t *container); 22void unfocus_all(swayc_t *container);
23void focus_view(swayc_t *view); 23void focus_view(swayc_t *view);
24void focus_view_for(swayc_t *ancestor, swayc_t *container); 24void focus_view_for(swayc_t *ancestor, swayc_t *container);
25
25swayc_t *get_focused_container(swayc_t *parent); 26swayc_t *get_focused_container(swayc_t *parent);
26swayc_t *get_swayc_for_handle(wlc_handle handle, swayc_t *parent); 27swayc_t *get_swayc_for_handle(wlc_handle handle, swayc_t *parent);
27 28
diff --git a/sway/container.c b/sway/container.c
index 89958a4f..3cf9e47a 100644
--- a/sway/container.c
+++ b/sway/container.c
@@ -227,3 +227,15 @@ void container_map(swayc_t *container, void (*f)(swayc_t *view, void *data), voi
227 } 227 }
228} 228}
229 229
230void set_view_visibility(swayc_t *view, void *data) {
231 uint32_t *p = data;
232 if (view->type == C_VIEW) {
233 wlc_view_set_mask(view->handle, *p);
234 if (*p == 2) {
235 wlc_view_bring_to_front(view->handle);
236 } else {
237 wlc_view_send_to_back(view->handle);
238 }
239 }
240 view->visible = (*p == 2);
241}
diff --git a/sway/layout.c b/sway/layout.c
index 963bd8dc..4407742a 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -272,4 +272,3 @@ void focus_view_for(swayc_t *top, swayc_t *view) {
272 } 272 }
273} 273}
274 274
275
diff --git a/sway/workspace.c b/sway/workspace.c
index 15828658..9bc3215f 100644
--- a/sway/workspace.c
+++ b/sway/workspace.c
@@ -80,19 +80,6 @@ bool workspace_by_name(swayc_t *view, void *data) {
80 (strcasecmp(view->name, (char *) data) == 0); 80 (strcasecmp(view->name, (char *) data) == 0);
81} 81}
82 82
83void set_mask(swayc_t *view, void *data) {
84 uint32_t *p = data;
85 if (view->type == C_VIEW) {
86 wlc_view_set_mask(view->handle, *p);
87 }
88 if (*p == 2) {
89 wlc_view_bring_to_front(view->handle);
90 } else {
91 wlc_view_send_to_back(view->handle);
92 }
93 view->visible = (*p == 2);
94}
95
96swayc_t *workspace_find_by_name(const char* name) { 83swayc_t *workspace_find_by_name(const char* name) {
97 return find_container(&root_container, workspace_by_name, (void *) name); 84 return find_container(&root_container, workspace_by_name, (void *) name);
98} 85}
@@ -198,9 +185,9 @@ void workspace_switch(swayc_t *workspace) {
198 185
199 // set all c_views in the old workspace to the invisible mask if the workspace 186 // set all c_views in the old workspace to the invisible mask if the workspace
200 // is in the same output & c_views in the new workspace to the visible mask 187 // is in the same output & c_views in the new workspace to the visible mask
201 container_map(focused_workspace, set_mask, &mask); 188 container_map(focused_workspace, set_view_visibility, &mask);
202 mask = 2; 189 mask = 2;
203 container_map(workspace, set_mask, &mask); 190 container_map(workspace, set_view_visibility, &mask);
204 wlc_output_set_mask(ws_output->handle, 2); 191 wlc_output_set_mask(ws_output->handle, 2);
205 192
206 destroy_workspace(focused_workspace); 193 destroy_workspace(focused_workspace);