Merge pull request #948 from psychon/deprecate-add-signal

Deprecate add_signal
This commit is contained in:
Daniel Hahler 2016-06-07 22:58:14 +02:00
commit d9cd0a4f0e
42 changed files with 367 additions and 706 deletions

View File

@ -34,13 +34,6 @@
int len, size; \ int len, size; \
} pfx##_array_t; } pfx##_array_t;
#define ARRAY_TYPE_EXTRA(type_t, pfx, extra) \
typedef struct pfx##_array_t { \
type_t *tab; \
int len, size; \
extra; \
} pfx##_array_t;
#define foreach(var, array) \ #define foreach(var, array) \
for(int __foreach_index_##var = 0; \ for(int __foreach_index_##var = 0; \
__foreach_index_##var < (array).len; \ __foreach_index_##var < (array).len; \

View File

@ -254,11 +254,6 @@ luaA_class_setup(lua_State *L, lua_class_t *class,
class->index_miss_handler = LUA_REFNIL; class->index_miss_handler = LUA_REFNIL;
class->newindex_miss_handler = LUA_REFNIL; class->newindex_miss_handler = LUA_REFNIL;
signal_add(&class->signals, "new");
if (parent)
class->signals.inherits_from = &parent->signals;
lua_class_array_append(&luaA_classes, class); lua_class_array_append(&luaA_classes, class);
} }

View File

@ -123,7 +123,7 @@ luaA_checkudataornil(lua_State *L, int udx, lua_class_t *class)
static inline int \ static inline int \
luaA_##prefix##_class_add_signal(lua_State *L) \ luaA_##prefix##_class_add_signal(lua_State *L) \
{ \ { \
signal_add(&(lua_class).signals, luaL_checkstring(L, 1)); \ luaA_deprecate(L, "signal usage without add_signal()"); \
return 0; \ return 0; \
} \ } \
\ \

View File

@ -253,8 +253,7 @@ signal_object_emit(lua_State *L, signal_array_t *arr, const char *name, int narg
lua_remove(L, - nargs - nbfunc - 1 + i); lua_remove(L, - nargs - nbfunc - 1 + i);
luaA_dofunction(L, nargs, 0); luaA_dofunction(L, nargs, 0);
} }
} else }
luaA_warn(L, "Trying to emit unknown signal '%s'", name);
/* remove args */ /* remove args */
lua_pop(L, nargs); lua_pop(L, nargs);
@ -304,9 +303,6 @@ luaA_object_emit_signal(lua_State *L, int oud,
lua_remove(L, - nargs - nbfunc - 2 + i); lua_remove(L, - nargs - nbfunc - 2 + i);
luaA_dofunction(L, nargs + 1, 0); luaA_dofunction(L, nargs + 1, 0);
} }
} else {
luaA_warn(L, "Trying to emit unknown signal '%s'", name);
return;
} }
/* Then emit signal on the class */ /* Then emit signal on the class */

View File

@ -175,7 +175,6 @@ int luaA_object_emit_signal_simple(lua_State *);
lua_setmetatable(L, -2); \ lua_setmetatable(L, -2); \
luaA_setuservalue(L, -2); \ luaA_setuservalue(L, -2); \
lua_pushvalue(L, -1); \ lua_pushvalue(L, -1); \
p->signals.inherits_from = &(lua_class).signals; \
luaA_class_emit_signal(L, &(lua_class), "new", 1); \ luaA_class_emit_signal(L, &(lua_class), "new", 1); \
return p; \ return p; \
} }

View File

