awful.widget: add graph stack property
[awesome.git] / ewmh.c
blobe970969bff2220224c8186923e5b760e0096dd60
1 /*
2 * ewmh.c - EWMH support functions
4 * Copyright © 2007-2009 Julien Danjou <julien@danjou.info>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 #include <sys/types.h>
23 #include <unistd.h>
25 #include <xcb/xcb.h>
26 #include <xcb/xcb_atom.h>
28 #include "ewmh.h"
29 #include "tag.h"
30 #include "screen.h"
31 #include "client.h"
32 #include "widget.h"
33 #include "wibox.h"
34 #include "luaa.h"
35 #include "common/atoms.h"
36 #include "common/buffer.h"
37 #include "common/xutil.h"
39 #define _NET_WM_STATE_REMOVE 0
40 #define _NET_WM_STATE_ADD 1
41 #define _NET_WM_STATE_TOGGLE 2
43 /** Update the desktop geometry.
44 * \param phys_screen The physical screen id.
46 static void
47 ewmh_update_desktop_geometry(int phys_screen)
49 area_t geom = screen_area_get(&globalconf.screens.tab[phys_screen], false);
50 uint32_t sizes[] = { geom.width, geom.height };
52 xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
53 xutil_screen_get(globalconf.connection, phys_screen)->root,
54 _NET_DESKTOP_GEOMETRY, CARDINAL, 32, countof(sizes), sizes);
57 void
58 ewmh_init(int phys_screen)
60 xcb_window_t father;
61 xcb_screen_t *xscreen = xutil_screen_get(globalconf.connection, phys_screen);
62 xcb_atom_t atom[] =
64 _NET_SUPPORTED,
65 _NET_SUPPORTING_WM_CHECK,
66 _NET_STARTUP_ID,
67 _NET_CLIENT_LIST,
68 _NET_CLIENT_LIST_STACKING,
69 _NET_NUMBER_OF_DESKTOPS,
70 _NET_CURRENT_DESKTOP,
71 _NET_DESKTOP_NAMES,
72 _NET_ACTIVE_WINDOW,
73 _NET_DESKTOP_GEOMETRY,
74 _NET_CLOSE_WINDOW,
75 _NET_WM_NAME,
76 _NET_WM_STRUT_PARTIAL,
77 _NET_WM_ICON_NAME,
78 _NET_WM_VISIBLE_ICON_NAME,
79 _NET_WM_DESKTOP,
80 _NET_WM_WINDOW_TYPE,
81 _NET_WM_WINDOW_TYPE_DESKTOP,
82 _NET_WM_WINDOW_TYPE_DOCK,
83 _NET_WM_WINDOW_TYPE_TOOLBAR,
84 _NET_WM_WINDOW_TYPE_MENU,
85 _NET_WM_WINDOW_TYPE_UTILITY,
86 _NET_WM_WINDOW_TYPE_SPLASH,
87 _NET_WM_WINDOW_TYPE_DIALOG,
88 _NET_WM_WINDOW_TYPE_DROPDOWN_MENU,
89 _NET_WM_WINDOW_TYPE_POPUP_MENU,
90 _NET_WM_WINDOW_TYPE_TOOLTIP,
91 _NET_WM_WINDOW_TYPE_NOTIFICATION,
92 _NET_WM_WINDOW_TYPE_COMBO,
93 _NET_WM_WINDOW_TYPE_DND,
94 _NET_WM_WINDOW_TYPE_NORMAL,
95 _NET_WM_ICON,
96 _NET_WM_PID,
97 _NET_WM_STATE,
98 _NET_WM_STATE_STICKY,
99 _NET_WM_STATE_SKIP_TASKBAR,
100 _NET_WM_STATE_FULLSCREEN,
101 _NET_WM_STATE_MAXIMIZED_HORZ,
102 _NET_WM_STATE_MAXIMIZED_VERT,
103 _NET_WM_STATE_ABOVE,
104 _NET_WM_STATE_BELOW,
105 _NET_WM_STATE_MODAL,
106 _NET_WM_STATE_HIDDEN,
107 _NET_WM_STATE_DEMANDS_ATTENTION
109 int i;
111 xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
112 xscreen->root, _NET_SUPPORTED, ATOM, 32,
113 countof(atom), atom);
115 /* create our own window */
116 father = xcb_generate_id(globalconf.connection);
117 xcb_create_window(globalconf.connection, xscreen->root_depth,
118 father, xscreen->root, -1, -1, 1, 1, 0,
119 XCB_COPY_FROM_PARENT, xscreen->root_visual, 0, NULL);
121 xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
122 xscreen->root, _NET_SUPPORTING_WM_CHECK, WINDOW, 32,
123 1, &father);
125 xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
126 father, _NET_SUPPORTING_WM_CHECK, WINDOW, 32,
127 1, &father);
129 /* set the window manager name */
130 xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
131 father, _NET_WM_NAME, UTF8_STRING, 8, 7, "awesome");
133 /* set the window manager PID */
134 i = getpid();
135 xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
136 father, _NET_WM_PID, CARDINAL, 32, 1, &i);
138 ewmh_update_desktop_geometry(phys_screen);
141 void
142 ewmh_update_net_client_list(int phys_screen)
144 xcb_window_t *wins = p_alloca(xcb_window_t, globalconf.clients.len);
146 int n = 0;
147 foreach(_c, globalconf.clients)
149 client_t *c = *_c;
150 if(c->phys_screen == phys_screen)
151 wins[n++] = c->window;
154 xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
155 xutil_screen_get(globalconf.connection, phys_screen)->root,
156 _NET_CLIENT_LIST, WINDOW, 32, n, wins);
159 /** Set the client list in stacking order, bottom to top.
160 * \param phys_screen The physical screen id.
162 void
163 ewmh_update_net_client_list_stacking(int phys_screen)
165 int n = 0;
166 xcb_window_t *wins = p_alloca(xcb_window_t, globalconf.stack.len);
168 foreach(client, globalconf.stack)
169 if((*client)->phys_screen == phys_screen)
170 wins[n++] = (*client)->window;
172 xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
173 xutil_screen_get(globalconf.connection, phys_screen)->root,
174 _NET_CLIENT_LIST_STACKING, WINDOW, 32, n, wins);
177 void
178 ewmh_update_net_numbers_of_desktop(int phys_screen)
180 uint32_t count = globalconf.screens.tab[phys_screen].tags.len;
182 xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
183 xutil_screen_get(globalconf.connection, phys_screen)->root,
184 _NET_NUMBER_OF_DESKTOPS, CARDINAL, 32, 1, &count);
187 void
188 ewmh_update_net_current_desktop(int phys_screen)
190 uint32_t idx = tags_get_first_selected_index(&globalconf.screens.tab[phys_screen]);
192 xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
193 xutil_screen_get(globalconf.connection, phys_screen)->root,
194 _NET_CURRENT_DESKTOP, CARDINAL, 32, 1, &idx);
197 void
198 ewmh_update_net_desktop_names(int phys_screen)
200 buffer_t buf;
202 buffer_inita(&buf, BUFSIZ);
204 foreach(tag, globalconf.screens.tab[phys_screen].tags)
206 buffer_adds(&buf, tag_get_name(*tag));
207 buffer_addc(&buf, '\0');
210 xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
211 xutil_screen_get(globalconf.connection, phys_screen)->root,
212 _NET_DESKTOP_NAMES, UTF8_STRING, 8, buf.len, buf.s);
213 buffer_wipe(&buf);
216 void
217 ewmh_update_net_active_window(int phys_screen)
219 xcb_window_t win;
221 if(globalconf.screen_focus->client_focus
222 && globalconf.screen_focus->client_focus->phys_screen == phys_screen)
223 win = globalconf.screen_focus->client_focus->window;
224 else
225 win = XCB_NONE;
227 xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
228 xutil_screen_get(globalconf.connection, phys_screen)->root,
229 _NET_ACTIVE_WINDOW, WINDOW, 32, 1, &win);
232 static void
233 ewmh_process_state_atom(client_t *c, xcb_atom_t state, int set)
235 luaA_object_push(globalconf.L, c);
237 if(state == _NET_WM_STATE_STICKY)
239 if(set == _NET_WM_STATE_REMOVE)
240 client_set_sticky(globalconf.L, -1, false);
241 else if(set == _NET_WM_STATE_ADD)
242 client_set_sticky(globalconf.L, -1, true);
243 else if(set == _NET_WM_STATE_TOGGLE)
244 client_set_sticky(globalconf.L, -1, !c->sticky);
246 else if(state == _NET_WM_STATE_SKIP_TASKBAR)
248 if(set == _NET_WM_STATE_REMOVE)
250 client_set_skip_taskbar(globalconf.L, -1, false);
251 ewmh_client_update_hints(c);
253 else if(set == _NET_WM_STATE_ADD)
255 client_set_skip_taskbar(globalconf.L, -1, true);
256 ewmh_client_update_hints(c);
258 else if(set == _NET_WM_STATE_TOGGLE)
260 client_set_skip_taskbar(globalconf.L, -1, !c->skip_taskbar);
261 ewmh_client_update_hints(c);
264 else if(state == _NET_WM_STATE_FULLSCREEN)
266 if(set == _NET_WM_STATE_REMOVE)
267 client_set_fullscreen(globalconf.L, -1, false);
268 else if(set == _NET_WM_STATE_ADD)
269 client_set_fullscreen(globalconf.L, -1, true);
270 else if(set == _NET_WM_STATE_TOGGLE)
271 client_set_fullscreen(globalconf.L, -1, !c->fullscreen);
273 else if(state == _NET_WM_STATE_MAXIMIZED_HORZ)
275 if(set == _NET_WM_STATE_REMOVE)
276 client_set_maximized_horizontal(globalconf.L, -1, false);
277 else if(set == _NET_WM_STATE_ADD)
278 client_set_maximized_horizontal(globalconf.L, -1, true);
279 else if(set == _NET_WM_STATE_TOGGLE)
280 client_set_maximized_horizontal(globalconf.L, -1, !c->maximized_horizontal);
282 else if(state == _NET_WM_STATE_MAXIMIZED_VERT)
284 if(set == _NET_WM_STATE_REMOVE)
285 client_set_maximized_vertical(globalconf.L, -1, false);
286 else if(set == _NET_WM_STATE_ADD)
287 client_set_maximized_vertical(globalconf.L, -1, true);
288 else if(set == _NET_WM_STATE_TOGGLE)
289 client_set_maximized_vertical(globalconf.L, -1, !c->maximized_vertical);
291 else if(state == _NET_WM_STATE_ABOVE)
293 if(set == _NET_WM_STATE_REMOVE)
294 client_set_above(globalconf.L, -1, false);
295 else if(set == _NET_WM_STATE_ADD)
296 client_set_above(globalconf.L, -1, true);
297 else if(set == _NET_WM_STATE_TOGGLE)
298 client_set_above(globalconf.L, -1, !c->above);
300 else if(state == _NET_WM_STATE_BELOW)
302 if(set == _NET_WM_STATE_REMOVE)
303 client_set_below(globalconf.L, -1, false);
304 else if(set == _NET_WM_STATE_ADD)
305 client_set_below(globalconf.L, -1, true);
306 else if(set == _NET_WM_STATE_TOGGLE)
307 client_set_below(globalconf.L, -1, !c->below);
309 else if(state == _NET_WM_STATE_MODAL)
311 if(set == _NET_WM_STATE_REMOVE)
312 client_set_modal(globalconf.L, -1, false);
313 else if(set == _NET_WM_STATE_ADD)
314 client_set_modal(globalconf.L, -1, true);
315 else if(set == _NET_WM_STATE_TOGGLE)
316 client_set_modal(globalconf.L, -1, !c->modal);
318 else if(state == _NET_WM_STATE_HIDDEN)
320 if(set == _NET_WM_STATE_REMOVE)
321 client_set_minimized(globalconf.L, -1, false);
322 else if(set == _NET_WM_STATE_ADD)
323 client_set_minimized(globalconf.L, -1, true);
324 else if(set == _NET_WM_STATE_TOGGLE)
325 client_set_minimized(globalconf.L, -1, !c->minimized);
327 else if(state == _NET_WM_STATE_DEMANDS_ATTENTION)
329 if(set == _NET_WM_STATE_REMOVE)
330 client_set_urgent(globalconf.L, -1, false);
331 else if(set == _NET_WM_STATE_ADD)
332 client_set_urgent(globalconf.L, -1, true);
333 else if(set == _NET_WM_STATE_TOGGLE)
334 client_set_urgent(globalconf.L, -1, !c->urgent);
339 ewmh_process_client_message(xcb_client_message_event_t *ev)
341 client_t *c;
342 int screen;
344 if(ev->type == _NET_CURRENT_DESKTOP)
345 for(screen = 0;
346 screen < xcb_setup_roots_length(xcb_get_setup(globalconf.connection));
347 screen++)
349 if(ev->window == xutil_screen_get(globalconf.connection, screen)->root)
350 tag_view_only_byindex(&globalconf.screens.tab[screen], ev->data.data32[0]);
352 else if(ev->type == _NET_CLOSE_WINDOW)
354 if((c = client_getbywin(ev->window)))
355 client_kill(c);
357 else if(ev->type == _NET_WM_DESKTOP)
359 if((c = client_getbywin(ev->window)))
361 tag_array_t *tags = &c->screen->tags;
363 if(ev->data.data32[0] == 0xffffffff)
364 c->sticky = true;
365 else
366 for(int i = 0; i < tags->len; i++)
367 if((int)ev->data.data32[0] == i)
369 luaA_object_push(globalconf.L, tags->tab[i]);
370 tag_client(c);
372 else
373 untag_client(c, tags->tab[i]);
376 else if(ev->type == _NET_WM_STATE)
378 if((c = client_getbywin(ev->window)))
380 ewmh_process_state_atom(c, (xcb_atom_t) ev->data.data32[1], ev->data.data32[0]);
381 if(ev->data.data32[2])
382 ewmh_process_state_atom(c, (xcb_atom_t) ev->data.data32[2],
383 ev->data.data32[0]);
386 else if(ev->type == _NET_ACTIVE_WINDOW)
388 if((c = client_getbywin(ev->window)))
389 client_focus(c);
392 return 0;
395 /** Update client EWMH hints.
396 * \param c The client.
398 void
399 ewmh_client_update_hints(client_t *c)
401 xcb_atom_t state[10]; /* number of defined state atoms */
402 int i = 0;
404 if(c->modal)
405 state[i++] = _NET_WM_STATE_MODAL;
406 if(c->fullscreen)
407 state[i++] = _NET_WM_STATE_FULLSCREEN;
408 if(c->maximized_vertical)
409 state[i++] = _NET_WM_STATE_MAXIMIZED_VERT;
410 if(c->maximized_horizontal)
411 state[i++] = _NET_WM_STATE_MAXIMIZED_HORZ;
412 if(c->sticky)
413 state[i++] = _NET_WM_STATE_STICKY;
414 if(c->skip_taskbar)
415 state[i++] = _NET_WM_STATE_SKIP_TASKBAR;
416 if(c->above)
417 state[i++] = _NET_WM_STATE_ABOVE;
418 if(c->below)
419 state[i++] = _NET_WM_STATE_BELOW;
420 if(c->minimized)
421 state[i++] = _NET_WM_STATE_HIDDEN;
422 if(c->urgent)
423 state[i++] = _NET_WM_STATE_DEMANDS_ATTENTION;
425 xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
426 c->window, _NET_WM_STATE, ATOM, 32, i, state);
429 /** Update the client active desktop.
430 * This is "wrong" since it can be on several tags, but EWMH has a strict view
431 * of desktop system so just take the first tag.
432 * \param c The client.
434 void
435 ewmh_client_update_desktop(client_t *c)
437 int i;
438 tag_array_t *tags = &c->screen->tags;
440 for(i = 0; i < tags->len; i++)
441 if(is_client_tagged(c, tags->tab[i]))
443 xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
444 c->window, _NET_WM_DESKTOP, CARDINAL, 32, 1, &i);
445 return;
449 /** Update the client struts.
450 * \param window The window to update the struts for.
451 * \param strut The strut type to update the window with.
453 void
454 ewmh_update_strut(xcb_window_t window, strut_t *strut)
456 const uint32_t state[] =
458 strut->left,
459 strut->right,
460 strut->top,
461 strut->bottom,
462 strut->left_start_y,
463 strut->left_end_y,
464 strut->right_start_y,
465 strut->right_end_y,
466 strut->top_start_x,
467 strut->top_end_x,
468 strut->bottom_start_x,
469 strut->bottom_end_x
472 xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
473 window, _NET_WM_STRUT_PARTIAL, CARDINAL, 32, countof(state), state);
476 void
477 ewmh_client_check_hints(client_t *c)
479 xcb_atom_t *state;
480 void *data = NULL;
481 int desktop;
482 xcb_get_property_cookie_t c0, c1, c2;
483 xcb_get_property_reply_t *reply;
485 /* Send the GetProperty requests which will be processed later */
486 c0 = xcb_get_property_unchecked(globalconf.connection, false, c->window,
487 _NET_WM_DESKTOP, XCB_GET_PROPERTY_TYPE_ANY, 0, 1);
489 c1 = xcb_get_property_unchecked(globalconf.connection, false, c->window,
490 _NET_WM_STATE, ATOM, 0, UINT32_MAX);
492 c2 = xcb_get_property_unchecked(globalconf.connection, false, c->window,
493 _NET_WM_WINDOW_TYPE, ATOM, 0, UINT32_MAX);
495 reply = xcb_get_property_reply(globalconf.connection, c0, NULL);
496 if(reply && reply->value_len && (data = xcb_get_property_value(reply)))
498 tag_array_t *tags = &c->screen->tags;
500 desktop = *(uint32_t *) data;
501 if(desktop == -1)
502 c->sticky = true;
503 else
504 for(int i = 0; i < tags->len; i++)
505 if(desktop == i)
507 luaA_object_push(globalconf.L, tags->tab[i]);
508 tag_client(c);
510 else
511 untag_client(c, tags->tab[i]);
514 p_delete(&reply);
516 reply = xcb_get_property_reply(globalconf.connection, c1, NULL);
517 if(reply && (data = xcb_get_property_value(reply)))
519 state = (xcb_atom_t *) data;
520 for(int i = 0; i < xcb_get_property_value_length(reply) / ssizeof(xcb_atom_t); i++)
521 ewmh_process_state_atom(c, state[i], _NET_WM_STATE_ADD);
524 p_delete(&reply);
526 reply = xcb_get_property_reply(globalconf.connection, c2, NULL);
527 if(reply && (data = xcb_get_property_value(reply)))
529 state = (xcb_atom_t *) data;
530 for(int i = 0; i < xcb_get_property_value_length(reply) / ssizeof(xcb_atom_t); i++)
531 if(state[i] == _NET_WM_WINDOW_TYPE_DESKTOP)
532 c->type = MAX(c->type, WINDOW_TYPE_DESKTOP);
533 else if(state[i] == _NET_WM_WINDOW_TYPE_DIALOG)
534 c->type = MAX(c->type, WINDOW_TYPE_DIALOG);
535 else if(state[i] == _NET_WM_WINDOW_TYPE_SPLASH)
536 c->type = MAX(c->type, WINDOW_TYPE_SPLASH);
537 else if(state[i] == _NET_WM_WINDOW_TYPE_DOCK)
538 c->type = MAX(c->type, WINDOW_TYPE_DOCK);
539 else if(state[i] == _NET_WM_WINDOW_TYPE_MENU)
540 c->type = MAX(c->type, WINDOW_TYPE_MENU);
541 else if(state[i] == _NET_WM_WINDOW_TYPE_TOOLBAR)
542 c->type = MAX(c->type, WINDOW_TYPE_TOOLBAR);
543 else if(state[i] == _NET_WM_WINDOW_TYPE_UTILITY)
544 c->type = MAX(c->type, WINDOW_TYPE_UTILITY);
547 p_delete(&reply);
550 /** Process the WM strut of a client.
551 * \param c The client.
552 * \param strut_r (Optional) An existing reply.
554 void
555 ewmh_process_client_strut(client_t *c, xcb_get_property_reply_t *strut_r)
557 void *data;
558 xcb_get_property_reply_t *mstrut_r = NULL;
560 if(!strut_r)
562 xcb_get_property_cookie_t strut_q = xcb_get_property_unchecked(globalconf.connection, false, c->window,
563 _NET_WM_STRUT_PARTIAL, CARDINAL, 0, 12);
564 strut_r = mstrut_r = xcb_get_property_reply(globalconf.connection, strut_q, NULL);
567 if(strut_r
568 && strut_r->value_len
569 && (data = xcb_get_property_value(strut_r)))
571 uint32_t *strut = data;
573 if(c->strut.left != strut[0]
574 || c->strut.right != strut[1]
575 || c->strut.top != strut[2]
576 || c->strut.bottom != strut[3]
577 || c->strut.left_start_y != strut[4]
578 || c->strut.left_end_y != strut[5]
579 || c->strut.right_start_y != strut[6]
580 || c->strut.right_end_y != strut[7]
581 || c->strut.top_start_x != strut[8]
582 || c->strut.top_end_x != strut[9]
583 || c->strut.bottom_start_x != strut[10]
584 || c->strut.bottom_end_x != strut[11])
586 c->strut.left = strut[0];
587 c->strut.right = strut[1];
588 c->strut.top = strut[2];
589 c->strut.bottom = strut[3];
590 c->strut.left_start_y = strut[4];
591 c->strut.left_end_y = strut[5];
592 c->strut.right_start_y = strut[6];
593 c->strut.right_end_y = strut[7];
594 c->strut.top_start_x = strut[8];
595 c->strut.top_end_x = strut[9];
596 c->strut.bottom_start_x = strut[10];
597 c->strut.bottom_end_x = strut[11];
599 hook_property(c, "struts");
600 luaA_object_push(globalconf.L, c);
601 luaA_object_emit_signal(globalconf.L, -1, "property::struts", 0);
602 lua_pop(globalconf.L, 1);
606 p_delete(&mstrut_r);
609 /** Send request to get NET_WM_ICON (EWMH)
610 * \param w The window.
611 * \return The cookie associated with the request.
613 xcb_get_property_cookie_t
614 ewmh_window_icon_get_unchecked(xcb_window_t w)
616 return xcb_get_property_unchecked(globalconf.connection, false, w,
617 _NET_WM_ICON, CARDINAL, 0, UINT32_MAX);
621 ewmh_window_icon_from_reply(xcb_get_property_reply_t *r)
623 uint32_t *data;
624 uint64_t len;
626 if(!r || r->type != CARDINAL || r->format != 32 || r->length < 2)
627 return 0;
629 data = (uint32_t *) xcb_get_property_value(r);
630 if (!data)
631 return 0;
633 /* Check that the property is as long as it should be, handling integer
634 * overflow. <uint32_t> times <another uint32_t casted to uint64_t> always
635 * fits into an uint64_t and thus this multiplication cannot overflow.
637 len = data[0] * (uint64_t) data[1];
638 if (!data[0] || !data[1] || len > r->length - 2)
639 return 0;
641 return image_new_from_argb32(data[0], data[1], data + 2);
644 /** Get NET_WM_ICON.
645 * \param cookie The cookie.
646 * \return The number of elements on stack.
649 ewmh_window_icon_get_reply(xcb_get_property_cookie_t cookie)
651 xcb_get_property_reply_t *r = xcb_get_property_reply(globalconf.connection, cookie, NULL);
652 int ret = ewmh_window_icon_from_reply(r);
653 p_delete(&r);
654 return ret;
657 // vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80