client: fix client signal emitting in set_icon

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-08-21 20:55:13 +02:00
parent 6a4d04d4f2
commit 69b4b2650d
1 changed files with 4 additions and 1 deletions

View File

@ -1375,10 +1375,13 @@ void
client_set_icon(lua_State *L, int cidx, int iidx) client_set_icon(lua_State *L, int cidx, int iidx)
{ {
client_t *c = luaA_client_checkudata(L, cidx); client_t *c = luaA_client_checkudata(L, cidx);
/* convert index to absolute */
cidx = luaA_absindex(L, cidx);
iidx = luaA_absindex(L, iidx);
luaA_checkudata(L, iidx, &image_class); luaA_checkudata(L, iidx, &image_class);
luaA_object_unref_item(L, cidx, c->icon); luaA_object_unref_item(L, cidx, c->icon);
c->icon = luaA_object_ref_item(L, cidx, iidx); c->icon = luaA_object_ref_item(L, cidx, iidx);
luaA_object_emit_signal(L, cidx, "property::icon", 0); luaA_object_emit_signal(L, cidx < iidx ? cidx : cidx - 1, "property::icon", 0);
/* execute hook */ /* execute hook */
hook_property(c, "icon"); hook_property(c, "icon");
} }