widget: fix widget_render() stack leftover

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-08-27 17:05:19 +02:00
parent 47f3925e3b
commit 9cee78f3e2
1 changed files with 9 additions and 4 deletions

View File

@ -145,7 +145,10 @@ widget_geometries(wibox_t *wibox)
luaA_object_push_item(globalconf.L, -1, wibox->widgets_table); luaA_object_push_item(globalconf.L, -1, wibox->widgets_table);
/* remove wibox */ /* remove wibox */
lua_remove(globalconf.L, -2); lua_remove(globalconf.L, -2);
/* get layout field from the table */
lua_getfield(globalconf.L, -1, "layout"); lua_getfield(globalconf.L, -1, "layout");
/* remove the widget table */
lua_remove(globalconf.L, -2);
} }
else else
lua_pushnil(globalconf.L); lua_pushnil(globalconf.L);
@ -167,8 +170,10 @@ widget_geometries(wibox_t *wibox)
geometry.width = i; geometry.width = i;
} }
luaA_pusharea(globalconf.L, geometry); luaA_pusharea(globalconf.L, geometry);
/* Re-push 2nd argument: widget table */ /* Push 2nd argument: widget table */
lua_pushvalue(globalconf.L, -3); luaA_object_push(globalconf.L, wibox);
luaA_object_push_item(globalconf.L, -1, wibox->widgets_table);
lua_remove(globalconf.L, -2);
/* Push 3rd argument: wibox screen */ /* Push 3rd argument: wibox screen */
lua_pushnumber(globalconf.L, screen_array_indexof(&globalconf.screens, wibox->screen)); lua_pushnumber(globalconf.L, screen_array_indexof(&globalconf.screens, wibox->screen));
/* Re-push the layout function */ /* Re-push the layout function */
@ -178,8 +183,8 @@ widget_geometries(wibox_t *wibox)
if(!luaA_dofunction(globalconf.L, 3, 1)) if(!luaA_dofunction(globalconf.L, 3, 1))
return false; return false;
lua_insert(globalconf.L, -3); /* Remove the left over layout function */
lua_pop(globalconf.L, 2); lua_remove(globalconf.L, -2);
} }
else else
{ {