@ -45,54 +45,13 @@ signal_wipe(signal_t *sig)
cptr_array_wipe(&sig->sigfuncs); cptr_array_wipe(&sig->sigfuncs);
} }
ARRAY_TYPE_EXTRA(signal_t, signal, struct signal_array_t *inherits_from) DO_BARRAY(signal_t, signal, signal_wipe, signal_cmp)
BARRAY_FUNCS(signal_t, signal, signal_wipe, signal_cmp)
static inline signal_t * static inline signal_t *
signal_array_getbyid(signal_array_t *arr, unsigned long id) signal_array_getbyid(signal_array_t *arr, unsigned long id)
{ {
signal_t sig = { .id = id }; signal_t sig = { .id = id };
signal_t *result; return signal_array_lookup(arr, &sig);
result = signal_array_lookup(arr, &sig);
if(result)
return result;
/* The signal doesn't exist yet. Check if some of our inherits_from have the
* signal and if yes, add it.
*/
signal_array_t *inherit = arr->inherits_from;
while(inherit != NULL)
{
if(signal_array_lookup(inherit, &sig))
break;
inherit = inherit->inherits_from;
}
if(inherit)
{
/* Add the signal to this array to pretend it always existed */
signal_array_insert(arr, sig);
result = signal_array_lookup(arr, &sig);
assert(result != NULL);
}
return result;
}
/** Add a signal to a signal array.
* Signals have to be added before they can be added or emitted.
* \param arr The signal array.
* \param name The signal name.
*/
static inline void
signal_add(signal_array_t *arr, const char *name)
{
unsigned long tok = a_strhash((const unsigned char *) name);
signal_t *sigfound = signal_array_getbyid(arr, tok);
if(!sigfound)
{
signal_t sig = { .id = tok };
signal_array_insert(arr, sig);
}
} }
/** Connect a signal inside a signal array. /** Connect a signal inside a signal array.
@ -109,7 +68,11 @@ signal_connect(signal_array_t *arr, const char *name, const void *ref)
if(sigfound) if(sigfound)
cptr_array_append(&sigfound->sigfuncs, ref); cptr_array_append(&sigfound->sigfuncs, ref);
else else
warn("Trying to connect to unknown signal '%s'", name); {
signal_t sig = { .id = tok };
cptr_array_append(&sig.sigfuncs, ref);
signal_array_insert(arr, sig);
}
} }
/** Disconnect a signal inside a signal array. /** Disconnect a signal inside a signal array.
@ -131,8 +94,7 @@ signal_disconnect(signal_array_t *arr, const char *name, const void *ref)
cptr_array_remove(&sigfound->sigfuncs, func); cptr_array_remove(&sigfound->sigfuncs, func);
break; break;
} }
} else }
warn("Trying to disconnect from unknown signal '%s'", name);
} }
#endif #endif

3
dbus.c
View File

@ -773,10 +773,7 @@ luaA_dbus_connect_signal(lua_State *L)
if(sig) if(sig)
luaA_warn(L, "cannot add signal %s on D-Bus, already existing", name); luaA_warn(L, "cannot add signal %s on D-Bus, already existing", name);
else else
{
signal_add(&dbus_signals, name);
signal_connect(&dbus_signals, name, luaA_object_ref(L, 2)); signal_connect(&dbus_signals, name, luaA_object_ref(L, 2));
}
return 0; return 0;
} }

View File

@ -2,7 +2,6 @@
--- Disonnect to a signal. --- Disonnect to a signal.
-- @tparam string name The name of the signal -- @tparam string name The name of the signal
-- @tparam function func The callback that should be disconnected -- @tparam function func The callback that should be disconnected
-- @see add_signal
-- @function disconnect_signal -- @function disconnect_signal
--- Emit a signal. --- Emit a signal.
@ -13,15 +12,9 @@
-- that are given to emit_signal() -- that are given to emit_signal()
-- @function emit_signal -- @function emit_signal
--- Add a signal to an object. All signals must be added before they can be used.
--
-- @tparam string name The name of the new signal.
-- @function add_signal
--- Connect to a signal. --- Connect to a signal.
-- @tparam string name The name of the signal -- @tparam string name The name of the signal
-- @tparam function func The callback to call when the signal is emitted -- @tparam function func The callback to call when the signal is emitted
-- @see add_signal
-- @function connect_signal -- @function connect_signal
--- Connect to a signal weakly. This allows the callback function to be garbage --- Connect to a signal weakly. This allows the callback function to be garbage

View File

@ -1159,25 +1159,17 @@ end
--- The last geometry when client was floating. --- The last geometry when client was floating.
-- @signal property::floating_geometry -- @signal property::floating_geometry
capi.client.add_signal("property::floating_geometry")
capi.client.add_signal("property::floating")
capi.client.add_signal("property::dockable")
--- Emited when a client need to get a titlebar. --- Emited when a client need to get a titlebar.
-- @signal request::titlebars -- @signal request::titlebars
-- @tparam[opt=nil] string content The context (like "rules") -- @tparam[opt=nil] string content The context (like "rules")
-- @tparam[opt=nil] table hints Some hints. -- @tparam[opt=nil] table hints Some hints.
capi.client.add_signal("request::titlebars")
--- The client marked signal (deprecated). --- The client marked signal (deprecated).
-- @signal .marked -- @signal .marked
capi.client.add_signal("marked")
--- The client unmarked signal (deprecated). --- The client unmarked signal (deprecated).
-- @signal unmarked -- @signal unmarked
capi.client.add_signal("unmarked")
-- Add clients during startup to focus history. -- Add clients during startup to focus history.
-- This used to happen through ewmh.activate, but that only handles visible -- This used to happen through ewmh.activate, but that only handles visible

View File

@ -222,8 +222,6 @@ local function arrange_tag(t)
layout.arrange(t.screen) layout.arrange(t.screen)
end end
capi.screen.add_signal("arrange")
capi.tag.connect_signal("property::master_width_factor", arrange_tag) capi.tag.connect_signal("property::master_width_factor", arrange_tag)
capi.tag.connect_signal("property::master_count", arrange_tag) capi.tag.connect_signal("property::master_count", arrange_tag)
capi.tag.connect_signal("property::column_count", arrange_tag) capi.tag.connect_signal("property::column_count", arrange_tag)

View File

@ -558,7 +558,6 @@ attach = function(d, position_f, args)
end end
-- Create a way to detach a placement function -- Create a way to detach a placement function
d:add_signal("property::detach_callback")
function d.detach_callback() function d.detach_callback()
d:disconnect_signal("property::width" , tracker) d:disconnect_signal("property::width" , tracker)
d:disconnect_signal("property::height" , tracker) d:disconnect_signal("property::height" , tracker)

View File

@ -465,8 +465,6 @@ function screen.object.set_selected_tag() end
--- When the tag history changed. --- When the tag history changed.
-- @signal tag::history::update -- @signal tag::history::update
capi.screen.add_signal("padding")
-- Extend the luaobject -- Extend the luaobject
object.properties(capi.screen, { object.properties(capi.screen, {
getter_class = screen.object, getter_class = screen.object,

View File

@ -297,7 +297,5 @@ capi.awesome.connect_signal("spawn::canceled" , spawn.on_snid_cancel )
capi.awesome.connect_signal("spawn::timeout" , spawn.on_snid_cancel ) capi.awesome.connect_signal("spawn::timeout" , spawn.on_snid_cancel )
capi.client.connect_signal ("manage" , spawn.on_snid_callback ) capi.client.connect_signal ("manage" , spawn.on_snid_callback )
capi.client.add_signal ("spawn::completed_with_payload" )
return setmetatable(spawn, { __call = function(_, ...) return spawn.spawn(...) end }) return setmetatable(spawn, { __call = function(_, ...) return spawn.spawn(...) end })
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -1323,22 +1323,6 @@ capi.client.connect_signal("untagged", client_untagged)
capi.client.connect_signal("tagged", client_tagged) capi.client.connect_signal("tagged", client_tagged)
capi.tag.connect_signal("request::select", tag.object.view_only) capi.tag.connect_signal("request::select", tag.object.view_only)
capi.tag.add_signal("property::hide")
capi.tag.add_signal("property::icon")
capi.tag.add_signal("property::icon_only")
capi.tag.add_signal("property::layout")
capi.tag.add_signal("property::mwfact")
capi.tag.add_signal("property::master_width_factor")
capi.tag.add_signal("property::useless_gap")
capi.tag.add_signal("property::master_fill_policy")
capi.tag.add_signal("property::ncol")
capi.tag.add_signal("property::column_count")
capi.tag.add_signal("property::nmaster")
capi.tag.add_signal("property::master_count")
capi.tag.add_signal("property::windowfact")
capi.tag.add_signal("property::screen")
capi.tag.add_signal("property::index")
--- True when a tagged client is urgent --- True when a tagged client is urgent
-- @signal property::urgent -- @signal property::urgent
-- @see client.urgent -- @see client.urgent
@ -1347,15 +1331,6 @@ capi.tag.add_signal("property::index")
-- @signal property::urgent_count -- @signal property::urgent_count
-- @see client.urgent -- @see client.urgent
capi.tag.add_signal("property::urgent")
capi.tag.add_signal("property::urgent_count")
capi.tag.add_signal("property::volatile")
capi.tag.add_signal("request::screen")
capi.tag.add_signal("removal-pending")
capi.screen.add_signal("tag::history::update")
capi.screen.connect_signal("tag::history::update", tag.history.update) capi.screen.connect_signal("tag::history::update", tag.history.update)
capi.screen.connect_signal("removed", function(s) capi.screen.connect_signal("removed", function(s)

View File

@ -196,7 +196,6 @@ end
-- @see set_markup -- @see set_markup
tooltip.new = function(args) tooltip.new = function(args)
local self = setmetatable(object(), instance_mt) local self = setmetatable(object(), instance_mt)
self:add_signal("property::visible")
self.visible = false self.visible = false
-- private data -- private data

View File

@ -341,11 +341,9 @@ function awfulwibar.new(arg)
w._screen = screen --HACK When a screen is removed, then getbycoords wont work w._screen = screen --HACK When a screen is removed, then getbycoords wont work
w._stretch = arg.stretch == nil and has_to_stretch or arg.stretch w._stretch = arg.stretch == nil and has_to_stretch or arg.stretch
w:add_signal("property::position")
w.get_position = get_position w.get_position = get_position
w.set_position = set_position w.set_position = set_position
w:add_signal("property::stretch")
w.get_stretch = get_stretch w.get_stretch = get_stretch
w.set_stretch = set_stretch w.set_stretch = set_stretch
w.remove = remove w.remove = remove

View File

@ -21,45 +21,36 @@ local object = { properties = properties, mt = {} }
--- Verify that obj is indeed a valid object as returned by new() --- Verify that obj is indeed a valid object as returned by new()
local function check(obj) local function check(obj)
if type(obj) ~= "table" or type(obj._signals) ~= "table" then if type(obj) ~= "table" or type(obj._signals) ~= "table" then
error("add_signal() called on non-object") error("called on non-object")
end end
end end
--- Find a given signal --- Find a given signal
-- @tparam table obj The object to search in -- @tparam table obj The object to search in
-- @tparam string name The signal to find -- @tparam string name The signal to find
-- @tparam string error_msg Error message for if the signal is not found
-- @treturn table The signal table -- @treturn table The signal table
local function find_signal(obj, name, error_msg) local function find_signal(obj, name)
check(obj) check(obj)
if not obj._signals[name] then if not obj._signals[name] then
error("Trying to " .. error_msg .. " non-existent signal '" .. name .. "'") assert(type(name) == "string", "name must be a string, got: " .. type(name))
end obj._signals[name] = {
return obj._signals[name]
end
--- Add a signal to an object. All signals must be added before they can be used.
--
--@DOC_text_gears_object_signal_EXAMPLE@
-- @tparam string name The name of the new signal.
function object:add_signal(name)
check(self)
assert(type(name) == "string", "name must be a string, got: " .. type(name))
if not self._signals[name] then
self._signals[name] = {
strong = {}, strong = {},
weak = setmetatable({}, { __mode = "kv" }) weak = setmetatable({}, { __mode = "kv" })
} }
end end
return obj._signals[name]
end
function object.add_signal()
require("awful.util").deprecate("Use signals without explicitly adding them. This is now done implicitly.")
end end
--- Connect to a signal. --- Connect to a signal.
-- @tparam string name The name of the signal -- @tparam string name The name of the signal
-- @tparam function func The callback to call when the signal is emitted -- @tparam function func The callback to call when the signal is emitted
-- @see add_signal
function object:connect_signal(name, func) function object:connect_signal(name, func)
assert(type(func) == "function", "callback must be a function, got: " .. type(func)) assert(type(func) == "function", "callback must be a function, got: " .. type(func))
local sig = find_signal(self, name, "connect to") local sig = find_signal(self, name)
assert(sig.weak[func] == nil, "Trying to connect a strong callback which is already connected weakly") assert(sig.weak[func] == nil, "Trying to connect a strong callback which is already connected weakly")
sig.strong[func] = true sig.strong[func] = true
end end
@ -100,7 +91,7 @@ end
-- @tparam function func The callback to call when the signal is emitted -- @tparam function func The callback to call when the signal is emitted
function object:weak_connect_signal(name, func) function object:weak_connect_signal(name, func)
assert(type(func) == "function", "callback must be a function, got: " .. type(func)) assert(type(func) == "function", "callback must be a function, got: " .. type(func))
local sig = find_signal(self, name, "connect to") local sig = find_signal(self, name)
assert(sig.strong[func] == nil, "Trying to connect a weak callback which is already connected strongly") assert(sig.strong[func] == nil, "Trying to connect a weak callback which is already connected strongly")
sig.weak[func] = make_the_gc_obey(func) sig.weak[func] = make_the_gc_obey(func)
end end
@ -108,9 +99,8 @@ end
--- Disonnect to a signal. --- Disonnect to a signal.
-- @tparam string name The name of the signal -- @tparam string name The name of the signal
-- @tparam function func The callback that should be disconnected -- @tparam function func The callback that should be disconnected
-- @see add_signal
function object:disconnect_signal(name, func) function object:disconnect_signal(name, func)
local sig = find_signal(self, name, "disconnect from") local sig = find_signal(self, name)
sig.weak[func] = nil sig.weak[func] = nil
sig.strong[func] = nil sig.strong[func] = nil
end end
@ -122,7 +112,7 @@ end
-- function receives the object as first argument and then any extra arguments -- function receives the object as first argument and then any extra arguments
-- that are given to emit_signal() -- that are given to emit_signal()
function object:emit_signal(name, ...) function object:emit_signal(name, ...)
local sig = find_signal(self, name, "emit") local sig = find_signal(self, name)
for func in pairs(sig.strong) do for func in pairs(sig.strong) do
func(self, ...) func(self, ...)
end end
@ -163,8 +153,8 @@ local function set_miss(self, key, value)
end end
end end
--- Returns a new object. You can call `:emit_signal()`, `:disconnect_signal()`, --- Returns a new object. You can call `:emit_signal()`, `:disconnect_signal()`
-- `:connect_signal()` and `:add_signal()` on the resulting object. -- and `:connect_signal()` on the resulting object.
-- --
-- Note that `args.enable_auto_signals` is only supported when -- Note that `args.enable_auto_signals` is only supported when
-- `args.enable_properties` is true. -- `args.enable_properties` is true.

View File

@ -97,11 +97,6 @@ local timer_instance_mt = {
timer.new = function(args) timer.new = function(args)
local ret = object() local ret = object()
ret:add_signal("property::timeout")
ret:add_signal("timeout")
ret:add_signal("start")
ret:add_signal("stop")
ret.data = { timeout = 0 } ret.data = { timeout = 0 }
setmetatable(ret, timer_instance_mt) setmetatable(ret, timer_instance_mt)

View File

@ -298,7 +298,6 @@ local function setup_signals(_drawable)
local d = _drawable.drawable local d = _drawable.drawable
local function clone_signal(name) local function clone_signal(name)
_drawable:add_signal(name)
-- When "name" is emitted on wibox.drawin, also emit it on wibox -- When "name" is emitted on wibox.drawin, also emit it on wibox
d:connect_signal(name, function(_, ...) d:connect_signal(name, function(_, ...)
_drawable:emit_signal(name, ...) _drawable:emit_signal(name, ...)

View File

@ -98,7 +98,6 @@ end
local function setup_signals(_wibox) local function setup_signals(_wibox)
local obj local obj
local function clone_signal(name) local function clone_signal(name)
_wibox:add_signal(name)
-- When "name" is emitted on wibox.drawin, also emit it on wibox -- When "name" is emitted on wibox.drawin, also emit it on wibox
obj:connect_signal(name, function(_, ...) obj:connect_signal(name, function(_, ...)
_wibox:emit_signal(name, ...) _wibox:emit_signal(name, ...)
@ -234,8 +233,6 @@ local function new(args)
return ret return ret
end end
capi.drawin.add_signal("property::get_wibox")
--- Redraw a wibox. You should never have to call this explicitely because it is --- Redraw a wibox. You should never have to call this explicitely because it is
-- automatically called when needed. -- automatically called when needed.
-- @param wibox -- @param wibox

View File

@ -556,18 +556,8 @@ function base.make_widget(proxy, widget_name, args)
class = args.class, class = args.class,
} }
-- This signal is used by layouts to find out when they have to update.
ret:add_signal("widget::layout_changed")
ret:add_signal("widget::redraw_needed")
-- Mouse input, oh noes!
ret:add_signal("button::press")
ret:add_signal("button::release")
ret:add_signal("mouse::enter")
ret:add_signal("mouse::leave")
-- Backwards compatibility -- Backwards compatibility
-- TODO: Remove this -- TODO: Remove this
ret:add_signal("widget::updated")
ret:connect_signal("widget::updated", function() ret:connect_signal("widget::updated", function()
ret:emit_signal("widget::layout_changed") ret:emit_signal("widget::layout_changed")
ret:emit_signal("widget::redraw_needed") ret:emit_signal("widget::redraw_needed")
@ -648,7 +638,7 @@ end
function base.check_widget(widget) function base.check_widget(widget)
assert(type(widget) == "table", "Type should be table, but is " .. tostring(type(widget))) assert(type(widget) == "table", "Type should be table, but is " .. tostring(type(widget)))
assert(widget.is_widget, "Argument is not a widget!") assert(widget.is_widget, "Argument is not a widget!")
for _, func in pairs({ "add_signal", "connect_signal", "disconnect_signal" }) do for _, func in pairs({ "connect_signal", "disconnect_signal" }) do
assert(type(widget[func]) == "function", func .. " is not a function") assert(type(widget[func]) == "function", func .. " is not a function")
end end
end end

97
luaa.c
View File

@ -67,6 +67,54 @@ extern const struct luaL_Reg awesome_root_lib[];
extern const struct luaL_Reg awesome_mouse_methods[]; extern const struct luaL_Reg awesome_mouse_methods[];
extern const struct luaL_Reg awesome_mouse_meta[]; extern const struct luaL_Reg awesome_mouse_meta[];
/** A call into the lua code aborted with an error
* @signal debug::error
*/
/** A deprecated lua function was called
* @signal debug::deprecation
*/
/** An invalid key was read from an object (e.g. c.foo)
* @signal debug::index::miss
*/
/** An invalid key was written to an object (e.g. c.foo = "bar")
* @signal debug::newindex::miss
*/
/**
* @signal systray::update
*/
/**
* @signal wallpaper_changed
*/
/**
* @signal xkb::map_changed
*/
/**
* @signal xkb::group_changed
*/
/**
* @signal refresh
*/
/**
* @signal startup
*/
/**
* @signal exit
*/
/**
* @signal screen::change
*/
/** Path to config file */ /** Path to config file */
static char *conffile; static char *conffile;
@ -675,55 +723,6 @@ luaA_init(xdgHandle* xdg)
lua_getfield(L, 1, "loaded"); lua_getfield(L, 1, "loaded");
lua_pop(L, 2); /* pop "package" and "package.loaded" */ lua_pop(L, 2); /* pop "package" and "package.loaded" */
/** A call into the lua code aborted with an error
* @signal debug::error
*/
signal_add(&global_signals, "debug::error");
/** A deprecated lua function was called
* @signal debug::deprecation
*/
signal_add(&global_signals, "debug::deprecation");
/** An invalid key was read from an object (e.g. c.foo)
* @signal debug::index::miss
*/
signal_add(&global_signals, "debug::index::miss");
/** An invalid key was written to an object (e.g. c.foo = "bar")
* @signal debug::newindex::miss
*/
signal_add(&global_signals, "debug::newindex::miss");
/**
* @signal systray::update
*/
signal_add(&global_signals, "systray::update");
/**
* @signal wallpaper_changed
*/
signal_add(&global_signals, "wallpaper_changed");
/**
* @signal xkb::map_changed
*/
signal_add(&global_signals, "xkb::map_changed");
/**
* @signal xkb::group_changed
*/
signal_add(&global_signals, "xkb::group_changed");
/**
* @signal refresh
*/
signal_add(&global_signals, "refresh");
/**
* @signal startup
*/
signal_add(&global_signals, "startup");
/**
* @signal exit
*/
signal_add(&global_signals, "exit");
/**
* @signal screen::change
*/
signal_add(&global_signals, "screen::change");
} }
static void static void

