2 * Various ICCCM related functions.
4 * This is ALL the code involving anything ICCCM related. for both WM and
10 #endif /* ifdef HAVE_CONFIG_H */
16 #include "ecore_x_private.h"
18 #include "Ecore_X_Atoms.h"
21 ecore_x_icccm_init(void)
23 LOGFN(__FILE__, __LINE__, __FUNCTION__);
27 ecore_x_icccm_state_set(Ecore_X_Window win,
28 Ecore_X_Window_State_Hint state)
32 LOGFN(__FILE__, __LINE__, __FUNCTION__);
33 if (state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN)
34 c[0] = WithdrawnState;
35 else if (state == ECORE_X_WINDOW_STATE_HINT_NORMAL)
37 else if (state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
41 XChangeProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_STATE,
42 ECORE_X_ATOM_WM_STATE, 32, PropModeReplace,
43 (unsigned char *)c, 2);
44 if (_ecore_xlib_sync) ecore_x_sync();
47 EAPI Ecore_X_Window_State_Hint
48 ecore_x_icccm_state_get(Ecore_X_Window win)
50 unsigned char *prop_ret = NULL;
52 unsigned long bytes_after, num_ret;
54 Ecore_X_Window_State_Hint hint;
56 LOGFN(__FILE__, __LINE__, __FUNCTION__);
57 hint = ECORE_X_WINDOW_STATE_HINT_NONE;
58 XGetWindowProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_STATE,
59 0, 0x7fffffff, False, ECORE_X_ATOM_WM_STATE,
60 &type_ret, &format_ret, &num_ret, &bytes_after,
62 if (_ecore_xlib_sync) ecore_x_sync();
63 if ((prop_ret) && (num_ret == 2))
65 if (prop_ret[0] == WithdrawnState)
66 hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
67 else if (prop_ret[0] == NormalState)
68 hint = ECORE_X_WINDOW_STATE_HINT_NORMAL;
69 else if (prop_ret[0] == IconicState)
70 hint = ECORE_X_WINDOW_STATE_HINT_ICONIC;
80 ecore_x_icccm_delete_window_send(Ecore_X_Window win,
83 LOGFN(__FILE__, __LINE__, __FUNCTION__);
84 ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
85 ECORE_X_EVENT_MASK_NONE,
86 ECORE_X_ATOM_WM_DELETE_WINDOW,
91 ecore_x_icccm_take_focus_send(Ecore_X_Window win,
94 LOGFN(__FILE__, __LINE__, __FUNCTION__);
95 ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
96 ECORE_X_EVENT_MASK_NONE,
97 ECORE_X_ATOM_WM_TAKE_FOCUS,
102 ecore_x_icccm_save_yourself_send(Ecore_X_Window win,
105 LOGFN(__FILE__, __LINE__, __FUNCTION__);
106 ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
107 ECORE_X_EVENT_MASK_NONE,
108 ECORE_X_ATOM_WM_SAVE_YOURSELF,
113 ecore_x_icccm_move_resize_send(Ecore_X_Window win,
121 LOGFN(__FILE__, __LINE__, __FUNCTION__);
122 ev.type = ConfigureNotify;
123 ev.xconfigure.display = _ecore_x_disp;
124 ev.xconfigure.event = win;
125 ev.xconfigure.window = win;
128 ev.xconfigure.width = w;
129 ev.xconfigure.height = h;
130 ev.xconfigure.border_width = 0;
131 ev.xconfigure.above = None;
132 ev.xconfigure.override_redirect = False;
133 XSendEvent(_ecore_x_disp, win, False, StructureNotifyMask, &ev);
134 if (_ecore_xlib_sync) ecore_x_sync();
138 ecore_x_icccm_hints_set(Ecore_X_Window win,
139 Eina_Bool accepts_focus,
140 Ecore_X_Window_State_Hint initial_state,
141 Ecore_X_Pixmap icon_pixmap,
142 Ecore_X_Pixmap icon_mask,
143 Ecore_X_Window icon_window,
144 Ecore_X_Window window_group,
149 hints = XAllocWMHints();
153 LOGFN(__FILE__, __LINE__, __FUNCTION__);
154 hints->flags = InputHint | StateHint;
155 hints->input = accepts_focus;
156 if (initial_state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN)
157 hints->initial_state = WithdrawnState;
158 else if (initial_state == ECORE_X_WINDOW_STATE_HINT_NORMAL)
159 hints->initial_state = NormalState;
160 else if (initial_state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
161 hints->initial_state = IconicState;
163 if (icon_pixmap != 0)
165 hints->icon_pixmap = icon_pixmap;
166 hints->flags |= IconPixmapHint;
171 hints->icon_mask = icon_mask;
172 hints->flags |= IconMaskHint;
175 if (icon_window != 0)
177 hints->icon_window = icon_window;
178 hints->flags |= IconWindowHint;
181 if (window_group != 0)
183 hints->window_group = window_group;
184 hints->flags |= WindowGroupHint;
188 hints->flags |= XUrgencyHint;
190 XSetWMHints(_ecore_x_disp, win, hints);
191 if (_ecore_xlib_sync) ecore_x_sync();
196 ecore_x_icccm_hints_get(Ecore_X_Window win,
197 Eina_Bool *accepts_focus,
198 Ecore_X_Window_State_Hint *initial_state,
199 Ecore_X_Pixmap *icon_pixmap,
200 Ecore_X_Pixmap *icon_mask,
201 Ecore_X_Window *icon_window,
202 Ecore_X_Window *window_group,
203 Eina_Bool *is_urgent)
207 LOGFN(__FILE__, __LINE__, __FUNCTION__);
209 *accepts_focus = EINA_TRUE;
212 *initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
227 *is_urgent = EINA_FALSE;
229 hints = XGetWMHints(_ecore_x_disp, win);
230 if (_ecore_xlib_sync) ecore_x_sync();
233 if ((hints->flags & InputHint) && (accepts_focus))
236 *accepts_focus = EINA_TRUE;
238 *accepts_focus = EINA_FALSE;
241 if ((hints->flags & StateHint) && (initial_state))
243 if (hints->initial_state == WithdrawnState)
244 *initial_state = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
245 else if (hints->initial_state == NormalState)
246 *initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
247 else if (hints->initial_state == IconicState)
248 *initial_state = ECORE_X_WINDOW_STATE_HINT_ICONIC;
251 if ((hints->flags & IconPixmapHint) && (icon_pixmap))
252 *icon_pixmap = hints->icon_pixmap;
254 if ((hints->flags & IconMaskHint) && (icon_mask))
255 *icon_mask = hints->icon_mask;
257 if ((hints->flags & IconWindowHint) && (icon_window))
258 *icon_window = hints->icon_window;
260 if ((hints->flags & WindowGroupHint) && (window_group))
261 *window_group = hints->window_group;
263 if ((hints->flags & XUrgencyHint) && (is_urgent))
264 *is_urgent = EINA_TRUE;
274 ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
275 Eina_Bool request_pos,
276 Ecore_X_Gravity gravity,
291 LOGFN(__FILE__, __LINE__, __FUNCTION__);
292 if (!XGetWMNormalHints(_ecore_x_disp, win, &hint, &mask))
293 memset(&hint, 0, sizeof(XSizeHints));
294 if (_ecore_xlib_sync) ecore_x_sync();
298 hint.flags |= USPosition;
300 if (gravity != ECORE_X_GRAVITY_NW)
302 hint.flags |= PWinGravity;
303 hint.win_gravity = gravity;
306 if ((min_w > 0) || (min_h > 0))
308 hint.flags |= PMinSize;
309 hint.min_width = min_w;
310 hint.min_height = min_h;
313 if ((max_w > 0) || (max_h > 0))
315 hint.flags |= PMaxSize;
316 hint.max_width = max_w;
317 hint.max_height = max_h;
320 if ((base_w > 0) || (base_h > 0))
322 hint.flags |= PBaseSize;
323 hint.base_width = base_w;
324 hint.base_height = base_h;
327 if ((step_x > 1) || (step_y > 1))
329 hint.flags |= PResizeInc;
330 hint.width_inc = step_x;
331 hint.height_inc = step_y;
334 if ((min_aspect > 0.0) || (max_aspect > 0.0))
336 hint.flags |= PAspect;
337 hint.min_aspect.x = min_aspect * 10000;
338 hint.min_aspect.y = 10000;
339 hint.max_aspect.x = max_aspect * 10000;
340 hint.max_aspect.y = 10000;
343 XSetWMNormalHints(_ecore_x_disp, win, &hint);
344 if (_ecore_xlib_sync) ecore_x_sync();
348 ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
349 Eina_Bool *request_pos,
350 Ecore_X_Gravity *gravity,
365 int minw = 0, minh = 0;
366 int maxw = 32767, maxh = 32767;
367 int basew = -1, baseh = -1;
368 int stepx = -1, stepy = -1;
369 double mina = 0.0, maxa = 0.0;
371 LOGFN(__FILE__, __LINE__, __FUNCTION__);
372 if (!XGetWMNormalHints(_ecore_x_disp, win, &hint, &mask))
374 if (_ecore_xlib_sync) ecore_x_sync();
378 if ((hint.flags & USPosition) || ((hint.flags & PPosition)))
381 *request_pos = EINA_TRUE;
383 else if (request_pos)
384 *request_pos = EINA_FALSE;
386 if (hint.flags & PWinGravity)
389 *gravity = hint.win_gravity;
392 *gravity = ECORE_X_GRAVITY_NW;
394 if (hint.flags & PMinSize)
396 minw = hint.min_width;
397 minh = hint.min_height;
400 if (hint.flags & PMaxSize)
402 maxw = hint.max_width;
403 maxh = hint.max_height;
411 if (hint.flags & PBaseSize)
413 basew = hint.base_width;
414 baseh = hint.base_height;
422 if (hint.flags & PResizeInc)
424 stepx = hint.width_inc;
425 stepy = hint.height_inc;
433 if (hint.flags & PAspect)
435 if (hint.min_aspect.y > 0)
436 mina = ((double)hint.min_aspect.x) / ((double)hint.min_aspect.y);
438 if (hint.max_aspect.y > 0)
439 maxa = ((double)hint.max_aspect.x) / ((double)hint.max_aspect.y);
476 ecore_x_icccm_title_set(Ecore_X_Window win,
486 LOGFN(__FILE__, __LINE__, __FUNCTION__);
488 #ifdef X_HAVE_UTF8_STRING
491 Xutf8TextListToTextProperty(_ecore_x_disp, list, 1, XUTF8StringStyle,
493 #else /* ifdef X_HAVE_UTF8_STRING */
496 XmbTextListToTextProperty(_ecore_x_disp, list, 1, XStdICCTextStyle,
498 #endif /* ifdef X_HAVE_UTF8_STRING */
499 if (_ecore_xlib_sync) ecore_x_sync();
502 XSetWMName(_ecore_x_disp, win, &xprop);
503 if (_ecore_xlib_sync) ecore_x_sync();
507 else if (XStringListToTextProperty(list, 1, &xprop) >= Success)
509 XSetWMName(_ecore_x_disp, win, &xprop);
510 if (_ecore_xlib_sync) ecore_x_sync();
519 ecore_x_icccm_title_get(Ecore_X_Window win)
523 LOGFN(__FILE__, __LINE__, __FUNCTION__);
525 if (XGetWMName(_ecore_x_disp, win, &xprop) >= Success)
527 if (_ecore_xlib_sync) ecore_x_sync();
535 if (xprop.encoding == ECORE_X_ATOM_UTF8_STRING)
536 t = strdup((char *)xprop.value);
539 /* convert to utf8 */
540 #ifdef X_HAVE_UTF8_STRING
541 ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop,
543 #else /* ifdef X_HAVE_UTF8_STRING */
544 ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop,
546 #endif /* ifdef X_HAVE_UTF8_STRING */
547 if (_ecore_xlib_sync) ecore_x_sync();
549 if ((ret == XLocaleNotSupported) ||
550 (ret == XNoMemory) || (ret == XConverterNotFound))
551 t = strdup((char *)xprop.value);
552 else if ((ret >= Success) && (num > 0))
556 XFreeStringList(list);
567 if (_ecore_xlib_sync) ecore_x_sync();
574 * Set protocol atoms explicitly
575 * @param win The Window
576 * @param protos An array of protocol atoms
577 * @param num the number of members of the array
580 ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win,
581 Ecore_X_Atom *protos,
584 Atom *protos2 = alloca(sizeof(Atom) * num);
587 for (i = 0; i < num; i++) protos2[i] = protos[i];
588 LOGFN(__FILE__, __LINE__, __FUNCTION__);
590 XSetWMProtocols(_ecore_x_disp, win, protos2, num);
592 XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_PROTOCOLS);
593 if (_ecore_xlib_sync) ecore_x_sync();
597 * Set or unset a wm protocol property.
598 * @param win The Window
599 * @param protocol The protocol to enable/disable
603 ecore_x_icccm_protocol_set(Ecore_X_Window win,
604 Ecore_X_WM_Protocol protocol,
609 int protos_count = 0;
613 /* Check for invalid values */
614 if (protocol >= ECORE_X_WM_PROTOCOL_NUM)
617 LOGFN(__FILE__, __LINE__, __FUNCTION__);
618 proto = _ecore_x_atoms_wm_protocols[protocol];
620 if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
625 if (_ecore_xlib_sync) ecore_x_sync();
626 for (i = 0; i < protos_count; i++)
628 if (protos[i] == proto)
637 Atom *new_protos = NULL;
642 new_protos = malloc((protos_count + 1) * sizeof(Atom));
646 for (i = 0; i < protos_count; i++)
647 new_protos[i] = protos[i];
648 new_protos[protos_count] = proto;
649 XSetWMProtocols(_ecore_x_disp, win, new_protos, protos_count + 1);
650 if (_ecore_xlib_sync) ecore_x_sync();
658 for (i = 0; i < protos_count; i++)
660 if (protos[i] == proto)
664 for (j = i + 1; j < protos_count; j++)
665 protos[j - 1] = protos[j];
666 if (protos_count > 1)
667 XSetWMProtocols(_ecore_x_disp, win, protos,
670 XDeleteProperty(_ecore_x_disp, win,
671 ECORE_X_ATOM_WM_PROTOCOLS);
672 if (_ecore_xlib_sync) ecore_x_sync();
685 * Determines whether a protocol is set for a window.
686 * @param win The Window
687 * @param protocol The protocol to query
688 * @return 1 if the protocol is set, else 0.
691 ecore_x_icccm_protocol_isset(Ecore_X_Window win,
692 Ecore_X_WM_Protocol protocol)
694 Atom proto, *protos = NULL;
695 int i, protos_count = 0;
696 Eina_Bool ret = EINA_FALSE;
698 /* check for invalid values */
699 if (protocol >= ECORE_X_WM_PROTOCOL_NUM)
702 LOGFN(__FILE__, __LINE__, __FUNCTION__);
703 proto = _ecore_x_atoms_wm_protocols[protocol];
705 if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
707 if (_ecore_xlib_sync) ecore_x_sync();
709 for (i = 0; i < protos_count; i++)
710 if (protos[i] == proto)
723 * Set a window name & class.
724 * @param win The window
725 * @param n The name string
726 * @param c The class string
728 * Set a window name * class
731 ecore_x_icccm_name_class_set(Ecore_X_Window win,
737 xch = XAllocClassHint();
741 LOGFN(__FILE__, __LINE__, __FUNCTION__);
742 xch->res_name = (char *)n;
743 xch->res_class = (char *)c;
744 XSetClassHint(_ecore_x_disp, win, xch);
745 if (_ecore_xlib_sync) ecore_x_sync();
750 * Get a window name & class.
751 * @param win The window
752 * @param n The name string
753 * @param c The class string
755 * Get a window name * class
758 ecore_x_icccm_name_class_get(Ecore_X_Window win,
764 LOGFN(__FILE__, __LINE__, __FUNCTION__);
772 xch.res_class = NULL;
773 if (XGetClassHint(_ecore_x_disp, win, &xch))
777 *n = strdup(xch.res_name);
781 *c = strdup(xch.res_class);
784 XFree(xch.res_class);
786 if (_ecore_xlib_sync) ecore_x_sync();
790 * Get a window client machine string.
791 * @param win The window
792 * @return The windows client machine string
794 * Return the client machine of a window. String must be free'd when done with.
797 ecore_x_icccm_client_machine_get(Ecore_X_Window win)
801 LOGFN(__FILE__, __LINE__, __FUNCTION__);
802 name = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_CLIENT_MACHINE);
807 * Sets the WM_COMMAND property for @a win.
809 * @param win The window.
810 * @param argc Number of arguments.
811 * @param argv Arguments.
814 ecore_x_icccm_command_set(Ecore_X_Window win,
818 LOGFN(__FILE__, __LINE__, __FUNCTION__);
819 XSetCommand(_ecore_x_disp, win, argv, argc);
820 if (_ecore_xlib_sync) ecore_x_sync();
824 * Get the WM_COMMAND property for @a win.
826 * Return the command of a window. String must be free'd when done with.
828 * @param win The window.
829 * @param argc Number of arguments.
830 * @param argv Arguments.
833 ecore_x_icccm_command_get(Ecore_X_Window win,
847 LOGFN(__FILE__, __LINE__, __FUNCTION__);
848 success = XGetCommand(_ecore_x_disp, win, &v, &c);
849 if (_ecore_xlib_sync) ecore_x_sync();
850 if (!success) return;
865 (*argv) = malloc(c * sizeof(char *));
875 for (i = 0; i < c; i++)
878 (*argv)[i] = strdup(v[i]);
880 (*argv)[i] = strdup("");
888 * Set a window icon name.
889 * @param win The window
890 * @param t The icon name string
892 * Set a window icon name
895 ecore_x_icccm_icon_name_set(Ecore_X_Window win,
902 LOGFN(__FILE__, __LINE__, __FUNCTION__);
904 #ifdef X_HAVE_UTF8_STRING
906 ret = Xutf8TextListToTextProperty(_ecore_x_disp, list, 1,
907 XUTF8StringStyle, &xprop);
908 #else /* ifdef X_HAVE_UTF8_STRING */
910 ret = XmbTextListToTextProperty(_ecore_x_disp, list, 1,
911 XStdICCTextStyle, &xprop);
912 #endif /* ifdef X_HAVE_UTF8_STRING */
913 if (_ecore_xlib_sync) ecore_x_sync();
916 XSetWMIconName(_ecore_x_disp, win, &xprop);
917 if (_ecore_xlib_sync) ecore_x_sync();
921 else if (XStringListToTextProperty(list, 1, &xprop) >= Success)
923 XSetWMIconName(_ecore_x_disp, win, &xprop);
924 if (_ecore_xlib_sync) ecore_x_sync();
933 * Get a window icon name.
934 * @param win The window
935 * @return The windows icon name string
937 * Return the icon name of a window. String must be free'd when done with.
940 ecore_x_icccm_icon_name_get(Ecore_X_Window win)
944 LOGFN(__FILE__, __LINE__, __FUNCTION__);
946 if (XGetWMIconName(_ecore_x_disp, win, &xprop) >= Success)
948 if (_ecore_xlib_sync) ecore_x_sync();
956 if (xprop.encoding == ECORE_X_ATOM_UTF8_STRING)
957 t = strdup((char *)xprop.value);
960 /* convert to utf8 */
961 #ifdef X_HAVE_UTF8_STRING
962 ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop,
964 #else /* ifdef X_HAVE_UTF8_STRING */
965 ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop,
967 #endif /* ifdef X_HAVE_UTF8_STRING */
968 if (_ecore_xlib_sync) ecore_x_sync();
970 if ((ret == XLocaleNotSupported) ||
971 (ret == XNoMemory) || (ret == XConverterNotFound))
972 t = strdup((char *)xprop.value);
973 else if (ret >= Success)
975 if ((num >= 1) && (list))
979 XFreeStringList(list);
991 if (_ecore_xlib_sync) ecore_x_sync();
998 * Add a subwindow to the list of windows that need a different colormap installed.
999 * @param win The toplevel window
1000 * @param subwin The subwindow to be added to the colormap windows list
1003 ecore_x_icccm_colormap_window_set(Ecore_X_Window win,
1004 Ecore_X_Window subwin)
1007 unsigned char *old_data = NULL;
1008 unsigned char *data = NULL;
1009 Window *oldset = NULL;
1010 Window *newset = NULL;
1012 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1013 if (!ecore_x_window_prop_property_get(win,
1014 ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
1015 XA_WINDOW, 32, &old_data, &num))
1017 newset = calloc(1, sizeof(Window));
1020 if (old_data) free(old_data);
1026 data = (unsigned char *)newset;
1030 newset = calloc(num + 1, sizeof(Window));
1031 oldset = (Window *)old_data;
1034 if (old_data) free(old_data);
1038 for (i = 0; i < num; ++i)
1040 if (oldset[i] == subwin)
1047 newset[i] = oldset[i];
1050 newset[num++] = subwin;
1051 data = (unsigned char *)newset;
1054 ecore_x_window_prop_property_set(win,
1055 ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
1056 XA_WINDOW, 32, data, num);
1062 * Remove a window from the list of colormap windows.
1063 * @param win The toplevel window
1064 * @param subwin The window to be removed from the colormap window list.
1067 ecore_x_icccm_colormap_window_unset(Ecore_X_Window win,
1068 Ecore_X_Window subwin)
1070 int num = 0, i, j, k = 0;
1071 unsigned char *old_data = NULL;
1072 unsigned char *data = NULL;
1073 Window *oldset = NULL;
1074 Window *newset = NULL;
1076 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1077 if (!ecore_x_window_prop_property_get(win,
1078 ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
1079 XA_WINDOW, 32, &old_data, &num))
1081 if (old_data) free(old_data);
1085 oldset = (Window *)old_data;
1086 for (i = 0; i < num; i++)
1088 if (oldset[i] == subwin)
1092 XDeleteProperty(_ecore_x_disp,
1093 win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS);
1094 if (_ecore_xlib_sync) ecore_x_sync();
1102 newset = calloc(num - 1, sizeof(Window));
1103 data = (unsigned char *)newset;
1104 for (j = 0; j < num; ++j)
1105 if (oldset[j] != subwin)
1106 newset[k++] = oldset[j];
1108 ecore_x_window_prop_property_set(
1110 ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
1129 * Specify that a window is transient for another top-level window and should be handled accordingly.
1130 * @param win the transient window
1131 * @param forwin the toplevel window
1134 ecore_x_icccm_transient_for_set(Ecore_X_Window win,
1135 Ecore_X_Window forwin)
1137 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1138 XSetTransientForHint(_ecore_x_disp, win, forwin);
1139 if (_ecore_xlib_sync) ecore_x_sync();
1143 * Remove the transient_for setting from a window.
1144 * @param win The window
1147 ecore_x_icccm_transient_for_unset(Ecore_X_Window win)
1149 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1150 XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_TRANSIENT_FOR);
1151 if (_ecore_xlib_sync) ecore_x_sync();
1155 * Get the window this window is transient for, if any.
1156 * @param win The window to check
1157 * @return The window ID of the top-level window, or 0 if the property does not exist.
1160 ecore_x_icccm_transient_for_get(Ecore_X_Window win)
1165 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1166 success = XGetTransientForHint(_ecore_x_disp, win, &forwin);
1167 if (_ecore_xlib_sync) ecore_x_sync();
1169 return (Ecore_X_Window)forwin;
1175 * Set the window role hint.
1176 * @param win The window
1177 * @param role The role string
1180 ecore_x_icccm_window_role_set(Ecore_X_Window win,
1183 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1184 ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_WINDOW_ROLE,
1189 * Get the window role.
1190 * @param win The window
1191 * @return The window's role string.
1194 ecore_x_icccm_window_role_get(Ecore_X_Window win)
1196 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1197 return ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_WINDOW_ROLE);
1201 * Set the window's client leader.
1202 * @param win The window
1203 * @param l The client leader window
1205 * All non-transient top-level windows created by an app other than
1206 * the main window must have this property set to the app's main window.
1209 ecore_x_icccm_client_leader_set(Ecore_X_Window win,
1212 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1213 ecore_x_window_prop_window_set(win, ECORE_X_ATOM_WM_CLIENT_LEADER,
1218 * Get the window's client leader.
1219 * @param win The window
1220 * @return The window's client leader window, or 0 if unset */
1222 ecore_x_icccm_client_leader_get(Ecore_X_Window win)
1226 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1227 if (ecore_x_window_prop_window_get(win, ECORE_X_ATOM_WM_CLIENT_LEADER,
1235 ecore_x_icccm_iconic_request_send(Ecore_X_Window win,
1236 Ecore_X_Window root)
1243 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1245 root = DefaultRootWindow(_ecore_x_disp);
1247 xev.xclient.type = ClientMessage;
1248 xev.xclient.serial = 0;
1249 xev.xclient.send_event = True;
1250 xev.xclient.display = _ecore_x_disp;
1251 xev.xclient.window = win;
1252 xev.xclient.format = 32;
1253 xev.xclient.message_type = ECORE_X_ATOM_WM_CHANGE_STATE;
1254 xev.xclient.data.l[0] = IconicState;
1256 XSendEvent(_ecore_x_disp, root, False,
1257 SubstructureNotifyMask | SubstructureRedirectMask, &xev);
1258 if (_ecore_xlib_sync) ecore_x_sync();
1261 /* FIXME: there are older E hints, gnome hints and mwm hints and new netwm */
1262 /* hints. each should go in their own file/section so we know which */
1263 /* is which. also older kde hints too. we should try support as much */
1264 /* as makese sense to support */