From: Guo Rui Date: Thu, 16 Jul 2009 15:01:39 +0000 (+0800) Subject: Add display.top_canvas & bottom_canvas interface. X-Git-Url: https://repo.or.cz/w/screen-lua.git/commitdiff_plain/f2975f6fd18a64ff52a505eded7f164d7b45da11 Add display.top_canvas & bottom_canvas interface. --- diff --git a/src/lua.c b/src/lua.c index 3aa7d0b..81197c9 100644 --- a/src/lua.c +++ b/src/lua.c @@ -768,8 +768,34 @@ display_get_canvases(lua_State *L) return 1; } +static int +display_top_canvas(lua_State *L) +{ + struct display *d; + d = check_display(L, 1); + push_canvas(L, &d->d_cvlist); + + return 1; +} + +static int +display_bot_canvas(lua_State *L) +{ + struct display *d; + struct canvas *c; + d = check_display(L, 1); + + for (c = d->d_cvlist; c->c_next; c = c->c_next) + ; + push_canvas(L, &c); + + return 1; +} + static const luaL_reg display_methods[] = { {"get_canvases", display_get_canvases}, + {"top_canvas", display_top_canvas}, + {"bottom_canvas", display_bot_canvas}, {0, 0} };