From b3580fc519beefa71127cae87a390d82ae481981 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 3 Oct 2008 08:56:13 +0200 Subject: [PATCH] wibox: handle position on new correctly We do not need to call setposition since we are not attached. We just need to set orientation and position_update to get the right coords. Signed-off-by: Julien Danjou --- wibox.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/wibox.c b/wibox.c index 7bb0507c..cbb95fbc 100644 --- a/wibox.c +++ b/wibox.c @@ -641,12 +641,29 @@ luaA_wibox_new(lua_State *L) w->sw.border.width = luaA_getopt_number(L, 2, "border_width", 0); + buf = luaA_getopt_lstring(L, 2, "position", "top", &len); + + switch((w->position = position_fromstr(buf, len))) + { + case Bottom: + case Top: + case Floating: + simplewindow_orientation_set(&w->sw, East); + break; + case Left: + simplewindow_orientation_set(&w->sw, North); + break; + case Right: + simplewindow_orientation_set(&w->sw, South); + break; + } + + /* recompute position */ + wibox_position_update(w); + w->sw.geometry.width = luaA_getopt_number(L, 2, "width", 0); w->sw.geometry.height = luaA_getopt_number(L, 2, "height", 0); - buf = luaA_getopt_lstring(L, 2, "position", "top", &len); - wibox_setposition(w, position_fromstr(buf, len)); - w->screen = SCREEN_UNDEF; w->isvisible = true;