2 * _NET_WM... aka Extended Window Manager Hint (EWMH) functions.
8 #include "ecore_xcb_private.h"
9 #include "Ecore_X_Atoms.h"
12 * @defgroup Ecore_X_NetWM_Group Extended Window Manager Hint (EWMH) functions
14 * Functions related to the Extended Window Manager Hint (EWMH).
17 typedef struct _Ecore_X_Startup_Info Ecore_X_Startup_Info;
19 struct _Ecore_X_Startup_Info
30 /* These are the sequence info fields */
44 static void _ecore_x_window_prop_string_utf8_get_prefetch(Ecore_X_Window window, Ecore_X_Atom atom);
45 static void _ecore_x_window_prop_string_utf8_get_fetch(void);
47 static void _ecore_x_window_prop_string_utf8_set(Ecore_X_Window window, Ecore_X_Atom atom, const char *str);
48 static char * _ecore_x_window_prop_string_utf8_get(Ecore_X_Window window, Ecore_X_Atom atom);
50 static int _ecore_x_netwm_startup_info_process(Ecore_X_Startup_Info *info);
51 static int _ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info, char *data);
53 static void _ecore_x_netwm_startup_info_free(void *data);
59 static Eina_Hash *startup_info = NULL;
62 * Initialize the NetWM module
65 ecore_x_netwm_init(void)
67 startup_info = eina_hash_string_superfast_new(_ecore_x_netwm_startup_info_free);
68 } /* ecore_x_netwm_init */
71 * Shutdown the NetWM module
74 ecore_x_netwm_shutdown(void)
77 eina_hash_free(startup_info);
80 } /* ecore_x_netwm_shutdown */
83 * Set the _NET_SUPPORTING_WM_CHECK property.
84 * @param root The root window.
85 * @param check The child window.
86 * @param wm_name The name of the Window Manager.
88 * Set the _NET_SUPPORTING_WM_CHECK property on the @p root window to be
89 * the ID of the child window @p check created by the Window Manager.
90 * @p check also have the _NET_WM_NAME property set to the name
91 * @p wm_name of the Window Manager.
93 * The Window MUST call that function to indicate that a compliant
94 * window manager is active.
95 * @ingroup Ecore_X_NetWM_Group
98 ecore_x_netwm_wm_identify(Ecore_X_Window root,
102 ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, &check, 1);
103 ecore_x_window_prop_window_set(check, ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, &check, 1);
104 _ecore_x_window_prop_string_utf8_set(check, ECORE_X_ATOM_NET_WM_NAME, wm_name);
105 /* This one isn't mandatory */
106 _ecore_x_window_prop_string_utf8_set(root, ECORE_X_ATOM_NET_WM_NAME, wm_name);
107 } /* ecore_x_netwm_wm_identify */
110 * Set the _NET_SUPPORTED property.
111 * @param root The root window.
112 * @param supported The supported hints.
113 * @param num The number of hints.
115 * Set the _NET_SUPPORTED property on the @p root window. The hints
116 * that the Window Manager supports are stored in @p supported.
118 * The Window Manager MUST set this property to indicate which hints
120 * @ingroup Ecore_X_NetWM_Group
123 ecore_x_netwm_supported_set(Ecore_X_Window root,
124 Ecore_X_Atom *supported,
127 ecore_x_window_prop_atom_set(root, ECORE_X_ATOM_NET_SUPPORTED, supported, num);
128 } /* ecore_x_netwm_supported_set */
131 * Sends the GetProperty request.
132 * @param root The root window
133 * @ingroup Ecore_X_NetWM_Group
136 ecore_x_netwm_supported_get_prefetch(Ecore_X_Window root)
138 xcb_get_property_cookie_t cookie;
140 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, root,
141 ECORE_X_ATOM_NET_SUPPORTED, ECORE_X_ATOM_ATOM,
143 _ecore_xcb_cookie_cache(cookie.sequence);
144 } /* ecore_x_netwm_supported_get_prefetch */
147 * Gets the reply of the GetProperty request sent by ecore_x_netwm_supported_get_prefetch().
148 * @ingroup Ecore_X_NetWM_Group
151 ecore_x_netwm_supported_get_fetch(void)
153 xcb_get_property_cookie_t cookie;
154 xcb_get_property_reply_t *reply;
156 cookie.sequence = _ecore_xcb_cookie_get();
157 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
158 _ecore_xcb_reply_cache(reply);
159 } /* ecore_x_netwm_supported_get_fetch */
162 * Get the hints supported by the Window Manager.
163 * @param root The root window.
164 * @param supported The supported hints.
165 * @param num The number of atoms.
166 * @return 1 on success, 0 otherwise.
168 * Get the hints supported by the Window Manager. @p root is the root
169 * window. The hints are stored in @p supported. The number of hints
170 * is stored in @p num.
172 * To use this function, you must call before, and in order,
173 * ecore_x_netwm_supported_get_prefetch(), which sends the GetProperty request,
174 * then ecore_x_netwm_supported_get_fetch(), which gets the reply.
175 * @ingroup Ecore_X_NetWM_Group
178 ecore_x_netwm_supported_get(Ecore_X_Window root,
179 Ecore_X_Atom **supported,
190 num_ret = ecore_x_window_prop_xid_list_get(root,
191 ECORE_X_ATOM_NET_SUPPORTED,
198 *num = (uint32_t)num_ret;
201 } /* ecore_x_netwm_supported_get */
204 * Set the _NET_NUMBER_OF_DESKTOPS property.
205 * @param root The root window.
206 * @param n_desks The number of desktops.
208 * Set the number of desktops @p n_desks of the Window Manager by
209 * sending the _NET_NUMBER_OF_DESKTOPS to the @p root window.
211 * The Window Manager SHOULD set and update this property to indicate
212 * the number of virtual desktops. A Pager can request a change in the
213 * number of desktops by using that function.
214 * @ingroup Ecore_X_NetWM_Group
217 ecore_x_netwm_desk_count_set(Ecore_X_Window root,
218 unsigned int n_desks)
220 ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS,
222 } /* ecore_x_netwm_desk_count_set */
225 * Set the _NET_VIRTUAL_ROOTS property.
226 * @param root The root window.
227 * @param vroots The virtual root windows.
228 * @param n_desks The number of desks.
230 * Set the number of virtual desktops by sending the
231 * _NET_VIRTUAL_ROOTS property to the @p root window. @p vroots is an
232 * array of window and @p n_desks is the number of windows.
234 * A Window Manager that implements virtual desktops by reparent
235 * client windows to a child of the root window MUST use that
237 * @ingroup Ecore_X_NetWM_Group
240 ecore_x_netwm_desk_roots_set(Ecore_X_Window root,
241 Ecore_X_Window *vroots,
242 unsigned int n_desks)
244 ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_VIRTUAL_ROOTS, vroots, n_desks);
245 } /* ecore_x_netwm_desk_roots_set */
248 * Set the _NET_DESKTOP_NAMES property.
249 * @param root The root window.
250 * @param names The names of the virtual desktops.
251 * @param n_desks The number of virtual desktops.
253 * Set the name of each virtual desktop by sending the
254 * _NET_DESKTOP_NAMES to the @p root window. @p names are the names of
255 * the virtual desktops and @p n_desks is the number of virtual
258 * A Pager MAY use that function. @p n_desks may be different from the
259 * one passed to ecore_x_netwm_desk_count_set(). If it less or equal,
260 * then the desktops with high numbers are unnamed. If it is larger,
261 * then the excess names are considered to be reserved in case the
262 * number of desktops is increased.
263 * @ingroup Ecore_X_NetWM_Group
266 ecore_x_netwm_desk_names_set(Ecore_X_Window root,
268 unsigned int n_desks)
280 for (i = 0; i < n_desks; i++)
282 s = (names) ? names[i] : NULL;
285 /* Default to "Desk-<number>" */
286 sprintf(ss, "Desk-%d", i);
291 buf = realloc(buf, len + l);
292 memcpy(buf + len, s, l);
296 xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, root,
297 ECORE_X_ATOM_NET_DESKTOP_NAMES,
298 ECORE_X_ATOM_UTF8_STRING,
299 8, len, (const void *)buf);
301 } /* ecore_x_netwm_desk_names_set */
304 * Set the _NET_DESKTOP_GEOMETRY property.
305 * @param root The root window.
306 * @param width The width of the desktop.
307 * @param height The height of the desktop.
309 * Set the common @p width and @p height of all desktops by sending
310 * the _NET_DESKTOP_GEOMETRY to the @p root window.
312 * This size is equal to the screen size if the Window Manager doesn't
313 * support large desktops, otherwise it's equal to the virtual size of
314 * the desktop. The Window Manager SHOULD set this property. A Pager
315 * can request a change in the desktop geometry by using this
317 * @ingroup Ecore_X_NetWM_Group
320 ecore_x_netwm_desk_size_set(Ecore_X_Window root,
328 ecore_x_window_prop_card32_set(root,
329 ECORE_X_ATOM_NET_DESKTOP_GEOMETRY,
331 } /* ecore_x_netwm_desk_size_set */
334 * Set the _NET_DESKTOP_VIEWPORT property.
335 * @param root The root window.
336 * @param origins An array of paris of coordiantes.
337 * @param n_desks The number of virtual desktops.
339 * Set the top left corner of each desktop's viewport by sending the
340 * _NET_DESKTOP_VIEWPORT property to the @p root window. @p origins
341 * contains each pair of X coordinate and Y coordinate of the top left
342 * corner of each desktop's viewport.
344 * If the Window Manager does not support large desktops, the
345 * coordinates MUST be (0,0). A Pager can request to change the
346 * viewport for the current desktop by using this function.
347 * @ingroup Ecore_X_NetWM_Group
350 ecore_x_netwm_desk_viewports_set(Ecore_X_Window root,
351 unsigned int *origins,
352 unsigned int n_desks)
354 ecore_x_window_prop_card32_set(root,
355 ECORE_X_ATOM_NET_DESKTOP_VIEWPORT,
356 origins, 2 * n_desks);
357 } /* ecore_x_netwm_desk_viewports_set */
360 * Set the _NET_DESKTOP_LAYOUT property.
361 * @param root The root window.
365 * @param starting_corner
367 * Set the layout of virtual desktops relative to each other by
368 * sending the _NET_DESKTOP_LAYOUT to the @p root window.
369 * @p orientation defines the orientation of the virtual desktop. 0
370 * means horizontal layout, 1 means vertical layout. @p columns is
371 * the number of desktops in the X direction and @p rows is the number
372 * in the Y direction. @p starting_corner is the corner containing the
373 * first desktop. The values for @p starting_corner are 0 (top-left),
374 * 1 (top-right), 2 (bottom-right) and 3 (bottom-left).
376 * When the orientation is horizontal the desktops are laid out in
377 * rows, with the first desktop in the specified starting corner. So a
378 * layout with four columns and three rows starting in
379 * the top-left corner looks like this:
389 * With @p starting_corner being bottom-right, it looks like this:
399 * When the orientation is vertical the layout with four columns and
400 * three rows starting in the top-left corner looks like:
410 * With @p starting_corner being top-right, it looks like:
420 * This function MUST be used by a Pager and NOT by the Window
421 * Manager. When using this function, the Pager must own a manager
423 * @ingroup Ecore_X_NetWM_Group
426 ecore_x_netwm_desk_layout_set(Ecore_X_Window root,
434 layout[0] = orientation;
437 layout[3] = starting_corner;
438 ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_LAYOUT, layout, 4);
439 } /* ecore_x_netwm_desk_layout_set */
442 * Set the _NET_WORKAREA property.
443 * @param root The root window.
444 * @param areas An array of areas.
445 * @param n_desks The number of desks.
447 * Set the work area for each desktop by sending the _NET_WORKAREA
448 * property to the @p root window. An area contains the geometry (X
449 * and Y coordinates, width and height). These geometries are
450 * specified relative to the viewport on each desktop and specify an
451 * area that is completely contained within the viewport. @p areas
452 * stores these geometries. @p n_desks is the number of geometry to
455 * This function MUST be set by the Window Manager. It is used by
456 * desktop applications to place desktop icons appropriately.
457 * @ingroup Ecore_X_NetWM_Group
460 ecore_x_netwm_desk_workareas_set(Ecore_X_Window root,
462 unsigned int n_desks)
464 ecore_x_window_prop_card32_set(root,
465 ECORE_X_ATOM_NET_WORKAREA,
467 } /* ecore_x_netwm_desk_workareas_set */
470 * Set the _NET_CURRENT_DESKTOP property.
471 * @param root The root window.
472 * @param desk The index of the current desktop.
474 * Set the current desktop by sending the _NET_CURRENT_DESKTOP to the
475 * @p root window. @p deskmust be an integer number between 0 and the
476 * number of desks (set by ecore_x_netwm_desk_count_set()) -1.
478 * This function MUST be called by the Window Manager. If a Pagerwants
479 * to switch to naother desktop, it MUST call that function.
480 * @ingroup Ecore_X_NetWM_Group
483 ecore_x_netwm_desk_current_set(Ecore_X_Window root,
486 ecore_x_window_prop_card32_set(root,
487 ECORE_X_ATOM_NET_CURRENT_DESKTOP,
489 } /* ecore_x_netwm_desk_current_set */
492 * Set the _NET_SHOWING_DESKTOP property.
493 * @param root The root window
494 * @param on 0 to hide the desktop, non 0 to show it.
496 * Set or unset the desktop in a "showing mode" by sending the
497 * _NET_SHOWING_DESKTOP property to the @p root window. If @p on is 0,
498 * the windows are hidden and the desktop background is displayed and
501 * If a Pager wants to enter or leave the mode, it MUST use this
503 * @ingroup Ecore_X_NetWM_Group
506 ecore_x_netwm_showing_desktop_set(Ecore_X_Window root,
512 ecore_x_window_prop_card32_set(root,
513 ECORE_X_ATOM_NET_SHOWING_DESKTOP,
515 } /* ecore_x_netwm_showing_desktop_set */
522 * Set the _NET_CLIENT_LIST property.
523 * @param root The root window.
524 * @param p_clients An array of windows.
525 * @param n_clients The number of windows.
527 * Map all the X windows managed by the window manager from the oldest
528 * to the newest by sending the _NET_CLIENT_LIST property to the
529 * @p root window. The X windows are stored in @p p_clients and their
530 * number in @p n_clients.
532 * This function SHOULD be called by the Window Manager.
533 * @ingroup Ecore_X_NetWM_Group
536 ecore_x_netwm_client_list_set(Ecore_X_Window root,
537 Ecore_X_Window *p_clients,
538 unsigned int n_clients)
540 ecore_x_window_prop_window_set(root,
541 ECORE_X_ATOM_NET_CLIENT_LIST,
542 p_clients, n_clients);
543 } /* ecore_x_netwm_client_list_set */
546 * Set the _NET_CLIENT_LIST_STACKING property.
547 * @param root The root window.
548 * @param p_clients An array of windows.
549 * @param n_clients The number of windows.
551 * Stack all the X windows managed by the window manager from bottom
552 * to top order by sending the _NET_CLIENT_LIST_STACKING property to the
553 * @p root window. The X windows are stored in @p p_clients and their
554 * number in @p n_clients.
556 * This function SHOULD be called by the Window Manager.
557 * @ingroup Ecore_X_NetWM_Group
560 ecore_x_netwm_client_list_stacking_set(Ecore_X_Window root,
561 Ecore_X_Window *p_clients,
562 unsigned int n_clients)
564 ecore_x_window_prop_window_set(root,
565 ECORE_X_ATOM_NET_CLIENT_LIST_STACKING,
566 p_clients, n_clients);
567 } /* ecore_x_netwm_client_list_stacking_set */
570 * Set the _NET_ACTIVE_WINDOW property.
571 * @param root The root window.
572 * @param window The widow to activate.
574 * Activate @p window by sending the _NET_ACTIVE_WINDOW property to
575 * the @p root window.
577 * If a Client wants to activate another window, it MUST call this
579 * @ingroup Ecore_X_NetWM_Group
582 ecore_x_netwm_client_active_set(Ecore_X_Window root,
583 Ecore_X_Window window)
585 ecore_x_window_prop_window_set(root,
586 ECORE_X_ATOM_NET_ACTIVE_WINDOW,
588 } /* ecore_x_netwm_client_active_set */
591 * Set the _NET_WM_NAME property.
592 * @param window The widow to activate.
593 * @param name The title name of the window.
595 * Set the title name of @p window to @p name by sending the
596 * _NET_WM_NAME property to @p window.
598 * The Client SHOULD set the title of @p window in UTF-8 encoding. If
599 * set, the Window Manager should use this in preference to WM_NAME.
600 * @ingroup Ecore_X_NetWM_Group
603 ecore_x_netwm_name_set(Ecore_X_Window window,
606 _ecore_x_window_prop_string_utf8_set(window, ECORE_X_ATOM_NET_WM_NAME, name);
607 } /* ecore_x_netwm_name_set */
610 * Sends the GetProperty request.
611 * @param window The window.
612 * @ingroup Ecore_X_NetWM_Group
615 ecore_x_netwm_name_get_prefetch(Ecore_X_Window window)
617 xcb_get_property_cookie_t cookie;
619 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, window,
620 ECORE_X_ATOM_NET_WM_NAME, ECORE_X_ATOM_UTF8_STRING,
622 _ecore_xcb_cookie_cache(cookie.sequence);
623 } /* ecore_x_netwm_name_get_prefetch */
626 * Gets the reply of the GetProperty request sent by ecore_x_netwm_name_get_prefetch().
627 * @ingroup Ecore_X_NetWM_Group
630 ecore_x_netwm_name_get_fetch(void)
632 xcb_get_property_cookie_t cookie;
633 xcb_get_property_reply_t *reply;
635 cookie.sequence = _ecore_xcb_cookie_get();
636 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
637 _ecore_xcb_reply_cache(reply);
638 } /* ecore_x_netwm_name_get_fetch */
641 * Get the title of a window.
642 * @param window The window.
643 * @param name The title name.
644 * @return Returns always 1.
646 * Retrieve the title name of @p window and store it in @p name. The
647 * function returns always 1.
649 * To use this function, you must call before, and in order,
650 * ecore_x_netwm_name_get_prefetch(), which sends the GetProperty request,
651 * then ecore_x_netwm_name_get_fetch(), which gets the reply.
652 * @ingroup Ecore_X_NetWM_Group
655 ecore_x_netwm_name_get(Ecore_X_Window window,
659 *name = _ecore_x_window_prop_string_utf8_get(window, ECORE_X_ATOM_NET_WM_NAME);
662 } /* ecore_x_netwm_name_get */
665 * Set the _NET_STARTUP_ID property.
666 * @param window The window.
667 * @param id The ID name.
669 * Set the ID @p id used for the startup sequence by sending the
670 * property _NET_STARTUP_ID to @p window. The ID name should be
673 * If a new value for the property is set, the Window Manager
674 * should update the window's status accordingly (update its virtual
676 * @ingroup Ecore_X_NetWM_Group
679 ecore_x_netwm_startup_id_set(Ecore_X_Window window,
682 _ecore_x_window_prop_string_utf8_set(window, ECORE_X_ATOM_NET_STARTUP_ID, id);
683 } /* ecore_x_netwm_startup_id_set */
686 * Sends the GetProperty request.
687 * @param window The window.
688 * @ingroup Ecore_X_NetWM_Group
691 ecore_x_netwm_startup_id_get_prefetch(Ecore_X_Window window)
693 xcb_get_property_cookie_t cookie;
695 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, window,
696 ECORE_X_ATOM_NET_STARTUP_ID, ECORE_X_ATOM_UTF8_STRING,
698 _ecore_xcb_cookie_cache(cookie.sequence);
699 } /* ecore_x_netwm_startup_id_get_prefetch */
702 * Gets the reply of the GetProperty request sent by ecore_x_netwm_startup_id_get_prefetch().
703 * @ingroup Ecore_X_NetWM_Group
706 ecore_x_netwm_startup_id_get_fetch(void)
708 xcb_get_property_cookie_t cookie;
709 xcb_get_property_reply_t *reply;
711 cookie.sequence = _ecore_xcb_cookie_get();
712 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
713 _ecore_xcb_reply_cache(reply);
714 } /* ecore_x_netwm_startup_id_get_fetch */
717 * Get the startup ID name of a window.
718 * @param window The window
719 * @param id The ID name
720 * @return Return always 1.
722 * To use this function, you must call before, and in order,
723 * ecore_x_netwm_startup_id_get_prefetch(), which sends the GetProperty request,
724 * then ecore_x_netwm_startup_id_get_fetch(), which gets the reply.
725 * @ingroup Ecore_X_NetWM_Group
728 ecore_x_netwm_startup_id_get(Ecore_X_Window window,
732 *id = _ecore_x_window_prop_string_utf8_get(window, ECORE_X_ATOM_NET_STARTUP_ID);
735 } /* ecore_x_netwm_startup_id_get */
738 * Set the _NET_WM_VISIBLE_NAME property.
739 * @param window The widow to activate.
740 * @param name The title name of the window.
742 * Set the title name of @p window to @p name by sending the
743 * _NET_WM_VISIBLE_NAME property to @p window, when the Window Manager
744 * displays a window name other than by calling
745 * ecore_x_netwm_name_set().
747 * The Client SHOULD set the title of @p window in UTF-8
748 * encoding. This function is used for displaying title windows like
749 * [xterm1], [xterm2], ... thereby allowing Pagers to display the same
750 * title as the Window Manager.
751 * @ingroup Ecore_X_NetWM_Group
754 ecore_x_netwm_visible_name_set(Ecore_X_Window window,
757 _ecore_x_window_prop_string_utf8_set(window, ECORE_X_ATOM_NET_WM_VISIBLE_NAME,
759 } /* ecore_x_netwm_visible_name_set */
762 * Sends the GetProperty request.
763 * @param window The window.
764 * @ingroup Ecore_X_NetWM_Group
767 ecore_x_netwm_visible_name_get_prefetch(Ecore_X_Window window)
769 xcb_get_property_cookie_t cookie;
771 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, window,
772 ECORE_X_ATOM_NET_WM_VISIBLE_NAME, ECORE_X_ATOM_UTF8_STRING,
774 _ecore_xcb_cookie_cache(cookie.sequence);
775 } /* ecore_x_netwm_visible_name_get_prefetch */
778 * Gets the reply of the GetProperty request sent by ecore_x_netwm_visible_name_get_prefetch().
779 * @ingroup Ecore_X_NetWM_Group
782 ecore_x_netwm_visible_name_get_fetch(void)
784 xcb_get_property_cookie_t cookie;
785 xcb_get_property_reply_t *reply;
787 cookie.sequence = _ecore_xcb_cookie_get();
788 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
789 _ecore_xcb_reply_cache(reply);
790 } /* ecore_x_netwm_visible_name_get_fetch */
793 * Get the visible title of a window.
794 * @param window The window.
795 * @param name The title name.
796 * @return Returns always 1.
798 * Retrieve the visible title name of @p window and store it in @p name. The
799 * function returns always 1.
800 * @param window The window
802 * To use this function, you must call before, and in order,
803 * ecore_x_netwm_visible_name_get_prefetch(), which sends the GetProperty request,
804 * then ecore_x_netwm_visible_name_get_fetch(), which gets the reply.
805 * @ingroup Ecore_X_NetWM_Group
808 ecore_x_netwm_visible_name_get(Ecore_X_Window window,
812 *name = _ecore_x_window_prop_string_utf8_get(window,
813 ECORE_X_ATOM_NET_WM_VISIBLE_NAME);
816 } /* ecore_x_netwm_visible_name_get */
819 * Set the _NET_WM_ICON_NAME property.
820 * @param window The widow to activate.
821 * @param name The icon name of the window.
823 * Set the icon name of @p window to @p name by sending the
824 * _NET_WM_ICON_NAME property to @p window.
826 * The Client SHOULD set the title of @p window in UTF-8 encoding. If
827 * set, the Window Manager should use this in preference to WM_ICON_NAME.
828 * @ingroup Ecore_X_NetWM_Group
831 ecore_x_netwm_icon_name_set(Ecore_X_Window window,
834 _ecore_x_window_prop_string_utf8_set(window, ECORE_X_ATOM_NET_WM_ICON_NAME,
836 } /* ecore_x_netwm_icon_name_set */
839 * Sends the GetProperty request.
840 * @param window The window.
841 * @ingroup Ecore_X_NetWM_Group
844 ecore_x_netwm_icon_name_get_prefetch(Ecore_X_Window window)
846 xcb_get_property_cookie_t cookie;
848 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, window,
849 ECORE_X_ATOM_NET_WM_ICON_NAME, ECORE_X_ATOM_UTF8_STRING,
851 _ecore_xcb_cookie_cache(cookie.sequence);
852 } /* ecore_x_netwm_icon_name_get_prefetch */
855 * Gets the reply of the GetProperty request sent by ecore_x_netwm_icon_name_get_prefetch().
856 * @ingroup Ecore_X_NetWM_Group
859 ecore_x_netwm_icon_name_get_fetch(void)
861 xcb_get_property_cookie_t cookie;
862 xcb_get_property_reply_t *reply;
864 cookie.sequence = _ecore_xcb_cookie_get();
865 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
866 _ecore_xcb_reply_cache(reply);
867 } /* ecore_x_netwm_icon_name_get_fetch */
870 * Get the icon name of a window.
871 * @param window The window.
872 * @param name The icon name.
873 * @return Returns always 1.
875 * Retrieve the icon name of @p window and store it in @p name. The
876 * function returns always 1.
878 * To use this function, you must call before, and in order,
879 * ecore_x_netwm_icon_name_get_prefetch(), which sends the GetProperty request,
880 * then ecore_x_netwm_icon_name_get_fetch(), which gets the reply.
881 * @ingroup Ecore_X_NetWM_Group
884 ecore_x_netwm_icon_name_get(Ecore_X_Window window,
888 *name = _ecore_x_window_prop_string_utf8_get(window,
889 ECORE_X_ATOM_NET_WM_ICON_NAME);
892 } /* ecore_x_netwm_icon_name_get */
895 * Set the _NET_WM_VISIBLE_ICON_NAME property.
896 * @param window The widow to activate.
897 * @param name The title name of the window.
899 * Set the icon name of @p window to @p name by sending the
900 * _NET_WM_VISIBLE_ICON_NAME property to @p window, when the Window Manager
901 * displays a icon name other than by calling
902 * ecore_x_netwm_icon_name_set().
904 * The Client SHOULD set the icon name in UTF-8
905 * encoding. The Window Manager MUST use this function is it display
906 * an icon name other than with ecore_x_netwm_icon_name_set().
907 * @ingroup Ecore_X_NetWM_Group
910 ecore_x_netwm_visible_icon_name_set(Ecore_X_Window window,
913 _ecore_x_window_prop_string_utf8_set(window,
914 ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME,
916 } /* ecore_x_netwm_visible_icon_name_set */
919 * Sends the GetProperty request.
920 * @param window The window.
921 * @ingroup Ecore_X_NetWM_Group
924 ecore_x_netwm_visible_icon_name_get_prefetch(Ecore_X_Window window)
926 xcb_get_property_cookie_t cookie;
928 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, window,
929 ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME, ECORE_X_ATOM_UTF8_STRING,
931 _ecore_xcb_cookie_cache(cookie.sequence);
932 } /* ecore_x_netwm_visible_icon_name_get_prefetch */
935 * Gets the reply of the GetProperty request sent by ecore_x_netwm_visible_icon_name_get_prefetch().
936 * @ingroup Ecore_X_NetWM_Group
939 ecore_x_netwm_visible_icon_name_get_fetch(void)
941 xcb_get_property_cookie_t cookie;
942 xcb_get_property_reply_t *reply;
944 cookie.sequence = _ecore_xcb_cookie_get();
945 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
946 _ecore_xcb_reply_cache(reply);
947 } /* ecore_x_netwm_visible_icon_name_get_fetch */
950 * Get the visible icon name of a window.
951 * @param window The window.
952 * @param name The icon name.
953 * @return Returns always 1.
955 * Retrieve the visible icon name of @p window and store it in
956 * @p name. The function returns always 1.
958 * To use this function, you must call before, and in order,
959 * ecore_x_netwm_visible_icon_name_get_prefetch(), which sends the GetProperty request,
960 * then ecore_x_netwm_visible_icon_name_get_fetch(), which gets the reply.
961 * @ingroup Ecore_X_NetWM_Group
964 ecore_x_netwm_visible_icon_name_get(Ecore_X_Window window,
968 *name = _ecore_x_window_prop_string_utf8_get(window,
969 ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME);
972 } /* ecore_x_netwm_visible_icon_name_get */
975 * Set the _NET_WM_DESKTOP property.
976 * @param window The window.
977 * @param desk The desktop index.
979 * Set on which desktop the @p window is in by sending the
980 * _NET_WM_DESKTOP property to @p window. @p desk is the index of
981 * the desktop, starting from 0. To indicate that the window should
982 * appear on all desktops, @p desk must be equal to 0xFFFFFFFF.
984 * A Client MAY choose not to set this property, in which case the
985 * Window Manager SHOULD place it as it wishes.
987 * The Window Manager should honor _NET_WM_DESKTOP whenever a
988 * withdrawn window requests to be mapped.
990 * A Client can request a change of desktop for a non-withdrawn window
991 * by sending a _NET_WM_DESKTOP client message to the root window.
992 * @ingroup Ecore_X_NetWM_Group
995 ecore_x_netwm_desktop_set(Ecore_X_Window window,
998 ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_DESKTOP, &desk, 1);
999 } /* ecore_x_netwm_desktop_set */
1002 * Sends the GetProperty request.
1003 * @param window The window.
1004 * @ingroup Ecore_X_NetWM_Group
1007 ecore_x_netwm_desktop_get_prefetch(Ecore_X_Window window)
1009 xcb_get_property_cookie_t cookie;
1011 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, window,
1012 ECORE_X_ATOM_NET_WM_DESKTOP, ECORE_X_ATOM_CARDINAL,
1014 _ecore_xcb_cookie_cache(cookie.sequence);
1015 } /* ecore_x_netwm_desktop_get_prefetch */
1018 * Gets the reply of the GetProperty request sent by ecore_x_netwm_desktop_get_prefetch().
1019 * @ingroup Ecore_X_NetWM_Group
1022 ecore_x_netwm_desktop_get_fetch(void)
1024 xcb_get_property_cookie_t cookie;
1025 xcb_get_property_reply_t *reply;
1027 cookie.sequence = _ecore_xcb_cookie_get();
1028 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
1029 _ecore_xcb_reply_cache(reply);
1030 } /* ecore_x_netwm_desktop_get_fetch */
1033 * Get the visible icon name of a window.
1034 * @param window The window.
1035 * @param desk The desktop index.
1036 * @return 1 on success, 0 otherwise.
1038 * Retrieve the desktop index in which @p window is displayed and
1039 * store it in @p desk. If @p desk value is 0xFFFFFFFF, the window
1040 * appears on all desktops. The function returns 1 on success, 0
1043 * To use this function, you must call before, and in order,
1044 * ecore_x_netwm_desktop_get_prefetch(), which sends the GetProperty request,
1045 * then ecore_x_netwm_desktop_get_fetch(), which gets the reply.
1046 * @ingroup Ecore_X_NetWM_Group
1049 ecore_x_netwm_desktop_get(Ecore_X_Window window,
1055 ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_DESKTOP,
1061 return (ret == 1) ? 1 : 0;
1062 } /* ecore_x_netwm_desktop_get */
1065 * Set the _NET_WM_STRUT property.
1066 * @param window The window
1067 * @param left The number of pixels at the left of the screen.
1068 * @param right The number of pixels at the right of the screen.
1069 * @param top The number of pixels at the top of the screen.
1070 * @param bottom The number of pixels at the bottom of the screen.
1072 * Set space at the edje of the screen by sending the _NET_WM_STRUT
1073 * property to @p window if @p window is to reserve that space.
1074 * @p left, @p right, @p top and @p bottom are respectively the number
1075 * of pixels at the left, right, top and bottom of the screen.
1077 * This property is deprecated and ecore_x_netwm_strut_partial_set()
1078 * should be used instead. However, Clients MAY set this property in
1079 * addition to _NET_WM_STRUT_PARTIAL to ensure backward compatibility
1080 * with Window Managers supporting older versions of the
1082 * @ingroup Ecore_X_NetWM_Group
1085 ecore_x_netwm_strut_set(Ecore_X_Window window,
1097 ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_STRUT, strut, 4);
1098 } /* ecore_x_netwm_strut_set */
1101 * Sends the GetProperty request.
1102 * @param window The window.
1103 * @ingroup Ecore_X_NetWM_Group
1106 ecore_x_netwm_strut_get_prefetch(Ecore_X_Window window)
1108 xcb_get_property_cookie_t cookie;
1110 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, window,
1111 ECORE_X_ATOM_NET_WM_STRUT, ECORE_X_ATOM_CARDINAL,
1113 _ecore_xcb_cookie_cache(cookie.sequence);
1114 } /* ecore_x_netwm_strut_get_prefetch */
1117 * Gets the reply of the GetProperty request sent by ecore_x_strut_get_prefetch().
1118 * @ingroup Ecore_X_NetWM_Group
1121 ecore_x_netwm_strut_get_fetch(void)
1123 xcb_get_property_cookie_t cookie;
1124 xcb_get_property_reply_t *reply;
1126 cookie.sequence = _ecore_xcb_cookie_get();
1127 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
1128 _ecore_xcb_reply_cache(reply);
1129 } /* ecore_x_netwm_strut_get_fetch */
1132 * _NET_WM_STRUT is deprecated
1136 * Get the space at the edje of the screen.
1137 * @param window The window
1138 * @param left The number of pixels at the left of the screen.
1139 * @param right The number of pixels at the right of the screen.
1140 * @param top The number of pixels at the top of the screen.
1141 * @param bottom The number of pixels at the bottom of the screen.
1142 * @return 1 on success, 0 otherwise.
1144 * Retrieve the space at the edje of the screen if @p window is to
1145 * reserve such space. The number of pixels at the left, right, top
1146 * and bottom of the screen are respectively stored in @p left,
1147 * @p right, @p top and @p bottom. This function returns 1 on success,
1150 * This property is deprecated. See ecore_x_netwm_strut_set() for more
1153 * To use this function, you must call before, and in order,
1154 * ecore_x_netwm_strut_get_prefetch(), which sends the GetProperty request,
1155 * then ecore_x_netwm_strut_get_fetch(), which gets the reply.
1156 * @ingroup Ecore_X_NetWM_Group
1159 ecore_x_netwm_strut_get(Ecore_X_Window window,
1168 ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_STRUT, strut, 4);
1185 } /* ecore_x_netwm_strut_get */
1188 * Set the _NET_WM_STRUT_PARTIAL property.
1189 * @param window The window
1190 * @param left The number of pixels at the left of the screen.
1191 * @param right The number of pixels at the right of the screen.
1192 * @param top The number of pixels at the top of the screen.
1193 * @param bottom The number of pixels at the bottom of the screen.
1194 * @param left_start_y The number of pixels.
1195 * @param left_end_y The number of pixels.
1196 * @param right_start_y The number of pixels.
1197 * @param right_end_y The number of pixels.
1198 * @param top_start_x The number of pixels.
1199 * @param top_end_x The number of pixels.
1200 * @param bottom_start_x The number of pixels.
1201 * @param bottom_end_x The number of pixels.
1203 * Set space at the edje of the screen by sending the
1204 * _NET_WM_STRUT_PARTIAL property to @p window if @p window is to
1205 * reserve that space. @p left, @p right, @p top and @p bottom are
1206 * respectively the number of pixels at the left, right, top and
1207 * bottom of the screen.
1209 * TODO: more description for that function.
1210 * @ingroup Ecore_X_NetWM_Group
1213 ecore_x_netwm_strut_partial_set(Ecore_X_Window window,
1227 unsigned int strut[12];
1233 strut[4] = left_start_y;
1234 strut[5] = left_end_y;
1235 strut[6] = right_start_y;
1236 strut[7] = right_end_y;
1237 strut[8] = top_start_x;
1238 strut[9] = top_end_x;
1239 strut[10] = bottom_start_x;
1240 strut[11] = bottom_end_x;
1241 ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_STRUT_PARTIAL, strut, 12);
1242 } /* ecore_x_netwm_strut_partial_set */
1245 * Sends the GetProperty request.
1246 * @param window The window.
1247 * @ingroup Ecore_X_NetWM_Group
1250 ecore_x_netwm_strut_partial_get_prefetch(Ecore_X_Window window)
1252 xcb_get_property_cookie_t cookie;
1254 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, window,
1255 ECORE_X_ATOM_NET_WM_STRUT_PARTIAL, ECORE_X_ATOM_CARDINAL,
1257 _ecore_xcb_cookie_cache(cookie.sequence);
1258 } /* ecore_x_netwm_strut_partial_get_prefetch */
1261 * Gets the reply of the GetProperty request sent by ecore_x_strut_partial_get_prefetch().
1262 * @ingroup Ecore_X_NetWM_Group
1265 ecore_x_netwm_strut_partial_get_fetch(void)
1267 xcb_get_property_cookie_t cookie;
1268 xcb_get_property_reply_t *reply;
1270 cookie.sequence = _ecore_xcb_cookie_get();
1271 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
1272 _ecore_xcb_reply_cache(reply);
1273 } /* ecore_x_netwm_strut_partial_get_fetch */
1276 * Get the space at the edje of the screen of a window.
1277 * @param window The window
1278 * @param left The number of pixels at the left of the screen.
1279 * @param right The number of pixels at the right of the screen.
1280 * @param top The number of pixels at the top of the screen.
1281 * @param bottom The number of pixels at the bottom of the screen.
1282 * @param left_start_y The number of pixels.
1283 * @param left_end_y The number of pixels.
1284 * @param right_start_y The number of pixels.
1285 * @param right_end_y The number of pixels.
1286 * @param top_start_x The number of pixels.
1287 * @param top_end_x The number of pixels.
1288 * @param bottom_start_x The number of pixels.
1289 * @param bottom_end_x The number of pixels.
1291 * Retrieve the space at the edje of the screen if @p window is to
1292 * reserve such space. The number of pixels at the left, right, top
1293 * and bottom of the screen are respectively stored in @p left,
1294 * @p right, @p top and @p bottom. This function returns 1 on success,
1297 * TODO: more description for that function.
1299 * To use this function, you must call before, and in order,
1300 * ecore_x_netwm_strut_partial_get_prefetch(), which sends the GetProperty request,
1301 * then ecore_x_netwm_strut_partial_get_fetch(), which gets the reply.
1302 * @ingroup Ecore_X_NetWM_Group
1305 ecore_x_netwm_strut_partial_get(Ecore_X_Window window,
1316 int *bottom_start_x,
1322 ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_STRUT_PARTIAL, strut, 12);
1339 *left_start_y = strut[4];
1342 *left_end_y = strut[5];
1345 *right_start_y = strut[6];
1348 *right_end_y = strut[7];
1351 *top_start_x = strut[8];
1354 *top_end_x = strut[9];
1357 *bottom_start_x = strut[10];
1360 *bottom_end_x = strut[11];
1363 } /* ecore_x_netwm_strut_partial_get */
1366 * Sends the GetProperty request.
1367 * @param window The window.
1368 * @ingroup Ecore_X_NetWM_Group
1371 ecore_x_netwm_icons_get_prefetch(Ecore_X_Window window)
1373 xcb_get_property_cookie_t cookie;
1375 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, window,
1376 ECORE_X_ATOM_NET_WM_ICON, ECORE_X_ATOM_CARDINAL,
1378 _ecore_xcb_cookie_cache(cookie.sequence);
1379 } /* ecore_x_netwm_icons_get_prefetch */
1382 * Gets the reply of the GetProperty request sent by ecore_x_icons_get_prefetch().
1383 * @ingroup Ecore_X_NetWM_Group
1386 ecore_x_netwm_icons_get_fetch(void)
1388 xcb_get_property_cookie_t cookie;
1389 xcb_get_property_reply_t *reply;
1391 cookie.sequence = _ecore_xcb_cookie_get();
1392 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
1393 _ecore_xcb_reply_cache(reply);
1394 } /* ecore_x_netwm_icons_get_fetch */
1397 * Retrieve hte possible icons of a window.
1398 * @param window The window
1399 * @param icon An array of icons.
1400 * @param num The number of icons.
1401 * @return 1 on success, 0 otherwise.
1403 * Retrieve an array of possible icons of @p window. The icons are
1404 * stored in @p icon and their number in @p num.
1406 * To use this function, you must call before, and in order,
1407 * ecore_x_netwm_icons_get_prefetch(), which sends the GetProperty request,
1408 * then ecore_x_netwm_icons_get_fetch(), which gets the reply.
1409 * @ingroup Ecore_X_NetWM_Group
1412 ecore_x_netwm_icons_get(Ecore_X_Window window,
1413 Ecore_X_Icon **icon,
1430 num_ret = ecore_x_window_prop_card32_list_get(window,
1431 ECORE_X_ATOM_NET_WM_ICON,
1433 if ((num_ret <= 0) || !data)
1442 /* Check how many icons there are */
1449 if ((p - data) > num_ret)
1457 if ((p - data) == num_ret)
1463 /* If the user doesn't want the icons, return */
1470 /* Allocate memory */
1471 *icon = malloc(icons * sizeof(Ecore_X_Icon));
1478 /* Fetch the icons */
1480 for (i = 0; i < icons; i++)
1482 uint32_t *ps, *pd, *pe;
1485 ((*icon)[i]).width = p[0];
1486 ((*icon)[i]).height = p[1];
1488 ((*icon)[i]).data = malloc(len * sizeof(uint32_t));
1489 if (!((*icon)[i]).data)
1492 free(((*icon)[--i]).data);
1498 pd = ((*icon)[i]).data;
1501 for (; ps < pe; ps++)
1503 uint32_t r, g, b, a;
1505 a = (*ps >> 24) & 0xff;
1506 r = (((*ps >> 16) & 0xff) * a) / 255;
1507 g = (((*ps >> 8) & 0xff) * a) / 255;
1508 b = (((*ps) & 0xff) * a) / 255;
1509 *pd = (a << 24) | (r << 16) | (g << 8) | (b);
1518 } /* ecore_x_netwm_icons_get */
1521 * Set the _NET_WM_ICON_GEOMETRY property.
1522 * @param window The window.
1523 * @param x The X coordinate of the icon.
1524 * @param y The Y coordinate of the icon.
1525 * @param width The width of the icon.
1526 * @param height The height of the icon.
1528 * Set the geometry of the icon of @p window by sending the
1529 * _NET_WM_ICON_GEOMETRY property to @p window. @p x, @p y, @p width
1530 * and @p height specify respectively the X coordinate, the Y
1531 * coordinate, the width and the height of the icon.
1533 * Stand alone tools like a taskbar or an iconbox MAY use this
1534 * function. This functions makes possible for a Window Manager to
1535 * display a nice animation like morphing the window into its icon.
1536 * @ingroup Ecore_X_NetWM_Group
1539 ecore_x_netwm_icon_geometry_set(Ecore_X_Window window,
1545 uint32_t geometry[4];
1547 geometry[0] = (uint32_t)x;
1548 geometry[1] = (uint32_t)y;
1549 geometry[2] = (uint32_t)width;
1550 geometry[3] = (uint32_t)height;
1551 ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, geometry, 4);
1552 } /* ecore_x_netwm_icon_geometry_set */
1555 * Sends the GetProperty request.
1556 * @param window The window.
1557 * @ingroup Ecore_X_NetWM_Group
1560 ecore_x_netwm_icon_geometry_get_prefetch(Ecore_X_Window window)
1562 xcb_get_property_cookie_t cookie;
1564 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, window,
1565 ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, ECORE_X_ATOM_CARDINAL,
1567 _ecore_xcb_cookie_cache(cookie.sequence);
1568 } /* ecore_x_netwm_icon_geometry_get_prefetch */
1571 * Gets the reply of the GetProperty request sent by ecore_x_icon_geometry_get_prefetch().
1572 * @ingroup Ecore_X_NetWM_Group
1575 ecore_x_netwm_icon_geometry_get_fetch(void)
1577 xcb_get_property_cookie_t cookie;
1578 xcb_get_property_reply_t *reply;
1580 cookie.sequence = _ecore_xcb_cookie_get();
1581 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
1582 _ecore_xcb_reply_cache(reply);
1583 } /* ecore_x_netwm_icon_geometry_get_fetch */
1586 * Get the geometry of an icon.
1587 * @param window The window
1589 * @param x The X coordinate of the icon.
1590 * @param y The Y coordinate of the icon.
1591 * @param width The width of the icon.
1592 * @param height The height of the icon.
1593 * @return 1 on success, 0 othrwise.
1595 * Retrieve the geometry of the icon of @p window. The geometry is
1596 * stored in @p x, @p y, @p width and @p height. The function returns
1597 * 1 on success, 0 otherwise.
1599 * To use this function, you must call before, and in order,
1600 * ecore_x_netwm_icon_geometry_get_prefetch(), which sends the GetProperty request,
1601 * then ecore_x_netwm_icon_geometry_get_fetch(), which gets the reply.
1602 * @ingroup Ecore_X_NetWM_Group
1605 ecore_x_netwm_icon_geometry_get(Ecore_X_Window window,
1611 uint32_t geometry[4];
1614 ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, geometry, 4);
1625 *width = geometry[2];
1628 *height = geometry[3];
1631 } /* ecore_x_netwm_icon_geometry_get */
1634 * Set the _NET_WM_PID property.
1635 * @param window The window.
1636 * @param pid The process ID.
1638 * Set the process ID of the client owning @p window by sending the
1639 * _NET_WM_PID property to @p window.
1641 * This function MAY be used by the Window Manager to kill windows
1642 * which do not respond to the _NET_WM_PING protocol.
1644 * If _NET_WM_PID is set, the ICCCM-specified property
1645 * WM_CLIENT_MACHINE MUST also be set.
1646 * @ingroup Ecore_X_NetWM_Group
1649 ecore_x_netwm_pid_set(Ecore_X_Window window,
1655 ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_PID,
1657 } /* ecore_x_netwm_pid_set */
1660 * Sends the GetProperty request.
1661 * @param window The window.
1662 * @ingroup Ecore_X_NetWM_Group
1665 ecore_x_netwm_pid_get_prefetch(Ecore_X_Window window)
1667 xcb_get_property_cookie_t cookie;
1669 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, window,
1670 ECORE_X_ATOM_NET_WM_PID, ECORE_X_ATOM_CARDINAL,
1672 _ecore_xcb_cookie_cache(cookie.sequence);
1673 } /* ecore_x_netwm_pid_get_prefetch */
1676 * Gets the reply of the GetProperty request sent by ecore_x_pid_get_prefetch().
1677 * @ingroup Ecore_X_NetWM_Group
1680 ecore_x_netwm_pid_get_fetch(void)
1682 xcb_get_property_cookie_t cookie;
1683 xcb_get_property_reply_t *reply;
1685 cookie.sequence = _ecore_xcb_cookie_get();
1686 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
1687 _ecore_xcb_reply_cache(reply);
1688 } /* ecore_x_netwm_pid_get_fetch */
1691 * Get the process ID of a client window.
1692 * @param window The window.
1693 * @param pid The process ID.
1694 * @return 1 on success, 0 otherwise.
1696 * Retrieve the process ID of @p window and store it in @p pid. This
1697 * function returns 1 on success, 0 otherwise.
1699 * To use this function, you must call before, and in order,
1700 * ecore_x_netwm_pid_get_prefetch(), which sends the GetProperty request,
1701 * then ecore_x_netwm_pid_get_fetch(), which gets the reply.
1702 * @ingroup Ecore_X_NetWM_Group
1705 ecore_x_netwm_pid_get(Ecore_X_Window window,
1711 ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_PID,
1716 return (ret == 1) ? 1 : 0;
1717 } /* ecore_x_netwm_pid_get */
1720 * Set the _NET_WM_HANDLED_ICONS property.
1721 * @param window The window.
1723 * Indicate to the Window Manager that it does not need to provide
1724 * icons for the iconified @p window by sending the
1725 * _NET_WM_HANDLED_ICONS property to @p window.
1727 * This function can be used by a Pager on one of its own toplevel
1728 * windows (for example if the Client is a taskbar and provides
1729 * buttons for iconified windows).
1730 * @ingroup Ecore_X_NetWM_Group
1733 ecore_x_netwm_handled_icons_set(Ecore_X_Window window)
1735 ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_HANDLED_ICONS,
1737 } /* ecore_x_netwm_handled_icons_set */
1740 * Sends the GetProperty request.
1741 * @param window The window.
1742 * @ingroup Ecore_X_NetWM_Group
1745 ecore_x_netwm_handled_icons_get_prefetch(Ecore_X_Window window)
1747 xcb_get_property_cookie_t cookie;
1749 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, window,
1750 ECORE_X_ATOM_NET_WM_HANDLED_ICONS, ECORE_X_ATOM_CARDINAL,
1752 _ecore_xcb_cookie_cache(cookie.sequence);
1753 } /* ecore_x_netwm_handled_icons_get_prefetch */
1756 * Gets the reply of the GetProperty request sent by ecore_x_handled_icons_get_prefetch().
1757 * @ingroup Ecore_X_NetWM_Group
1760 ecore_x_netwm_handled_icons_get_fetch(void)
1762 xcb_get_property_cookie_t cookie;
1763 xcb_get_property_reply_t *reply;
1765 cookie.sequence = _ecore_xcb_cookie_get();
1766 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
1767 _ecore_xcb_reply_cache(reply);
1768 } /* ecore_x_netwm_handled_icons_get_fetch */
1771 * Return wheter the Client handles icons or not.
1772 * @param window The window.
1773 * @return 1 if icons are handled, 0 otherwise.
1775 * Return whether the client handles icons or not if @p window is
1778 * To use this function, you must call before, and in order,
1779 * ecore_x_netwm_handled_icons_get_prefetch(), which sends the GetProperty request,
1780 * then ecore_x_netwm_handled_icons_get_fetch(), which gets the reply.
1781 * @ingroup Ecore_X_NetWM_Group
1784 ecore_x_netwm_handled_icons_get(Ecore_X_Window window)
1787 ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_HANDLED_ICONS,
1789 return (ret == 0) ? 1 : 0;
1790 } /* ecore_x_netwm_handled_icons_get */
1793 * Set the _NET_WM_USER_TIME property.
1794 * @param window The window.
1795 * @param time The last user activity time in the window.
1797 * Set the XServer time at which last user activity in @p window took
1798 * place by sending the _NET_WM_USER_TIME property to @p window. @p
1799 * time contains that XServer time in seconds.
1801 * This function allows a Window Manager to alter the focus, stacking,
1802 * and/or placement behavior of windows when they are mapped depending
1803 * on whether the new window was created by a user action or is a
1804 * "pop-up" window activated by a timer or some other event.
1805 * @ingroup Ecore_X_NetWM_Group
1808 ecore_x_netwm_user_time_set(Ecore_X_Window window,
1811 ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_USER_TIME,
1813 } /* ecore_x_netwm_user_time_set */
1816 * Sends the GetProperty request.
1817 * @param window The window.
1818 * @ingroup Ecore_X_NetWM_Group
1821 ecore_x_netwm_user_time_get_prefetch(Ecore_X_Window window)
1823 xcb_get_property_cookie_t cookie;
1825 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, window,
1826 ECORE_X_ATOM_NET_WM_USER_TIME, ECORE_X_ATOM_CARDINAL,
1828 _ecore_xcb_cookie_cache(cookie.sequence);
1829 } /* ecore_x_netwm_user_time_get_prefetch */
1832 * Gets the reply of the GetProperty request sent by ecore_x_netwm_user_time_get_prefetch().
1833 * @ingroup Ecore_X_NetWM_Group
1836 ecore_x_netwm_user_time_get_fetch(void)
1838 xcb_get_property_cookie_t cookie;
1839 xcb_get_property_reply_t *reply;
1841 cookie.sequence = _ecore_xcb_cookie_get();
1842 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
1843 _ecore_xcb_reply_cache(reply);
1844 } /* ecore_x_netwm_user_time_get_fetch */
1847 * Get the last user activity time in the window.
1848 * @param window The window.
1849 * @param time The returned time.
1850 * @return 1 on success, 0 otherwise.
1852 * Return the XServer time at which last user activity in @p window
1853 * took place. The time is stored in @p time.
1855 * To use this function, you must call before, and in order,
1856 * ecore_x_netwm_user_time_get_prefetch(), which sends the GetProperty request,
1857 * then ecore_x_netwm_user_time_get_fetch(), which gets the reply.
1858 * @ingroup Ecore_X_NetWM_Group
1861 ecore_x_netwm_user_time_get(Ecore_X_Window window,
1867 ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_USER_TIME,
1872 return (ret == 1) ? 1 : 0;
1873 } /* ecore_x_netwm_user_time_get */
1875 Ecore_X_Window_State
1876 _ecore_x_netwm_state_get(Ecore_X_Atom a)
1878 if (a == ECORE_X_ATOM_NET_WM_STATE_MODAL)
1879 return ECORE_X_WINDOW_STATE_MODAL;
1880 else if (a == ECORE_X_ATOM_NET_WM_STATE_STICKY)
1881 return ECORE_X_WINDOW_STATE_STICKY;
1882 else if (a == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT)
1883 return ECORE_X_WINDOW_STATE_MAXIMIZED_VERT;
1884 else if (a == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ)
1885 return ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ;
1886 else if (a == ECORE_X_ATOM_NET_WM_STATE_SHADED)
1887 return ECORE_X_WINDOW_STATE_SHADED;
1888 else if (a == ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR)
1889 return ECORE_X_WINDOW_STATE_SKIP_TASKBAR;
1890 else if (a == ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER)
1891 return ECORE_X_WINDOW_STATE_SKIP_PAGER;
1892 else if (a == ECORE_X_ATOM_NET_WM_STATE_HIDDEN)
1893 return ECORE_X_WINDOW_STATE_HIDDEN;
1894 else if (a == ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN)
1895 return ECORE_X_WINDOW_STATE_FULLSCREEN;
1896 else if (a == ECORE_X_ATOM_NET_WM_STATE_ABOVE)
1897 return ECORE_X_WINDOW_STATE_ABOVE;
1898 else if (a == ECORE_X_ATOM_NET_WM_STATE_BELOW)
1899 return ECORE_X_WINDOW_STATE_BELOW;
1900 else if (a == ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION)
1901 return ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION;
1903 return ECORE_X_WINDOW_STATE_UNKNOWN;
1904 } /* _ecore_x_netwm_state_get */
1907 _ecore_x_netwm_state_atom_get(Ecore_X_Window_State s)
1911 case ECORE_X_WINDOW_STATE_MODAL:
1912 return ECORE_X_ATOM_NET_WM_STATE_MODAL;
1914 case ECORE_X_WINDOW_STATE_STICKY:
1915 return ECORE_X_ATOM_NET_WM_STATE_STICKY;
1917 case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT:
1918 return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT;
1920 case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ:
1921 return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ;
1923 case ECORE_X_WINDOW_STATE_SHADED:
1924 return ECORE_X_ATOM_NET_WM_STATE_SHADED;
1926 case ECORE_X_WINDOW_STATE_SKIP_TASKBAR:
1927 return ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR;
1929 case ECORE_X_WINDOW_STATE_SKIP_PAGER:
1930 return ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER;
1932 case ECORE_X_WINDOW_STATE_HIDDEN:
1933 return ECORE_X_ATOM_NET_WM_STATE_HIDDEN;
1935 case ECORE_X_WINDOW_STATE_FULLSCREEN:
1936 return ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN;
1938 case ECORE_X_WINDOW_STATE_ABOVE:
1939 return ECORE_X_ATOM_NET_WM_STATE_ABOVE;
1941 case ECORE_X_WINDOW_STATE_BELOW:
1942 return ECORE_X_ATOM_NET_WM_STATE_BELOW;
1944 case ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION:
1945 return ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION;
1950 } /* _ecore_x_netwm_state_atom_get */
1953 * Set the _NET_WM_STATE property.
1954 * @param window The window.
1955 * @param state An array of window hints.
1956 * @param num The number of hints.
1958 * Set a list of hints describing @p window state by sending the
1959 * _NET_WM_STATE property to @p window. The hints are stored in the
1960 * array @p state. @p num must contain the number of hints.
1962 * The Window Manager SHOULD honor _NET_WM_STATE whenever a withdrawn
1963 * window requests to be mapped. A Client wishing to change the state
1964 * of a window MUST send a _NET_WM_STATE client message to the root
1965 * window. The Window Manager MUST keep this property updated to
1966 * reflect the current state of the window.
1967 * @ingroup Ecore_X_NetWM_Group
1970 ecore_x_netwm_window_state_set(Ecore_X_Window window,
1971 Ecore_X_Window_State *state,
1979 ecore_x_window_prop_property_del(window, ECORE_X_ATOM_NET_WM_STATE);
1983 set = malloc(num * sizeof(Ecore_X_Atom));
1987 for (i = 0; i < num; i++)
1988 set[i] = _ecore_x_netwm_state_atom_get(state[i]);
1990 ecore_x_window_prop_atom_set(window, ECORE_X_ATOM_NET_WM_STATE, set, num);
1993 } /* ecore_x_netwm_window_state_set */
1996 * Sends the GetProperty request.
1997 * @param window The window.
1998 * @ingroup Ecore_X_NetWM_Group
2001 ecore_x_netwm_window_state_get_prefetch(Ecore_X_Window window)
2003 xcb_get_property_cookie_t cookie;
2005 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, window,
2006 ECORE_X_ATOM_NET_WM_STATE, ECORE_X_ATOM_ATOM,
2008 _ecore_xcb_cookie_cache(cookie.sequence);
2009 } /* ecore_x_netwm_window_state_get_prefetch */
2012 * Gets the reply of the GetProperty request sent by ecore_x_window_state_get_prefetch().
2013 * @ingroup Ecore_X_NetWM_Group
2016 ecore_x_netwm_window_state_get_fetch(void)
2018 xcb_get_property_cookie_t cookie;
2019 xcb_get_property_reply_t *reply;
2021 cookie.sequence = _ecore_xcb_cookie_get();
2022 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
2023 _ecore_xcb_reply_cache(reply);
2024 } /* ecore_x_netwm_window_state_get_fetch */
2027 * Get the hints describing the window state.
2028 * @param window The window.
2029 * @param state The returned hins.
2030 * @param num The number of hints.
2031 * @return 1 on success, 0 otherwise.
2033 * Retrieve the hints describing @p window state. The state is
2034 * returned in @p state. The nummber of hints is stored in @p
2035 * num. This function returns 1 on success, 0 otherwise.
2037 * To use this function, you must call before, and in order,
2038 * ecore_x_netwm_window_state_get_prefetch(), which sends the GetProperty request,
2039 * then ecore_x_netwm_window_state_get_fetch(), which gets the reply.
2040 * @ingroup Ecore_X_NetWM_Group
2043 ecore_x_netwm_window_state_get(Ecore_X_Window window,
2044 Ecore_X_Window_State **state,
2047 Ecore_X_Atom *atoms;
2057 num_ret = ecore_x_window_prop_atom_list_get(window, ECORE_X_ATOM_NET_WM_STATE,
2064 *state = malloc(num_ret * sizeof(Ecore_X_Window_State));
2066 for (i = 0; i < num_ret; ++i)
2067 (*state)[i] = _ecore_x_netwm_state_get(atoms[i]);
2076 } /* ecore_x_netwm_window_state_get */
2078 static Ecore_X_Window_Type
2079 _ecore_x_netwm_window_type_type_get(Ecore_X_Atom atom)
2081 if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP)
2082 return ECORE_X_WINDOW_TYPE_DESKTOP;
2083 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK)
2084 return ECORE_X_WINDOW_TYPE_DOCK;
2085 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR)
2086 return ECORE_X_WINDOW_TYPE_TOOLBAR;
2087 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU)
2088 return ECORE_X_WINDOW_TYPE_MENU;
2089 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY)
2090 return ECORE_X_WINDOW_TYPE_UTILITY;
2091 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH)
2092 return ECORE_X_WINDOW_TYPE_SPLASH;
2093 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG)
2094 return ECORE_X_WINDOW_TYPE_DIALOG;
2095 else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL)
2096 return ECORE_X_WINDOW_TYPE_NORMAL;
2098 return ECORE_X_WINDOW_TYPE_UNKNOWN;
2099 } /* _ecore_x_netwm_window_type_type_get */
2102 _ecore_x_netwm_window_type_atom_get(Ecore_X_Window_Type type)
2106 case ECORE_X_WINDOW_TYPE_DESKTOP:
2107 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP;
2109 case ECORE_X_WINDOW_TYPE_DOCK:
2110 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK;
2112 case ECORE_X_WINDOW_TYPE_TOOLBAR:
2113 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR;
2115 case ECORE_X_WINDOW_TYPE_MENU:
2116 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU;
2118 case ECORE_X_WINDOW_TYPE_UTILITY:
2119 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY;
2121 case ECORE_X_WINDOW_TYPE_SPLASH:
2122 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH;
2124 case ECORE_X_WINDOW_TYPE_DIALOG:
2125 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG;
2127 case ECORE_X_WINDOW_TYPE_NORMAL:
2128 return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL;
2133 } /* _ecore_x_netwm_window_type_atom_get */
2136 * FIXME: We should set WM_TRANSIENT_FOR if type is ECORE_X_WINDOW_TYPE_TOOLBAR
2137 * , ECORE_X_WINDOW_TYPE_MENU or ECORE_X_WINDOW_TYPE_DIALOG
2141 * Set the _NET_WM_WINDOW_TYPE property.
2142 * @param window The window.
2143 * @param type The functional type of the window.
2145 * Set the functional @p type of @p window by sending _NET_WM_WINDOW_TYPE
2146 * property to @p window.
2148 * This property SHOULD be set by the Client before mapping. This
2149 * property SHOULD be used by the window manager in determining the
2150 * decoration, stacking position and other behavior of the window. The
2151 * Client SHOULD specify window types in order of preference (the first
2152 * being most preferable).
2154 * This hint is intended to replace the MOTIF hints.
2155 * @ingroup Ecore_X_NetWM_Group
2158 ecore_x_netwm_window_type_set(Ecore_X_Window window,
2159 Ecore_X_Window_Type type)
2163 atom = _ecore_x_netwm_window_type_atom_get(type);
2164 ecore_x_window_prop_atom_set(window, ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
2166 } /* ecore_x_netwm_window_type_set */
2169 * Sends the GetProperty request.
2170 * @param window The window.
2171 * @ingroup Ecore_X_NetWM_Group
2174 ecore_x_netwm_window_type_get_prefetch(Ecore_X_Window window)
2176 xcb_get_property_cookie_t cookie;
2178 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, window,
2179 ECORE_X_ATOM_NET_WM_WINDOW_TYPE, ECORE_X_ATOM_ATOM,
2181 _ecore_xcb_cookie_cache(cookie.sequence);
2182 } /* ecore_x_netwm_window_type_get_prefetch */
2185 * Gets the reply of the GetProperty request sent by ecore_x_window_type_get_prefetch().
2186 * @ingroup Ecore_X_NetWM_Group
2189 ecore_x_netwm_window_type_get_fetch(void)
2191 xcb_get_property_cookie_t cookie;
2192 xcb_get_property_reply_t *reply;
2194 cookie.sequence = _ecore_xcb_cookie_get();
2195 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
2196 _ecore_xcb_reply_cache(reply);
2197 } /* ecore_x_netwm_window_type_get_fetch */
2199 /* FIXME: Maybe return 0 on some conditions? */
2202 * Get the functional type of a window.
2203 * @param window The window.
2204 * @param type The function type of the window.
2205 * @return 1 on success, 0 otherwise.
2207 * Retrieve the functional type of @p window. The type is stored in
2208 * @p type. This function returns 1 on success, 0 otherwise.
2210 * To use this function, you must call before, and in order,
2211 * ecore_x_netwm_window_type_get_prefetch(), which sends the GetProperty request,
2212 * then ecore_x_netwm_window_type_get_fetch(), which gets the reply.
2213 * @ingroup Ecore_X_NetWM_Group
2216 ecore_x_netwm_window_type_get(Ecore_X_Window window,
2217 Ecore_X_Window_Type *type)
2219 Ecore_X_Atom *atoms;
2224 *type = ECORE_X_WINDOW_TYPE_NORMAL;
2226 num = ecore_x_window_prop_atom_list_get(window, ECORE_X_ATOM_NET_WM_WINDOW_TYPE,
2230 /* IMO this is not the place to mix netwm and icccm /kwo */
2231 /* Check if WM_TRANSIENT_FOR is set */
2233 /* Disable it for xcb */
2235 /* if ((type) && (ecore_x_icccm_transient_for_get(window))) */
2236 /* *type = ECORE_X_WINDOW_TYPE_DIALOG; */
2242 for (i = 0; i < num; ++i)
2244 *type = _ecore_x_netwm_window_type_type_get(atoms[i]);
2245 if (*type != ECORE_X_WINDOW_TYPE_UNKNOWN)
2253 } /* ecore_x_netwm_window_type_get */
2256 _ecore_x_netwm_action_atom_get(Ecore_X_Action action)
2260 case ECORE_X_ACTION_MOVE:
2261 return ECORE_X_ATOM_NET_WM_ACTION_MOVE;
2263 case ECORE_X_ACTION_RESIZE:
2264 return ECORE_X_ATOM_NET_WM_ACTION_RESIZE;
2266 case ECORE_X_ACTION_MINIMIZE:
2267 return ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE;
2269 case ECORE_X_ACTION_SHADE:
2270 return ECORE_X_ATOM_NET_WM_ACTION_SHADE;
2272 case ECORE_X_ACTION_STICK:
2273 return ECORE_X_ATOM_NET_WM_ACTION_STICK;
2275 case ECORE_X_ACTION_MAXIMIZE_HORZ:
2276 return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ;
2278 case ECORE_X_ACTION_MAXIMIZE_VERT:
2279 return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT;
2281 case ECORE_X_ACTION_FULLSCREEN:
2282 return ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN;
2284 case ECORE_X_ACTION_CHANGE_DESKTOP:
2285 return ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP;
2287 case ECORE_X_ACTION_CLOSE:
2288 return ECORE_X_ATOM_NET_WM_ACTION_CLOSE;
2290 case ECORE_X_ACTION_ABOVE:
2291 return ECORE_X_ATOM_NET_WM_ACTION_ABOVE;
2293 case ECORE_X_ACTION_BELOW:
2294 return ECORE_X_ATOM_NET_WM_ACTION_BELOW;
2299 } /* _ecore_x_netwm_action_atom_get */
2302 * Sends the GetProperty request.
2303 * @param window The window.
2304 * @ingroup Ecore_X_NetWM_Group
2307 ecore_x_netwm_allowed_action_get_prefetch(Ecore_X_Window window)
2309 xcb_get_property_cookie_t cookie;
2311 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, window,
2312 ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS, ECORE_X_ATOM_ATOM,
2314 _ecore_xcb_cookie_cache(cookie.sequence);
2315 } /* ecore_x_netwm_allowed_action_get_prefetch */
2318 * Gets the reply of the GetProperty request sent by ecore_x_allowed_action_get_prefetch().
2319 * @ingroup Ecore_X_NetWM_Group
2322 ecore_x_netwm_allowed_action_get_fetch(void)
2324 xcb_get_property_cookie_t cookie;
2325 xcb_get_property_reply_t *reply;
2327 cookie.sequence = _ecore_xcb_cookie_get();
2328 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
2329 _ecore_xcb_reply_cache(reply);
2330 } /* ecore_x_netwm_allowed_action_get_fetch */
2332 /* FIXME: Get complete list */
2335 * Check whether an action is supported by a window.
2336 * @param window The window
2337 * @param action The action
2338 * @return 1 if set, 0 otherwise.
2340 * Return whether the user operation @p action is supported by the
2341 * Window Manager for @p window.
2343 * To use this function, you must call before, and in order,
2344 * ecore_x_netwm_allowed_action_get_prefetch(), which sends the GetProperty request,
2345 * then ecore_x_netwm_allowed_action_get_fetch(), which gets the reply.
2346 * @ingroup Ecore_X_NetWM_Group
2349 ecore_x_netwm_allowed_action_isset(Ecore_X_Window window,
2350 Ecore_X_Action action)
2352 Ecore_X_Atom *atoms;
2358 num = ecore_x_window_prop_atom_list_get(window, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS,
2363 atom = _ecore_x_netwm_action_atom_get(action);
2365 for (i = 0; i < num; ++i)
2367 if (atom == atoms[i])
2377 } /* ecore_x_netwm_allowed_action_isset */
2379 /* FIXME: Set complete list */
2381 * Set the _NET_WM_ALLOWED_ACTIONS property.
2382 * @param window The window.
2383 * @param action An array of allowed actions.
2384 * @param num The number of actions.
2386 * Set the user operations that the Window Manager supports for
2387 * @p window by sending the _NET_WM_ALLOWED_ACTIONS property to
2388 * @p window. @p action stores @p num actions.
2390 * To use this function, you must call before, and in order,
2391 * ecore_x_netwm_allowed_action_get_prefetch(), which sends the GetProperty request,
2392 * then ecore_x_netwm_allowed_action_get_fetch(), which gets the reply.
2393 * @ingroup Ecore_X_NetWM_Group
2396 ecore_x_netwm_allowed_action_set(Ecore_X_Window window,
2397 Ecore_X_Action *action,
2405 ecore_x_window_prop_property_del(window, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS);
2409 set = malloc(num * sizeof(Ecore_X_Atom));
2413 for (i = 0; i < num; i++)
2414 set[i] = _ecore_x_netwm_action_atom_get(action[i]);
2416 ecore_x_window_prop_atom_set(window, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS, set, num);
2419 } /* ecore_x_netwm_allowed_action_set */
2422 * Get the allowed actions supported by a window.
2423 * @param window The window.
2424 * @param action The returned array of the actions.
2425 * @param num The number of actions.
2426 * @return 1 on success, 0 otherwise.
2428 * Retrieve the user operations that the Window Manager supports for
2429 * @p window and store them in @p action. The number of actions is
2430 * stored in @p num. This function returns 1 on success, 0 otherwise.
2432 * To use this function, you must call before, and in order,
2433 * ecore_x_netwm_allowed_action_get_prefetch(), which sends the GetProperty request,
2434 * then ecore_x_netwm_allowed_action_get_fetch(), which gets the reply.
2435 * @ingroup Ecore_X_NetWM_Group
2438 ecore_x_netwm_allowed_action_get(Ecore_X_Window window,
2439 Ecore_X_Action **action,
2442 Ecore_X_Atom *atoms;
2452 num_ret = ecore_x_window_prop_atom_list_get(window, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS,
2459 *action = malloc(num_ret * sizeof(Ecore_X_Action));
2461 for (i = 0; i < num_ret; ++i)
2462 (*action)[i] = _ecore_x_netwm_action_atom_get(atoms[i]);
2471 } /* ecore_x_netwm_allowed_action_get */
2474 * Set the _NET_WM_WINDOW_OPACITY property.
2475 * @param window The window.
2476 * @param opacity The opacity value.
2478 * Set the desired opacity of @p window by sending the
2479 * _NET_WM_WINDOW_OPACITY property to @p window. @p opacity is 0 for a
2480 * transparent window and 0xffffffff for an opaque window. @p opacity
2481 * must be multiplied with the original alpha value of @p window
2482 * (which is 1 for visuals not including an alpha component) so that
2483 * @p window content is modulated by the opacity value.
2485 * Window Managers acting as compositing managers MAY take this into
2486 * account when displaying a window. Window Managers MUST forward the
2487 * value of this property to any enclosing frame window. This
2488 * property MAY change while the window is mapped and the Window
2489 * Manager MUST respect changes while the window is mapped.
2490 * @ingroup Ecore_X_NetWM_Group
2493 ecore_x_netwm_opacity_set(Ecore_X_Window window,
2494 unsigned int opacity)
2496 uint32_t op = opacity;
2497 ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY,
2499 } /* ecore_x_netwm_opacity_set */
2502 * Sends the GetProperty request.
2503 * @param window The window.
2504 * @ingroup Ecore_X_NetWM_Group
2507 ecore_x_netwm_opacity_get_prefetch(Ecore_X_Window window)
2509 xcb_get_property_cookie_t cookie;
2511 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, window,
2512 ECORE_X_ATOM_NET_WM_WINDOW_OPACITY, ECORE_X_ATOM_CARDINAL,
2514 _ecore_xcb_cookie_cache(cookie.sequence);
2515 } /* ecore_x_netwm_opacity_get_prefetch */
2518 * Gets the reply of the GetProperty request sent by ecore_x_netwm_opacity_get_prefetch().
2519 * @ingroup Ecore_X_NetWM_Group
2522 ecore_x_netwm_opacity_get_fetch(void)
2524 xcb_get_property_cookie_t cookie;
2525 xcb_get_property_reply_t *reply;
2527 cookie.sequence = _ecore_xcb_cookie_get();
2528 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
2529 _ecore_xcb_reply_cache(reply);
2530 } /* ecore_x_netwm_opacity_get_fetch */
2533 * Get the opacity value of a window.
2534 * @param window The window.
2535 * @param opacity The returned opacity.
2536 * @return 1 on success, 0 otherwise.
2538 * Retriee the opacity value of @p window and store it in
2539 * @p opacity. This function returns 1 on success, 0 otherwise.
2541 * To use this function, you must call before, and in order,
2542 * ecore_x_netwm_opacity_get_prefetch(), which sends the GetProperty request,
2543 * then ecore_x_netwm_opacity_get_fetch(), which gets the reply.
2544 * @ingroup Ecore_X_NetWM_Group
2547 ecore_x_netwm_opacity_get(Ecore_X_Window window,
2548 unsigned int *opacity)
2553 ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY,
2558 return ret == 1 ? 1 : 0;
2559 } /* ecore_x_netwm_opacity_get */
2562 * Set the _NET_FRAME_EXTENTS property.
2563 * @param window The window.
2564 * @param fl The number of pixels of the left border of the window.
2565 * @param fr The number of pixels of the right border of the window.
2566 * @param ft The number of pixels of the top border of the window.
2567 * @param fb The number of pixels of the bottom border of the window.
2569 * Set the border witdh of @p window by sending the _NET_FRAME_EXTENTS
2570 * property to @p window. @p fl, @p fr, @p ft and @p fb are respectively
2571 * the number of pixels of the left, right, top and bottom border of
2574 * The Window Manager MUST set _NET_FRAME_EXTENTS to the extents of
2575 * the window's frame.
2576 * @ingroup Ecore_X_NetWM_Group
2579 ecore_x_netwm_frame_size_set(Ecore_X_Window window,
2591 ecore_x_window_prop_card32_set(window, ECORE_X_ATOM_NET_FRAME_EXTENTS, frames, 4);
2592 } /* ecore_x_netwm_frame_size_set */
2595 * Sends the GetProperty request.
2596 * @param window The window.
2597 * @ingroup Ecore_X_NetWM_Group
2600 ecore_x_netwm_frame_size_get_prefetch(Ecore_X_Window window)
2602 xcb_get_property_cookie_t cookie;
2604 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, window,
2605 ECORE_X_ATOM_NET_FRAME_EXTENTS, ECORE_X_ATOM_CARDINAL,
2607 _ecore_xcb_cookie_cache(cookie.sequence);
2608 } /* ecore_x_netwm_frame_size_get_prefetch */
2611 * Gets the reply of the GetProperty request sent by ecore_x_netwm_frame_size_get_prefetch().
2612 * @ingroup Ecore_X_NetWM_Group
2615 ecore_x_netwm_frame_size_get_fetch(void)
2617 xcb_get_property_cookie_t cookie;
2618 xcb_get_property_reply_t *reply;
2620 cookie.sequence = _ecore_xcb_cookie_get();
2621 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
2622 _ecore_xcb_reply_cache(reply);
2623 } /* ecore_x_netwm_frame_size_get_fetch */
2626 * Get the frame extent of a window.
2627 * @param window The window.
2628 * @param fl The number of pixels of the left border of the window.
2629 * @param fr The number of pixels of the right border of the window.
2630 * @param ft The number of pixels of the top border of the window.
2631 * @param fb The number of pixels of the bottom border of the window.
2632 * @return 1 on success, 0 otherwise.
2634 * Retrieve the frame extents of @p window. The number of pixels of
2635 * the left, right, top and bottom border of @p window are
2636 * respectively stored in @p fl, @p fr, @p ft anfd @p fb. TYhis
2637 * function retuirns 1 on success, 0 otherwise.
2639 * To use this function, you must call before, and in order,
2640 * ecore_x_netwm_frame_size_get_prefetch(), which sends the GetProperty request,
2641 * then ecore_x_netwm_frame_size_get_fetch(), which gets the reply.
2642 * @ingroup Ecore_X_NetWM_Group
2645 ecore_x_netwm_frame_size_get(Ecore_X_Window window,
2654 ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_FRAME_EXTENTS, frames, 4);
2671 } /* ecore_x_netwm_frame_size_get */
2674 * Sends the GetProperty request.
2675 * @param window The window.
2676 * @ingroup Ecore_X_NetWM_Group
2679 ecore_x_netwm_sync_counter_get_prefetch(Ecore_X_Window window)
2681 xcb_get_property_cookie_t cookie;
2683 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, window,
2684 ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER, ECORE_X_ATOM_CARDINAL,
2686 _ecore_xcb_cookie_cache(cookie.sequence);
2687 } /* ecore_x_netwm_sync_counter_get_prefetch */
2690 * Gets the reply of the GetProperty request sent by ecore_x_netwm_sync_counter_get_prefetch().
2691 * @ingroup Ecore_X_NetWM_Group
2694 ecore_x_netwm_sync_counter_get_fetch(void)
2696 xcb_get_property_cookie_t cookie;
2697 xcb_get_property_reply_t *reply;
2699 cookie.sequence = _ecore_xcb_cookie_get();
2700 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
2701 _ecore_xcb_reply_cache(reply);
2702 } /* ecore_x_netwm_sync_counter_get_fetch */
2705 * Get the X ID of a X Sync counter.
2706 * @param window The window.
2707 * @param counter The X ID of the Sync counter.
2708 * @return 1 on success, 0 otherwise.
2710 * Retrieve the X ID of the X Sync counter of @p window and store it
2711 * in @p counter. This function returns 1 on success, 0 otherwise.
2713 * To use this function, you must call before, and in order,
2714 * ecore_x_netwm_frame_size_get_prefetch(), which sends the GetProperty request,
2715 * then ecore_x_netwm_frame_size_get_fetch(), which gets the reply.
2716 * @ingroup Ecore_X_NetWM_Group
2719 ecore_x_netwm_sync_counter_get(Ecore_X_Window window,
2720 Ecore_X_Sync_Counter *counter)
2725 ret = ecore_x_window_prop_card32_get(window, ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER,
2731 return (ret == 1) ? 1 : 0;
2732 } /* ecore_x_netwm_sync_counter_get */
2735 * Send a _NET_WM_PING property event.
2736 * @param window The window.
2738 * Send a ClientMessage event from @p window with the _NET_WM_PING
2740 * @ingroup Ecore_X_NetWM_Group
2743 ecore_x_netwm_ping_send(Ecore_X_Window window)
2745 xcb_client_message_event_t ev;
2750 ev.response_type = XCB_CLIENT_MESSAGE | 0x80;
2754 ev.type = ECORE_X_ATOM_WM_PROTOCOLS;
2755 ev.data.data32[0] = ECORE_X_ATOM_NET_WM_PING;
2756 ev.data.data32[1] = _ecore_xcb_event_last_time;
2757 ev.data.data32[2] = window;
2758 ev.data.data32[3] = 0;
2759 ev.data.data32[4] = 0;
2760 ev.data.data32[5] = 0;
2762 xcb_send_event(_ecore_xcb_conn, 0, window, XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
2763 } /* ecore_x_netwm_ping_send */
2766 * Send a _NET_WM_SYNC_REQUEST property event.
2767 * @param window The window.
2768 * @param serial The update request number.
2770 * Send a ClientMessage event from @p window with the _NET_WM_SYNC_REQUEST
2772 * @ingroup Ecore_X_NetWM_Group
2775 ecore_x_netwm_sync_request_send(Ecore_X_Window window,
2776 unsigned int serial)
2778 xcb_client_message_event_t ev;
2783 ev.response_type = XCB_CLIENT_MESSAGE | 0x80;
2786 ev.type = ECORE_X_ATOM_WM_PROTOCOLS;
2787 ev.data.data32[0] = ECORE_X_ATOM_NET_WM_SYNC_REQUEST;
2788 ev.data.data32[1] = _ecore_xcb_event_last_time;
2789 ev.data.data32[2] = serial;
2790 /* FIXME: imho, the following test is useless as serial is non negative */
2791 /* should we remove it ? */
2792 ev.data.data32[3] = (serial < 0) ? ~0L : 0L;
2793 ev.data.data32[4] = 0;
2795 xcb_send_event(_ecore_xcb_conn, 0, window, 0, (const char *)&ev);
2796 } /* ecore_x_netwm_sync_request_send */
2799 * Send a _NET_WM_STATE property event.
2800 * @param window The window.
2801 * @param root The root window.
2802 * @param s1 The first state to alter.
2803 * @param s2 The second state to alter.
2804 * @param set 0 to unset the property, set it otherwise.
2806 * Send a ClientMessage event from @p window to the @p root window
2807 * with the _NET_WM_STATE property set. This change the state of a
2808 * mapped window. @p s1 is the first state to alter. @p s2 is the
2809 * second state to alter. If @p set value is 0, the property is
2810 * removed (or unset), otherwise, the property is set.
2811 * @ingroup Ecore_X_NetWM_Group
2814 ecore_x_netwm_state_request_send(Ecore_X_Window window,
2815 Ecore_X_Window root,
2816 Ecore_X_Window_State s1,
2817 Ecore_X_Window_State s2,
2820 xcb_client_message_event_t ev;
2826 root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
2828 ev.response_type = XCB_CLIENT_MESSAGE | 0x80;
2831 ev.type = ECORE_X_ATOM_NET_WM_STATE;
2832 ev.data.data32[0] = !!set;
2833 ev.data.data32[1] = _ecore_x_netwm_state_atom_get(s1);
2834 ev.data.data32[2] = _ecore_x_netwm_state_atom_get(s2);
2835 /* 1 == normal client, if someone wants to use this
2836 * function in a pager, this should be 2 */
2837 ev.data.data32[3] = 1;
2838 ev.data.data32[4] = 0;
2840 xcb_send_event(_ecore_xcb_conn, 0, root,
2841 XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT,
2843 } /* ecore_x_netwm_state_request_send */
2846 * Send a _NET_WM_DESKTOP property event.
2847 * @param window The window.
2848 * @param root The root window.
2849 * @param desktop The new desktop index.
2851 * Send a ClientMessage event from @p window to the @p root window
2852 * with the _NET_WM_DESKTOP property set. This change the state of a
2853 * non-withdrawn window. @p desktop is the new desktop index to set.
2854 * @ingroup Ecore_X_NetWM_Group
2857 ecore_x_netwm_desktop_request_send(Ecore_X_Window window,
2858 Ecore_X_Window root,
2859 unsigned int desktop)
2861 xcb_client_message_event_t ev;
2867 root = ((xcb_screen_t *)_ecore_xcb_screen)->root;
2869 ev.response_type = XCB_CLIENT_MESSAGE | 0x80;
2872 ev.type = ECORE_X_ATOM_NET_WM_DESKTOP;
2873 ev.data.data32[0] = desktop;
2875 xcb_send_event(_ecore_xcb_conn, 0, root,
2876 XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT,
2878 } /* ecore_x_netwm_desktop_request_send */
2881 _ecore_x_netwm_startup_info_begin(Ecore_X_Window window,
2885 Ecore_X_Startup_Info *info;
2886 unsigned char exists = 0;
2891 info = eina_hash_find(startup_info, (void *)window);
2895 INF("Already got info for win: 0x%x", window);
2896 _ecore_x_netwm_startup_info_free(info);
2899 info = calloc(1, sizeof(Ecore_X_Startup_Info));
2905 info->buffer_size = 161;
2906 info->buffer = calloc(info->buffer_size, sizeof(char));
2909 _ecore_x_netwm_startup_info_free(info);
2913 memcpy(info->buffer, data, 20);
2915 info->buffer[info->length] = 0;
2917 eina_hash_modify(startup_info, (void *)info->win, info);
2919 eina_hash_add(startup_info, (void *)info->win, info);
2921 if (strlen(info->buffer) != 20)
2923 /* We have a '\0' in there, the message is done */
2924 _ecore_x_netwm_startup_info_process(info);
2933 } /* _ecore_x_netwm_startup_info_begin */
2936 _ecore_x_netwm_startup_info(Ecore_X_Window window,
2940 Ecore_X_Startup_Info *info;
2946 info = eina_hash_find(startup_info, (void *)window);
2950 if ((info->length + 20) > info->buffer_size)
2952 info->buffer_size += 160;
2953 info->buffer = realloc(info->buffer, info->buffer_size * sizeof(char));
2956 eina_hash_del(startup_info, (void *)info->win);
2957 _ecore_x_netwm_startup_info_free(info);
2962 memcpy(info->buffer + info->length, data, 20);
2963 p = info->buffer + info->length;
2965 info->buffer[info->length] = 0;
2966 if (strlen(p) != 20)
2968 /* We have a '\0' in there, the message is done */
2969 _ecore_x_netwm_startup_info_process(info);
2978 } /* _ecore_x_netwm_startup_info */
2981 * Set UTF-8 string property
2984 _ecore_x_window_prop_string_utf8_set(Ecore_X_Window window,
2988 xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, window,
2989 atom, ECORE_X_ATOM_UTF8_STRING,
2990 8, strlen(str), str);
2991 } /* _ecore_x_window_prop_string_utf8_set */
2994 _ecore_x_window_prop_string_utf8_get_prefetch(Ecore_X_Window window,
2997 xcb_get_property_cookie_t cookie;
2999 cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, window,
3000 atom, ECORE_X_ATOM_UTF8_STRING,
3002 _ecore_xcb_cookie_cache(cookie.sequence);
3003 } /* _ecore_x_window_prop_string_utf8_get_prefetch */
3006 _ecore_x_window_prop_string_utf8_get_fetch(void)
3008 xcb_get_property_cookie_t cookie;
3009 xcb_get_property_reply_t *reply;
3011 cookie.sequence = _ecore_xcb_cookie_get();
3012 reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL);
3013 _ecore_xcb_reply_cache(reply);
3014 } /* _ecore_x_window_prop_string_utf8_get_fetch */
3017 * Get UTF-8 string property
3018 * call _ecore_x_window_prop_string_utf8_get_prefetch() before.
3021 _ecore_x_window_prop_string_utf8_get(Ecore_X_Window window __UNUSED__,
3022 Ecore_X_Atom atom __UNUSED__)
3024 xcb_get_property_reply_t *reply;
3028 reply = _ecore_xcb_reply_get();
3032 if ((reply->format != 8) ||
3033 (reply->value_len <= 0))
3036 length = reply->value_len;
3037 str = (char *)malloc (sizeof (char) * (length + 1));
3043 memcpy(str, xcb_get_property_value(reply), length);
3047 } /* _ecore_x_window_prop_string_utf8_get */
3051 * Process startup info
3054 _ecore_x_netwm_startup_info_process(Ecore_X_Startup_Info *info)
3056 Ecore_X_Event_Startup_Sequence *e;
3060 p = strchr(info->buffer, ':');
3063 eina_hash_del(startup_info, (void *)info->win);
3064 _ecore_x_netwm_startup_info_free(info);
3069 if (!strcmp(info->buffer, "new"))
3072 event = ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE;
3074 event = ECORE_X_EVENT_STARTUP_SEQUENCE_NEW;
3078 else if (!strcmp(info->buffer, "change"))
3080 event = ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE;
3082 else if (!strcmp(info->buffer, "remove"))
3083 event = ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE;
3086 eina_hash_del(startup_info, (void *)info->win);
3087 _ecore_x_netwm_startup_info_free(info);
3093 if (!_ecore_x_netwm_startup_info_parse(info, p))
3095 eina_hash_del(startup_info, (void *)info->win);
3096 _ecore_x_netwm_startup_info_free(info);
3102 e = calloc(1, sizeof(Ecore_X_Event_Startup_Sequence));
3105 eina_hash_del(startup_info, (void *)info->win);
3106 _ecore_x_netwm_startup_info_free(info);
3111 ecore_event_add(event, e, NULL, NULL);
3114 if (event == ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE)
3116 eina_hash_del(startup_info, (void *)info->win);
3117 _ecore_x_netwm_startup_info_free(info);
3121 /* Discard buffer */
3123 info->buffer[0] = 0;
3127 } /* _ecore_x_netwm_startup_info_process */
3130 * Parse startup info
3133 _ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info,
3138 int in_quot_sing, in_quot_dbl, escaped;
3144 while (*data == ' ') data++;
3147 data = strchr(key, '=');
3162 if ((pp - value) >= 1024)
3171 else if (in_quot_sing)
3175 else if (*p == '\'')
3183 else if (in_quot_dbl)
3187 else if (*p == '\"')
3199 else if (*p == '\'')
3201 else if (*p == '\"')
3216 if ((in_quot_dbl) || (in_quot_sing))
3223 if (!strcmp(key, "ID"))
3225 if ((info->id) && (strcmp(info->id, value)))
3228 info->id = strdup(value);
3229 p = strstr(value, "_TIME");
3232 info->timestamp = atoi(p + 5);
3235 else if (!strcmp(key, "NAME"))
3240 info->name = strdup(value);
3242 else if (!strcmp(key, "SCREEN"))
3244 info->screen = atoi(value);
3246 else if (!strcmp(key, "BIN"))
3251 info->bin = strdup(value);
3253 else if (!strcmp(key, "ICON"))
3258 info->icon = strdup(value);
3260 else if (!strcmp(key, "DESKTOP"))
3262 info->desktop = atoi(value);
3264 else if (!strcmp(key, "TIMESTAMP"))
3266 if (!info->timestamp)
3267 info->timestamp = atoi(value);
3269 else if (!strcmp(key, "DESCRIPTION"))
3271 if (info->description)
3272 free(info->description);
3274 info->description = strdup(value);
3276 else if (!strcmp(key, "WMCLASS"))
3279 free(info->wmclass);
3281 info->wmclass = strdup(value);
3283 else if (!strcmp(key, "SILENT"))
3285 info->silent = atoi(value);
3289 WRN("Ecore X Sequence, Unknown: %s=%s", key, value);
3296 } /* _ecore_x_netwm_startup_info_parse */
3301 * Free startup info struct
3304 _ecore_x_netwm_startup_info_free(void *data)
3306 Ecore_X_Startup_Info *info;
3327 if (info->description)
3328 free(info->description);
3331 free(info->wmclass);
3334 } /* _ecore_x_netwm_startup_info_free */
3337 * Is screen composited?
3340 /* FIXME: one round trip can be removed. Can we keep it ? */
3343 * Check whether a screen is composited or not.
3344 * @param screen The screen index.
3346 * Return 1 if @p screen is composited, 0 otherwise.
3347 * @ingroup Ecore_X_NetWM_Group
3350 ecore_x_screen_is_composited(int screen)
3353 xcb_intern_atom_cookie_t cookie_atom;
3354 xcb_get_selection_owner_cookie_t cookie_owner;
3355 xcb_intern_atom_reply_t *reply_atom;
3356 xcb_get_selection_owner_reply_t *reply_owner;
3357 Ecore_X_Window window;
3360 snprintf(buf, sizeof(buf), "_NET_WM_CM_S%d", screen);
3361 cookie_atom = xcb_intern_atom_unchecked(_ecore_xcb_conn, 1,
3363 reply_atom = xcb_intern_atom_reply(_ecore_xcb_conn, cookie_atom, NULL);
3367 atom = reply_atom->atom;
3370 cookie_owner = xcb_get_selection_owner_unchecked(_ecore_xcb_conn, atom);
3371 reply_owner = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie_owner, NULL);
3375 window = reply_owner->owner;
3378 return window != XCB_NONE;
3379 } /* ecore_x_screen_is_composited */