/** Remove a tag from screen. Tag must be on a screen and have no clients. * \param tag The tag to remove. */ static void tag_remove_from_screen(tag_t *tag) { int screen = tag->screen; int phys_screen = screen_virttophys(tag->screen); tag_array_t *tags = &globalconf.screens[tag->screen].tags; for(int i = 0; i < tags->len; i++) if(tags->tab[i] == tag) { tag_array_take(tags, i); break; } ewmh_update_net_numbers_of_desktop(phys_screen); ewmh_update_net_desktop_names(phys_screen); ewmh_update_workarea(phys_screen); tag->screen = SCREEN_UNDEF; /* call hook */ if(globalconf.hooks.tags != LUA_REFNIL) { lua_pushnumber(globalconf.L, screen + 1); tag_push(globalconf.L, tag); lua_pushliteral(globalconf.L, "remove"); luaA_dofunction(globalconf.L, globalconf.hooks.tags, 3, 0); } tag_unref(globalconf.L, tag); }
/** Remove a tag from screen. Tag must be on a screen and have no clients. * \param tag The tag to remove. */ static void tag_remove_from_screen(tag_t *tag) { int screen = tag->screen; int phys_screen = screen_virttophys(tag->screen); tag_array_t *tags = &globalconf.screens[tag->screen].tags; for(int i = 0; i < tags->len; i++) if(tags->tab[i] == tag) { tag_array_take(tags, i); break; } ewmh_update_net_numbers_of_desktop(phys_screen); ewmh_update_net_desktop_names(phys_screen); ewmh_update_workarea(phys_screen); tag->screen = SCREEN_UNDEF; tag_unref(&tag); /* resave tag prop of all clients so the number of tag will be the * same */ for(client_t *c = globalconf.clients; c; c = c->next) client_saveprops_tags(c); /* call hook */ if(globalconf.hooks.tags != LUA_REFNIL) { lua_pushnumber(globalconf.L, screen + 1); luaA_dofunction(globalconf.L, globalconf.hooks.tags, 1, 0); } }
/** Remove a tag from screen. Tag must be on a screen and have no clients. * \param tag The tag to remove. */ void tag_remove_from_screen(tag_t *tag) { if(!tag->screen) return; int screen_index = screen_array_indexof(&globalconf.screens, tag->screen); int phys_screen = screen_virttophys(screen_index); tag_array_t *tags = &tag->screen->tags; for(int i = 0; i < tags->len; i++) if(tags->tab[i] == tag) { tag_array_take(tags, i); break; } /* tag was selected? If so, reban */ if(tag->selected) banning_need_update(tag->screen); ewmh_update_net_numbers_of_desktop(phys_screen); ewmh_update_net_desktop_names(phys_screen); /* call hook */ if(globalconf.hooks.tags != LUA_REFNIL) { lua_pushnumber(globalconf.L, screen_index + 1); luaA_object_push(globalconf.L, tag); lua_pushliteral(globalconf.L, "remove"); luaA_dofunction_from_registry(globalconf.L, globalconf.hooks.tags, 3, 0); } screen_t *s = tag->screen; tag->screen = NULL; luaA_object_push(globalconf.L, tag); luaA_object_emit_signal(globalconf.L, -1, "property::screen", 0); screen_emit_signal(globalconf.L, s, "tag::detach", 1); luaA_object_unref(globalconf.L, tag); }