From 2432dda3e3315c3a26a6872a8647075c175e17cd Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 26 Mar 2016 18:25:51 +0100 Subject: [PATCH] screen: Add "added" signal This signal is emitted when a new screen is added. Signed-off-by: Uli Schlachter --- objects/screen.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/objects/screen.c b/objects/screen.c index 044fb9edb..c7e508b71 100644 --- a/objects/screen.c +++ b/objects/screen.c @@ -145,8 +145,12 @@ screen_add(lua_State *L, int sidx) return; } + sidx = luaA_absindex(L, sidx); + lua_pushvalue(L, sidx); luaA_object_ref(L, sidx); screen_array_append(&globalconf.screens, new_screen); + luaA_object_emit_signal(L, -1, "added", 0); + lua_pop(L, 1); } static bool @@ -755,6 +759,11 @@ screen_class_setup(lua_State *L) * @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"); } // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80