From 786c0b8dafcba712cd3ffcd11b5b727338be4edf Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 19 Jan 2009 17:17:15 +0100 Subject: [PATCH] widget: add align property Signed-off-by: Julien Danjou --- widget.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/widget.c b/widget.c index 4e90abe4..ebda7fd6 100644 --- a/widget.c +++ b/widget.c @@ -70,7 +70,6 @@ widget_calculate_offset(int barwidth, int widgetwidth, int offset, int alignment return barwidth - offset - widgetwidth; } - /** Get a widget node from a wibox by coords. * \param Container position. * \param widgets The widget list. @@ -424,6 +423,7 @@ luaA_widget_buttons(lua_State *L) * \param L The Lua VM state. * \return The number of elements pushed on stack. * \luastack + * \lfield align The widget alignment. * \lfield visible The widget visibility. * \lfield mouse_enter A function to execute when the mouse enter the widget. * \lfield mouse_leave A function to execute when the mouse leave the widget. @@ -441,6 +441,9 @@ luaA_widget_index(lua_State *L) switch((token = a_tokenize(buf, len))) { + case A_TK_ALIGN: + lua_pushstring(L, draw_align_tostr((*widget)->align)); + return 1; case A_TK_VISIBLE: lua_pushboolean(L, (*widget)->isvisible); return 1; @@ -477,6 +480,10 @@ luaA_widget_newindex(lua_State *L) switch((token = a_tokenize(buf, len))) { + case A_TK_ALIGN: + buf = luaL_checklstring(L, 3, &len); + (*widget)->align = draw_align_fromstr(buf, len); + break; case A_TK_VISIBLE: (*widget)->isvisible = luaA_checkboolean(L, 3); break; -- 2.11.4.GIT