mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
luaobject: emit signal on new object
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
4003ef726f
commit
c1d99f0960
15 changed files with 31 additions and 9 deletions
1
button.c
1
button.c
|
@ -144,6 +144,7 @@ luaA_button_newindex(lua_State *L)
|
|||
|
||||
const struct luaL_reg awesome_button_methods[] =
|
||||
{
|
||||
LUA_CLASS_METHODS(button)
|
||||
{ "__call", luaA_button_new },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
|
3
button.h
3
button.h
|
@ -38,7 +38,8 @@ struct button_t
|
|||
void *release;
|
||||
};
|
||||
|
||||
LUA_OBJECT_FUNCS(button_t, button, "button")
|
||||
lua_class_t button_class;
|
||||
LUA_OBJECT_FUNCS(button_class, button_t, button, "button")
|
||||
|
||||
#endif
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
1
client.c
1
client.c
|
@ -1956,6 +1956,7 @@ luaA_client_module_newindex(lua_State *L)
|
|||
|
||||
const struct luaL_reg awesome_client_methods[] =
|
||||
{
|
||||
LUA_CLASS_METHODS(client)
|
||||
{ "get", luaA_client_get },
|
||||
{ "__index", luaA_client_module_index },
|
||||
{ "__newindex", luaA_client_module_newindex },
|
||||
|
|
7
client.h
7
client.h
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "mouse.h"
|
||||
#include "stack.h"
|
||||
#include "common/luaclass.h"
|
||||
|
||||
#define CLIENT_SELECT_INPUT_EVENT_MASK (XCB_EVENT_MASK_STRUCTURE_NOTIFY \
|
||||
| XCB_EVENT_MASK_PROPERTY_CHANGE \
|
||||
|
@ -154,7 +155,11 @@ struct client_t
|
|||
client_t * luaA_client_checkudata(lua_State *, int);
|
||||
|
||||
ARRAY_FUNCS(client_t *, client, DO_NOTHING)
|
||||
LUA_OBJECT_FUNCS(client_t, client, "client")
|
||||
|
||||
/** Client class */
|
||||
lua_class_t client_class;
|
||||
|
||||
LUA_OBJECT_FUNCS(client_class, client_t, client, "client")
|
||||
|
||||
#define client_need_reban(c) \
|
||||
do { \
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#ifndef AWESOME_COMMON_LUAOBJECT
|
||||
#define AWESOME_COMMON_LUAOBJECT
|
||||
|
||||
#include "common/signal.h"
|
||||
#include "common/luaclass.h"
|
||||
|
||||
static inline int
|
||||
luaA_settype(lua_State *L, const char *type)
|
||||
|
@ -160,7 +160,8 @@ typedef struct
|
|||
LUA_OBJECT_HEADER
|
||||
} lua_object_t;
|
||||
|
||||
#define LUA_OBJECT_FUNCS(type, prefix, lua_type) \
|
||||
#define LUA_OBJECT_FUNCS(lua_class, type, prefix, lua_type) \
|
||||
LUA_CLASS_FUNCS(prefix, lua_class) \
|
||||
static inline type * \
|
||||
prefix##_new(lua_State *L) \
|
||||
{ \
|
||||
|
@ -171,6 +172,8 @@ typedef struct
|
|||
lua_newtable(L); \
|
||||
lua_setmetatable(L, -2); \
|
||||
lua_setfenv(L, -2); \
|
||||
lua_pushvalue(L, -1); \
|
||||
luaA_class_emit_signal(L, &(lua_class), "new", 1); \
|
||||
return p; \
|
||||
} \
|
||||
\
|
||||
|
|
1
image.c
1
image.c
|
@ -770,6 +770,7 @@ luaA_image_index(lua_State *L)
|
|||
|
||||
const struct luaL_reg awesome_image_methods[] =
|
||||
{
|
||||
LUA_CLASS_METHODS(image)
|
||||
{ "__call", luaA_image_new },
|
||||
{ "argb32", luaA_image_argb32_new },
|
||||
{ NULL, NULL }
|
||||
|
|
4
image.h
4
image.h
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "common/util.h"
|
||||
#include "common/luaobject.h"
|
||||
#include "common/luaclass.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -39,7 +40,8 @@ typedef struct
|
|||
bool isupdated;
|
||||
} image_t;
|
||||
|
||||
LUA_OBJECT_FUNCS(image_t, image, "image")
|
||||
lua_class_t image_class;
|
||||
LUA_OBJECT_FUNCS(image_class, image_t, image, "image")
|
||||
|
||||
int image_new_from_argb32(int, int, uint32_t *);
|
||||
uint8_t * image_getdata(image_t *);
|
||||
|
|
1
key.c
1
key.c
|
@ -1146,6 +1146,7 @@ luaA_key_newindex(lua_State *L)
|
|||
|
||||
const struct luaL_reg awesome_key_methods[] =
|
||||
{
|
||||
LUA_CLASS_METHODS(key)
|
||||
{ "__call", luaA_key_new },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
|
3
key.h
3
key.h
|
@ -39,7 +39,8 @@ typedef struct keyb_t
|
|||
void *release;
|
||||
} keyb_t;
|
||||
|
||||
LUA_OBJECT_FUNCS(keyb_t, key, "key")
|
||||
lua_class_t key_class;
|
||||
LUA_OBJECT_FUNCS(key_class, keyb_t, key, "key")
|
||||
|
||||
bool key_press_lookup_string(xcb_keysym_t, char *, ssize_t);
|
||||
xcb_keysym_t key_getkeysym(xcb_keycode_t, uint16_t);
|
||||
|
|
1
tag.c
1
tag.c
|
@ -405,6 +405,7 @@ luaA_tag_newindex(lua_State *L)
|
|||
|
||||
const struct luaL_reg awesome_tag_methods[] =
|
||||
{
|
||||
LUA_CLASS_METHODS(tag)
|
||||
{ "__call", luaA_tag_new },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
|
3
tag.h
3
tag.h
|
@ -47,7 +47,8 @@ void tag_append_to_screen(screen_t *);
|
|||
void tag_unref_simplified(tag_t **);
|
||||
|
||||
ARRAY_FUNCS(tag_t *, tag, tag_unref_simplified)
|
||||
LUA_OBJECT_FUNCS(tag_t, tag, "tag")
|
||||
lua_class_t tag_class;
|
||||
LUA_OBJECT_FUNCS(tag_class, tag_t, tag, "tag")
|
||||
|
||||
#endif
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
1
wibox.c
1
wibox.c
|
@ -1201,6 +1201,7 @@ luaA_wibox_newindex(lua_State *L)
|
|||
|
||||
const struct luaL_reg awesome_wibox_methods[] =
|
||||
{
|
||||
LUA_CLASS_METHODS(wibox)
|
||||
{ "__call", luaA_wibox_new },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
|
3
wibox.h
3
wibox.h
|
@ -116,7 +116,8 @@ void wibox_border_width_set(wibox_t *, uint32_t);
|
|||
void wibox_border_color_set(wibox_t *, const xcolor_t *);
|
||||
void wibox_orientation_set(wibox_t *, orientation_t);
|
||||
|
||||
LUA_OBJECT_FUNCS(wibox_t, wibox, "wibox")
|
||||
lua_class_t wibox_class;
|
||||
LUA_OBJECT_FUNCS(wibox_class, wibox_t, wibox, "wibox")
|
||||
|
||||
#endif
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||
|
|
1
widget.c
1
widget.c
|
@ -552,6 +552,7 @@ luaA_widget_extents(lua_State *L)
|
|||
|
||||
const struct luaL_reg awesome_widget_methods[] =
|
||||
{
|
||||
LUA_CLASS_METHODS(widget)
|
||||
{ "__call", luaA_widget_new },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
|
3
widget.h
3
widget.h
|
@ -56,7 +56,8 @@ struct widget_t
|
|||
bool isvisible;
|
||||
};
|
||||
|
||||
LUA_OBJECT_FUNCS(widget_t, widget, "widget");
|
||||
lua_class_t widget_class;
|
||||
LUA_OBJECT_FUNCS(widget_class, widget_t, widget, "widget");
|
||||
|
||||
struct widget_node_t
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue