/** View or unview a tag. * \param tag the tag * \param view set visible or not */ static void tag_view(tag_t *tag, bool view) { tag->selected = view; ewmh_update_net_current_desktop(screen_virttophys(tag->screen)); globalconf.screens[tag->screen].need_arrange = true; }
void toggleview(View *cv, int index) { Client *c; View *v; unsigned long long tags; unsigned i; /* Typically from a keyboard command. Again, we should use the monitor with the keyboard focus before the monitor with the pointer in it. */ /* This function used to worry about having a selected tag for each monitor, but this has now been moved to the view. We don't care if there exists views that have no selected tag because they can still be assigned to a monitor and tags toggled from there. */ if (-1 > index || index >= scr->ntags) return; tags = (index == -1) ? ((1ULL << scr->ntags) - 1) : (1ULL << index); cv->seltags ^= tags; for (v = scr->views, i = 0; i < scr->ntags; i++, v++) if ((v->seltags & tags) && v != cv) arrange(v); arrange(cv); c = lastselected(cv); focus(c); focuslockclient(c); ewmh_update_net_current_desktop(); }
/** View or unview a tag. * \param L The Lua VM state. * \param udx The index of the tag on the stack. * \param view Set visible or not. */ static void tag_view(lua_State *L, int udx, bool view) { tag_t *tag = luaA_checkudata(L, udx, &tag_class); if(tag->selected != view) { tag->selected = view; if(tag->screen) { int screen_index = screen_array_indexof(&globalconf.screens, tag->screen); banning_need_update(tag->screen); ewmh_update_net_current_desktop(screen_virttophys(screen_index)); if(globalconf.hooks.tags != LUA_REFNIL) { lua_pushnumber(globalconf.L, screen_index + 1); luaA_object_push(globalconf.L, tag); if(view) lua_pushliteral(globalconf.L, "select"); else lua_pushliteral(globalconf.L, "unselect"); luaA_dofunction_from_registry(globalconf.L, globalconf.hooks.tags, 3, 0); } } luaA_object_emit_signal(L, udx, "property::selected", 0); } }
void view(View *ov, int index) { Monitor *cm, *om; Client *c; View *cv; if (!ov) { EPRINTF("Null view pointer.\n"); return; } if (0 > index || index >= scr->ntags) { XPRINTF("WARNING: bad index %d\n", index); return; } if (ov->index == index) { XPRINTF("WARNING: view already index %d\n", index); return; } if (!(cm = ov->curmon)) { XPRINTF("WARNING: view %d has no monitor\n", ov->index); return; } XPRINTF("VIEW: disassociating monitor %d from view %d\n", cm->num, ov->index); ov->curmon = NULL; XPRINTF("VIEW: setting previous view for monitor %d to view %d\n", cm->num, ov->index); cm->preview = ov; XPRINTF("VIEW: new view is %d\n", index); cv = scr->views + index; XPRINTF("VIEW: associating monitor %d with view %d\n", cm->num, cv->index); cv->curmon = cm; XPRINTF("VIEW: associating view %d with monitor %d\n", cv->index, cm->num); cm->curview = cv; for (om = scr->monitors; om; om = om->next) { if (om == cm) continue; if (om->curview == cv) { XPRINTF("VIEW: switching monitor %d from view %d to %d\n", om->num, om->curview->index, ov->index); om->curview = ov; ov->curmon = om; updategeom(om); XPRINTF("VIEW: arranging view %d\n", ov->index); arrange(ov); /* only one can match */ break; } } updategeom(cm); XPRINTF("VIEW: arranging view %d\n", cv->index); arrange(cv); c = lastselected(cv); focus(c); focuslockclient(c); ewmh_update_net_current_desktop(); }
/** View or unview a tag. * \param L The Lua VM state. * \param udx The index of the tag on the stack. * \param view Set selected or not. */ static void tag_view(lua_State *L, int udx, bool view) { tag_t *tag = luaA_checkudata(L, udx, &tag_class); if(tag->selected != view) { tag->selected = view; banning_need_update(); ewmh_update_net_current_desktop(); luaA_object_emit_signal(L, udx, "property::selected", 0); } }