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 <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-10-03 08:56:13 +02:00
parent a8124ad269
commit b3580fc519

23
wibox.c
View file

@ -641,12 +641,29 @@ luaA_wibox_new(lua_State *L)
w->sw.border.width = luaA_getopt_number(L, 2, "border_width", 0); 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.width = luaA_getopt_number(L, 2, "width", 0);
w->sw.geometry.height = luaA_getopt_number(L, 2, "height", 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->screen = SCREEN_UNDEF;
w->isvisible = true; w->isvisible = true;