screen: Add "added" signal

This signal is emitted when a new screen is added.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-03-26 18:25:51 +01:00
parent 4731712af2
commit 2432dda3e3
1 changed files with 9 additions and 0 deletions

View File

@ -145,8 +145,12 @@ screen_add(lua_State *L, int sidx)
return; return;
} }
sidx = luaA_absindex(L, sidx);
lua_pushvalue(L, sidx);
luaA_object_ref(L, sidx); luaA_object_ref(L, sidx);
screen_array_append(&globalconf.screens, new_screen); screen_array_append(&globalconf.screens, new_screen);
luaA_object_emit_signal(L, -1, "added", 0);
lua_pop(L, 1);
} }
static bool static bool
@ -755,6 +759,11 @@ screen_class_setup(lua_State *L)
* @signal primary_changed * @signal primary_changed
*/ */
signal_add(&screen_class.signals, "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 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80