From ca89ba83a8adf392ba3409f18d3af2545d69b034 Mon Sep 17 00:00:00 2001 From: minus Date: Tue, 25 Aug 2015 20:13:35 +0200 Subject: changed view visibility to be bool view_visibility enum remains with one constant that is the mask to wlc's view masking --- include/container.h | 5 ++--- sway/container.c | 15 +++++++-------- sway/focus.c | 8 ++++---- sway/handlers.c | 2 +- 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 { struct sway_container *focused; }; -enum view_visibility { - INVISIBLE = 1, - VISIBLE = 2 +enum visibility_mask { + VISIBLE = 1 }; // 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) { if (!ASSERT_NONNULL(view)) { return; } - uint32_t mask = *(uint32_t *)data; + bool visible = *(bool *)data; if (view->type == C_VIEW) { - wlc_view_set_mask(view->handle, mask); - if (mask & VISIBLE) { + wlc_view_set_mask(view->handle, visible ? VISIBLE : 0); + if (visible) { wlc_view_bring_to_front(view->handle); } else { wlc_view_send_to_back(view->handle); } } - view->visible = mask & VISIBLE; - sway_log(L_DEBUG, "Container %p is now %s", view, view->visible ? "visible" : "invisible"); + view->visible = visible; + sway_log(L_DEBUG, "Container %p is now %s", view, visible ? "visible" : "invisible"); } void update_visibility(swayc_t *container) { swayc_t *ws = swayc_active_workspace_for(container); - bool visible = ws->parent->focused == container; - uint32_t mask = visible ? VISIBLE : INVISIBLE; + bool visible = (ws->parent->focused == container); sway_log(L_DEBUG, "Setting visibility of container %p to %s", container, visible ? "visible" : "invisible"); - container_map(ws, set_view_visibility, &mask); + container_map(ws, set_view_visibility, &visible); } void 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) { if (parent->focused) { swayc_t *ws = parent->focused; // hide visibility of old workspace - uint32_t mask = INVISIBLE; - container_map(ws, set_view_visibility, &mask); + bool visible = false; + container_map(ws, set_view_visibility, &visible); // set visibility of new workspace - mask = VISIBLE; - container_map(c, set_view_visibility, &mask); + visible = true; + container_map(c, set_view_visibility, &visible); destroy_workspace(ws); } 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) { static bool handle_output_created(wlc_handle output) { swayc_t *op = new_output(output); - // Visibilty mask to be able to make view invisible + // Visibility mask to be able to make view invisible wlc_output_set_mask(output, VISIBLE); if (!op) { -- cgit v1.2.3-54-g00ecf