View File

@ -59,6 +59,24 @@
* @function set_newindex_miss_handler * @function set_newindex_miss_handler
*/ */
/** When bound mouse button + modifiers are pressed.
* @param ... One or more arguments are possible
* @signal .press
*/
/** When property changes.
* @signal property::button
*/
/** When property changes.
* @signal property::modifiers
*/
/** When bound mouse button + modifiers are pressed.
* @param ... One or more arguments are possible
* @signal .release
*/
/** Create a new mouse button bindings. /** Create a new mouse button bindings.
* \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.
@ -160,25 +178,6 @@ button_class_setup(lua_State *L)
(lua_class_propfunc_t) luaA_button_set_modifiers, (lua_class_propfunc_t) luaA_button_set_modifiers,
(lua_class_propfunc_t) luaA_button_get_modifiers, (lua_class_propfunc_t) luaA_button_get_modifiers,
(lua_class_propfunc_t) luaA_button_set_modifiers); (lua_class_propfunc_t) luaA_button_set_modifiers);
/** When bound mouse button + modifiers are pressed.
* @param ... One or more arguments are possible
* @signal .press
*/
signal_add(&button_class.signals, "press");
/** When property changes.
* @signal property::button
*/
signal_add(&button_class.signals, "property::button");
/** When property changes.
* @signal property::modifiers
*/
signal_add(&button_class.signals, "property::modifiers");
/** When bound mouse button + modifiers are pressed.
* @param ... One or more arguments are possible
* @signal .release
*/
signal_add(&button_class.signals, "release");
} }
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -109,6 +109,100 @@
* @table object * @table object
*/ */
/** When a client gains focus.
* @signal .focus
*/
/** Before manage, after unmanage, and when clients swap.
* @signal .list
*/
/** When 2 clients are swapped
* @tparam client client The other client
* @tparam boolean is_source If self is the source or the destination of the swap
* @signal .swapped
*/
/**
* @signal .manage
*/
/**
* @signal button::press
*/
/**
* @signal button::release
*/
/**
* @signal mouse::enter
*/
/**
* @signal mouse::leave
*/
/**
* @signal mouse::move
*/
/**
* @signal property::window
*/
/** When a client should get activated (focused and/or raised).
*
* Default implementation: `awful.ewmh.activate`.
* @signal request::activate
* @tparam string context The context where this signal was used.
* @tparam[opt] table hints A table with additional hints:
* @tparam[opt=false] boolean hints.raise should the client be raised?
*/
/**
* @signal request::geometry
* @tparam client c The client
* @tparam string context Why and what to resize. This is used for the
* handlers to know if they are capable of applying the new geometry.
* @tparam[opt={}] table Additional arguments. Each context handler may
* interpret this differently.
*/
/**
* @signal request::tag
*/
/**
* @signal request::urgent
*/
/** When a client gets tagged.
* @signal .tagged
* @tag t The tag object.
*/
/** When a client gets unfocused.
* @signal .unfocus
*/
/**
* @signal .unmanage
*/
/** When a client gets untagged.
* @signal .untagged
* @tag t The tag object.
*/
/**
* @signal .raised
*/
/**
* @signal .lowered
*/
/** /**
* The focused `client` or nil (in case there is none). * The focused `client` or nil (in case there is none).
* *
@ -3335,145 +3429,6 @@ client_class_setup(lua_State *L)
NULL, NULL,
(lua_class_propfunc_t) luaA_client_get_first_tag, (lua_class_propfunc_t) luaA_client_get_first_tag,
NULL); NULL);
/** When a client gains focus.
* @signal .focus
*/
signal_add(&client_class.signals, "focus");
/** Before manage, after unmanage, and when clients swap.
* @signal .list
*/
signal_add(&client_class.signals, "list");
/** When 2 clients are swapped
* @tparam client client The other client
* @tparam boolean is_source If self is the source or the destination of the swap
* @signal .swapped
*/
signal_add(&client_class.signals, "swapped");
/**
* @signal .manage
*/
signal_add(&client_class.signals, "manage");
/**
* @signal button::press
*/
signal_add(&client_class.signals, "button::press");
/**
* @signal button::release
*/
signal_add(&client_class.signals, "button::release");
/**
* @signal mouse::enter
*/
signal_add(&client_class.signals, "mouse::enter");
/**
* @signal mouse::leave
*/
signal_add(&client_class.signals, "mouse::leave");
/**
* @signal mouse::move
*/
signal_add(&client_class.signals, "mouse::move");
/* Those signals are documented elsewhere */
signal_add(&client_class.signals, "property::above");
signal_add(&client_class.signals, "property::below");
signal_add(&client_class.signals, "property::class");
signal_add(&client_class.signals, "property::focusable");
signal_add(&client_class.signals, "property::fullscreen");
signal_add(&client_class.signals, "property::geometry");
signal_add(&client_class.signals, "property::group_window");
signal_add(&client_class.signals, "property::height");
signal_add(&client_class.signals, "property::hidden");
signal_add(&client_class.signals, "property::icon");
signal_add(&client_class.signals, "property::icon_name");
signal_add(&client_class.signals, "property::instance");
signal_add(&client_class.signals, "property::keys");
signal_add(&client_class.signals, "property::machine");
signal_add(&client_class.signals, "property::maximized");
signal_add(&client_class.signals, "property::maximized_horizontal");
signal_add(&client_class.signals, "property::maximized_vertical");
signal_add(&client_class.signals, "property::minimized");
signal_add(&client_class.signals, "property::modal");
signal_add(&client_class.signals, "property::name");
signal_add(&client_class.signals, "property::ontop");
signal_add(&client_class.signals, "property::pid");
signal_add(&client_class.signals, "property::role");
signal_add(&client_class.signals, "property::screen");
signal_add(&client_class.signals, "property::shape_bounding");
signal_add(&client_class.signals, "property::shape_client_bounding");
signal_add(&client_class.signals, "property::shape_client_clip");
signal_add(&client_class.signals, "property::shape_clip");
signal_add(&client_class.signals, "property::size_hints_honor");
signal_add(&client_class.signals, "property::skip_taskbar");
signal_add(&client_class.signals, "property::sticky");
signal_add(&client_class.signals, "property::struts");
signal_add(&client_class.signals, "property::titlebar_bottom");
signal_add(&client_class.signals, "property::titlebar_left");
signal_add(&client_class.signals, "property::titlebar_right");
signal_add(&client_class.signals, "property::titlebar_top");
signal_add(&client_class.signals, "property::transient_for");
signal_add(&client_class.signals, "property::type");
signal_add(&client_class.signals, "property::urgent");
signal_add(&client_class.signals, "property::width");
/**
* @signal property::window
*/
signal_add(&client_class.signals, "property::window");
signal_add(&client_class.signals, "property::x");
signal_add(&client_class.signals, "property::y");
/** When a client should get activated (focused and/or raised).
*
* Default implementation: `awful.ewmh.activate`.
* @signal request::activate
* @tparam string context The context where this signal was used.
* @tparam[opt] table hints A table with additional hints:
* @tparam[opt=false] boolean hints.raise should the client be raised?
*/
signal_add(&client_class.signals, "request::activate");
/**
* @signal request::geometry
* @tparam client c The client
* @tparam string context Why and what to resize. This is used for the
* handlers to know if they are capable of applying the new geometry.
* @tparam[opt={}] table Additional arguments. Each context handler may
* interpret this differently.
*/
signal_add(&client_class.signals, "request::geometry");
/**
* @signal request::tag
*/
signal_add(&client_class.signals, "request::tag");
/**
* @signal request::urgent
*/
signal_add(&client_class.signals, "request::urgent");
/** When a client gets tagged.
* @signal .tagged
* @tag t The tag object.
*/
signal_add(&client_class.signals, "tagged");
/** When a client gets unfocused.
* @signal .unfocus
*/
signal_add(&client_class.signals, "unfocus");
/**
* @signal .unmanage
*/
signal_add(&client_class.signals, "unmanage");
/** When a client gets untagged.
* @signal .untagged
* @tag t The tag object.
*/
signal_add(&client_class.signals, "untagged");
/**
* @signal .raised
*/
signal_add(&client_class.signals, "raised");
/**
* @signal .lowered
*/
signal_add(&client_class.signals, "lowered");
} }
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -43,6 +43,50 @@
* @function drawable * @function drawable
*/ */
/**
* @signal button::press
*/
/**
* @signal button::release
*/
/**
* @signal mouse::enter
*/
/**
* @signal mouse::leave
*/
/**
* @signal mouse::move
*/
/**
* @signal property::geometry
*/
/**
* @signal property::height
*/
/**
* @signal property::width
*/
/**
* @signal property::x
*/
/**
* @signal property::y
*/
/**
* @signal property::surface
*/
/** Get the number of instances. /** Get the number of instances.
* *
* @return The number of drawable objects alive. * @return The number of drawable objects alive.
@ -196,51 +240,6 @@ drawable_class_setup(lua_State *L)
NULL, NULL,
(lua_class_propfunc_t) luaA_drawable_get_surface, (lua_class_propfunc_t) luaA_drawable_get_surface,
NULL); NULL);
/**
* @signal button::press
*/
signal_add(&drawable_class.signals, "button::press");
/**
* @signal button::release
*/
signal_add(&drawable_class.signals, "button::release");
/**
* @signal mouse::enter
*/
signal_add(&drawable_class.signals, "mouse::enter");
/**
* @signal mouse::leave
*/
signal_add(&drawable_class.signals, "mouse::leave");
/**
* @signal mouse::move
*/
signal_add(&drawable_class.signals, "mouse::move");
/**
* @signal property::geometry
*/
signal_add(&drawable_class.signals, "property::geometry");
/**
* @signal property::height
*/
signal_add(&drawable_class.signals, "property::height");
/**
* @signal property::width
*/
signal_add(&drawable_class.signals, "property::width");
/**
* @signal property::x
*/
signal_add(&drawable_class.signals, "property::x");
/**
* @signal property::y
*/
signal_add(&drawable_class.signals, "property::y");
/**
* @signal property::surface
*/
signal_add(&drawable_class.signals, "property::surface");
} }
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -67,6 +67,50 @@
* @table drawin * @table drawin
*/ */
/**
* @signal property::geometry
*/
/**
* @signal property::shape_bounding
*/
/**
* @signal property::shape_clip
*/
/**
* @signal property::border_width
*/
/**
* @signal property::cursor
*/
/**
* @signal property::height
*/
/**
* @signal property::ontop
*/
/**
* @signal property::visible
*/
/**
* @signal property::width
*/
/**
* @signal property::x
*/
/**
* @signal property::y
*/
/** Get or set mouse buttons bindings to a drawin. /** Get or set mouse buttons bindings to a drawin.
* *
* @param buttons_table A table of buttons objects, or nothing. * @param buttons_table A table of buttons objects, or nothing.
@ -715,51 +759,6 @@ drawin_class_setup(lua_State *L)
(lua_class_propfunc_t) luaA_drawin_set_shape_clip, (lua_class_propfunc_t) luaA_drawin_set_shape_clip,
(lua_class_propfunc_t) luaA_drawin_get_shape_clip, (lua_class_propfunc_t) luaA_drawin_get_shape_clip,
(lua_class_propfunc_t) luaA_drawin_set_shape_clip); (lua_class_propfunc_t) luaA_drawin_set_shape_clip);
/**
* @signal property::geometry
*/
signal_add(&drawin_class.signals, "property::geometry");
/**
* @signal property::shape_bounding
*/
signal_add(&drawin_class.signals, "property::shape_bounding");
/**
* @signal property::shape_clip
*/
signal_add(&drawin_class.signals, "property::shape_clip");
/**
* @signal property::border_width
*/
signal_add(&drawin_class.signals, "property::border_width");
/**
* @signal property::cursor
*/
signal_add(&drawin_class.signals, "property::cursor");
/**
* @signal property::height
*/
signal_add(&drawin_class.signals, "property::height");
/**
* @signal property::ontop
*/
signal_add(&drawin_class.signals, "property::ontop");
/**
* @signal property::visible
*/
signal_add(&drawin_class.signals, "property::visible");
/**
* @signal property::width
*/
signal_add(&drawin_class.signals, "property::width");
/**
* @signal property::x
*/
signal_add(&drawin_class.signals, "property::x");
/**
* @signal property::y
*/
signal_add(&drawin_class.signals, "property::y");
} }
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -56,6 +56,22 @@
* @table key * @table key
*/ */
/**
* @signal .press
*/
/**
* @signal property::key
*/
/**
* @signal property::modifiers
*/
/**
* @signal .release
*/
/** Get the number of instances. /** Get the number of instances.
* *
* @return The number of key objects alive. * @return The number of key objects alive.
@ -357,23 +373,6 @@ key_class_setup(lua_State *L)
(lua_class_propfunc_t) luaA_key_set_modifiers, (lua_class_propfunc_t) luaA_key_set_modifiers,
(lua_class_propfunc_t) luaA_key_get_modifiers, (lua_class_propfunc_t) luaA_key_get_modifiers,
(lua_class_propfunc_t) luaA_key_set_modifiers); (lua_class_propfunc_t) luaA_key_set_modifiers);
/**
* @signal .press
*/
signal_add(&key_class.signals, "press");
/**
* @signal property::key
*/
signal_add(&key_class.signals, "property::key");
/**
* @signal property::modifiers
*/
signal_add(&key_class.signals, "property::modifiers");
/**
* @signal .release
*/
signal_add(&key_class.signals, "release");
} }
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -66,6 +66,20 @@
* *
*/ */
/**
* @signal .primary_changed
*/
/**
* This signal is emitted when a new screen is added to the current setup.
* @signal .added
*/
/**
* This signal is emitted when a screen is removed from the setup.
* @signal removed
*/
/** /**
* The primary screen. * The primary screen.
* *
@ -1143,24 +1157,6 @@ screen_class_setup(lua_State *L)
NULL, NULL,
(lua_class_propfunc_t) luaA_screen_get_workarea, (lua_class_propfunc_t) luaA_screen_get_workarea,
NULL); NULL);
signal_add(&screen_class.signals, "property::workarea");
signal_add(&screen_class.signals, "property::geometry");
signal_add(&screen_class.signals, "property::outputs");
/**
* @signal .primary_changed
*/
signal_add(&screen_class.signals, "primary_changed");
/**
* This signal is emitted when a new screen is added to the current setup.
* @signal .added
*/
signal_add(&screen_class.signals, "added");
/**
* This signal is emitted when a screen is removed from the setup.
* @signal removed
*/
signal_add(&screen_class.signals, "removed");
} }
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -42,6 +42,20 @@
#include "ewmh.h" #include "ewmh.h"
#include "luaa.h" #include "luaa.h"
/**
* @signal request::select
*/
/** When a client gets tagged with this tag.
* @signal tagged
* @client c The tagged client.
*/
/** When a client gets untagged with this tag.
* @signal untagged
* @client c The untagged client.
*/
/** /**
* Tag name. * Tag name.
* *
@ -411,24 +425,6 @@ tag_class_setup(lua_State *L)
(lua_class_propfunc_t) luaA_tag_set_activated, (lua_class_propfunc_t) luaA_tag_set_activated,
(lua_class_propfunc_t) luaA_tag_get_activated, (lua_class_propfunc_t) luaA_tag_get_activated,
(lua_class_propfunc_t) luaA_tag_set_activated); (lua_class_propfunc_t) luaA_tag_set_activated);
signal_add(&tag_class.signals, "property::name");
signal_add(&tag_class.signals, "property::selected");
signal_add(&tag_class.signals, "property::activated");
/**
* @signal request::select
*/
signal_add(&tag_class.signals, "request::select");
/** When a client gets tagged with this tag.
* @signal tagged
* @client c The tagged client.
*/
signal_add(&tag_class.signals, "tagged");
/** When a client gets untagged with this tag.
* @signal untagged
* @client c The untagged client.
*/
signal_add(&tag_class.signals, "untagged");
} }
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -27,6 +27,30 @@
* @classmod xproperties * @classmod xproperties
*/ */
/**
* @signal property::border_color
*/
/**
* @signal property::border_width
*/
/**
* @signal property::buttons
*/
/**
* @signal property::opacity
*/
/**
* @signal property::struts
*/
/**
* @signal property::type
*/
#include "objects/window.h" #include "objects/window.h"
#include "common/atoms.h" #include "common/atoms.h"
#include "common/xutil.h" #include "common/xutil.h"
@ -519,31 +543,6 @@ window_class_setup(lua_State *L)
(lua_class_propfunc_t) luaA_window_set_border_width, (lua_class_propfunc_t) luaA_window_set_border_width,
(lua_class_propfunc_t) luaA_window_get_border_width, (lua_class_propfunc_t) luaA_window_get_border_width,
(lua_class_propfunc_t) luaA_window_set_border_width); (lua_class_propfunc_t) luaA_window_set_border_width);
/**
* @signal property::border_color
*/
signal_add(&window_class.signals, "property::border_color");
/**
* @signal property::border_width
*/
signal_add(&window_class.signals, "property::border_width");
/**
* @signal property::buttons
*/
signal_add(&window_class.signals, "property::buttons");
/**
* @signal property::opacity
*/
signal_add(&window_class.signals, "property::opacity");
/**
* @signal property::struts
*/
signal_add(&window_class.signals, "property::struts");
/**
* @signal property::type
*/
signal_add(&window_class.signals, "property::type");
} }
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -530,15 +530,8 @@ luaA_register_xproperty(lua_State *L)
} }
else else
{ {
buffer_t buf;
buffer_inita(&buf, a_strlen(name) + a_strlen("xproperty::") + 1);
buffer_addf(&buf, "xproperty::%s", name);
property.name = a_strdup(name); property.name = a_strdup(name);
xproperty_array_insert(&globalconf.xproperties, property); xproperty_array_insert(&globalconf.xproperties, property);
signal_add(&window_class.signals, buf.s);
signal_add(&global_signals, buf.s);
buffer_wipe(&buf);
} }
return 0; return 0;

55
spawn.c
View File

@ -27,6 +27,31 @@
* @module awesome * @module awesome
*/ */
/** For some reason the application aborted startup
* @param arg Table which only got the "id" key set
* @signal spawn::canceled
*/
/** When one of the fields from the @{spawn::initiated} table changes
* @param arg Table which describes the spawn event
* @signal spawn::change
*/
/** An application finished starting
* @param arg Table which only got the "id" key set
* @signal spawn::completed
*/
/** When a new client is beginning to start
* @param arg Table which describes the spawn event
* @signal spawn::initiated
*/
/** An application started a spawn event but didn't start in time.
* @param arg Table which only got the "id" key set
* @signal spawn::timeout
*/
#include "spawn.h" #include "spawn.h"
#include <unistd.h> #include <unistd.h>
@ -87,8 +112,6 @@ spawn_monitor_timeout(gpointer sequence)
} }
lua_pop(L, 1); lua_pop(L, 1);
} }
else
warn("spawn::timeout signal is missing");
} }
sn_startup_sequence_unref(sequence); sn_startup_sequence_unref(sequence);
return FALSE; return FALSE;
@ -193,8 +216,6 @@ spawn_monitor_event(SnMonitorEvent *event, void *data)
} }
lua_pop(L, 1); lua_pop(L, 1);
} }
else
warn("%s signal is missing", event_type_str);
} }
/** Tell the spawn module that an app has been started. /** Tell the spawn module that an app has been started.
@ -244,32 +265,6 @@ spawn_init(void)
globalconf.default_screen, globalconf.default_screen,
spawn_monitor_event, spawn_monitor_event,
NULL, NULL); NULL, NULL);
/** For some reason the application aborted startup
* @param arg Table which only got the "id" key set
* @signal spawn::canceled
*/
signal_add(&global_signals, "spawn::canceled");
/** When one of the fields from the @{spawn::initiated} table changes
* @param arg Table which describes the spawn event
* @signal spawn::change
*/
signal_add(&global_signals, "spawn::change");
/** An application finished starting
* @param arg Table which only got the "id" key set
* @signal spawn::completed
*/
signal_add(&global_signals, "spawn::completed");
/** When a new client is beginning to start
* @param arg Table which describes the spawn event
* @signal spawn::initiated
*/
signal_add(&global_signals, "spawn::initiated");
/** An application started a spawn event but didn't start in time.
* @param arg Table which only got the "id" key set
* @signal spawn::timeout
*/
signal_add(&global_signals, "spawn::timeout");
} }
static gboolean static gboolean

