From 08b0d71db345d641c17b2fdcd60ceaf63e435259 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Mon, 22 Sep 2008 19:23:28 +0200 Subject: [PATCH] wibox: add ontop attribute Signed-off-by: Julien Danjou --- client.c | 38 +++++++++++++++++++++++++++++++------- structs.h | 2 ++ wibox.c | 14 ++++++++++++++ 3 files changed, 47 insertions(+), 7 deletions(-) diff --git a/client.c b/client.c index 353822498..5f16e84ff 100644 --- a/client.c +++ b/client.c @@ -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]); diff --git a/structs.h b/structs.h index ece2d4a24..9ad531e5d 100644 --- a/structs.h +++ b/structs.h @@ -90,6 +90,8 @@ typedef struct { /** Ref count */ int refcount; + /** Ontop */ + bool ontop; /** Wibox type */ wibox_type_t type; /** Window */ diff --git a/wibox.c b/wibox.c index fe554c806..0f4e63e1a 100644 --- a/wibox.c +++ b/wibox.c @@ -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) {