[statusbar] Add a flag to know if user specified width

That fix dynamic position switching.

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-06-03 11:47:05 +02:00
parent 34cd5504a7
commit 59aa2b2da7
2 changed files with 6 additions and 2 deletions

View File

@ -265,7 +265,7 @@ statusbar_position_update(statusbar_t *statusbar, position_t position)
{
case Right:
case Left:
if(statusbar->width <= 0)
if(!statusbar->width_user)
statusbar->width = area.height;
statusbar->sw =
simplewindow_new(globalconf.connection, statusbar->phys_screen, 0, 0,
@ -285,7 +285,7 @@ statusbar_position_update(statusbar_t *statusbar, position_t position)
statusbar->colors.bg);
break;
default:
if(statusbar->width <= 0)
if(!statusbar->width_user)
statusbar->width = area.width;
statusbar->sw =
simplewindow_new(globalconf.connection, statusbar->phys_screen, 0, 0,
@ -558,6 +558,8 @@ luaA_statusbar_new(lua_State *L)
(*sb)->align = draw_align_get_from_str(luaA_getopt_string(L, 1, "align", "left"));
(*sb)->width = luaA_getopt_number(L, 1, "width", 0);
if((*sb)->width > 0)
(*sb)->width_user = true;
(*sb)->height = luaA_getopt_number(L, 1, "height", 0);
if((*sb)->height <= 0)
/* 1.5 as default factor, it fits nice but no one knows why */

View File

@ -202,6 +202,8 @@ struct statusbar_t
int width;
/** Bar height */
int height;
/** True if user specified width */
bool width_user;
/** Bar position */
position_t position;
/** Alignment */