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) if(client_layer_translator(node->client) == layer)
config_win_vals[0] = client_stack_below(node->client, config_win_vals[0]); 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(screen = 0; screen < globalconf.nscreen; screen++)
for(int i = 0; i < globalconf.screens[screen].statusbars.len; i++) for(int i = 0; i < globalconf.screens[screen].statusbars.len; i++)
{ {
wibox_t *sb = globalconf.screens[screen].statusbars.tab[i]; wibox_t *sb = globalconf.screens[screen].statusbars.tab[i];
xcb_configure_window(globalconf.connection, if(sb->ontop)
sb->sw.window, {
XCB_CONFIG_WINDOW_SIBLING | XCB_CONFIG_WINDOW_STACK_MODE, xcb_configure_window(globalconf.connection,
config_win_vals); sb->sw.window,
config_win_vals[0] = 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 */ /* 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) for(node = globalconf.stack; node; node = node->next)
if(client_layer_translator(node->client) == layer) if(client_layer_translator(node->client) == layer)
config_win_vals[0] = client_stack_below(node->client, config_win_vals[0]); config_win_vals[0] = client_stack_below(node->client, config_win_vals[0]);

View File

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

14
wibox.c
View File

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