util: remove off position
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
08b0d71db3
commit
2dfde8c181
4
client.c
4
client.c
|
@ -808,9 +808,9 @@ client_unban(client_t *c)
|
|||
{
|
||||
xcb_map_window(globalconf.connection, c->win);
|
||||
window_state_set(c->win, XCB_WM_STATE_NORMAL);
|
||||
if(c->titlebar && c->titlebar->position)
|
||||
if(c->titlebar)
|
||||
{
|
||||
if(c->isfullscreen)
|
||||
if(c->isfullscreen || !c->titlebar->isvisible)
|
||||
xcb_unmap_window(globalconf.connection, c->titlebar->sw.window);
|
||||
else
|
||||
xcb_map_window(globalconf.connection, c->titlebar->sw.window);
|
||||
|
|
|
@ -105,7 +105,7 @@ position_fromstr(const char *pos, ssize_t len)
|
|||
{
|
||||
switch(a_tokenize(pos, len))
|
||||
{
|
||||
case A_TK_TOP:
|
||||
default:
|
||||
return Top;
|
||||
case A_TK_BOTTOM:
|
||||
return Bottom;
|
||||
|
@ -113,8 +113,6 @@ position_fromstr(const char *pos, ssize_t len)
|
|||
return Right;
|
||||
case A_TK_LEFT:
|
||||
return Left;
|
||||
default:
|
||||
return Off;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -131,7 +129,7 @@ position_tostr(position_t p)
|
|||
case Bottom: return "bottom";
|
||||
case Right: return "right";
|
||||
case Left: return "left";
|
||||
default: return "off";
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ typedef enum
|
|||
/** A list of possible position, not sex related */
|
||||
typedef enum
|
||||
{
|
||||
Off = 0,
|
||||
Top,
|
||||
Bottom,
|
||||
Right,
|
||||
|
|
1
screen.c
1
screen.c
|
@ -219,6 +219,7 @@ screen_area_get(int screen, wibox_array_t *statusbars,
|
|||
for(int i = 0; i < statusbars->len; i++)
|
||||
{
|
||||
wibox_t *sb = statusbars->tab[i];
|
||||
if(sb->isvisible)
|
||||
switch(sb->position)
|
||||
{
|
||||
case Top:
|
||||
|
|
31
statusbar.c
31
statusbar.c
|
@ -66,7 +66,7 @@ statusbar_systray_refresh(wibox_t *statusbar)
|
|||
position_t pos;
|
||||
int phys_screen = statusbar->sw.ctx.phys_screen;
|
||||
|
||||
if(statusbar->position
|
||||
if(statusbar->isvisible
|
||||
&& systray->widget->isvisible
|
||||
&& systray->area.width)
|
||||
{
|
||||
|
@ -123,8 +123,8 @@ statusbar_systray_refresh(wibox_t *statusbar)
|
|||
else
|
||||
{
|
||||
xcb_unmap_window(globalconf.connection, globalconf.screens[phys_screen].systray.window);
|
||||
/* hide */
|
||||
pos = Off;
|
||||
statusbar_systray_kickout(phys_screen);
|
||||
break;
|
||||
}
|
||||
|
||||
switch(pos)
|
||||
|
@ -200,9 +200,6 @@ statusbar_systray_refresh(wibox_t *statusbar)
|
|||
config_win_vals_off);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
statusbar_systray_kickout(phys_screen);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -216,7 +213,7 @@ statusbar_draw(wibox_t *statusbar)
|
|||
{
|
||||
statusbar->need_update = false;
|
||||
|
||||
if(statusbar->position)
|
||||
if(statusbar->isvisible)
|
||||
{
|
||||
widget_render(statusbar->widgets, &statusbar->sw.ctx, statusbar->sw.gc,
|
||||
statusbar->sw.pixmap,
|
||||
|
@ -270,7 +267,9 @@ statusbar_position_update(wibox_t *statusbar)
|
|||
area_t area;
|
||||
bool ignore = false;
|
||||
|
||||
if(statusbar->position == Off)
|
||||
globalconf.screens[statusbar->screen].need_arrange = true;
|
||||
|
||||
if(!statusbar->isvisible)
|
||||
{
|
||||
xcb_unmap_window(globalconf.connection, statusbar->sw.window);
|
||||
/* kick out systray if needed */
|
||||
|
@ -344,8 +343,6 @@ statusbar_position_update(wibox_t *statusbar)
|
|||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -438,7 +435,6 @@ statusbar_position_update(wibox_t *statusbar)
|
|||
0, statusbar->position,
|
||||
&statusbar->colors.fg, &statusbar->colors.bg);
|
||||
statusbar->need_update = true;
|
||||
xcb_map_window(globalconf.connection, statusbar->sw.window);
|
||||
}
|
||||
/* same window size and position ? */
|
||||
else
|
||||
|
@ -455,8 +451,7 @@ statusbar_position_update(wibox_t *statusbar)
|
|||
simplewindow_move(&statusbar->sw, statusbar->geometry.x, statusbar->geometry.y);
|
||||
}
|
||||
|
||||
/* Set need update */
|
||||
globalconf.screens[statusbar->screen].need_arrange = true;
|
||||
xcb_map_window(globalconf.connection, statusbar->sw.window);
|
||||
}
|
||||
|
||||
/** Create a new statusbar (DEPRECATED).
|
||||
|
@ -483,14 +478,14 @@ statusbar_detach(wibox_t *statusbar)
|
|||
{
|
||||
if(statusbar->screen != SCREEN_UNDEF)
|
||||
{
|
||||
position_t p;
|
||||
bool v;
|
||||
|
||||
/* save position */
|
||||
p = statusbar->position;
|
||||
statusbar->position = Off;
|
||||
/* save visible state */
|
||||
v = statusbar->isvisible;
|
||||
statusbar->isvisible = false;
|
||||
statusbar_position_update(statusbar);
|
||||
/* restore position */
|
||||
statusbar->position = p;
|
||||
statusbar->isvisible = v;
|
||||
|
||||
simplewindow_wipe(&statusbar->sw);
|
||||
|
||||
|
|
|
@ -92,6 +92,8 @@ typedef struct
|
|||
int refcount;
|
||||
/** Ontop */
|
||||
bool ontop;
|
||||
/** Visible */
|
||||
bool isvisible;
|
||||
/** Wibox type */
|
||||
wibox_type_t type;
|
||||
/** Window */
|
||||
|
|
|
@ -66,7 +66,7 @@ client_getbytitlebarwin(xcb_window_t win)
|
|||
void
|
||||
titlebar_draw(client_t *c)
|
||||
{
|
||||
if(!c || !c->titlebar || !c->titlebar->position)
|
||||
if(!c || !c->titlebar || !c->titlebar->isvisible)
|
||||
return;
|
||||
|
||||
widget_render(c->titlebar->widgets, &c->titlebar->sw.ctx,
|
||||
|
@ -203,9 +203,6 @@ titlebar_init(client_t *c)
|
|||
|
||||
switch(c->titlebar->position)
|
||||
{
|
||||
default:
|
||||
c->titlebar->position = Off;
|
||||
return;
|
||||
case Top:
|
||||
case Bottom:
|
||||
if(c->titlebar->geometry.width)
|
||||
|
|
20
wibox.c
20
wibox.c
|
@ -100,6 +100,7 @@ luaA_wibox_new(lua_State *L)
|
|||
w->position = position_fromstr(buf, len);
|
||||
|
||||
w->screen = SCREEN_UNDEF;
|
||||
w->isvisible = true;
|
||||
|
||||
for(i = 0; i <= reqs_nbr; i++)
|
||||
xcolor_init_reply(reqs[i]);
|
||||
|
@ -139,6 +140,9 @@ luaA_wibox_index(lua_State *L)
|
|||
case A_TK_GEOMETRY:
|
||||
luaA_pusharea(L, (*wibox)->geometry);
|
||||
break;
|
||||
case A_TK_VISIBLE:
|
||||
lua_pushboolean(L, (*wibox)->isvisible);
|
||||
break;
|
||||
case A_TK_CLIENT:
|
||||
if((c = client_getbytitlebar(*wibox)))
|
||||
return luaA_client_userdata_new(L, c);
|
||||
|
@ -290,6 +294,22 @@ luaA_wibox_newindex(lua_State *L)
|
|||
client_stack();
|
||||
}
|
||||
break;
|
||||
case A_TK_VISIBLE:
|
||||
b = luaA_checkboolean(L, 3);
|
||||
if(b != (*wibox)->isvisible)
|
||||
{
|
||||
(*wibox)->isvisible = b;
|
||||
switch((*wibox)->type)
|
||||
{
|
||||
case WIBOX_TYPE_STATUSBAR:
|
||||
statusbar_position_update(*wibox);
|
||||
break;
|
||||
case WIBOX_TYPE_NONE:
|
||||
case WIBOX_TYPE_TITLEBAR:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
switch((*wibox)->type)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue