From d7c70c57b552a007a6e43cd21c8c54c23b676837 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 1 Jul 2008 19:55:18 +0200 Subject: [PATCH] client: merge floating_{set,get} into index Signed-off-by: Julien Danjou --- awesomerc.lua.in | 2 +- client.c | 38 ++++++-------------------------------- common/tokenize.gperf | 1 + lib/awful.lua | 2 +- 4 files changed, 9 insertions(+), 34 deletions(-) diff --git a/awesomerc.lua.in b/awesomerc.lua.in index 208876b6..29a593f8 100644 --- a/awesomerc.lua.in +++ b/awesomerc.lua.in @@ -324,7 +324,7 @@ function hook_manage(c) c:border_set({ width = border_width, color = border_normal }) c:focus_set() if floatings[c.name:lower()] then - c:floating_set(true) + c.floating = true end -- Honor size hints c:honorsizehints_set(true) diff --git a/client.c b/client.c index c0367825..8768eab4 100644 --- a/client.c +++ b/client.c @@ -1177,36 +1177,6 @@ luaA_client_raise(lua_State *L) return 0; } -/** Set the client floating attribute. - * \param L The Lua VM state. - * \luastack - * \lparam A client. - * \lparam A boolean, true to set, false to unset. - */ -static int -luaA_client_floating_set(lua_State *L) -{ - client_t **c = luaA_checkudata(L, 1, "client"); - bool f = luaA_checkboolean(L, 2); - client_setfloating(*c, f); - return 0; -} - -/** Check if a client has the floating attribute. - * \param L The Lua VM state. - * \luastack - * \lvalue A client. - * \lreturn A boolean, true if the client has the floating attribute set, false - * otherwise. - */ -static int -luaA_client_floating_get(lua_State *L) -{ - client_t **c = luaA_checkudata(L, 1, "client"); - lua_pushboolean(L, (*c)->isfloating); - return 1; -} - /** Redraw a client by unmapping and mapping it quickly. * \param L The Lua VM state. * @@ -1403,6 +1373,9 @@ luaA_client_newindex(lua_State *L) if(d == -1 || (d >= 0 && d <= 1)) window_settrans((*c)->win, d); break; + case A_TK_FLOATING: + client_setfloating(*c, luaA_checkboolean(L, 3)); + break; default: return 0; } @@ -1435,6 +1408,9 @@ luaA_client_index(lua_State *L) case A_TK_ICON_PATH: lua_pushstring(L, (*c)->icon_path); break; + case A_TK_FLOATING: + lua_pushboolean(L, (*c)->isfloating); + break; default: break; } @@ -1467,8 +1443,6 @@ const struct luaL_reg awesome_client_meta[] = { "focus_set", luaA_client_focus_set }, { "raise", luaA_client_raise }, { "redraw", luaA_client_redraw }, - { "floating_set", luaA_client_floating_set }, - { "floating_get", luaA_client_floating_get }, { "class_get", luaA_client_class_get }, { "mouse_resize", luaA_client_mouse_resize }, { "mouse_move", luaA_client_mouse_move }, diff --git a/common/tokenize.gperf b/common/tokenize.gperf index f4b002c0..fe9cafeb 100644 --- a/common/tokenize.gperf +++ b/common/tokenize.gperf @@ -15,6 +15,7 @@ center color fg flex +floating focus gap grow diff --git a/lib/awful.lua b/lib/awful.lua index 09e9f0ad..bab292f4 100644 --- a/lib/awful.lua +++ b/lib/awful.lua @@ -316,7 +316,7 @@ end function P.client.togglefloating(c) local sel = c or client.focus_get(); if sel then - sel:floating_set(not sel:floating_get()) + sel.floating = not sel.floating end end