luaobject: remove useless custom function

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-06-29 11:02:13 +02:00
parent 27fd05320e
commit 1cc50b8a29
17 changed files with 109 additions and 127 deletions

View File

@ -86,7 +86,7 @@ client_seturgent(client_t *c, bool urgent)
xcb_set_wm_hints(globalconf.connection, c->win, &wmh);
hook_property(client, c, "urgent");
hook_property(c, "urgent");
}
}
@ -174,7 +174,7 @@ client_unfocus_update(client_t *c)
/* Call hook */
if(globalconf.hooks.unfocus != LUA_REFNIL)
{
client_push(globalconf.L, c);
luaA_object_push(globalconf.L, c);
luaA_dofunction_from_registry(globalconf.L, globalconf.hooks.unfocus, 1, 0);
}
@ -316,7 +316,7 @@ client_focus_update(client_t *c)
/* execute hook */
if(globalconf.hooks.focus != LUA_REFNIL)
{
client_push(globalconf.L, c);
luaA_object_push(globalconf.L, c);
luaA_dofunction_from_registry(globalconf.L, globalconf.hooks.focus, 1, 0);
}
@ -515,7 +515,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
client_t *c = client_new(globalconf.L);
/* Push client in client list */
client_array_push(&globalconf.clients, client_ref(globalconf.L, -1));
client_array_push(&globalconf.clients, luaA_object_ref(globalconf.L, -1));
screen = c->screen = screen_getbycoord(&globalconf.screens.tab[phys_screen],
@ -542,7 +542,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
if(ewmh_window_icon_get_reply(ewmh_icon_cookie))
{
client_push(globalconf.L, c);
luaA_object_push(globalconf.L, c);
c->icon = luaA_object_ref_item(globalconf.L, -1, -2);
lua_pop(globalconf.L, 1);
}
@ -612,7 +612,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int phys_screen,
/* call hook */
if(globalconf.hooks.manage != LUA_REFNIL)
{
client_push(globalconf.L, c);
luaA_object_push(globalconf.L, c);
lua_pushboolean(globalconf.L, startup);
luaA_dofunction_from_registry(globalconf.L, globalconf.hooks.manage, 2, 0);
}
@ -784,7 +784,7 @@ client_resize(client_t *c, area_t geometry, bool hints)
screen_client_moveto(c, new_screen, true, false);
/* execute hook */
hook_property(client, c, "geometry");
hook_property(c, "geometry");
return true;
}
@ -810,7 +810,7 @@ client_setminimized(client_t *c, bool s)
window_state_set(c->win, XCB_WM_STATE_NORMAL);
ewmh_client_update_hints(c);
/* execute hook */
hook_property(client, c, "minimized");
hook_property(c, "minimized");
}
}
@ -827,7 +827,7 @@ client_setsticky(client_t *c, bool s)
c->issticky = s;
client_need_reban(c);
ewmh_client_update_hints(c);
hook_property(client, c, "sticky");
hook_property(c, "sticky");
}
}
@ -870,7 +870,7 @@ client_setfullscreen(client_t *c, bool s)
client_resize(c, geometry, false);
client_stack();
ewmh_client_update_hints(c);
hook_property(client, c, "fullscreen");
hook_property(c, "fullscreen");
}
}
@ -906,7 +906,7 @@ client_setmaxhoriz(client_t *c, bool s)
client_resize(c, geometry, c->size_hints_honor);
client_stack();
ewmh_client_update_hints(c);
hook_property(client, c, "maximized_horizontal");
hook_property(c, "maximized_horizontal");
}
}
@ -942,7 +942,7 @@ client_setmaxvert(client_t *c, bool s)
client_resize(c, geometry, c->size_hints_honor);
client_stack();
ewmh_client_update_hints(c);
hook_property(client, c, "maximized_vertical");
hook_property(c, "maximized_vertical");
}
}
@ -966,7 +966,7 @@ client_setabove(client_t *c, bool s)
client_stack();
ewmh_client_update_hints(c);
/* execute hook */
hook_property(client, c, "above");
hook_property(c, "above");
}
}
@ -990,7 +990,7 @@ client_setbelow(client_t *c, bool s)
client_stack();
ewmh_client_update_hints(c);
/* execute hook */
hook_property(client, c, "below");
hook_property(c, "below");
}
}
@ -1007,7 +1007,7 @@ client_setmodal(client_t *c, bool s)
client_stack();
ewmh_client_update_hints(c);
/* execute hook */
hook_property(client, c, "modal");
hook_property(c, "modal");
}
}
@ -1030,7 +1030,7 @@ client_setontop(client_t *c, bool s)
c->isontop = s;
client_stack();
/* execute hook */
hook_property(client, c, "ontop");
hook_property(c, "ontop");
}
}
@ -1084,7 +1084,7 @@ client_unmanage(client_t *c)
/* call hook */
if(globalconf.hooks.unmanage != LUA_REFNIL)
{
client_push(globalconf.L, c);
luaA_object_push(globalconf.L, c);
luaA_dofunction_from_registry(globalconf.L, globalconf.hooks.unmanage, 1, 0);
}
@ -1101,7 +1101,7 @@ client_unmanage(client_t *c)
/* set client as invalid */
c->invalid = true;
client_unref(globalconf.L, c);
luaA_object_unref(globalconf.L, c);
}
/** Kill a client via a WM_DELETE_WINDOW request or KillClient if not
@ -1151,7 +1151,7 @@ luaA_client_get(lua_State *L)
if(screen == -1)
foreach(c, globalconf.clients)
{
client_push(L, *c);
luaA_object_push(L, *c);
lua_rawseti(L, -2, i++);
}
else
@ -1160,7 +1160,7 @@ luaA_client_get(lua_State *L)
foreach(c, globalconf.clients)
if((*c)->screen == &globalconf.screens.tab[screen])
{
client_push(L, *c);
luaA_object_push(L, *c);
lua_rawseti(L, -2, i++);
}
}
@ -1215,7 +1215,7 @@ client_setborder(client_t *c, int width)
/* Changing border size also affects the size of the titlebar. */
titlebar_update_geometry(c);
hook_property(client, c, "border_width");
hook_property(c, "border_width");
}
/** Kill a client.
@ -1296,7 +1296,7 @@ luaA_client_tags(lua_State *L)
foreach(tag, *tags)
if(is_client_tagged(c, *tag))
{
tag_push(L, *tag);
luaA_object_push(L, *tag);
lua_rawseti(L, -2, ++j);
}
@ -1464,7 +1464,7 @@ luaA_client_struts(lua_State *L)
ewmh_update_client_strut(c);
hook_property(client, c, "struts");
hook_property(c, "struts");
}
}
@ -1502,7 +1502,7 @@ luaA_client_newindex(lua_State *L)
client_need_reban(c);
c->ishidden = b;
client_need_reban(c);
hook_property(client, c, "hide");
hook_property(c, "hide");
}
break;
case A_TK_MINIMIZED:
@ -1522,7 +1522,7 @@ luaA_client_newindex(lua_State *L)
c->icon = NULL;
c->icon = luaA_object_ref_item(L, 1, 3);
/* execute hook */
hook_property(client, c, "icon");
hook_property(c, "icon");
break;
case A_TK_OPACITY:
if(lua_isnil(L, 3))
@ -1545,7 +1545,7 @@ luaA_client_newindex(lua_State *L)
break;
case A_TK_SIZE_HINTS_HONOR:
c->size_hints_honor = luaA_checkboolean(L, 3);
hook_property(client, c, "size_hints_honor");
hook_property(c, "size_hints_honor");
break;
case A_TK_BORDER_WIDTH:
client_setborder(c, luaL_checknumber(L, 3));
@ -1576,7 +1576,7 @@ luaA_client_newindex(lua_State *L)
break;
case A_TK_SKIP_TASKBAR:
c->skiptb = luaA_checkboolean(L, 3);
hook_property(client, c, "skip_taskbar");
hook_property(c, "skip_taskbar");
break;
default:
return 0;
@ -1640,7 +1640,7 @@ luaA_client_index(lua_State *L)
lua_pushstring(L, c->name);
break;
case A_TK_TRANSIENT_FOR:
return client_push(globalconf.L, c->transient_for);
return luaA_object_push(globalconf.L, c->transient_for);
case A_TK_SKIP_TASKBAR:
lua_pushboolean(L, c->skiptb);
break;
@ -1769,7 +1769,7 @@ luaA_client_index(lua_State *L)
luaA_pushxcolor(L, c->border_color);
break;
case A_TK_TITLEBAR:
return wibox_push(L, c->titlebar);
return luaA_object_push(L, c->titlebar);
case A_TK_URGENT:
lua_pushboolean(L, c->isurgent);
break;
@ -1959,7 +1959,7 @@ luaA_client_module_index(lua_State *L)
switch(a_tokenize(buf, len))
{
case A_TK_FOCUS:
return client_push(globalconf.L, globalconf.screen_focus->client_focus);
return luaA_object_push(globalconf.L, globalconf.screen_focus->client_focus);
break;
default:
return 0;

View File

@ -245,11 +245,11 @@ client_raise(client_t *c)
static inline void
client_lower(client_t *c)
{
stack_client_push(c);
stack_luaA_object_push(c);
/* Traverse all transient layers. */
for(client_t *tc = c->transient_for; tc; tc = tc->transient_for)
stack_client_push(tc);
stack_luaA_object_push(tc);
client_stack();
}

View File

@ -167,27 +167,9 @@ int luaA_object_emit_signal_simple(lua_State *);
} \
\
static inline int \
prefix##_push(lua_State *L, type *item) \
{ \
return luaA_object_push(L, item); \
} \
\
static inline type * \
prefix##_ref(lua_State *L, int ud) \
{ \
return luaA_object_ref(L, ud); \
} \
\
static inline void \
prefix##_unref(lua_State *L, type *item) \
{ \
luaA_object_unref(L, item); \
} \
\
static inline int \
prefix##_push_item(lua_State *L, type *item, void *ref) \
{ \
prefix##_push(L, item); \
luaA_object_push(L, item); \
luaA_object_push_item(L, -1, ref); \
lua_remove(L, -2); \
return 1; \

34
event.c
View File

@ -42,7 +42,7 @@
#include "common/atoms.h"
#include "common/xutil.h"
#define DO_EVENT_HOOK_CALLBACK(type, prefix, xcbtype, xcbeventprefix, arraytype, match) \
#define DO_EVENT_HOOK_CALLBACK(type, xcbtype, xcbeventprefix, arraytype, match) \
static void \
event_##xcbtype##_callback(xcb_##xcbtype##_press_event_t *ev, \
arraytype *arr, \
@ -58,7 +58,7 @@
if(oud) \
luaA_object_push_item(globalconf.L, abs_oud, *item); \
else \
prefix##_push(globalconf.L, *item); \
luaA_object_push(globalconf.L, *item); \
item_matching++; \
} \
for(; item_matching > 0; item_matching--) \
@ -98,8 +98,8 @@ event_button_match(xcb_button_press_event_t *ev, button_t *b, void *data)
&& (b->modifiers == XCB_BUTTON_MASK_ANY || b->modifiers == ev->state));
}
DO_EVENT_HOOK_CALLBACK(button_t, button, button, XCB_BUTTON, button_array_t, event_button_match)
DO_EVENT_HOOK_CALLBACK(keyb_t, key, key, XCB_KEY, key_array_t, event_key_match)
DO_EVENT_HOOK_CALLBACK(button_t, button, XCB_BUTTON, button_array_t, event_button_match)
DO_EVENT_HOOK_CALLBACK(keyb_t, key, XCB_KEY, key_array_t, event_key_match)
/** Handle an event with mouse grabber if needed
* \param x The x coordinate.
@ -160,7 +160,7 @@ event_handle_button(void *data, xcb_connection_t *connection, xcb_button_press_e
ev->event_y -= wibox->geometry.y;
}
wibox_push(globalconf.L, wibox);
luaA_object_push(globalconf.L, wibox);
event_button_callback(ev, &wibox->buttons, -1, 1, NULL);
/* then try to match a widget binding */
@ -170,14 +170,14 @@ event_handle_button(void *data, xcb_connection_t *connection, xcb_button_press_e
&ev->event_x, &ev->event_y);
if(w)
{
widget_push(globalconf.L, w);
wibox_push(globalconf.L, wibox);
luaA_object_push(globalconf.L, w);
luaA_object_push(globalconf.L, wibox);
event_button_callback(ev, &w->buttons, -2, 2, NULL);
}
}
else if((c = client_getbywin(ev->event)))
{
client_push(globalconf.L, c);
luaA_object_push(globalconf.L, c);
event_button_callback(ev, &c->buttons, -1, 1, NULL);
xcb_allow_events(globalconf.connection,
XCB_ALLOW_REPLAY_POINTER,
@ -354,8 +354,8 @@ event_handle_widget_motionnotify(void *object,
if((*mouse_over)->mouse_leave)
{
/* call mouse leave function on old widget */
widget_push(globalconf.L, *mouse_over);
widget_push_item(globalconf.L, *mouse_over, (*mouse_over)->mouse_leave);
luaA_object_push(globalconf.L, *mouse_over);
luaA_object_push_item(globalconf.L, -1, (*mouse_over)->mouse_leave);
luaA_dofunction(globalconf.L, 1, 0);
}
}
@ -365,8 +365,8 @@ event_handle_widget_motionnotify(void *object,
*mouse_over = widget;
if(widget->mouse_enter)
{
widget_push(globalconf.L, widget);
widget_push_item(globalconf.L, widget, widget->mouse_enter);
luaA_object_push(globalconf.L, widget);
luaA_object_push_item(globalconf.L, -1, widget->mouse_enter);
luaA_dofunction(globalconf.L, 1, 0);
}
}
@ -420,7 +420,7 @@ event_handle_leavenotify(void *data __attribute__ ((unused)),
if((c = client_getbytitlebarwin(ev->event)) || (c = client_getbywin(ev->event)))
if(globalconf.hooks.mouse_leave != LUA_REFNIL)
{
client_push(globalconf.L, c);
luaA_object_push(globalconf.L, c);
luaA_dofunction_from_registry(globalconf.L, globalconf.hooks.mouse_leave, 1, 0);
}
@ -431,8 +431,8 @@ event_handle_leavenotify(void *data __attribute__ ((unused)),
if(wibox->mouse_over->mouse_leave)
{
/* call mouse leave function on widget the mouse was over */
wibox_push(globalconf.L, wibox);
widget_push_item(globalconf.L, wibox->mouse_over, wibox->mouse_over->mouse_leave);
luaA_object_push(globalconf.L, wibox->mouse_over);
luaA_object_push_item(globalconf.L, -1, wibox->mouse_over->mouse_leave);
luaA_dofunction(globalconf.L, 1, 0);
}
wibox->mouse_over = NULL;
@ -484,7 +484,7 @@ event_handle_enternotify(void *data __attribute__ ((unused)),
|| (c = client_getbywin(ev->event)))
if(globalconf.hooks.mouse_enter != LUA_REFNIL)
{
client_push(globalconf.L, c);
luaA_object_push(globalconf.L, c);
luaA_dofunction_from_registry(globalconf.L, globalconf.hooks.mouse_enter, 1, 0);
}
@ -578,7 +578,7 @@ event_handle_key(void *data __attribute__ ((unused)),
client_t *c;
if((c = client_getbywin(ev->event)))
{
client_push(globalconf.L, c);
luaA_object_push(globalconf.L, c);
event_key_callback(ev, &c->keys, -1, 1, &keysym);
}
else

6
ewmh.c
View File

@ -388,7 +388,7 @@ ewmh_process_client_message(xcb_client_message_event_t *ev)
for(int i = 0; i < tags->len; i++)
if((int)ev->data.data32[0] == i)
{
tag_push(globalconf.L, tags->tab[i]);
luaA_object_push(globalconf.L, tags->tab[i]);
tag_client(c);
}
else
@ -525,7 +525,7 @@ ewmh_client_check_hints(client_t *c)
for(int i = 0; i < tags->len; i++)
if(desktop == i)
{
tag_push(globalconf.L, tags->tab[i]);
luaA_object_push(globalconf.L, tags->tab[i]);
tag_client(c);
}
else
@ -617,7 +617,7 @@ ewmh_process_client_strut(client_t *c, xcb_get_property_reply_t *strut_r)
c->strut.bottom_start_x = strut[10];
c->strut.bottom_end_x = strut[11];
hook_property(client, c, "struts");
hook_property(c, "struts");
}
}

4
luaa.h
View File

@ -229,11 +229,11 @@ void luaA_table2wtable(lua_State *);
int luaA_next(lua_State *, int);
bool luaA_isloop(lua_State *, int);
#define hook_property(type, obj, prop) \
#define hook_property(obj, prop) \
do { \
if(globalconf.hooks.property != LUA_REFNIL) \
{ \
type##_push(globalconf.L, obj); \
luaA_object_push(globalconf.L, obj); \
lua_pushliteral(globalconf.L, prop); \
luaA_dofunction_from_registry(globalconf.L, globalconf.hooks.property, 2, 0); \
} \

View File

@ -254,7 +254,7 @@ luaA_mouse_object_under_pointer(lua_State *L)
client_t *client;
if((wibox = wibox_getbywin(child)))
{
wibox_push(L, wibox);
luaA_object_push(L, wibox);
int16_t x = mouse_x - wibox->geometry.x;
int16_t y = mouse_y - wibox->geometry.y;
@ -266,13 +266,13 @@ luaA_mouse_object_under_pointer(lua_State *L)
if(widget)
{
widget_push(L, widget);
luaA_object_push(L, widget);
return 2;
}
return 1;
}
else if((client = client_getbywin(child)))
return client_push(globalconf.L, client);
return luaA_object_push(globalconf.L, client);
return 0;
}

View File

@ -280,7 +280,7 @@ property_update_wm_name(client_t *c)
c->name = name;
/* call hook */
hook_property(client, c, "name");
hook_property(c, "name");
}
/** Update WM_CLASS of a client.
@ -333,7 +333,7 @@ property_update_wm_icon_name(client_t *c)
c->icon_name = name;
/* call hook */
hook_property(client, c, "icon_name");
hook_property(c, "icon_name");
}
static int
@ -412,7 +412,7 @@ property_handle_net_wm_icon(void *data,
if(c)
{
client_push(globalconf.L, c);
luaA_object_push(globalconf.L, c);
luaA_object_unref_item(globalconf.L, -1, c->icon);
if(ewmh_window_icon_from_reply(reply))
c->icon = luaA_object_ref_item(globalconf.L, -2, -1);
@ -421,7 +421,7 @@ property_handle_net_wm_icon(void *data,
/* remove client */
lua_pop(globalconf.L, 1);
/* execute hook */
hook_property(client, c, "icon");
hook_property(c, "icon");
}
return 0;

14
root.c
View File

@ -117,14 +117,14 @@ luaA_root_keys(lua_State *L)
luaA_checktable(L, 1);
foreach(key, globalconf.keys)
key_unref(globalconf.L, *key);
luaA_object_unref(globalconf.L, *key);
key_array_wipe(&globalconf.keys);
key_array_init(&globalconf.keys);
lua_pushnil(L);
while(lua_next(L, 1))
key_array_append(&globalconf.keys, key_ref(L, -1));
key_array_append(&globalconf.keys, luaA_object_ref(L, -1));
int nscreen = xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
@ -141,7 +141,7 @@ luaA_root_keys(lua_State *L)
lua_createtable(L, globalconf.keys.len, 0);
for(int i = 0; i < globalconf.keys.len; i++)
{
key_push(L, globalconf.keys.tab[i]);
luaA_object_push(L, globalconf.keys.tab[i]);
lua_rawseti(L, -2, i + 1);
}
@ -164,14 +164,14 @@ luaA_root_buttons(lua_State *L)
luaA_checktable(L, 1);
foreach(button, globalconf.buttons)
button_unref(globalconf.L, *button);
luaA_object_unref(globalconf.L, *button);
button_array_wipe(&globalconf.buttons);
button_array_init(&globalconf.buttons);
lua_pushnil(L);
while(lua_next(L, 1))
button_array_append(&globalconf.buttons, button_ref(L, -1));
button_array_append(&globalconf.buttons, luaA_object_ref(L, -1));
return 1;
}
@ -179,7 +179,7 @@ luaA_root_buttons(lua_State *L)
lua_createtable(L, globalconf.buttons.len, 0);
for(int i = 0; i < globalconf.buttons.len; i++)
{
button_push(L, globalconf.buttons.tab[i]);
luaA_object_push(L, globalconf.buttons.tab[i]);
lua_rawseti(L, -2, i + 1);
}
@ -229,7 +229,7 @@ luaA_root_wiboxes(lua_State *L)
for(int i = 0; i < globalconf.wiboxes.len; i++)
{
wibox_push(L, globalconf.wiboxes.tab[i]);
luaA_object_push(L, globalconf.wiboxes.tab[i]);
lua_rawseti(L, -2, i + 1);
}

View File

@ -276,14 +276,14 @@ screen_client_moveto(client_t *c, screen_t *new_screen, bool dotag, bool doresiz
foreach(new_tag, new_screen->tags)
if((*new_tag)->selected)
{
tag_push(globalconf.L, *new_tag);
luaA_object_push(globalconf.L, *new_tag);
tag_client(c);
}
}
if(!doresize)
{
hook_property(client, c, "screen");
hook_property(c, "screen");
return;
}
@ -333,7 +333,7 @@ screen_client_moveto(client_t *c, screen_t *new_screen, bool dotag, bool doresiz
}
/* move / resize the client */
client_resize(c, new_geometry, false);
hook_property(client, c, "screen");
hook_property(c, "screen");
}
/** Push a screen onto the stack.
@ -401,7 +401,7 @@ luaA_screen_tags(lua_State *L)
lua_createtable(L, s->tags.len, 0);
for(i = 0; i < s->tags.len; i++)
{
tag_push(L, s->tags.tab[i]);
luaA_object_push(L, s->tags.tab[i]);
lua_rawseti(L, -2, i + 1);
}
}

View File

@ -39,7 +39,7 @@ stack_client_remove(client_t *c)
* \param c The client to push.
*/
void
stack_client_push(client_t *c)
stack_luaA_object_push(client_t *c)
{
stack_client_remove(c);
client_array_push(&globalconf.stack, c);

View File

@ -25,7 +25,7 @@
#include "structs.h"
void stack_client_remove(client_t *);
void stack_client_push(client_t *);
void stack_luaA_object_push(client_t *);
void stack_client_append(client_t *);
#endif

28
tag.c
View File

@ -28,7 +28,7 @@
void
tag_unref_simplified(tag_t **tag)
{
tag_unref(globalconf.L, *tag);
luaA_object_unref(globalconf.L, *tag);
}
/** Garbage collect a tag.
@ -62,7 +62,7 @@ tag_view(tag_t *tag, bool view)
if(globalconf.hooks.tags != LUA_REFNIL)
{
lua_pushnumber(globalconf.L, screen_index + 1);
tag_push(globalconf.L, tag);
luaA_object_push(globalconf.L, tag);
if(view)
lua_pushliteral(globalconf.L, "select");
else
@ -88,7 +88,7 @@ tag_append_to_screen(screen_t *s)
int phys_screen = screen_virttophys(screen_index);
tag->screen = s;
tag_array_append(&s->tags, tag_ref(globalconf.L, -1));
tag_array_append(&s->tags, luaA_object_ref(globalconf.L, -1));
ewmh_update_net_numbers_of_desktop(phys_screen);
ewmh_update_net_desktop_names(phys_screen);
ewmh_update_workarea(phys_screen);
@ -97,7 +97,7 @@ tag_append_to_screen(screen_t *s)
if(globalconf.hooks.tags != LUA_REFNIL)
{
lua_pushnumber(globalconf.L, screen_index + 1);
tag_push(globalconf.L, tag);
luaA_object_push(globalconf.L, tag);
lua_pushliteral(globalconf.L, "add");
luaA_dofunction_from_registry(globalconf.L, globalconf.hooks.tags, 3, 0);
}
@ -127,14 +127,14 @@ tag_remove_from_screen(tag_t *tag)
if(globalconf.hooks.tags != LUA_REFNIL)
{
lua_pushnumber(globalconf.L, screen_index + 1);
tag_push(globalconf.L, tag);
luaA_object_push(globalconf.L, tag);
lua_pushliteral(globalconf.L, "remove");
luaA_dofunction_from_registry(globalconf.L, globalconf.hooks.tags, 3, 0);
}
tag->screen = NULL;
tag_unref(globalconf.L, tag);
luaA_object_unref(globalconf.L, tag);
}
/** Tag a client with the tag on top of the stack.
@ -143,12 +143,12 @@ tag_remove_from_screen(tag_t *tag)
void
tag_client(client_t *c)
{
tag_t *t = tag_ref(globalconf.L, -1);
tag_t *t = luaA_object_ref(globalconf.L, -1);
/* don't tag twice */
if(is_client_tagged(c, t))
{
tag_unref(globalconf.L, t);
luaA_object_unref(globalconf.L, t);
return;
}
@ -159,8 +159,8 @@ tag_client(client_t *c)
/* call hook */
if(globalconf.hooks.tagged != LUA_REFNIL)
{
client_push(globalconf.L, c);
tag_push(globalconf.L, t);
luaA_object_push(globalconf.L, c);
luaA_object_push(globalconf.L, t);
luaA_dofunction_from_registry(globalconf.L, globalconf.hooks.tagged, 2, 0);
}
}
@ -182,11 +182,11 @@ untag_client(client_t *c, tag_t *t)
/* call hook */
if(globalconf.hooks.tagged != LUA_REFNIL)
{
client_push(globalconf.L, c);
tag_push(globalconf.L, t);
luaA_object_push(globalconf.L, c);
luaA_object_push(globalconf.L, t);
luaA_dofunction_from_registry(globalconf.L, globalconf.hooks.tagged, 2, 0);
}
tag_unref(globalconf.L, t);
luaA_object_unref(globalconf.L, t);
return;
}
}
@ -295,7 +295,7 @@ luaA_tag_clients(lua_State *L)
lua_createtable(L, clients->len, 0);
for(i = 0; i < clients->len; i++)
{
client_push(L, clients->tab[i]);
luaA_object_push(L, clients->tab[i]);
lua_rawseti(L, -2, i + 1);
}

