summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar minus <minus@mnus.de>2015-08-25 20:13:35 +0200
committerLibravatar minus <minus@mnus.de>2015-08-25 20:13:35 +0200
commitca89ba83a8adf392ba3409f18d3af2545d69b034 (patch)
tree9b94c93270737625c17bde12669b67bd14385577
parentadded missing util.h/c stuff (diff)
downloadsway-ca89ba83a8adf392ba3409f18d3af2545d69b034.tar.gz
sway-ca89ba83a8adf392ba3409f18d3af2545d69b034.tar.zst
sway-ca89ba83a8adf392ba3409f18d3af2545d69b034.zip
changed view visibility to be bool
view_visibility enum remains with one constant that is the mask to wlc's view masking
-rw-r--r--include/container.h5
-rw-r--r--sway/container.c15
-rw-r--r--sway/focus.c8
-rw-r--r--sway/handlers.c2
4 files changed, 14 insertions, 16 deletions
diff --git a/include/container.h b/include/container.h
index f684129a..798a31a2 100644
--- a/include/container.h
+++ b/include/container.h
@@ -56,9 +56,8 @@ struct sway_container {
56 struct sway_container *focused; 56 struct sway_container *focused;
57}; 57};
58 58
59enum view_visibility { 59enum visibility_mask {
60 INVISIBLE = 1, 60 VISIBLE = 1
61 VISIBLE = 2
62}; 61};
63 62
64// Container Creation 63// Container Creation
diff --git a/sway/container.c b/sway/container.c
index 666d6a2c..acce050f 100644
--- a/sway/container.c
+++ b/sway/container.c
@@ -520,25 +520,24 @@ void set_view_visibility(swayc_t *view, void *data) {
520 if (!ASSERT_NONNULL(view)) { 520 if (!ASSERT_NONNULL(view)) {
521 return; 521 return;
522 } 522 }
523 uint32_t mask = *(uint32_t *)data; 523 bool visible = *(bool *)data;
524 if (view->type == C_VIEW) { 524 if (view->type == C_VIEW) {
525 wlc_view_set_mask(view->handle, mask); 525 wlc_view_set_mask(view->handle, visible ? VISIBLE : 0);
526 if (mask & VISIBLE) { 526 if (visible) {
527 wlc_view_bring_to_front(view->handle); 527 wlc_view_bring_to_front(view->handle);
528 } else { 528 } else {
529 wlc_view_send_to_back(view->handle); 529 wlc_view_send_to_back(view->handle);
530 } 530 }
531 } 531 }
532 view->visible = mask & VISIBLE; 532 view->visible = visible;
533 sway_log(L_DEBUG, "Container %p is now %s", view, view->visible ? "visible" : "invisible"); 533 sway_log(L_DEBUG, "Container %p is now %s", view, visible ? "visible" : "invisible");
534} 534}
535 535
536void update_visibility(swayc_t *container) { 536void update_visibility(swayc_t *container) {
537 swayc_t *ws = swayc_active_workspace_for(container); 537 swayc_t *ws = swayc_active_workspace_for(container);
538 bool visible = ws->parent->focused == container; 538 bool visible = (ws->parent->focused == container);
539 uint32_t mask = visible ? VISIBLE : INVISIBLE;
540 sway_log(L_DEBUG, "Setting visibility of container %p to %s", container, visible ? "visible" : "invisible"); 539 sway_log(L_DEBUG, "Setting visibility of container %p to %s", container, visible ? "visible" : "invisible");
541 container_map(ws, set_view_visibility, &mask); 540 container_map(ws, set_view_visibility, &visible);
542} 541}
543 542
544void reset_gaps(swayc_t *view, void *data) { 543void reset_gaps(swayc_t *view, void *data) {
diff --git a/sway/focus.c b/sway/focus.c
index 823eefa2..1086f1a8 100644
--- a/sway/focus.c
+++ b/sway/focus.c
@@ -28,11 +28,11 @@ static void update_focus(swayc_t *c) {
28 if (parent->focused) { 28 if (parent->focused) {
29 swayc_t *ws = parent->focused; 29 swayc_t *ws = parent->focused;
30 // hide visibility of old workspace 30 // hide visibility of old workspace
31 uint32_t mask = INVISIBLE; 31 bool visible = false;
32 container_map(ws, set_view_visibility, &mask); 32 container_map(ws, set_view_visibility, &visible);
33 // set visibility of new workspace 33 // set visibility of new workspace
34 mask = VISIBLE; 34 visible = true;
35 container_map(c, set_view_visibility, &mask); 35 container_map(c, set_view_visibility, &visible);
36 destroy_workspace(ws); 36 destroy_workspace(ws);
37 } 37 }
38 break; 38 break;
diff --git a/sway/handlers.c b/sway/handlers.c
index 8b3ae3c1..af68b765 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -90,7 +90,7 @@ swayc_t *container_under_pointer(void) {
90static bool handle_output_created(wlc_handle output) { 90static bool handle_output_created(wlc_handle output) {
91 swayc_t *op = new_output(output); 91 swayc_t *op = new_output(output);
92 92
93 // Visibilty mask to be able to make view invisible 93 // Visibility mask to be able to make view invisible
94 wlc_output_set_mask(output, VISIBLE); 94 wlc_output_set_mask(output, VISIBLE);
95 95
96 if (!op) { 96 if (!op) {