screen: add luaA_pushscreen
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
e02384e4fe
commit
458a770fd7
18
screen.c
18
screen.c
|
@ -338,6 +338,20 @@ screen_client_moveto(client_t *c, screen_t *new_screen, bool dotag, bool doresiz
|
||||||
hook_property(client, c, "screen");
|
hook_property(client, c, "screen");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Push a screen onto the stack.
|
||||||
|
* \param L The Lua VM state.
|
||||||
|
* \param s The scren to push.
|
||||||
|
* \return The number of elements pushed on stack.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
luaA_pushscreen(lua_State *L, screen_t *s)
|
||||||
|
{
|
||||||
|
lua_pushlightuserdata(L, s);
|
||||||
|
luaL_getmetatable(L, "screen");
|
||||||
|
lua_setmetatable(L, -2);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/** Screen module.
|
/** Screen module.
|
||||||
* \param L The Lua VM state.
|
* \param L The Lua VM state.
|
||||||
* \return The number of elements pushed on stack.
|
* \return The number of elements pushed on stack.
|
||||||
|
@ -348,10 +362,8 @@ static int
|
||||||
luaA_screen_module_index(lua_State *L)
|
luaA_screen_module_index(lua_State *L)
|
||||||
{
|
{
|
||||||
int screen = luaL_checknumber(L, 2) - 1;
|
int screen = luaL_checknumber(L, 2) - 1;
|
||||||
|
|
||||||
luaA_checkscreen(screen);
|
luaA_checkscreen(screen);
|
||||||
lua_pushlightuserdata(L, &globalconf.screens.tab[screen]);
|
return luaA_pushscreen(L, &globalconf.screens.tab[screen]);
|
||||||
return luaA_settype(L, "screen");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get or set screen tags.
|
/** Get or set screen tags.
|
||||||
|
|
1
screen.h
1
screen.h
|
@ -56,6 +56,7 @@ area_t screen_area_get(screen_t *, bool);
|
||||||
area_t display_area_get(int);
|
area_t display_area_get(int);
|
||||||
int screen_virttophys(int);
|
int screen_virttophys(int);
|
||||||
void screen_client_moveto(client_t *, screen_t *, bool, bool);
|
void screen_client_moveto(client_t *, screen_t *, bool, bool);
|
||||||
|
int luaA_pushscreen(lua_State *, screen_t *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||||
|
|
Loading…
Reference in New Issue