lua{class,object}: rename signals functions

I knew this was wrong at the beginning, f*ck.

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-10-09 20:39:55 +02:00 committed by Uli Schlachter
parent f523b37e1d
commit 6d332f07a0
31 changed files with 209 additions and 209 deletions

View File

@ -307,9 +307,9 @@ awful.rules.rules = {
-- {{{ Signals
-- Signal function to execute when a new client appears.
client.add_signal("manage", function (c, startup)
client.connect_signal("manage", function (c, startup)
-- Enable sloppy focus
c:add_signal("mouse::enter", function(c)
c:connect_signal("mouse::enter", function(c)
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
and awful.client.focus.filter(c) then
client.focus = c
@ -329,6 +329,6 @@ client.add_signal("manage", function (c, startup)
end
end)
client.add_signal("focus", function(c) c.border_color = beautiful.border_focus end)
client.add_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- }}}

View File

@ -248,14 +248,14 @@ luaA_class_setup(lua_State *L, lua_class_t *class,
}
void
luaA_class_add_signal(lua_State *L, lua_class_t *lua_class, const char *name, lua_CFunction fn)
luaA_class_connect_signal(lua_State *L, lua_class_t *lua_class, const char *name, lua_CFunction fn)
{
lua_pushcfunction(L, fn);
luaA_class_add_signal_from_stack(L, lua_class, name, -1);
luaA_class_connect_signal_from_stack(L, lua_class, name, -1);
}
void
luaA_class_add_signal_from_stack(lua_State *L, lua_class_t *lua_class,
luaA_class_connect_signal_from_stack(lua_State *L, lua_class_t *lua_class,
const char *name, int ud)
{
luaA_checkfunction(L, ud);
@ -263,7 +263,7 @@ luaA_class_add_signal_from_stack(lua_State *L, lua_class_t *lua_class,
}
void
luaA_class_remove_signal_from_stack(lua_State *L, lua_class_t *lua_class,
luaA_class_disconnect_signal_from_stack(lua_State *L, lua_class_t *lua_class,
const char *name, int ud)
{
luaA_checkfunction(L, ud);

View File

@ -73,9 +73,9 @@ struct lua_class_t
const char * luaA_typename(lua_State *, int);
lua_class_t * luaA_class_get(lua_State *, int);
void luaA_class_add_signal(lua_State *, lua_class_t *, const char *, lua_CFunction);
void luaA_class_add_signal_from_stack(lua_State *, lua_class_t *, const char *, int);
void luaA_class_remove_signal_from_stack(lua_State *, lua_class_t *, const char *, int);
void luaA_class_connect_signal(lua_State *, lua_class_t *, const char *, lua_CFunction);
void luaA_class_connect_signal_from_stack(lua_State *, lua_class_t *, const char *, int);
void luaA_class_disconnect_signal_from_stack(lua_State *, lua_class_t *, const char *, int);
void luaA_class_emit_signal(lua_State *, lua_class_t *, const char *, int);
void luaA_openlib(lua_State *, const char *, const struct luaL_reg[], const struct luaL_reg[]);
@ -106,17 +106,17 @@ luaA_checkudataornil(lua_State *L, int udx, lua_class_t *class)
#define LUA_CLASS_FUNCS(prefix, lua_class) \
static inline int \
luaA_##prefix##_class_add_signal(lua_State *L) \
luaA_##prefix##_class_connect_signal(lua_State *L) \
{ \
luaA_class_add_signal_from_stack(L, &(lua_class), \
luaA_class_connect_signal_from_stack(L, &(lua_class), \
luaL_checkstring(L, 1), 2); \
return 0; \
} \
\
static inline int \
luaA_##prefix##_class_remove_signal(lua_State *L) \
luaA_##prefix##_class_disconnect_signal(lua_State *L) \
{ \
luaA_class_remove_signal_from_stack(L, &(lua_class), \
luaA_class_disconnect_signal_from_stack(L, &(lua_class), \
luaL_checkstring(L, 1), 2); \
return 0; \
} \
@ -130,8 +130,8 @@ luaA_checkudataornil(lua_State *L, int udx, lua_class_t *class)
}
#define LUA_CLASS_METHODS(class) \
{ "add_signal", luaA_##class##_class_add_signal }, \
{ "remove_signal", luaA_##class##_class_remove_signal }, \
{ "connect_signal", luaA_##class##_class_connect_signal }, \
{ "disconnect_signal", luaA_##class##_class_disconnect_signal }, \
{ "emit_signal", luaA_##class##_class_emit_signal },
#define LUA_CLASS_META \

View File

@ -149,19 +149,19 @@ luaA_settype(lua_State *L, lua_class_t *lua_class)
}
void
luaA_object_add_signal(lua_State *L, int oud,
luaA_object_connect_signal(lua_State *L, int oud,
const char *name, lua_CFunction fn)
{
lua_pushcfunction(L, fn);
luaA_object_add_signal_from_stack(L, oud, name, -1);
luaA_object_connect_signal_from_stack(L, oud, name, -1);
}
void
luaA_object_remove_signal(lua_State *L, int oud,
luaA_object_disconnect_signal(lua_State *L, int oud,
const char *name, lua_CFunction fn)
{
lua_pushcfunction(L, fn);
luaA_object_remove_signal_from_stack(L, oud, name, -1);
luaA_object_disconnect_signal_from_stack(L, oud, name, -1);
}
/** Add a signal to an object.
@ -171,7 +171,7 @@ luaA_object_remove_signal(lua_State *L, int oud,
* \param ud The index of function to call when signal is emitted.
*/
void
luaA_object_add_signal_from_stack(lua_State *L, int oud,
luaA_object_connect_signal_from_stack(lua_State *L, int oud,
const char *name, int ud)
{
luaA_checkfunction(L, ud);
@ -186,7 +186,7 @@ luaA_object_add_signal_from_stack(lua_State *L, int oud,
* \param ud The index of function to call when signal is emitted.
*/
void
luaA_object_remove_signal_from_stack(lua_State *L, int oud,
luaA_object_disconnect_signal_from_stack(lua_State *L, int oud,
const char *name, int ud)
{
luaA_checkfunction(L, ud);
@ -274,16 +274,16 @@ luaA_object_emit_signal(lua_State *L, int oud,
}
int
luaA_object_add_signal_simple(lua_State *L)
luaA_object_connect_signal_simple(lua_State *L)
{
luaA_object_add_signal_from_stack(L, 1, luaL_checkstring(L, 2), 3);
luaA_object_connect_signal_from_stack(L, 1, luaL_checkstring(L, 2), 3);
return 0;
}
int
luaA_object_remove_signal_simple(lua_State *L)
luaA_object_disconnect_signal_simple(lua_State *L)
{
luaA_object_remove_signal_from_stack(L, 1, luaL_checkstring(L, 2), 3);
luaA_object_disconnect_signal_from_stack(L, 1, luaL_checkstring(L, 2), 3);
return 0;
}

View File

@ -150,14 +150,14 @@ luaA_object_push(lua_State *L, void *pointer)
void signal_object_emit(lua_State *, signal_array_t *, const char *, int);
void luaA_object_add_signal(lua_State *, int, const char *, lua_CFunction);
void luaA_object_remove_signal(lua_State *, int, const char *, lua_CFunction);
void luaA_object_add_signal_from_stack(lua_State *, int, const char *, int);
void luaA_object_remove_signal_from_stack(lua_State *, int, const char *, int);
void luaA_object_connect_signal(lua_State *, int, const char *, lua_CFunction);
void luaA_object_disconnect_signal(lua_State *, int, const char *, lua_CFunction);
void luaA_object_connect_signal_from_stack(lua_State *, int, const char *, int);
void luaA_object_disconnect_signal_from_stack(lua_State *, int, const char *, int);
void luaA_object_emit_signal(lua_State *, int, const char *, int);
int luaA_object_add_signal_simple(lua_State *);
int luaA_object_remove_signal_simple(lua_State *);
int luaA_object_connect_signal_simple(lua_State *);
int luaA_object_disconnect_signal_simple(lua_State *);
int luaA_object_emit_signal_simple(lua_State *);
#define LUA_OBJECT_FUNCS(lua_class, type, prefix) \
@ -196,8 +196,8 @@ int luaA_object_tostring(lua_State *);
#define LUA_OBJECT_META(prefix) \
{ "__tostring", luaA_object_tostring }, \
{ "add_signal", luaA_object_add_signal_simple }, \
{ "remove_signal", luaA_object_remove_signal_simple }, \
{ "connect_signal", luaA_object_connect_signal_simple }, \
{ "disconnect_signal", luaA_object_disconnect_signal_simple }, \
{ "emit_signal", luaA_object_emit_signal_simple },
#endif

8
dbus.c
View File

@ -754,7 +754,7 @@ luaA_dbus_remove_match(lua_State *L)
* \lparam The function to call.
*/
static int
luaA_dbus_add_signal(lua_State *L)
luaA_dbus_connect_signal(lua_State *L)
{
const char *name = luaL_checkstring(L, 1);
luaA_checkfunction(L, 2);
@ -775,7 +775,7 @@ luaA_dbus_add_signal(lua_State *L)
* \lparam The function to call.
*/
static int
luaA_dbus_remove_signal(lua_State *L)
luaA_dbus_disconnect_signal(lua_State *L)
{
const char *name = luaL_checkstring(L, 1);
luaA_checkfunction(L, 2);
@ -791,8 +791,8 @@ const struct luaL_reg awesome_dbus_lib[] =
{ "release_name", luaA_dbus_release_name },
{ "add_match", luaA_dbus_add_match },
{ "remove_match", luaA_dbus_remove_match },
{ "add_signal", luaA_dbus_add_signal },
{ "remove_signal", luaA_dbus_remove_signal },
{ "connect_signal", luaA_dbus_connect_signal },
{ "disconnect_signal", luaA_dbus_disconnect_signal },
{ NULL, NULL }
};

30
ewmh.c
View File

@ -80,16 +80,16 @@ ewmh_client_update_hints(lua_State *L)
static int
ewmh_signal_on_client_new(lua_State *L)
{
luaA_object_add_signal(L, 1, "property::modal" , ewmh_client_update_hints);
luaA_object_add_signal(L, 1, "property::fullscreen" , ewmh_client_update_hints);
luaA_object_add_signal(L, 1, "property::maximized_horizontal" , ewmh_client_update_hints);
luaA_object_add_signal(L, 1, "property::maximized_vertical" , ewmh_client_update_hints);
luaA_object_add_signal(L, 1, "property::sticky" , ewmh_client_update_hints);
luaA_object_add_signal(L, 1, "property::skip_taskbar" , ewmh_client_update_hints);
luaA_object_add_signal(L, 1, "property::above" , ewmh_client_update_hints);
luaA_object_add_signal(L, 1, "property::below" , ewmh_client_update_hints);
luaA_object_add_signal(L, 1, "property::minimized" , ewmh_client_update_hints);
luaA_object_add_signal(L, 1, "property::urgent" , ewmh_client_update_hints);
luaA_object_connect_signal(L, 1, "property::modal" , ewmh_client_update_hints);
luaA_object_connect_signal(L, 1, "property::fullscreen" , ewmh_client_update_hints);
luaA_object_connect_signal(L, 1, "property::maximized_horizontal" , ewmh_client_update_hints);
luaA_object_connect_signal(L, 1, "property::maximized_vertical" , ewmh_client_update_hints);
luaA_object_connect_signal(L, 1, "property::sticky" , ewmh_client_update_hints);
luaA_object_connect_signal(L, 1, "property::skip_taskbar" , ewmh_client_update_hints);
luaA_object_connect_signal(L, 1, "property::above" , ewmh_client_update_hints);
luaA_object_connect_signal(L, 1, "property::below" , ewmh_client_update_hints);
luaA_object_connect_signal(L, 1, "property::minimized" , ewmh_client_update_hints);
luaA_object_connect_signal(L, 1, "property::urgent" , ewmh_client_update_hints);
return 0;
}
@ -222,11 +222,11 @@ ewmh_init(void)
ewmh_update_desktop_geometry();
luaA_class_add_signal(globalconf.L, &client_class, "new", ewmh_signal_on_client_new);
luaA_class_add_signal(globalconf.L, &client_class, "focus", ewmh_update_net_active_window);
luaA_class_add_signal(globalconf.L, &client_class, "unfocus", ewmh_update_net_active_window);
luaA_class_add_signal(globalconf.L, &client_class, "manage", ewmh_update_net_client_list);
luaA_class_add_signal(globalconf.L, &client_class, "unmanage", ewmh_update_net_client_list);
luaA_class_connect_signal(globalconf.L, &client_class, "new", ewmh_signal_on_client_new);
luaA_class_connect_signal(globalconf.L, &client_class, "focus", ewmh_update_net_active_window);
luaA_class_connect_signal(globalconf.L, &client_class, "unfocus", ewmh_update_net_active_window);
luaA_class_connect_signal(globalconf.L, &client_class, "manage", ewmh_update_net_client_list);
luaA_class_connect_signal(globalconf.L, &client_class, "unmanage", ewmh_update_net_client_list);
}
/** Set the client list in stacking order, bottom to top.

View File

@ -25,12 +25,12 @@ local function check_focus(obj)
end
end
atag.attached_add_signal(nil, "property::selected", check_focus)
client.add_signal("unmanage", check_focus)
client.add_signal("new", function(c)
c:add_signal("untagged", check_focus)
c:add_signal("property::hidden", check_focus)
c:add_signal("property::minimized", check_focus)
atag.attached_connect_signal(nil, "property::selected", check_focus)
client.connect_signal("unmanage", check_focus)
client.connect_signal("new", function(c)
c:connect_signal("untagged", check_focus)
c:connect_signal("property::hidden", check_focus)
c:connect_signal("property::minimized", check_focus)
end)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

View File

@ -38,10 +38,10 @@ function new(mod, button, press, release)
ret[#ret + 1] = capi.button({ modifiers = util.table.join(mod, set),
button = button })
if press then
ret[#ret]:add_signal("press", function(bobj, ...) press(...) end)
ret[#ret]:connect_signal("press", function(bobj, ...) press(...) end)
end
if release then
ret[#ret]:add_signal("release", function (bobj, ...) release(...) end)
ret[#ret]:connect_signal("release", function (bobj, ...) release(...) end)
end
end
return ret

View File

@ -570,16 +570,16 @@ local function store_floating_geometry(c)
end
-- Store the initial client geometry.
capi.client.add_signal("new", function(c)
capi.client.connect_signal("new", function(c)
local function store_init_geometry(c)
property.set(c, "floating_geometry", c:geometry())
c:remove_signal("property::geometry", store_init_geometry)
c:disconnect_signal("property::geometry", store_init_geometry)
end
c:add_signal("property::geometry", store_init_geometry)
c:connect_signal("property::geometry", store_init_geometry)
end)
capi.client.add_signal("manage", function(c)
c:add_signal("property::geometry", store_floating_geometry)
capi.client.connect_signal("manage", function(c)
c:connect_signal("property::geometry", store_floating_geometry)
end)
--- Return if a client has a fixe size or not.
@ -834,13 +834,13 @@ function property.set(c, prop, value)
end
-- Register standards signals
capi.client.add_signal("focus", focus.history.add)
capi.client.add_signal("unmanage", focus.history.delete)
capi.client.connect_signal("focus", focus.history.add)
capi.client.connect_signal("unmanage", focus.history.delete)
capi.client.add_signal("manage", function(c) c:add_signal("property::urgent", urgent.add) end)
capi.client.add_signal("focus", urgent.delete)
capi.client.add_signal("unmanage", urgent.delete)
capi.client.connect_signal("manage", function(c) c:connect_signal("property::urgent", urgent.add) end)
capi.client.connect_signal("focus", urgent.delete)
capi.client.connect_signal("unmanage", urgent.delete)
capi.client.add_signal("unmanage", floating.delete)
capi.client.connect_signal("unmanage", floating.delete)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

View File

@ -102,11 +102,11 @@ local function screen_change(window)
end
end
client.add_signal("manage", function (c)
c:add_signal("request::maximized_horizontal", maximized_horizontal)
c:add_signal("request::maximized_vertical", maximized_vertical)
c:add_signal("request::fullscreen", fullscreen)
c:add_signal("property::screen", screen_change)
client.connect_signal("manage", function (c)
c:connect_signal("request::maximized_horizontal", maximized_horizontal)
c:connect_signal("request::maximized_vertical", maximized_vertical)
c:connect_signal("request::fullscreen", fullscreen)
c:connect_signal("property::screen", screen_change)
end)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

View File

@ -38,10 +38,10 @@ function new(mod, key, press, release)
ret[#ret + 1] = capi.key({ modifiers = util.table.join(mod, set),
key = key })
if press then
ret[#ret]:add_signal("press", function(kobj, ...) press(...) end)
ret[#ret]:connect_signal("press", function(kobj, ...) press(...) end)
end
if release then
ret[#ret]:add_signal("release", function(kobj, ...) release(...) end)
ret[#ret]:connect_signal("release", function(kobj, ...) release(...) end)
end
end
return ret

View File

@ -96,21 +96,21 @@ end
local function arrange_prop(obj) arrange(obj.screen) end
capi.client.add_signal("new", function(c)
c:add_signal("property::size_hints_honor", arrange_prop)
c:add_signal("property::struts", arrange_prop)
c:add_signal("property::minimized", arrange_prop)
c:add_signal("property::sticky", arrange_prop)
c:add_signal("property::fullscreen", arrange_prop)
c:add_signal("property::maximized_horizontal", arrange_prop)
c:add_signal("property::maximized_vertical", arrange_prop)
c:add_signal("property::border_width", arrange_prop)
c:add_signal("property::hidden", arrange_prop)
c:add_signal("property::floating", arrange_prop)
c:add_signal("property::geometry", arrange_prop)
capi.client.connect_signal("new", function(c)
c:connect_signal("property::size_hints_honor", arrange_prop)
c:connect_signal("property::struts", arrange_prop)
c:connect_signal("property::minimized", arrange_prop)
c:connect_signal("property::sticky", arrange_prop)
c:connect_signal("property::fullscreen", arrange_prop)
c:connect_signal("property::maximized_horizontal", arrange_prop)
c:connect_signal("property::maximized_vertical", arrange_prop)
c:connect_signal("property::border_width", arrange_prop)
c:connect_signal("property::hidden", arrange_prop)
c:connect_signal("property::floating", arrange_prop)
c:connect_signal("property::geometry", arrange_prop)
-- If prop is screen, we do not know what was the previous screen, so
-- let's arrange all screens :-(
c:add_signal("property::screen", function(c)
c:connect_signal("property::screen", function(c)
for screen = 1, capi.screen.count() do arrange(screen) end end)
end)
@ -124,29 +124,29 @@ local function arrange_on_tagged(c, tag)
end
for s = 1, capi.screen.count() do
tag.attached_add_signal(s, "property::mwfact", arrange_prop)
tag.attached_add_signal(s, "property::nmaster", arrange_prop)
tag.attached_add_signal(s, "property::ncol", arrange_prop)
tag.attached_add_signal(s, "property::layout", arrange_prop)
tag.attached_add_signal(s, "property::windowfact", arrange_prop)
tag.attached_add_signal(s, "property::selected", arrange_prop)
tag.attached_add_signal(s, "tagged", arrange_prop)
capi.screen[s]:add_signal("property::workarea", function(screen)
tag.attached_connect_signal(s, "property::mwfact", arrange_prop)
tag.attached_connect_signal(s, "property::nmaster", arrange_prop)
tag.attached_connect_signal(s, "property::ncol", arrange_prop)
tag.attached_connect_signal(s, "property::layout", arrange_prop)
tag.attached_connect_signal(s, "property::windowfact", arrange_prop)
tag.attached_connect_signal(s, "property::selected", arrange_prop)
tag.attached_connect_signal(s, "tagged", arrange_prop)
capi.screen[s]:connect_signal("property::workarea", function(screen)
arrange(screen.index)
end)
capi.screen[s]:add_signal("tag::attach", function (screen, tag)
capi.screen[s]:connect_signal("tag::attach", function (screen, tag)
arrange(screen.index)
end)
capi.screen[s]:add_signal("tag::detach", function (screen, tag)
capi.screen[s]:connect_signal("tag::detach", function (screen, tag)
arrange(screen.index)
end)
capi.screen[s]:add_signal("padding", function (screen)
capi.screen[s]:connect_signal("padding", function (screen)
arrange(screen.index)
end)
end
capi.client.add_signal("focus", function(c) arrange(c.screen) end)
capi.client.add_signal("list", function()
capi.client.connect_signal("focus", function(c) arrange(c.screen) end)
capi.client.connect_signal("list", function()
for screen = 1, capi.screen.count() do
arrange(screen)
end

View File

@ -237,7 +237,7 @@ local function add_item(data, num, item_info)
item:buttons(bindings)
local mouse_enter_func = function () item_enter(data, num, true) end
item:add_signal("mouse::enter", mouse_enter_func)
item:connect_signal("mouse::enter", mouse_enter_func)
-- Create the submenu icon widget
local submenu

View File

@ -137,8 +137,8 @@ local function new()
-- setup the timer action only if needed
data[self].timer = timer { timeout = data[self].timeout }
data[self].animate_timer = timer { timeout = data[self].animate_timeout }
data[self].timer:add_signal("timeout", data[self].hide)
data[self].animate_timer:add_signal("timeout", data[self].animate)
data[self].timer:connect_signal("timeout", data[self].hide)
data[self].animate_timer:connect_signal("timeout", data[self].animate)
data[self].wibox.ontop = true
data[self].wibox.visible = false

View File

@ -18,7 +18,7 @@ local type = type
module("awful.remote")
if dbus then
dbus.add_signal("org.naquadah.awesome.awful.Remote", function(data, code)
dbus.connect_signal("org.naquadah.awesome.awful.Remote", function(data, code)
if data.member == "Eval" then
local f, e = loadstring(code)
if f then

View File

@ -145,7 +145,7 @@ function apply(c)
end
end
client.add_signal("manage", apply)
client.remove_signal("manage", atag.withcurrent)
client.connect_signal("manage", apply)
client.disconnect_signal("manage", atag.withcurrent)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

View File

@ -46,9 +46,9 @@ end
local function unregister_hook(event) unregister_event(event.id) end
local function register_hook(event) register_event(event.id) end
capi.awesome.add_signal("spawn::initiated", register_hook)
capi.awesome.add_signal("spawn::canceled", unregister_hook)
capi.awesome.add_signal("spawn::completed", unregister_hook)
capi.awesome.add_signal("spawn::timeout", unregister_hook)
capi.awesome.connect_signal("spawn::initiated", register_hook)
capi.awesome.connect_signal("spawn::canceled", unregister_hook)
capi.awesome.connect_signal("spawn::completed", unregister_hook)
capi.awesome.connect_signal("spawn::timeout", unregister_hook)
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

View File

@ -459,33 +459,33 @@ function withcurrent(c, startup)
end
end
local function attached_add_signal_screen(screen, sig, func)
capi.screen[screen]:add_signal("tag::attach", function (s, tag)
tag:add_signal(sig, func)
local function attached_connect_signal_screen(screen, sig, func)
capi.screen[screen]:connect_signal("tag::attach", function (s, tag)
tag:connect_signal(sig, func)
end)
capi.screen[screen]:add_signal("tag::detach", function (s, tag)
tag:remove_signal(sig, func)
capi.screen[screen]:connect_signal("tag::detach", function (s, tag)
tag:disconnect_signal(sig, func)
end)
for _, tag in ipairs(capi.screen[screen]:tags()) do
tag:add_signal(sig, func)
tag:connect_signal(sig, func)
end
end
--- Add a signal to all attached tag and all tag that will be attached in the
-- future. When a tag is detach from the screen, its signal is removed.
-- @param screen The screen concerned, or all if nil.
function attached_add_signal(screen, ...)
function attached_connect_signal(screen, ...)
if screen then
attached_add_signal_screen(screen, ...)
attached_connect_signal_screen(screen, ...)
else
for screen = 1, capi.screen.count() do
attached_add_signal_screen(screen, ...)
attached_connect_signal_screen(screen, ...)
end
end
end
-- Register standards signals
capi.client.add_signal("manage", function(c, startup)
capi.client.connect_signal("manage", function(c, startup)
-- If we are not managing this application at startup,
-- move it to the screen where the mouse is.
-- We only do it for "normal" windows (i.e. no dock, etc).
@ -502,13 +502,13 @@ capi.client.add_signal("manage", function(c, startup)
c.screen = capi.mouse.screen
end
end
c:add_signal("property::screen", withcurrent)
c:connect_signal("property::screen", withcurrent)
end)
capi.client.add_signal("manage", withcurrent)
capi.client.connect_signal("manage", withcurrent)
for s = 1, capi.screen.count() do
capi.screen[s]:add_signal("tag::history::update", history.update)
capi.screen[s]:connect_signal("tag::history::update", history.update)
end
setmetatable(_M, { __call = function (_, ...) return new(...) end })

View File

@ -18,7 +18,7 @@ local ipairs = ipairs
-- A tooltip is a small hint displayed when the mouse cursor
-- hovers a specific item.
-- In awesome, a tooltip can be linked with almost any
-- object having a <code>add_signal()</code> method and receiving
-- object having a <code>connect_signal()</code> method and receiving
-- <code>mouse::enter</code> and <code>mouse::leave</code> signals.
-- <p>How to create a tooltip?<br/>
-- <code>
@ -151,16 +151,16 @@ end
-- @param self The tooltip.
-- @param object An object.
local function add_to_object(self, object)
object:add_signal("mouse::enter", data[self].show)
object:add_signal("mouse::leave", data[self].hide)
object:connect_signal("mouse::enter", data[self].show)
object:connect_signal("mouse::leave", data[self].hide)
end
--- Remove tooltip from an object.
-- @param self The tooltip.
-- @param object An object.
local function remove_from_object(self, object)
object:remove_signal("mouse::enter", data[self].show)
object:remove_signal("mouse::leave", data[self].hide)
object:disconnect_signal("mouse::enter", data[self].show)
object:disconnect_signal("mouse::leave", data[self].hide)
end
@ -206,7 +206,7 @@ local function new(args)
self:set_text(args.timer_function())
set_geometry(self)
end
data[self].timer:add_signal("timeout", data[self].timer_function)
data[self].timer:connect_signal("timeout", data[self].timer_function)
end
-- set tooltip properties
@ -216,7 +216,7 @@ local function new(args)
self.wibox.widgets = { my_textbox }
-- add some signals on both the tooltip and widget
self.wibox:add_signal("mouse::enter", data[self].hide)
self.wibox:connect_signal("mouse::enter", data[self].hide)
-- Add tooltip to objects
if args.objects then

View File

@ -128,15 +128,15 @@ function attach(wibox, position)
wibox_prop_table.position = position
end
wibox:add_signal("property::width", wibox_update_strut)
wibox:add_signal("property::height", wibox_update_strut)
wibox:add_signal("property::visible", wibox_update_strut)
wibox:connect_signal("property::width", wibox_update_strut)
wibox:connect_signal("property::height", wibox_update_strut)
wibox:connect_signal("property::visible", wibox_update_strut)
wibox:add_signal("property::screen", call_wibox_position_hook_on_prop_update)
wibox:add_signal("property::width", call_wibox_position_hook_on_prop_update)
wibox:add_signal("property::height", call_wibox_position_hook_on_prop_update)
wibox:add_signal("property::visible", call_wibox_position_hook_on_prop_update)
wibox:add_signal("property::border_width", call_wibox_position_hook_on_prop_update)
wibox:connect_signal("property::screen", call_wibox_position_hook_on_prop_update)
wibox:connect_signal("property::width", call_wibox_position_hook_on_prop_update)
wibox:connect_signal("property::height", call_wibox_position_hook_on_prop_update)
wibox:connect_signal("property::visible", call_wibox_position_hook_on_prop_update)
wibox:connect_signal("property::border_width", call_wibox_position_hook_on_prop_update)
end
--- Align a wibox.
@ -326,11 +326,11 @@ local function update_wiboxes_on_struts(c)
end
-- Hook registered to reset all wiboxes position.
capi.client.add_signal("manage", function(c)
capi.client.connect_signal("manage", function(c)
update_wiboxes_on_struts(c)
c:add_signal("property::struts", update_wiboxes_on_struts)
c:connect_signal("property::struts", update_wiboxes_on_struts)
end)
capi.client.add_signal("unmanage", update_wiboxes_on_struts)
capi.client.connect_signal("unmanage", update_wiboxes_on_struts)
setmetatable(_M, { __call = function(_, ...) return new(...) end })

View File

@ -33,8 +33,8 @@ function new(args)
local w = capi.widget(args)
w.image = img_release
w:buttons(button({}, 1, function () w.image = img_press end, function () w.image = img_release end))
w:add_signal("mouse::leave", function () w.image = img_release end)
w:add_signal("mouse::enter", function ()
w:connect_signal("mouse::leave", function () w.image = img_release end)
w:connect_signal("mouse::enter", function ()
if capi.mouse.coords().buttons[1] then w.image = img_press end
end)
return w

View File

@ -81,8 +81,8 @@ function common.list_update(w, buttons, label, data, template, objects)
-- button object the user provided, but with the object as
-- argument.
local btn = capi.button { modifiers = b.modifiers, button = b.button }
btn:add_signal("press", function () b:emit_signal("press", o) end)
btn:add_signal("release", function () b:emit_signal("release", o) end)
btn:connect_signal("press", function () b:emit_signal("press", o) end)
btn:connect_signal("release", function () b:emit_signal("release", o) end)
data[o][#data[o] + 1] = btn
end
end

View File

@ -42,8 +42,8 @@ function new(screen, args)
return update(w, tag.screen)
end
tag.attached_add_signal(screen, "property::selected", update_on_tag_selection)
tag.attached_add_signal(screen, "property::layout", update_on_tag_selection)
tag.attached_connect_signal(screen, "property::selected", update_on_tag_selection)
tag.attached_connect_signal(screen, "property::layout", update_on_tag_selection)
return w
end

View File

@ -165,29 +165,29 @@ function new(screen, filter, buttons, style, template)
end
end
local uc = function (c) return u(c.screen) end
capi.client.add_signal("focus", uc)
capi.client.add_signal("unfocus", uc)
tag.attached_add_signal(screen, "property::selected", uc)
tag.attached_add_signal(screen, "property::icon", uc)
tag.attached_add_signal(screen, "property::hide", uc)
tag.attached_add_signal(screen, "property::name", uc)
capi.screen[screen]:add_signal("tag::attach", function(screen, tag)
capi.client.connect_signal("focus", uc)
capi.client.connect_signal("unfocus", uc)
tag.attached_connect_signal(screen, "property::selected", uc)
tag.attached_connect_signal(screen, "property::icon", uc)
tag.attached_connect_signal(screen, "property::hide", uc)
tag.attached_connect_signal(screen, "property::name", uc)
capi.screen[screen]:connect_signal("tag::attach", function(screen, tag)
u(screen.index)
end)
capi.screen[screen]:add_signal("tag::detach", function(screen, tag)
capi.screen[screen]:connect_signal("tag::detach", function(screen, tag)
u(screen.index)
end)
capi.client.add_signal("new", function(c)
c:add_signal("property::urgent", uc)
c:add_signal("property::screen", function(c)
capi.client.connect_signal("new", function(c)
c:connect_signal("property::urgent", uc)
c:connect_signal("property::screen", function(c)
-- If client change screen, refresh it anyway since we don't from
-- which screen it was coming :-)
u(screen)
end)
c:add_signal("tagged", uc)
c:add_signal("untagged", uc)
c:connect_signal("tagged", uc)
c:connect_signal("untagged", uc)
end)
capi.client.add_signal("unmanage", uc)
capi.client.connect_signal("unmanage", uc)
u(screen)
return w
end

View File

@ -135,25 +135,25 @@ function new(screen, filter, buttons, style, template)
local data = setmetatable({}, { __mode = 'k' })
local u = function () tasklist_update(screen, w, buttons, filter, data, style, template) end
capi.screen[screen]:add_signal("tag::detach", u)
tag.attached_add_signal(screen, "property::selected", u)
capi.client.add_signal("new", function (c)
c:add_signal("property::urgent", u)
c:add_signal("property::floating", u)
c:add_signal("property::maximized_horizontal", u)
c:add_signal("property::maximized_vertical", u)
c:add_signal("property::name", u)
c:add_signal("property::icon_name", u)
c:add_signal("property::icon", u)
c:add_signal("property::skip_taskbar", u)
c:add_signal("property::hidden", u)
c:add_signal("tagged", u)
c:add_signal("untagged", u)
capi.screen[screen]:connect_signal("tag::detach", u)
tag.attached_connect_signal(screen, "property::selected", u)
capi.client.connect_signal("new", function (c)
c:connect_signal("property::urgent", u)
c:connect_signal("property::floating", u)
c:connect_signal("property::maximized_horizontal", u)
c:connect_signal("property::maximized_vertical", u)
c:connect_signal("property::name", u)
c:connect_signal("property::icon_name", u)
c:connect_signal("property::icon", u)
c:connect_signal("property::skip_taskbar", u)
c:connect_signal("property::hidden", u)
c:connect_signal("tagged", u)
c:connect_signal("untagged", u)
end)
capi.client.add_signal("unmanage", u)
capi.client.add_signal("list", u)
capi.client.add_signal("focus", u)
capi.client.add_signal("unfocus", u)
capi.client.connect_signal("unmanage", u)
capi.client.connect_signal("list", u)
capi.client.connect_signal("focus", u)
capi.client.connect_signal("unfocus", u)
u()
return w
end

View File

@ -25,7 +25,7 @@ function new(args, format, timeout)
local w = capi.widget(args)
local timer = capi.timer { timeout = timeout }
w.text = os.date(format)
timer:add_signal("timeout", function() w.text = os.date(format) end)
timer:connect_signal("timeout", function() w.text = os.date(format) end)
timer:start()
return w
end

View File

@ -324,7 +324,7 @@ function notify(args)
local die = function () destroy(notification) end
if timeout > 0 then
local timer_die = capi.timer { timeout = timeout }
timer_die:add_signal("timeout", die)
timer_die:connect_signal("timeout", die)
if not suspended then
timer_die:start()
end
@ -346,7 +346,7 @@ function notify(args)
else
if notification.timer then notification.timer:stop() end
notification.timer = capi.timer { timeout = hover_timeout }
notification.timer:add_signal("timeout", die)
notification.timer:connect_signal("timeout", die)
notification.timer:start()
end
end
@ -403,7 +403,7 @@ function notify(args)
border_color = border_color,
border_width = border_width })
if hover_timeout then notification.box:add_signal("mouse::enter", hover_destroy) end
if hover_timeout then notification.box:connect_signal("mouse::enter", hover_destroy) end
-- calculate the height
if not height then
@ -465,7 +465,7 @@ end
-- DBUS/Notification support
-- Notify
if capi.dbus then
capi.dbus.add_signal("org.freedesktop.Notifications", function (data, appname, replaces_id, icon, title, text, actions, hints, expire)
capi.dbus.connect_signal("org.freedesktop.Notifications", function (data, appname, replaces_id, icon, title, text, actions, hints, expire)
args = { preset = { } }
if data.member == "Notify" then
if text ~= "" then
@ -543,7 +543,7 @@ if capi.dbus then
end
end)
capi.dbus.add_signal("org.freedesktop.DBus.Introspectable",
capi.dbus.connect_signal("org.freedesktop.DBus.Introspectable",
function (data, text)
if data.member == "Introspect" then
local xml = [=[<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object

8
luaa.c
View File

@ -614,7 +614,7 @@ luaA_awesome_newindex(lua_State *L)
* \lparam The function to call.
*/
static int
luaA_awesome_add_signal(lua_State *L)
luaA_awesome_connect_signal(lua_State *L)
{
const char *name = luaL_checkstring(L, 1);
luaA_checkfunction(L, 2);
@ -630,7 +630,7 @@ luaA_awesome_add_signal(lua_State *L)
* \lparam The function to call.
*/
static int
luaA_awesome_remove_signal(lua_State *L)
luaA_awesome_disconnect_signal(lua_State *L)
{
const char *name = luaL_checkstring(L, 1);
luaA_checkfunction(L, 2);
@ -701,8 +701,8 @@ luaA_init(xdgHandle* xdg)
{ "exec", luaA_exec },
{ "spawn", luaA_spawn },
{ "restart", luaA_restart },
{ "add_signal", luaA_awesome_add_signal },
{ "remove_signal", luaA_awesome_remove_signal },
{ "connect_signal", luaA_awesome_connect_signal },
{ "disconnect_signal", luaA_awesome_disconnect_signal },
{ "emit_signal", luaA_awesome_emit_signal },
{ "__index", luaA_awesome_index },
{ "__newindex", luaA_awesome_newindex },

View File

@ -770,7 +770,7 @@ luaA_wibox_new(lua_State *L)
if(!w->geometry.height)
w->geometry.height = 1;
luaA_object_add_signal(L, -2, "property::border_width", luaA_wibox_need_update);
luaA_object_connect_signal(L, -2, "property::border_width", luaA_wibox_need_update);
return 1;
}

View File

@ -538,7 +538,7 @@ luaA_screen_index(lua_State *L)
* \lparam A function to call when the signal is emitted.
*/
static int
luaA_screen_add_signal(lua_State *L)
luaA_screen_connect_signal(lua_State *L)
{
screen_t *s = lua_touserdata(L, 1);
const char *name = luaL_checkstring(L, 2);
@ -556,7 +556,7 @@ luaA_screen_add_signal(lua_State *L)
* \lparam A function to remove
*/
static int
luaA_screen_remove_signal(lua_State *L)
luaA_screen_disconnect_signal(lua_State *L)
{
screen_t *s = lua_touserdata(L, 1);
const char *name = luaL_checkstring(L, 2);
@ -619,8 +619,8 @@ const struct luaL_reg awesome_screen_methods[] =
const struct luaL_reg awesome_screen_meta[] =
{
{ "add_signal", luaA_screen_add_signal },
{ "remove_signal", luaA_screen_remove_signal },
{ "connect_signal", luaA_screen_connect_signal },
{ "disconnect_signal", luaA_screen_disconnect_signal },
{ "emit_signal", luaA_screen_emit_signal },
{ "tags", luaA_screen_tags },
{ "__index", luaA_screen_index },