tag: remove get and geti methods
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
bcfc3656ab
commit
5758a3919a
|
@ -20,7 +20,6 @@ local capi =
|
|||
{
|
||||
screen = screen,
|
||||
client = client,
|
||||
tag = tag,
|
||||
mouse = mouse,
|
||||
titlebar = titlebar,
|
||||
widget = widget,
|
||||
|
@ -336,7 +335,7 @@ end
|
|||
--- Update the tag history.
|
||||
-- @param screen The screen number.
|
||||
function tag.history.update(screen)
|
||||
local curtags = capi.tag.geti(screen)
|
||||
local curtags = capi.screen[screen].tags
|
||||
if not tag_compare_select(curtags, tag.history.data.current[screen]) then
|
||||
tag.history.data.past[screen] = tag.history.data.current[screen]
|
||||
tag.history.data.current[screen] = {}
|
||||
|
@ -350,7 +349,7 @@ end
|
|||
-- @param screen The screen number.
|
||||
function tag.history.restore(screen)
|
||||
local s = screen or capi.mouse.screen
|
||||
local tags = capi.tag.geti(s)
|
||||
local tags = capi.screen[s].tags
|
||||
for k, t in pairs(tags) do
|
||||
t.selected = tag.history.data.past[s][k]
|
||||
end
|
||||
|
@ -361,7 +360,7 @@ end
|
|||
-- @return A table with all selected tags.
|
||||
function tag.selectedlist(s)
|
||||
local screen = s or capi.mouse.screen
|
||||
local tags = capi.tag.geti(screen)
|
||||
local tags = capi.screen[screen].tags
|
||||
local vtags = {}
|
||||
for i, t in pairs(tags) do
|
||||
if t.selected then
|
||||
|
@ -434,7 +433,7 @@ end
|
|||
--- View no tag.
|
||||
-- @param Optional screen number.
|
||||
function tag.viewnone(screen)
|
||||
local tags = capi.tag.get(screen or capi.mouse.screen)
|
||||
local tags = capi.screen[screen or capi.mouse.screen].tags
|
||||
for i, t in pairs(tags) do
|
||||
t.selected = false
|
||||
end
|
||||
|
@ -444,7 +443,7 @@ end
|
|||
-- @param i The relative index to see.
|
||||
-- @param screen Optional screen number.
|
||||
function tag.viewidx(i, screen)
|
||||
local tags = capi.tag.geti(screen or capi.mouse.screen)
|
||||
local tags = capi.screen[screen or capi.mouse.screen].tags
|
||||
local sel = tag.selected()
|
||||
tag.viewnone()
|
||||
for k, t in ipairs(tags) do
|
||||
|
@ -1187,7 +1186,7 @@ end
|
|||
function widget.tasklist.label.currenttags(c, screen, args)
|
||||
-- Only print client on the same screen as this widget
|
||||
if c.screen ~= screen then return end
|
||||
for k, t in pairs(capi.tag.get(screen)) do
|
||||
for k, t in ipairs(capi.screen[screen].tags) do
|
||||
if t.selected and c.tags[t] then
|
||||
return widget_tasklist_label_common(c, args)
|
||||
end
|
||||
|
|
55
tag.c
55
tag.c
|
@ -240,59 +240,6 @@ luaA_tag_tostring(lua_State *L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/** Get all tags from a screen.
|
||||
* \param L The Lua VM state.
|
||||
*
|
||||
* \luastack
|
||||
* \lparam A screen number.
|
||||
* \lreturn A table with all tags from the screen specified, indexed by tag name.
|
||||
*/
|
||||
static int
|
||||
luaA_tag_get(lua_State *L)
|
||||
{
|
||||
int screen = luaL_checknumber(L, 1) - 1;
|
||||
tag_array_t *tags = &globalconf.screens[screen].tags;
|
||||
|
||||
luaA_checkscreen(screen);
|
||||
|
||||
lua_newtable(L);
|
||||
|
||||
for(int i = 0; i < tags->len; i++)
|
||||
{
|
||||
luaA_tag_userdata_new(L, tags->tab[i]);
|
||||
lua_setfield(L, -2, tags->tab[i]->name);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** Get all tags from a screen.
|
||||
* \param L The Lua VM state.
|
||||
*
|
||||
* \luastack
|
||||
* \lparam A screen number.
|
||||
* \lreturn A table with all tags from the screen specified, ordered and indexed
|
||||
* by number.
|
||||
*/
|
||||
static int
|
||||
luaA_tag_geti(lua_State *L)
|
||||
{
|
||||
int screen = luaL_checknumber(L, 1) - 1;
|
||||
tag_array_t *tags = &globalconf.screens[screen].tags;
|
||||
|
||||
luaA_checkscreen(screen);
|
||||
|
||||
lua_newtable(L);
|
||||
|
||||
for(int i = 0; i < tags->len; i++)
|
||||
{
|
||||
luaA_tag_userdata_new(L, tags->tab[i]);
|
||||
lua_rawseti(L, -2, i + 1);
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/** Create a new tag.
|
||||
* \param L The Lua VM state.
|
||||
*
|
||||
|
@ -529,8 +476,6 @@ luaA_tag_newindex(lua_State *L)
|
|||
const struct luaL_reg awesome_tag_methods[] =
|
||||
{
|
||||
{ "__call", luaA_tag_new },
|
||||
{ "get", luaA_tag_get },
|
||||
{ "geti", luaA_tag_geti },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
const struct luaL_reg awesome_tag_meta[] =
|
||||
|
|
Loading…
Reference in New Issue