client: merge floating placement into index

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-07-01 21:46:43 +02:00
parent 014214794a
commit fc38d32052
2 changed files with 9 additions and 18 deletions

View File

@ -1240,23 +1240,6 @@ luaA_client_unmanage(lua_State *L)
return 0; 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. /** Client newindex.
* \param L The Lua VM state. * \param L The Lua VM state.
* \return The number of elements pushed on stack. * \return The number of elements pushed on stack.
@ -1280,6 +1263,10 @@ luaA_client_newindex(lua_State *L)
a_iso2utf8(&(*c)->name, buf, len); a_iso2utf8(&(*c)->name, buf, len);
widget_invalidate_cache((*c)->screen, WIDGET_CACHE_CLIENTS); widget_invalidate_cache((*c)->screen, WIDGET_CACHE_CLIENTS);
break; break;
case A_TK_FLOATING_PLACEMENT:
(*c)->floating_placement = name_func_lookup(luaL_checkstring(L, 3),
FloatingPlacementList);
break;
case A_TK_SCREEN: case A_TK_SCREEN:
i = luaL_checknumber(L, 3) - 1; i = luaL_checknumber(L, 3) - 1;
luaA_checkscreen(i); luaA_checkscreen(i);
@ -1351,6 +1338,10 @@ luaA_client_index(lua_State *L)
case A_TK_NAME: case A_TK_NAME:
lua_pushstring(L, (*c)->name); lua_pushstring(L, (*c)->name);
break; break;
case A_TK_FLOATING_PLACEMENT:
lua_pushstring(L, name_func_rlookup((*c)->floating_placement,
FloatingPlacementList));
break;
case A_TK_SCREEN: case A_TK_SCREEN:
lua_pushnumber(L, 1 + (*c)->screen); lua_pushnumber(L, 1 + (*c)->screen);
break; break;
@ -1387,7 +1378,6 @@ const struct luaL_reg awesome_client_methods[] =
}; };
const struct luaL_reg awesome_client_meta[] = const struct luaL_reg awesome_client_meta[] =
{ {
{ "floating_placement_set", luaA_client_floating_placement_set },
{ "titlebar_set", luaA_client_titlebar_set }, { "titlebar_set", luaA_client_titlebar_set },
{ "titlebar_get", luaA_client_titlebar_get }, { "titlebar_get", luaA_client_titlebar_get },
{ "tag", luaA_client_tag }, { "tag", luaA_client_tag },

View File

@ -16,6 +16,7 @@ color
fg fg
flex flex
floating floating
floating_placement
focus focus
gap gap
grow grow