From fc38d32052a060bfaf6592809c2d40d0fd0f3cd0 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 1 Jul 2008 21:46:43 +0200 Subject: [PATCH] client: merge floating placement into index Signed-off-by: Julien Danjou --- client.c | 26 ++++++++------------------ common/tokenize.gperf | 1 + 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/client.c b/client.c index 40c4f66e..fb933d6c 100644 --- a/client.c +++ b/client.c @@ -1240,23 +1240,6 @@ luaA_client_unmanage(lua_State *L) return 0; } -/** Set the floating placement algorithm. This will be used to compute the - * initial floating position of the window then floating. - * \param L The Lua VM state. - * - * \luastack - * \lvalue A client. - * \lparam An algorith name, either `none', `smart' or `under_mouse'. - */ -static int -luaA_client_floating_placement_set(lua_State *L) -{ - client_t **c = luaA_checkudata(L, 1, "client"); - const char *pl = luaL_checkstring(L, 2); - (*c)->floating_placement = name_func_lookup(pl, FloatingPlacementList); - return 0; -} - /** Client newindex. * \param L The Lua VM state. * \return The number of elements pushed on stack. @@ -1280,6 +1263,10 @@ luaA_client_newindex(lua_State *L) a_iso2utf8(&(*c)->name, buf, len); widget_invalidate_cache((*c)->screen, WIDGET_CACHE_CLIENTS); break; + case A_TK_FLOATING_PLACEMENT: + (*c)->floating_placement = name_func_lookup(luaL_checkstring(L, 3), + FloatingPlacementList); + break; case A_TK_SCREEN: i = luaL_checknumber(L, 3) - 1; luaA_checkscreen(i); @@ -1351,6 +1338,10 @@ luaA_client_index(lua_State *L) case A_TK_NAME: lua_pushstring(L, (*c)->name); break; + case A_TK_FLOATING_PLACEMENT: + lua_pushstring(L, name_func_rlookup((*c)->floating_placement, + FloatingPlacementList)); + break; case A_TK_SCREEN: lua_pushnumber(L, 1 + (*c)->screen); break; @@ -1387,7 +1378,6 @@ const struct luaL_reg awesome_client_methods[] = }; const struct luaL_reg awesome_client_meta[] = { - { "floating_placement_set", luaA_client_floating_placement_set }, { "titlebar_set", luaA_client_titlebar_set }, { "titlebar_get", luaA_client_titlebar_get }, { "tag", luaA_client_tag }, diff --git a/common/tokenize.gperf b/common/tokenize.gperf index 780fdce7..be9d290a 100644 --- a/common/tokenize.gperf +++ b/common/tokenize.gperf @@ -16,6 +16,7 @@ color fg flex floating +floating_placement focus gap grow