View File

@ -6,7 +6,6 @@
local fake_screens = {} local fake_screens = {}
_G.screen = setmetatable({ _G.screen = setmetatable({
add_signal = function() end,
set_index_miss_handler = function() end, set_index_miss_handler = function() end,
set_newindex_miss_handler = function() end, set_newindex_miss_handler = function() end,
}, { }, {

View File

@ -9,31 +9,6 @@ describe("gears.object", function()
local obj local obj
before_each(function() before_each(function()
obj = object() obj = object()
obj:add_signal("signal")
end)
it("strong connect non-existent signal", function()
assert.has.errors(function()
obj:connect_signal("foo", function() end)
end)
end)
it("weak connect non-existent signal", function()
assert.has.errors(function()
obj:weak_connect_signal("foo", function() end)
end)
end)
it("strong disconnect non-existent signal", function()
assert.has.errors(function()
obj:disconnect_signal("foo", function() end)
end)
end)
it("emitting non-existent signal", function()
assert.has.errors(function()
obj:emit_signal("foo")
end)
end) end)
it("strong connecting and emitting signal", function() it("strong connecting and emitting signal", function()
@ -188,7 +163,6 @@ describe("gears.object", function()
it("auto emit disabled", function() it("auto emit disabled", function()
local got_it = false local got_it = false
obj:add_signal("property::foo")
obj:connect_signal("property::foo", function() got_it=true end) obj:connect_signal("property::foo", function() got_it=true end)
obj.foo = 42 obj.foo = 42
@ -199,7 +173,6 @@ describe("gears.object", function()
it("auto emit enabled", function() it("auto emit enabled", function()
local got_it = false local got_it = false
local obj2 = object{enable_auto_signals=true, enable_properties=true} local obj2 = object{enable_auto_signals=true, enable_properties=true}
obj2:add_signal("property::foo")
obj2:connect_signal("property::foo", function() got_it=true end) obj2:connect_signal("property::foo", function() got_it=true end)
obj2.foo = 42 obj2.foo = 42
@ -207,13 +180,6 @@ describe("gears.object", function()
assert.is_true(got_it) assert.is_true(got_it)
end) end)
it("auto emit enabled", function()
assert.has.errors(function()
local obj2 = object{enable_auto_signals=true, enable_properties=true}
obj2.foo = "bar"
end)
end)
it("auto emit without dynamic properties", function() it("auto emit without dynamic properties", function()
assert.has.errors(function() assert.has.errors(function()
object{enable_auto_signals=true, enable_properties=false} object{enable_auto_signals=true, enable_properties=false}

View File

@ -83,8 +83,6 @@ return {
widget_stub = function(width, height) widget_stub = function(width, height)
local w = object() local w = object()
w._private = {} w._private = {}
w:add_signal("widget::redraw_needed")
w:add_signal("widget::layout_changed")
w.is_widget = true w.is_widget = true
w._private.visible = true w._private.visible = true
w._private.opacity = 1 w._private.opacity = 1

View File

@ -17,12 +17,6 @@ local function _shim_fake_class()
return obj._connect_signal(obj, name, func) return obj._connect_signal(obj, name, func)
end end
obj._add_signal = obj.add_signal
function obj.add_signal(name)
return obj._add_signal(obj, name)
end
function obj.set_index_miss_handler(handler) function obj.set_index_miss_handler(handler)
meta.__index = handler meta.__index = handler
end end
@ -50,11 +44,6 @@ awesome.startup = true
function awesome.register_xproperty() function awesome.register_xproperty()
end end
awesome.add_signal("refresh")
awesome.add_signal("wallpaper_changed")
awesome.add_signal("spawn::canceled")
awesome.add_signal("spawn::timeout")
return awesome return awesome
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -4,20 +4,6 @@ local clients = {}
local client, meta = awesome._shim_fake_class() local client, meta = awesome._shim_fake_class()
local function add_signals(c)
c:add_signal("property::width")
c:add_signal("property::height")
c:add_signal("property::x")
c:add_signal("property::y")
c:add_signal("property::screen")
c:add_signal("property::geometry")
c:add_signal("request::geometry")
c:add_signal("request::tag")
c:add_signal("swapped")
c:add_signal("raised")
c:add_signal("property::_label") --Used internally
end
-- Keep an history of the geometry for validation and images -- Keep an history of the geometry for validation and images
local function push_geometry(c) local function push_geometry(c)
table.insert(c._old_geo, c:geometry()) table.insert(c._old_geo, c:geometry())
@ -46,9 +32,6 @@ function client.gen_fake(args)
ret[v] = ret[v] or 1 ret[v] = ret[v] or 1
end end
add_signals(ret)
-- Emulate capi.client.geometry -- Emulate capi.client.geometry
function ret:geometry(new) function ret:geometry(new)
if new then if new then
@ -142,37 +125,6 @@ function client.get(s)
return ret return ret
end end
client:_add_signal("manage")
client:_add_signal("unmanage")
client:_add_signal("property::urgent")
client:_add_signal("untagged")
client:_add_signal("tagged")
client:_add_signal("property::shape_client_bounding")
client:_add_signal("property::shape_client_clip")
client:_add_signal("property::width")
client:_add_signal("property::height")
client:_add_signal("property::x")
client:_add_signal("property::y")
client:_add_signal("property::geometry")
client:_add_signal("focus")
client:_add_signal("new")
client:_add_signal("property::size_hints_honor")
client:_add_signal("property::struts")
client:_add_signal("property::minimized")
client:_add_signal("property::maximized_horizontal")
client:_add_signal("property::maximized_vertical")
client:_add_signal("property::sticky")
client:_add_signal("property::fullscreen")
client:_add_signal("property::border_width")
client:_add_signal("property::hidden")
client:_add_signal("property::screen")
client:_add_signal("request::tag")
client:_add_signal("request::geometry")
client:_add_signal("request::activate")
client:_add_signal("raised")
client:_add_signal("lowered")
client:_add_signal("list")
return client return client
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -7,10 +7,6 @@ screen.count = 1
local function create_screen(args) local function create_screen(args)
local s = gears_obj() local s = gears_obj()
s:add_signal("property::workarea")
s:add_signal("property::index")
s:add_signal("padding")
-- Copy the geo in case the args are mutated -- Copy the geo in case the args are mutated
local geo = { local geo = {
x = args.x , x = args.x ,
@ -99,10 +95,6 @@ end
screen._add_screen {width=320, height=240} screen._add_screen {width=320, height=240}
screen.add_signal("property::workarea")
screen.add_signal("added")
screen.add_signal("removed")
return screen return screen
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80 -- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -5,20 +5,6 @@ local tag, meta = awesome._shim_fake_class()
local function new_tag(_, args) local function new_tag(_, args)
local ret = gears_obj() local ret = gears_obj()
ret:add_signal("property::layout")
ret:add_signal("property::name")
ret:add_signal("property::geometry")
ret:add_signal("property::screen")
ret:add_signal("property::master_width_factor")
ret:add_signal("property::mwfact")
ret:add_signal("property::ncol")
ret:add_signal("property::column_count")
ret:add_signal("property::master_count")
ret:add_signal("property::nmaster")
ret:add_signal("property::index")
ret:add_signal("property::useless_gap")
ret:add_signal("property::_wa_tracker")
ret.name = args.name or "test" ret.name = args.name or "test"
ret.activated = true ret.activated = true
ret.selected = true ret.selected = true
@ -42,12 +28,6 @@ local function new_tag(_, args)
}) })
end end
tag:_add_signal("request::select")
tag:_add_signal("property::selected")
tag:_add_signal("property::activated")
tag:_add_signal("tagged")
tag:_add_signal("untagged")
return setmetatable(tag, { return setmetatable(tag, {
__call = new_tag, __call = new_tag,
}) })

View File

@ -31,8 +31,6 @@ local o = gears.object {
enable_auto_signals = true, enable_auto_signals = true,
} }
o:add_signal "property::foo"
print(o.foo) print(o.foo)
o.foo = 42 o.foo = 42
@ -42,7 +40,6 @@ print(o.foo)
o:method(1, 2, 3) o:method(1, 2, 3)
-- Random properties can also be added, the signal will be emited automatically. -- Random properties can also be added, the signal will be emited automatically.
o:add_signal "property::something"
o:connect_signal("property::something", function(obj, value) o:connect_signal("property::something", function(obj, value)
print("In the connection handler!", obj, value) print("In the connection handler!", obj, value)

View File

@ -2,9 +2,6 @@ local gears = require("gears") --DOC_HIDE
local o = gears.object{} local o = gears.object{}
-- Add a new signals to the object. This is used to catch typos
o:add_signal "my_signal"
-- Function can be attached to signals -- Function can be attached to signals
local function slot(obj, a, b, c) local function slot(obj, a, b, c)
print("In slot", obj, a, b, c) print("In slot", obj, a, b, c)

View File

@ -18,7 +18,6 @@ client.focus = client.get()[1]
local c = client.focus local c = client.focus
-- local c2 = client.get()[2] -- local c2 = client.get()[2]
client.add_signal("property::foo")
c.foo = "bar" c.foo = "bar"
-- Check if the property system works -- Check if the property system works