luaobject: ref take index number as argument
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
f8d549139f
commit
a8115bd45e
2
button.c
2
button.c
|
@ -102,7 +102,7 @@ luaA_button_array_set(lua_State *L, int idx, button_array_t *buttons)
|
||||||
button_array_init(buttons);
|
button_array_init(buttons);
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
while(lua_next(L, idx))
|
while(lua_next(L, idx))
|
||||||
button_array_append(buttons, button_ref(L));
|
button_array_append(buttons, button_ref(L, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Push an array of button as an Lua table onto the stack.
|
/** Push an array of button as an Lua table onto the stack.
|
||||||
|
|
6
client.c
6
client.c
|
@ -459,7 +459,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
|
||||||
|
|
||||||
c = client_new(globalconf.L);
|
c = client_new(globalconf.L);
|
||||||
/* Push client in client list */
|
/* Push client in client list */
|
||||||
client_array_push(&globalconf.clients, client_ref(globalconf.L));
|
client_array_push(&globalconf.clients, client_ref(globalconf.L, -1));
|
||||||
|
|
||||||
|
|
||||||
screen = c->screen = screen_getbycoord(&globalconf.screens.tab[phys_screen],
|
screen = c->screen = screen_getbycoord(&globalconf.screens.tab[phys_screen],
|
||||||
|
@ -485,7 +485,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
|
||||||
client_setborder(c, wgeom->border_width);
|
client_setborder(c, wgeom->border_width);
|
||||||
|
|
||||||
if(ewmh_window_icon_get_reply(ewmh_icon_cookie))
|
if(ewmh_window_icon_get_reply(ewmh_icon_cookie))
|
||||||
c->icon = image_ref(globalconf.L);
|
c->icon = image_ref(globalconf.L, -1);
|
||||||
|
|
||||||
/* we honor size hints by default */
|
/* we honor size hints by default */
|
||||||
c->size_hints_honor = true;
|
c->size_hints_honor = true;
|
||||||
|
@ -1460,7 +1460,7 @@ luaA_client_newindex(lua_State *L)
|
||||||
break;
|
break;
|
||||||
case A_TK_ICON:
|
case A_TK_ICON:
|
||||||
image_unref(L, c->icon);
|
image_unref(L, c->icon);
|
||||||
c->icon = image_ref(L);
|
c->icon = image_ref(L, 3);
|
||||||
/* execute hook */
|
/* execute hook */
|
||||||
hook_property(client, c, "icon");
|
hook_property(client, c, "icon");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -73,12 +73,14 @@ typedef struct
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
static inline type * \
|
static inline type * \
|
||||||
prefix##_ref(lua_State *L) \
|
prefix##_ref(lua_State *L, int ud) \
|
||||||
{ \
|
{ \
|
||||||
if(lua_isnil(L, -1)) \
|
if(lua_isnil(L, ud)) \
|
||||||
return NULL; \
|
return NULL; \
|
||||||
type *item = luaL_checkudata(L, -1, lua_type); \
|
type *item = luaL_checkudata(L, ud, lua_type); \
|
||||||
|
lua_pushvalue(L, ud); \
|
||||||
luaA_ref_array_append(&item->refs, luaL_ref(L, LUA_REGISTRYINDEX)); \
|
luaA_ref_array_append(&item->refs, luaL_ref(L, LUA_REGISTRYINDEX)); \
|
||||||
|
lua_remove(L, ud); \
|
||||||
return item; \
|
return item; \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
|
|
2
key.c
2
key.c
|
@ -1066,7 +1066,7 @@ luaA_key_array_set(lua_State *L, int idx, key_array_t *keys)
|
||||||
|
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
while(lua_next(L, idx))
|
while(lua_next(L, idx))
|
||||||
key_array_append(keys, key_ref(L));
|
key_array_append(keys, key_ref(L, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Push an array of key as an Lua table onto the stack.
|
/** Push an array of key as an Lua table onto the stack.
|
||||||
|
|
|
@ -355,7 +355,7 @@ property_handle_net_wm_icon(void *data,
|
||||||
{
|
{
|
||||||
image_unref(globalconf.L, c->icon);
|
image_unref(globalconf.L, c->icon);
|
||||||
if(ewmh_window_icon_from_reply(reply))
|
if(ewmh_window_icon_from_reply(reply))
|
||||||
c->icon = image_ref(globalconf.L);
|
c->icon = image_ref(globalconf.L, -1);
|
||||||
/* execute hook */
|
/* execute hook */
|
||||||
hook_property(client, c, "icon");
|
hook_property(client, c, "icon");
|
||||||
}
|
}
|
||||||
|
|
4
tag.c
4
tag.c
|
@ -90,7 +90,7 @@ tag_append_to_screen(screen_t *s)
|
||||||
int phys_screen = screen_virttophys(screen_index);
|
int phys_screen = screen_virttophys(screen_index);
|
||||||
|
|
||||||
tag->screen = s;
|
tag->screen = s;
|
||||||
tag_array_append(&s->tags, tag_ref(globalconf.L));
|
tag_array_append(&s->tags, tag_ref(globalconf.L, -1));
|
||||||
ewmh_update_net_numbers_of_desktop(phys_screen);
|
ewmh_update_net_numbers_of_desktop(phys_screen);
|
||||||
ewmh_update_net_desktop_names(phys_screen);
|
ewmh_update_net_desktop_names(phys_screen);
|
||||||
ewmh_update_workarea(phys_screen);
|
ewmh_update_workarea(phys_screen);
|
||||||
|
@ -145,7 +145,7 @@ tag_remove_from_screen(tag_t *tag)
|
||||||
void
|
void
|
||||||
tag_client(client_t *c)
|
tag_client(client_t *c)
|
||||||
{
|
{
|
||||||
tag_t *t = tag_ref(globalconf.L);
|
tag_t *t = tag_ref(globalconf.L, -1);
|
||||||
|
|
||||||
/* don't tag twice */
|
/* don't tag twice */
|
||||||
if(is_client_tagged(c, t))
|
if(is_client_tagged(c, t))
|
||||||
|
|
|
@ -223,7 +223,7 @@ void
|
||||||
titlebar_client_attach(client_t *c)
|
titlebar_client_attach(client_t *c)
|
||||||
{
|
{
|
||||||
/* check if we can register the object */
|
/* check if we can register the object */
|
||||||
wibox_t *t = wibox_ref(globalconf.L);
|
wibox_t *t = wibox_ref(globalconf.L, -1);
|
||||||
|
|
||||||
titlebar_client_detach(c);
|
titlebar_client_detach(c);
|
||||||
|
|
||||||
|
|
4
wibox.c
4
wibox.c
|
@ -408,7 +408,7 @@ wibox_attach(screen_t *s)
|
||||||
{
|
{
|
||||||
int phys_screen = screen_virttophys(screen_array_indexof(&globalconf.screens, s));
|
int phys_screen = screen_virttophys(screen_array_indexof(&globalconf.screens, s));
|
||||||
|
|
||||||
wibox_t *wibox = wibox_ref(globalconf.L);
|
wibox_t *wibox = wibox_ref(globalconf.L, -1);
|
||||||
|
|
||||||
wibox_detach(wibox);
|
wibox_detach(wibox);
|
||||||
|
|
||||||
|
@ -736,7 +736,7 @@ luaA_wibox_newindex(lua_State *L)
|
||||||
break;
|
break;
|
||||||
case A_TK_BG_IMAGE:
|
case A_TK_BG_IMAGE:
|
||||||
image_unref(L, wibox->bg_image);
|
image_unref(L, wibox->bg_image);
|
||||||
wibox->bg_image = image_ref(L);
|
wibox->bg_image = image_ref(L, 3);
|
||||||
wibox->need_update = true;
|
wibox->need_update = true;
|
||||||
break;
|
break;
|
||||||
case A_TK_ALIGN:
|
case A_TK_ALIGN:
|
||||||
|
|
2
widget.c
2
widget.c
|
@ -123,7 +123,7 @@ luaA_table2widgets(lua_State *L, widget_node_array_t *widgets)
|
||||||
{
|
{
|
||||||
widget_node_t w;
|
widget_node_t w;
|
||||||
p_clear(&w, 1);
|
p_clear(&w, 1);
|
||||||
w.widget = widget_ref(L);
|
w.widget = widget_ref(L, -1);
|
||||||
widget_node_array_append(widgets, w);
|
widget_node_array_append(widgets, w);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -197,7 +197,7 @@ luaA_imagebox_newindex(lua_State *L, awesome_token_t token)
|
||||||
|
|
||||||
case A_TK_IMAGE:
|
case A_TK_IMAGE:
|
||||||
image_unref(L, d->image);
|
image_unref(L, d->image);
|
||||||
d->image = image_ref(L);
|
d->image = image_ref(L, 3);
|
||||||
break;
|
break;
|
||||||
case A_TK_BG:
|
case A_TK_BG:
|
||||||
if(lua_isnil(L, 3))
|
if(lua_isnil(L, 3))
|
||||||
|
|
|
@ -297,7 +297,7 @@ luaA_textbox_newindex(lua_State *L, awesome_token_t token)
|
||||||
break;
|
break;
|
||||||
case A_TK_BG_IMAGE:
|
case A_TK_BG_IMAGE:
|
||||||
image_unref(L, d->bg_image);
|
image_unref(L, d->bg_image);
|
||||||
d->bg_image = image_ref(L);
|
d->bg_image = image_ref(L, 3);
|
||||||
break;
|
break;
|
||||||
case A_TK_BG:
|
case A_TK_BG:
|
||||||
if(lua_isnil(L, 3))
|
if(lua_isnil(L, 3))
|
||||||
|
|
Loading…
Reference in New Issue