From 008cf2b34090602aa4f5714478598c98fdbdc457 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 13 Jun 2008 14:41:10 +0200 Subject: [PATCH] ewmh: add modal windows support and a modal layout Signed-off-by: Julien Danjou --- client.c | 2 +- ewmh.c | 19 ++++++++++++++----- structs.h | 4 +++- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/client.c b/client.c index 4d8cbcf0..d61ce177 100644 --- a/client.c +++ b/client.c @@ -299,7 +299,7 @@ client_raise(client_t *c) /* Push c on top of the stack. */ stack_client_push(c); - for(layer = LAYER_FULLSCREEN; layer >= LAYER_DESKTOP; layer--) + for(layer = LAYER_OUTOFSPACE - 1; layer >= LAYER_DESKTOP; layer--) for(node = globalconf.stack; node; node = node->next) if(node->client->layer == layer && client_isvisible_anyscreen(node->client)) diff --git a/ewmh.c b/ewmh.c index 596df8f2..ecaad5b9 100644 --- a/ewmh.c +++ b/ewmh.c @@ -54,6 +54,7 @@ static xcb_atom_t net_wm_state_skip_taskbar; static xcb_atom_t net_wm_state_fullscreen; static xcb_atom_t net_wm_state_above; static xcb_atom_t net_wm_state_below; +static xcb_atom_t net_wm_state_modal; static xcb_atom_t utf8_string; @@ -88,6 +89,7 @@ static AtomItem AtomNames[] = { "_NET_WM_STATE_FULLSCREEN", &net_wm_state_fullscreen }, { "_NET_WM_STATE_ABOVE", &net_wm_state_above }, { "_NET_WM_STATE_BELOW", &net_wm_state_below }, + { "_NET_WM_STATE_MODAL", &net_wm_state_modal }, { "UTF8_STRING", &utf8_string }, }; @@ -155,6 +157,7 @@ ewmh_set_supported_hints(int phys_screen) atom[i++] = net_wm_state_fullscreen; atom[i++] = net_wm_state_above; atom[i++] = net_wm_state_below; + atom[i++] = net_wm_state_modal; xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE, xcb_aux_get_screen(globalconf.connection, phys_screen)->root, @@ -313,9 +316,7 @@ ewmh_process_state_atom(client_t *c, xcb_atom_t state, int set) else if(state == net_wm_state_above) { if(set == _NET_WM_STATE_REMOVE) - { c->layer = c->oldlayer; - } else if(set == _NET_WM_STATE_ADD) { c->oldlayer = c->layer; @@ -325,15 +326,23 @@ ewmh_process_state_atom(client_t *c, xcb_atom_t state, int set) else if(state == net_wm_state_below) { if(set == _NET_WM_STATE_REMOVE) - { c->layer = c->oldlayer; - } else if(set == _NET_WM_STATE_ADD) { c->oldlayer = c->layer; c->layer = LAYER_BELOW; } } + else if(state == net_wm_state_modal) + { + if(set == _NET_WM_STATE_REMOVE) + c->layer = c->oldlayer; + else if(set == _NET_WM_STATE_ADD) + { + c->oldlayer = c->layer; + c->layer = LAYER_MODAL; + } + } } @@ -359,7 +368,7 @@ ewmh_process_window_type_atom(client_t *c, xcb_atom_t state) client_setfloating(c, true, LAYER_ABOVE); } else if (state == net_wm_window_type_dialog) - client_setfloating(c, true, LAYER_ABOVE); + client_setfloating(c, true, LAYER_MODAL); } void diff --git a/structs.h b/structs.h index 4ec6d7b3..56489974 100644 --- a/structs.h +++ b/structs.h @@ -40,7 +40,9 @@ typedef enum LAYER_TILE, LAYER_FLOAT, LAYER_ABOVE, - LAYER_FULLSCREEN + LAYER_FULLSCREEN, + LAYER_MODAL, + LAYER_OUTOFSPACE } layer_t; /** Cursors */