void set_view_visibility(swayc_t *view, void *data) { uint32_t *p = data; if (view->type == C_VIEW) { wlc_view_set_mask(view->handle, *p); if (*p == 2) { wlc_view_bring_to_front(view->handle); } else { wlc_view_send_to_back(view->handle); } } view->visible = (*p == 2); }
static bool keyboard_key(wlc_handle view, uint32_t time, const struct wlc_modifiers *modifiers, uint32_t key, uint32_t sym, enum wlc_key_state state) { (void)time, (void)key; if (state == WLC_KEY_STATE_PRESSED) { if (view) { if (modifiers->mods & WLC_BIT_MOD_CTRL && sym == XKB_KEY_q) { wlc_view_close(view); return true; } else if (modifiers->mods & WLC_BIT_MOD_CTRL && sym == XKB_KEY_Down) { wlc_view_send_to_back(view); wlc_view_focus(get_topmost(wlc_view_get_output(view), 0)); return true; } } else if (modifiers->mods & WLC_BIT_MOD_CTRL && sym == XKB_KEY_Escape) { wlc_terminate(); return true; } } return false; }