screen: use signal_object_emit

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-08-18 18:11:18 +02:00
parent 2a252cd4da
commit 2eed237009
1 changed files with 3 additions and 12 deletions

View File

@ -510,18 +510,9 @@ luaA_screen_remove_signal(lua_State *L)
void void
screen_emit_signal(lua_State *L, screen_t *screen, const char *name, int nargs) screen_emit_signal(lua_State *L, screen_t *screen, const char *name, int nargs)
{ {
signal_t *sigfound = signal_array_getbyid(&screen->signals, luaA_pushscreen(L, screen);
a_strhash((const unsigned char *) name)); lua_insert(L, - nargs - 1);
if(sigfound) signal_object_emit(L, &screen->signals, name, nargs + 1);
foreach(func, sigfound->sigfuncs)
{
luaA_pushscreen(L, screen);
for(int i = 0; i < nargs; i++)
lua_pushvalue(L, - nargs - 1);
luaA_object_push(L, (void *) *func);
luaA_dofunction(L, nargs + 1, 0);
}
lua_pop(L, nargs);
} }
/** Emit a signal to a screen. /** Emit a signal to a screen.