View File

@ -205,10 +205,10 @@ titlebar_client_detach(client_t *c)
c->titlebar->type = WIBOX_TYPE_NORMAL;
c->titlebar->screen = NULL;
wibox_unref(globalconf.L, c->titlebar);
luaA_object_unref(globalconf.L, c->titlebar);
c->titlebar = NULL;
hook_property(client, c, "titlebar");
hook_property(c, "titlebar");
client_stack();
}
}
@ -220,7 +220,7 @@ void
titlebar_client_attach(client_t *c)
{
/* check if we can register the object */
wibox_t *t = wibox_ref(globalconf.L, -1);
wibox_t *t = luaA_object_ref(globalconf.L, -1);
titlebar_client_detach(c);
@ -267,7 +267,7 @@ titlebar_client_attach(client_t *c)
xcb_map_window(globalconf.connection, t->window);
hook_property(client, c, "titlebar");
hook_property(c, "titlebar");
client_stack();
}
@ -285,7 +285,7 @@ titlebar_set_visible(wibox_t *t, bool visible)
else
titlebar_ban(t);
hook_property(wibox, t, "visible");
hook_property(t, "visible");
client_stack();
}
}
@ -388,7 +388,7 @@ luaA_titlebar_newindex(lua_State *L, wibox_t *titlebar, awesome_token_t tok)
titlebar_update_geometry(c);
/* call geometry hook for client because some like to
* set titlebar width in that hook, which make sense */
hook_property(client, c, "geometry");
hook_property(c, "geometry");
}
}
break;

