From aa9a7b1fc8855a4508fe71403bebdeea842f9e12 Mon Sep 17 00:00:00 2001 From: Gregor Best Date: Fri, 20 Mar 2009 21:15:38 +0100 Subject: [PATCH] widgets: get rid of align attribute Signed-off-by: Gregor Best Signed-off-by: Julien Danjou --- draw.c | 3 --- draw.h | 5 ++--- widget.c | 17 ++--------------- widget.h | 4 ---- widgets/textbox.c | 1 - 5 files changed, 4 insertions(+), 26 deletions(-) diff --git a/draw.c b/draw.c index 6df4498e..a1e722ff 100644 --- a/draw.c +++ b/draw.c @@ -660,7 +660,6 @@ draw_text_extents(draw_text_context_t *data) /** Transform a string to a alignment_t type. * Recognized string are flex, fixed, left, center, middle or right. - * Everything else will be recognized as AlignLeft. * \param align Atring with align text. * \param len The string length. * \return An alignment_t type. @@ -672,7 +671,6 @@ draw_align_fromstr(const char *align, ssize_t len) { case A_TK_CENTER: return AlignCenter; case A_TK_RIGHT: return AlignRight; - case A_TK_FLEX: return AlignFlex; case A_TK_FIXED: return AlignFixed; case A_TK_TOP: return AlignTop; case A_TK_BOTTOM: return AlignBottom; @@ -693,7 +691,6 @@ draw_align_tostr(alignment_t a) case AlignLeft: return "left"; case AlignCenter: return "center"; case AlignRight: return "right"; - case AlignFlex: return "flex"; case AlignFixed: return "fixed"; case AlignBottom: return "bottom"; case AlignTop: return "top"; diff --git a/draw.h b/draw.h index 48671cd4..45880b75 100644 --- a/draw.h +++ b/draw.h @@ -51,9 +51,8 @@ typedef enum AlignCenter = (1 << 1), AlignTop = (1 << 2), AlignBottom = (1 << 3), - AlignFlex = (1 << 4), - AlignFixed = (1 << 5), - AlignMiddle = (1 << 6) + AlignFixed = (1 << 4), + AlignMiddle = (1 << 5) } alignment_t; typedef struct vector_t vector_t; diff --git a/widget.c b/widget.c index fe95be92..3a6aab7d 100644 --- a/widget.c +++ b/widget.c @@ -383,14 +383,13 @@ widget_invalidate_bywidget(widget_t *widget) * \param L The Lua VM state. * * \luastack - * \lparam A table with at least a type value. Optional attributes - * are: align. + * \lparam A table with at least a type value. * \lreturn A brand new widget. */ static int luaA_widget_new(lua_State *L) { - const char *align, *type; + const char *type; widget_t *w; widget_constructor_t *wc = NULL; size_t len; @@ -433,10 +432,6 @@ luaA_widget_new(lua_State *L) w->type = wc; - align = luaA_getopt_lstring(L, 2, "align", "left", &len); - w->align_supported |= AlignLeft | AlignRight | AlignFixed; - w->align = draw_align_fromstr(align, len); - /* Set visible by default. */ w->isvisible = true; @@ -472,7 +467,6 @@ 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. @@ -490,9 +484,6 @@ 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; @@ -529,10 +520,6 @@ 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; diff --git a/widget.h b/widget.h index 3bf58c5b..22a03908 100644 --- a/widget.h +++ b/widget.h @@ -48,10 +48,6 @@ struct widget_t int (*newindex)(lua_State *, awesome_token_t); /** Mouse over event handler */ luaA_ref mouse_enter, mouse_leave; - /** Alignement */ - alignment_t align; - /** Supported alignment */ - alignment_t align_supported; /** Misc private data */ void *data; /** Button bindings */ diff --git a/widgets/textbox.c b/widgets/textbox.c index 6930ac66..d943af46 100644 --- a/widgets/textbox.c +++ b/widgets/textbox.c @@ -372,7 +372,6 @@ luaA_textbox_newindex(lua_State *L, awesome_token_t token) widget_t * widget_textbox(widget_t *w) { - w->align_supported |= AlignFlex; w->draw = textbox_draw; w->index = luaA_textbox_index; w->newindex = luaA_textbox_newindex;