ewmh: add support for _NET_WM_WINDOW_TYPE_DESKTOP

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-06-19 19:51:58 +02:00
parent 8947213491
commit a5478e5438
2 changed files with 28 additions and 23 deletions

View File

@ -124,26 +124,6 @@ window_isprotodel(xcb_window_t win)
return ret;
}
/** Returns true if a client is tagged with one of the tags visibl
* on any screen.
* \param c The client.
* \return True if client is tagged, false otherwise.
*/
static bool
client_isvisible_anyscreen(client_t *c)
{
tag_t *tag;
int screen;
if(c && !c->ishidden)
for(screen = 0; screen < globalconf.screens_info->nscreen; screen++)
for(tag = globalconf.screens[screen].tags; tag; tag = tag->next)
if(tag->selected && is_client_tagged(c, tag))
return true;
return false;
}
/** Returns true if a client is tagged
* with one of the tags of the specified screen.
* \param c The client to check.
@ -295,6 +275,8 @@ client_raise(client_t *c)
uint32_t config_win_vals[2];
client_node_t *node;
layer_t layer;
statusbar_t *sb;
int screen;
config_win_vals[0] = XCB_NONE;
config_win_vals[1] = XCB_STACK_MODE_BELOW;
@ -302,10 +284,19 @@ client_raise(client_t *c)
/* Push c on top of the stack. */
stack_client_push(c);
for(screen = 0; screen < globalconf.screens_info->nscreen; screen++)
for(sb = globalconf.screens[screen].statusbar; sb; sb = sb->next)
{
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;
}
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))
if(node->client->layer == layer)
{
if(node->client->titlebar
&& node->client->titlebar->sw

14
ewmh.c
View File

@ -54,6 +54,7 @@ static xcb_atom_t net_wm_icon_name;
static xcb_atom_t net_wm_visible_icon_name;
static xcb_atom_t net_wm_window_type;
static xcb_atom_t net_wm_window_type_normal;
static xcb_atom_t net_wm_window_type_desktop;
static xcb_atom_t net_wm_window_type_dock;
static xcb_atom_t net_wm_window_type_splash;
static xcb_atom_t net_wm_window_type_dialog;
@ -98,6 +99,7 @@ static AtomItem AtomNames[] =
{ "_NET_WM_VISIBLE_ICON_NAME", &net_wm_visible_icon_name },
{ "_NET_WM_WINDOW_TYPE", &net_wm_window_type },
{ "_NET_WM_WINDOW_TYPE_NORMAL", &net_wm_window_type_normal },
{ "_NET_WM_WINDOW_TYPE_DESKTOP", &net_wm_window_type_desktop },
{ "_NET_WM_WINDOW_TYPE_DOCK", &net_wm_window_type_dock },
{ "_NET_WM_WINDOW_TYPE_SPLASH", &net_wm_window_type_splash },
{ "_NET_WM_WINDOW_TYPE_DIALOG", &net_wm_window_type_dialog },
@ -176,6 +178,7 @@ ewmh_set_supported_hints(int phys_screen)
atom[i++] = net_wm_desktop;
atom[i++] = net_wm_window_type;
atom[i++] = net_wm_window_type_normal;
atom[i++] = net_wm_window_type_desktop;
atom[i++] = net_wm_window_type_dock;
atom[i++] = net_wm_window_type_splash;
atom[i++] = net_wm_window_type_dialog;
@ -480,6 +483,8 @@ ewmh_process_state_atom(client_t *c, xcb_atom_t state, int set)
static void
ewmh_process_window_type_atom(client_t *c, xcb_atom_t state)
{
tag_t *tag;
if(state == net_wm_window_type_normal)
{
/* do nothing. this is REALLY IMPORTANT */
@ -500,6 +505,15 @@ ewmh_process_window_type_atom(client_t *c, xcb_atom_t state)
}
else if(state == net_wm_window_type_dialog)
client_setfloating(c, true, LAYER_MODAL);
else if(state == net_wm_window_type_desktop)
{
c->noborder = true;
c->isfixed = true;
c->skip = true;
c->layer = LAYER_DESKTOP;
for(tag = globalconf.screens[c->screen].tags; tag; tag = tag->next)
tag_client(c, tag);
}
}
int