ewmh: add support for _NET_CLIENT_LIST_STACKING

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-06-17 21:47:57 +02:00
parent b3d969f4e1
commit 63ab310585
3 changed files with 34 additions and 0 deletions

30
ewmh.c
View File

@ -29,6 +29,7 @@
#include "screen.h"
#include "client.h"
#include "widget.h"
#include "cnode.h"
#include "titlebar.h"
extern awesome_t globalconf;
@ -36,6 +37,7 @@ extern awesome_t globalconf;
static xcb_atom_t net_supported;
static xcb_atom_t net_supporting_wm_check;
static xcb_atom_t net_client_list;
static xcb_atom_t net_client_list_stacking;
static xcb_atom_t net_number_of_desktops;
static xcb_atom_t net_current_desktop;
static xcb_atom_t net_desktop_names;
@ -71,6 +73,7 @@ static AtomItem AtomNames[] =
{ "_NET_SUPPORTED", &net_supported },
{ "_NET_SUPPORTING_WM_CHECK", &net_supporting_wm_check },
{ "_NET_CLIENT_LIST", &net_client_list },
{ "_NET_CLIENT_LIST_STACKING", &net_client_list_stacking },
{ "_NET_NUMBER_OF_DESKTOPS", &net_number_of_desktops },
{ "_NET_CURRENT_DESKTOP", &net_current_desktop },
{ "_NET_DESKTOP_NAMES", &net_desktop_names },
@ -143,6 +146,7 @@ ewmh_set_supported_hints(int phys_screen)
atom[i++] = net_supported;
atom[i++] = net_supporting_wm_check;
atom[i++] = net_client_list;
atom[i++] = net_client_list_stacking;
atom[i++] = net_number_of_desktops;
atom[i++] = net_current_desktop;
atom[i++] = net_desktop_names;
@ -208,6 +212,32 @@ ewmh_update_net_client_list(int phys_screen)
p_delete(&wins);
}
/** Set the client list in stacking order, bottom to top.
* \param phys_screen The physical screen id.
*/
void
ewmh_update_net_client_list_stacking(int phys_screen)
{
xcb_window_t *wins;
client_node_t *c;
int n = 0;
for(c = globalconf.stack; c; c = c->next)
n++;
wins = p_new(xcb_window_t, n);
for(n = 0, c = *client_node_list_last(&globalconf.stack); c; c = c->prev, n++)
if(c->client->phys_screen == phys_screen)
wins[n] = c->client->win;
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
xutil_screen_get(globalconf.connection, phys_screen)->root,
net_client_list, WINDOW, 32, n, wins);
p_delete(&wins);
}
void
ewmh_update_net_numbers_of_desktop(int phys_screen)
{

1
ewmh.h
View File

@ -39,6 +39,7 @@ void ewmh_update_net_current_desktop(int);
void ewmh_update_net_desktop_names(int);
void ewmh_update_net_active_window(int);
int ewmh_process_client_message(xcb_client_message_event_t *);
void ewmh_update_net_client_list_stacking(int);
void ewmh_check_client_hints(client_t *);
NetWMIcon * ewmh_get_window_icon(xcb_window_t);

View File

@ -21,6 +21,7 @@
#include "stack.h"
#include "cnode.h"
#include "ewmh.h"
extern awesome_t globalconf;
@ -32,6 +33,7 @@ stack_client_push(client_t *c)
{
client_node_t *node = client_node_client_add(&globalconf.stack, c);
client_node_list_push(&globalconf.stack, node);
ewmh_update_net_client_list_stacking(c->phys_screen);
}
/** Remove a client from stack history.
@ -46,6 +48,7 @@ stack_client_delete(client_t *c)
{
client_node_list_detach(&globalconf.stack, node);
p_delete(&node);
ewmh_update_net_client_list_stacking(c->phys_screen);
}
}