3 #include <xcb/xcb_ewmh.h>
12 ewmh = (xcb_ewmh_connection_t *) malloc(sizeof(xcb_ewmh_connection_t));
13 xcb_intern_atom_cookie_t *ewmh_cookies;
14 ewmh_cookies = xcb_ewmh_init_atoms(dpy, ewmh);
15 xcb_ewmh_init_atoms_replies(ewmh, ewmh_cookies, NULL);
18 void ewmh_update_wm_name(void)
21 xcb_ewmh_set_wm_name(ewmh, screen->root, strlen(wm_name), wm_name);
24 void ewmh_update_active_window(void)
26 xcb_window_t win = (desk->focus == NULL ? XCB_NONE : desk->focus->client->window);
27 xcb_ewmh_set_active_window(ewmh, default_screen, win);
30 void ewmh_update_number_of_desktops(void)
32 xcb_ewmh_set_number_of_desktops(ewmh, default_screen, num_desktops);
35 void ewmh_update_current_desktop(void)
37 desktop_t *d = desk_head;
38 unsigned int i = 0, cd = 0;
40 while (d != NULL && i < num_desktops) {
47 xcb_ewmh_set_current_desktop(ewmh, default_screen, cd);
50 void ewmh_update_desktop_names(void)
53 desktop_t *d = desk_head;
58 while (d != NULL && i < num_desktops) {
59 for (unsigned int j = 0; j < strlen(d->name); j++)
60 names[pos + j] = d->name[j];
61 pos += strlen(d->name);
68 if (i != num_desktops)
73 xcb_ewmh_set_desktop_names(ewmh, default_screen, pos, names);
76 void ewmh_update_client_list(void)
78 if (num_clients == 0) {
79 xcb_ewmh_set_client_list(ewmh, default_screen, 0, NULL);
83 xcb_window_t wins[num_clients];
84 desktop_t *d = desk_head;
87 while (d != NULL && i < num_clients) {
88 node_t *n = first_extrema(d->root);
90 wins[i++] = n->client->window;
99 xcb_ewmh_set_client_list(ewmh, default_screen, num_clients, wins);