//although bool view_created(tw_handle view) { //routine: //0): create a view: which is most likely insert a node to a list tw_handle output = wlc_view_get_output(view); Layout *layout = tw_output_get_current_layout(output);//it shouldn't be //Null, one output //should at least //has one layout struct wl_resource *surface = wlc_surface_get_wl_resource(wlc_view_get_surface(view)); if (TMP_DATA[0] == surface) debug_log("BG_VIEW created\n"); else if (TMP_DATA[1] == surface) debug_log("PANEL_VIEW created\n"); else if (TMP_DATA[2] == surface) debug_log("LOCK_VIEW created\n"); if (!layout->createView(view)) return false; //call update view layout->update_views(); //1): setting up the view visibility attributes, focus attributes, etc. wlc_view_set_mask(view, wlc_output_get_mask(output)); wlc_view_bring_to_front(view); //you have to call it at floating layout wlc_view_focus(view); //2): relayout relayout(wlc_view_get_output(view)); return true; }
static swayc_t *fetch_view_from_scratchpad() { if (sp_index >= scratchpad->length) { sp_index = 0; } swayc_t *view = scratchpad->items[sp_index++]; if (wlc_view_get_output(view->handle) != swayc_active_output()->handle) { wlc_view_set_output(view->handle, swayc_active_output()->handle); } if (!view->is_floating) { view->width = swayc_active_workspace()->width/2; view->height = swayc_active_workspace()->height/2; view->x = (swayc_active_workspace()->width - view->width)/2; view->y = (swayc_active_workspace()->height - view->height)/2; } if (swayc_active_workspace()->width < view->x + 20 || view->x + view->width < 20) { view->x = (swayc_active_workspace()->width - view->width)/2; } if (swayc_active_workspace()->height < view->y + 20 || view->y + view->height < 20) { view->y = (swayc_active_workspace()->height - view->height)/2; } add_floating(swayc_active_workspace(), view); wlc_view_set_mask(view->handle, VISIBLE); view->visible = true; arrange_windows(swayc_active_workspace(), -1, -1); set_focused_container(view); return view; }
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); }