client: merge screen_{set,get} into index
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
49466fa385
commit
014214794a
41
client.c
41
client.c
|
@ -969,36 +969,6 @@ client_setborder(client_t *c, int width)
|
||||||
globalconf.screens[c->screen].need_arrange = true;
|
globalconf.screens[c->screen].need_arrange = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Move the client to another screen.
|
|
||||||
* \param L The Lua VM state.
|
|
||||||
* \luastack
|
|
||||||
* \lvalue A client.
|
|
||||||
* \lparam A screen number.
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
luaA_client_screen_set(lua_State *L)
|
|
||||||
{
|
|
||||||
client_t **c = luaA_checkudata(L, 1, "client");
|
|
||||||
int screen = luaL_checknumber(L, 2) - 1;
|
|
||||||
luaA_checkscreen(screen);
|
|
||||||
screen_client_moveto(*c, screen, true);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Get the screen number the client is onto.
|
|
||||||
* \param L The Lua VM state.
|
|
||||||
* \luastack
|
|
||||||
* \lvalue A client.
|
|
||||||
* \lreturn A screen number.
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
luaA_client_screen_get(lua_State *L)
|
|
||||||
{
|
|
||||||
client_t **c = luaA_checkudata(L, 1, "client");
|
|
||||||
lua_pushnumber(L, 1 + (*c)->screen);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Tag a client with a specified tag.
|
/** Tag a client with a specified tag.
|
||||||
* \param L The Lua VM state.
|
* \param L The Lua VM state.
|
||||||
* \luastack
|
* \luastack
|
||||||
|
@ -1299,6 +1269,7 @@ luaA_client_newindex(lua_State *L)
|
||||||
const char *buf = luaL_checklstring(L, 2, &len);
|
const char *buf = luaL_checklstring(L, 2, &len);
|
||||||
bool b;
|
bool b;
|
||||||
double d;
|
double d;
|
||||||
|
int i;
|
||||||
xcolor_t color;
|
xcolor_t color;
|
||||||
|
|
||||||
switch(a_tokenize(buf, len))
|
switch(a_tokenize(buf, len))
|
||||||
|
@ -1309,6 +1280,11 @@ luaA_client_newindex(lua_State *L)
|
||||||
a_iso2utf8(&(*c)->name, buf, len);
|
a_iso2utf8(&(*c)->name, buf, len);
|
||||||
widget_invalidate_cache((*c)->screen, WIDGET_CACHE_CLIENTS);
|
widget_invalidate_cache((*c)->screen, WIDGET_CACHE_CLIENTS);
|
||||||
break;
|
break;
|
||||||
|
case A_TK_SCREEN:
|
||||||
|
i = luaL_checknumber(L, 3) - 1;
|
||||||
|
luaA_checkscreen(i);
|
||||||
|
screen_client_moveto(*c, i, true);
|
||||||
|
break;
|
||||||
case A_TK_HIDE:
|
case A_TK_HIDE:
|
||||||
b = luaA_checkboolean(L, 3);
|
b = luaA_checkboolean(L, 3);
|
||||||
if(b != (*c)->ishidden)
|
if(b != (*c)->ishidden)
|
||||||
|
@ -1375,6 +1351,9 @@ luaA_client_index(lua_State *L)
|
||||||
case A_TK_NAME:
|
case A_TK_NAME:
|
||||||
lua_pushstring(L, (*c)->name);
|
lua_pushstring(L, (*c)->name);
|
||||||
break;
|
break;
|
||||||
|
case A_TK_SCREEN:
|
||||||
|
lua_pushnumber(L, 1 + (*c)->screen);
|
||||||
|
break;
|
||||||
case A_TK_HIDE:
|
case A_TK_HIDE:
|
||||||
lua_pushboolean(L, (*c)->ishidden);
|
lua_pushboolean(L, (*c)->ishidden);
|
||||||
break;
|
break;
|
||||||
|
@ -1411,8 +1390,6 @@ const struct luaL_reg awesome_client_meta[] =
|
||||||
{ "floating_placement_set", luaA_client_floating_placement_set },
|
{ "floating_placement_set", luaA_client_floating_placement_set },
|
||||||
{ "titlebar_set", luaA_client_titlebar_set },
|
{ "titlebar_set", luaA_client_titlebar_set },
|
||||||
{ "titlebar_get", luaA_client_titlebar_get },
|
{ "titlebar_get", luaA_client_titlebar_get },
|
||||||
{ "screen_set", luaA_client_screen_set },
|
|
||||||
{ "screen_get", luaA_client_screen_get },
|
|
||||||
{ "tag", luaA_client_tag },
|
{ "tag", luaA_client_tag },
|
||||||
{ "istagged", luaA_client_istagged },
|
{ "istagged", luaA_client_istagged },
|
||||||
{ "coords_get", luaA_client_coords_get },
|
{ "coords_get", luaA_client_coords_get },
|
||||||
|
|
|
@ -38,6 +38,7 @@ plot_properties_set
|
||||||
position
|
position
|
||||||
resize
|
resize
|
||||||
right
|
right
|
||||||
|
screen
|
||||||
selected
|
selected
|
||||||
shadow
|
shadow
|
||||||
shadow_offset
|
shadow_offset
|
||||||
|
|
|
@ -81,7 +81,7 @@ function P.client.next(i, c)
|
||||||
local sel = c or client.focus_get()
|
local sel = c or client.focus_get()
|
||||||
if sel then
|
if sel then
|
||||||
-- Get all visible clients
|
-- Get all visible clients
|
||||||
local cls = client.visible_get(sel:screen_get())
|
local cls = client.visible_get(sel.screen)
|
||||||
-- Loop upon each client
|
-- Loop upon each client
|
||||||
for idx, c in ipairs(cls) do
|
for idx, c in ipairs(cls) do
|
||||||
if c == sel then
|
if c == sel then
|
||||||
|
@ -143,7 +143,7 @@ function P.screen.focus(i)
|
||||||
local sel = client.focus_get()
|
local sel = client.focus_get()
|
||||||
local s
|
local s
|
||||||
if sel then
|
if sel then
|
||||||
s = sel:screen_get()
|
s = sel.screen
|
||||||
else
|
else
|
||||||
s = mouse.screen_get()
|
s = mouse.screen_get()
|
||||||
end
|
end
|
||||||
|
@ -283,7 +283,7 @@ end
|
||||||
-- @para c Optional client to move, otherwise the focused one is used.
|
-- @para c Optional client to move, otherwise the focused one is used.
|
||||||
function P.client.movetotag(target, c)
|
function P.client.movetotag(target, c)
|
||||||
local sel = c or client.focus_get();
|
local sel = c or client.focus_get();
|
||||||
local tags = tag.get(sel:screen_get())
|
local tags = tag.get(sel.screen)
|
||||||
for k, t in pairs(tags) do
|
for k, t in pairs(tags) do
|
||||||
sel:tag(t, false)
|
sel:tag(t, false)
|
||||||
end
|
end
|
||||||
|
@ -299,7 +299,7 @@ function P.client.toggletag(target, c)
|
||||||
if sel then
|
if sel then
|
||||||
-- Count how many tags has the client
|
-- Count how many tags has the client
|
||||||
-- an only toggle tag if the client has at least one tag other than target
|
-- an only toggle tag if the client has at least one tag other than target
|
||||||
for k, v in pairs(tag.get(sel:screen_get())) do
|
for k, v in pairs(tag.get(sel.screen)) do
|
||||||
if target ~= v and sel:istagged(v) then
|
if target ~= v and sel:istagged(v) then
|
||||||
toggle = true
|
toggle = true
|
||||||
break
|
break
|
||||||
|
@ -328,10 +328,10 @@ function P.client.movetoscreen(c, s)
|
||||||
if sel then
|
if sel then
|
||||||
local sc = screen.count()
|
local sc = screen.count()
|
||||||
if not s then
|
if not s then
|
||||||
s = sel:screen_get() + 1
|
s = sel.screen + 1
|
||||||
end
|
end
|
||||||
if s > sc then s = 1 elseif s < 1 then s = sc end
|
if s > sc then s = 1 elseif s < 1 then s = sc end
|
||||||
sel:screen_set(s)
|
sel.screen = s
|
||||||
mouse.coords_set(screen.coords_get(s))
|
mouse.coords_set(screen.coords_get(s))
|
||||||
sel:focus_set()
|
sel:focus_set()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue