changed view visibility to be bool

view_visibility enum remains with one constant that is the mask to wlc's view masking
master
minus 9 years ago
parent e533014201
commit ca89ba83a8

@ -56,9 +56,8 @@ struct sway_container {
struct sway_container *focused; struct sway_container *focused;
}; };
enum view_visibility { enum visibility_mask {
INVISIBLE = 1, VISIBLE = 1
VISIBLE = 2
}; };
// Container Creation // Container Creation

@ -520,25 +520,24 @@ void set_view_visibility(swayc_t *view, void *data) {
if (!ASSERT_NONNULL(view)) { if (!ASSERT_NONNULL(view)) {
return; return;
} }
uint32_t mask = *(uint32_t *)data; bool visible = *(bool *)data;
if (view->type == C_VIEW) { if (view->type == C_VIEW) {
wlc_view_set_mask(view->handle, mask); wlc_view_set_mask(view->handle, visible ? VISIBLE : 0);
if (mask & VISIBLE) { if (visible) {
wlc_view_bring_to_front(view->handle); wlc_view_bring_to_front(view->handle);
} else { } else {
wlc_view_send_to_back(view->handle); wlc_view_send_to_back(view->handle);
} }
} }
view->visible = mask & VISIBLE; view->visible = visible;
sway_log(L_DEBUG, "Container %p is now %s", view, view->visible ? "visible" : "invisible"); sway_log(L_DEBUG, "Container %p is now %s", view, visible ? "visible" : "invisible");
} }
void update_visibility(swayc_t *container) { void update_visibility(swayc_t *container) {
swayc_t *ws = swayc_active_workspace_for(container); swayc_t *ws = swayc_active_workspace_for(container);
bool visible = ws->parent->focused == container; bool visible = (ws->parent->focused == container);
uint32_t mask = visible ? VISIBLE : INVISIBLE;
sway_log(L_DEBUG, "Setting visibility of container %p to %s", container, visible ? "visible" : "invisible"); 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) { void reset_gaps(swayc_t *view, void *data) {

@ -28,11 +28,11 @@ static void update_focus(swayc_t *c) {
if (parent->focused) { if (parent->focused) {
swayc_t *ws = parent->focused; swayc_t *ws = parent->focused;
// hide visibility of old workspace // hide visibility of old workspace
uint32_t mask = INVISIBLE; bool visible = false;
container_map(ws, set_view_visibility, &mask); container_map(ws, set_view_visibility, &visible);
// set visibility of new workspace // set visibility of new workspace
mask = VISIBLE; visible = true;
container_map(c, set_view_visibility, &mask); container_map(c, set_view_visibility, &visible);
destroy_workspace(ws); destroy_workspace(ws);
} }
break; break;

@ -90,7 +90,7 @@ swayc_t *container_under_pointer(void) {
static bool handle_output_created(wlc_handle output) { static bool handle_output_created(wlc_handle output) {
swayc_t *op = new_output(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); wlc_output_set_mask(output, VISIBLE);
if (!op) { if (!op) {

Loading…
Cancel
Save