From e25443d74c66b066ff32fe3fc8ca9c027423880f Mon Sep 17 00:00:00 2001 From: Rui Guo Date: Mon, 10 Aug 2009 21:08:49 +0800 Subject: [PATCH] Add the window.viewing_canvases method --- src/lua.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/lua.c b/src/lua.c index 441a26d..3539cda 100644 --- a/src/lua.c +++ b/src/lua.c @@ -483,8 +483,30 @@ window_activate(lua_State *L) return 0; } +static int +window_get_showing_canvases(lua_State *L) +{ + struct win *w = check_window(L, 1); + int count = 0; + struct canvas *cv = w->w_layer.l_cvlist; + if (!cv) { + lua_pushnil(L); + return 1; + } + lua_newtable(L); + while (cv) { + lua_pushinteger(L, count++); + push_canvas(L, &cv); + lua_settable(L, -3); + cv = cv->c_lnext; + } + + return 1; +} + static const luaL_reg window_methods[] = { {"get_monitor_status", window_get_monitor_status}, + {"showing_canvases", window_get_showing_canvases}, {"stuff", window_stuff}, {"activate", window_activate}, {"hook", LuaRegEvent}, -- 2.11.4.GIT