wibox: add ontop attribute

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-09-22 19:23:28 +02:00
parent 305af484f5
commit 08b0d71db3
3 changed files with 47 additions and 7 deletions

View File

@ -330,20 +330,44 @@ client_stack(void)
if(client_layer_translator(node->client) == layer)
config_win_vals[0] = client_stack_below(node->client, config_win_vals[0]);
/* then stack statusbar window */
/* then stack ontop statusbar window */
for(screen = 0; screen < globalconf.nscreen; screen++)
for(int i = 0; i < globalconf.screens[screen].statusbars.len; i++)
{
wibox_t *sb = globalconf.screens[screen].statusbars.tab[i];
xcb_configure_window(globalconf.connection,
sb->sw.window,
XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE,
config_win_vals);
config_win_vals[0] = sb->sw.window;
if(sb->ontop)
{
xcb_configure_window(globalconf.connection,
sb->sw.window,
XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE,
config_win_vals);
config_win_vals[0] = sb->sw.window;
}
}
/* finally stack everything else */
for(layer = LAYER_FULLSCREEN - 1; layer >= LAYER_DESKTOP; layer--)
for(layer = LAYER_FULLSCREEN - 1; layer >= LAYER_TILE; layer--)
for(node = globalconf.stack; node; node = node->next)
if(client_layer_translator(node->client) == layer)
config_win_vals[0] = client_stack_below(node->client, config_win_vals[0]);
/* then stack not ontop statusbar window */
for(screen = 0; screen < globalconf.nscreen; screen++)
for(int i = 0; i < globalconf.screens[screen].statusbars.len; i++)
{
wibox_t *sb = globalconf.screens[screen].statusbars.tab[i];
if(!sb->ontop)
{
xcb_configure_window(globalconf.connection,
sb->sw.window,
XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE,
config_win_vals);
config_win_vals[0] = sb->sw.window;
}
}
/* finally stack everything else */
for(layer = LAYER_TILE - 1; layer >= LAYER_DESKTOP; layer--)
for(node = globalconf.stack; node; node = node->next)
if(client_layer_translator(node->client) == layer)
config_win_vals[0] = client_stack_below(node->client, config_win_vals[0]);

View File

@ -90,6 +90,8 @@ typedef struct
{
/** Ref count */
int refcount;
/** Ontop */
bool ontop;
/** Wibox type */
wibox_type_t type;
/** Window */

14
wibox.c
View File

@ -120,6 +120,7 @@ luaA_wibox_new(lua_State *L)
* \lfield fg Foreground color.
* \lfield bg Background color.
* \lfield position The position.
* \lfield ontop On top of other windows.
*/
static int
luaA_wibox_index(lua_State *L)
@ -166,6 +167,9 @@ luaA_wibox_index(lua_State *L)
case A_TK_POSITION:
lua_pushstring(L, position_tostr((*wibox)->position));
break;
case A_TK_ONTOP:
lua_pushboolean(L, (*wibox)->ontop);
break;
default:
return 0;
}
@ -209,6 +213,8 @@ luaA_wibox_newindex(lua_State *L)
switch((tok = a_tokenize(attr, len)))
{
bool b;
case A_TK_FG:
if((buf = luaL_checklstring(L, 3, &len)))
if(xcolor_init_reply(xcolor_init_unchecked(&(*wibox)->colors.fg, buf, len)))
@ -276,6 +282,14 @@ luaA_wibox_newindex(lua_State *L)
statusbar_attach(*wibox, &globalconf.screens[screen]);
}
break;
case A_TK_ONTOP:
b = luaA_checkboolean(L, 3);
if(b != (*wibox)->ontop)
{
(*wibox)->ontop = b;
client_stack();
}
break;
default:
switch((*wibox)->type)
{