Implement screens.layouts.
authorGuo Rui <firemeteor@Adam.(none)>
Wed, 8 Jul 2009 14:18:24 +0000 (8 22:18 +0800)
committerGuo Rui <firemeteor@Adam.(none)>
Wed, 8 Jul 2009 14:18:24 +0000 (8 22:18 +0800)
src/lua.c

index 96c70ba..0231f4d 100644 (file)
--- a/src/lua.c
+++ b/src/lua.c
@@ -790,6 +790,23 @@ screen_get_displays(lua_State *L)
   return 1;
 }
 
+extern struct layout *layouts;
+static int
+screen_get_layouts(lua_State *L)
+{
+  struct layout *iter;
+  int count;
+
+  lua_newtable(L);
+  for (iter = layouts, count = 0; iter; iter = iter->lay_next, count++) {
+    lua_pushinteger(L, iter->lay_number);
+    push_layout(L, &iter);
+    lua_settable(L, -3);
+  }
+
+  return 1;
+}
+
 static int
 screen_get_display(lua_State *L)
 {
@@ -895,6 +912,7 @@ screen_input(lua_State *L)
 static const luaL_reg screen_methods[] = {
   {"windows", screen_get_windows},
   {"displays", screen_get_displays},
+  {"layouts", screen_get_layouts},
   {"display", screen_get_display},
   {"command", screen_exec_command},
   {"append_msg", screen_append_msg},