ewmh: add modal windows support and a modal layout

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-06-13 14:41:10 +02:00
parent c207bd0145
commit 008cf2b340
3 changed files with 18 additions and 7 deletions

View File

@ -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))

19
ewmh.c
View File

@ -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

View File

@ -40,7 +40,9 @@ typedef enum
LAYER_TILE,
LAYER_FLOAT,
LAYER_ABOVE,
LAYER_FULLSCREEN
LAYER_FULLSCREEN,
LAYER_MODAL,
LAYER_OUTOFSPACE
} layer_t;
/** Cursors */