16
wibox.c
View File

@ -48,7 +48,7 @@ luaA_wibox_gc(lua_State *L)
void
wibox_unref_simplified(wibox_t **item)
{
wibox_unref(globalconf.L, *item);
luaA_object_unref(globalconf.L, *item);
}
static void
@ -603,7 +603,7 @@ wibox_setvisible(wibox_t *wibox, bool v)
wibox_systray_refresh(wibox);
}
hook_property(wibox, wibox, "visible");
hook_property(wibox, "visible");
}
}
@ -659,11 +659,11 @@ wibox_detach(wibox_t *wibox)
break;
}
hook_property(wibox, wibox, "screen");
hook_property(wibox, "screen");
wibox->screen = NULL;
wibox_unref(globalconf.L, wibox);
luaA_object_unref(globalconf.L, wibox);
}
}
@ -675,7 +675,7 @@ wibox_attach(screen_t *s)
{
int phys_screen = screen_virttophys(screen_array_indexof(&globalconf.screens, s));
wibox_t *wibox = wibox_ref(globalconf.L, -1);
wibox_t *wibox = luaA_object_ref(globalconf.L, -1);
wibox_detach(wibox);
@ -707,7 +707,7 @@ wibox_attach(screen_t *s)
else
wibox_need_update(wibox);
hook_property(wibox, wibox, "screen");
hook_property(wibox, "screen");
}
/** Create a new wibox.
@ -771,7 +771,7 @@ luaA_wibox_hasitem(lua_State *L, wibox_t *wibox, const void *item)
{
if(wibox->widgets_table)
{
wibox_push(L, wibox);
luaA_object_push(L, wibox);
luaA_object_push_item(L, -1, wibox->widgets_table);
lua_remove(L, -2);
if(lua_topointer(L, -1) == item || luaA_hasitem(L, item))
@ -851,7 +851,7 @@ luaA_wibox_index(lua_State *L)
lua_pushboolean(L, wibox->isvisible);
break;
case A_TK_CLIENT:
return client_push(L, client_getbytitlebar(wibox));
return luaA_object_push(L, client_getbytitlebar(wibox));
case A_TK_SCREEN:
if(!wibox->screen)
return 0;

View File

@ -52,7 +52,7 @@ luaA_widget_gc(lua_State *L)
void
widget_node_delete(widget_node_t *node)
{
widget_unref(globalconf.L, node->widget);
luaA_object_unref(globalconf.L, node->widget);
}
/** Get a widget node from a wibox by coords.
@ -117,7 +117,7 @@ luaA_table2widgets(lua_State *L, widget_node_array_t *widgets)
{
widget_node_t w;
p_clear(&w, 1);
w.widget = widget_ref(L, -1);
w.widget = luaA_object_ref(L, -1);
widget_node_array_append(widgets, w);
}
else
@ -138,7 +138,7 @@ widget_geometries(wibox_t *wibox)
if(wibox->widgets_table)
{
/* push wibox */
wibox_push(globalconf.L, wibox);
luaA_object_push(globalconf.L, wibox);
/* push widgets table */
luaA_object_push_item(globalconf.L, -1, wibox->widgets_table);
/* remove wibox */
@ -195,7 +195,7 @@ widget_geometries(wibox_t *wibox)
widget_node_array_init(widgets);
/* push wibox */
wibox_push(globalconf.L, wibox);
luaA_object_push(globalconf.L, wibox);
/* push widgets table */
luaA_object_push_item(globalconf.L, -1, wibox->widgets_table);
/* remove wibox */
@ -292,7 +292,7 @@ widget_render(wibox_t *wibox)
widget_node_array_wipe(widgets);
widget_node_array_init(widgets);
/* push wibox */
wibox_push(globalconf.L, wibox);
luaA_object_push(globalconf.L, wibox);
/* push widgets table */
luaA_object_push_item(globalconf.L, -1, wibox->widgets_table);
/* remove wibox */

View File

@ -190,7 +190,7 @@ luaA_textbox_index(lua_State *L, awesome_token_t token)
lua_pushstring(L, draw_align_tostr(d->bg_align));
return 1;
case A_TK_BG_IMAGE:
return image_push(L, d->bg_image);
return luaA_object_push(L, d->bg_image);
case A_TK_BG:
return luaA_pushcolor(L, &d->bg);
case A_TK_MARGIN: