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__);
24 } /* ecore_x_icccm_init */
27 ecore_x_icccm_state_set(Ecore_X_Window win, Ecore_X_Window_State_Hint state)
31 LOGFN(__FILE__, __LINE__, __FUNCTION__);
32 if (state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN)
33 c[0] = WithdrawnState;
34 else if (state == ECORE_X_WINDOW_STATE_HINT_NORMAL)
36 else if (state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
40 XChangeProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_STATE,
41 ECORE_X_ATOM_WM_STATE, 32, PropModeReplace,
42 (unsigned char *)c, 2);
43 } /* ecore_x_icccm_state_set */
45 EAPI Ecore_X_Window_State_Hint
46 ecore_x_icccm_state_get(Ecore_X_Window win)
48 unsigned char *prop_ret = NULL;
50 unsigned long bytes_after, num_ret;
52 Ecore_X_Window_State_Hint hint;
54 LOGFN(__FILE__, __LINE__, __FUNCTION__);
55 hint = ECORE_X_WINDOW_STATE_HINT_NONE;
56 XGetWindowProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_STATE,
57 0, 0x7fffffff, False, ECORE_X_ATOM_WM_STATE,
58 &type_ret, &format_ret, &num_ret, &bytes_after,
60 if ((prop_ret) && (num_ret == 2))
62 if (prop_ret[0] == WithdrawnState)
63 hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
64 else if (prop_ret[0] == NormalState)
65 hint = ECORE_X_WINDOW_STATE_HINT_NORMAL;
66 else if (prop_ret[0] == IconicState)
67 hint = ECORE_X_WINDOW_STATE_HINT_ICONIC;
74 } /* ecore_x_icccm_state_get */
77 ecore_x_icccm_delete_window_send(Ecore_X_Window win, Ecore_X_Time t)
79 LOGFN(__FILE__, __LINE__, __FUNCTION__);
80 ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
81 ECORE_X_EVENT_MASK_NONE,
82 ECORE_X_ATOM_WM_DELETE_WINDOW,
84 } /* ecore_x_icccm_delete_window_send */
87 ecore_x_icccm_take_focus_send(Ecore_X_Window win, Ecore_X_Time t)
89 LOGFN(__FILE__, __LINE__, __FUNCTION__);
90 ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
91 ECORE_X_EVENT_MASK_NONE,
92 ECORE_X_ATOM_WM_TAKE_FOCUS,
94 } /* ecore_x_icccm_take_focus_send */
97 ecore_x_icccm_save_yourself_send(Ecore_X_Window win, Ecore_X_Time t)
99 LOGFN(__FILE__, __LINE__, __FUNCTION__);
100 ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS,
101 ECORE_X_EVENT_MASK_NONE,
102 ECORE_X_ATOM_WM_SAVE_YOURSELF,
104 } /* ecore_x_icccm_save_yourself_send */
107 ecore_x_icccm_move_resize_send(Ecore_X_Window win, int x, int y, int w, int h)
111 LOGFN(__FILE__, __LINE__, __FUNCTION__);
112 ev.type = ConfigureNotify;
113 ev.xconfigure.display = _ecore_x_disp;
114 ev.xconfigure.event = win;
115 ev.xconfigure.window = win;
118 ev.xconfigure.width = w;
119 ev.xconfigure.height = h;
120 ev.xconfigure.border_width = 0;
121 ev.xconfigure.above = None;
122 ev.xconfigure.override_redirect = False;
123 XSendEvent(_ecore_x_disp, win, False, StructureNotifyMask, &ev);
124 } /* ecore_x_icccm_move_resize_send */
127 ecore_x_icccm_hints_set(Ecore_X_Window win,
129 Ecore_X_Window_State_Hint initial_state,
130 Ecore_X_Pixmap icon_pixmap,
131 Ecore_X_Pixmap icon_mask,
132 Ecore_X_Window icon_window,
133 Ecore_X_Window window_group, int is_urgent)
137 hints = XAllocWMHints();
141 LOGFN(__FILE__, __LINE__, __FUNCTION__);
142 hints->flags = InputHint | StateHint;
143 hints->input = accepts_focus;
144 if (initial_state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN)
145 hints->initial_state = WithdrawnState;
146 else if (initial_state == ECORE_X_WINDOW_STATE_HINT_NORMAL)
147 hints->initial_state = NormalState;
148 else if (initial_state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
149 hints->initial_state = IconicState;
151 if (icon_pixmap != 0)
153 hints->icon_pixmap = icon_pixmap;
154 hints->flags |= IconPixmapHint;
159 hints->icon_mask = icon_mask;
160 hints->flags |= IconMaskHint;
163 if (icon_window != 0)
165 hints->icon_window = icon_window;
166 hints->flags |= IconWindowHint;
169 if (window_group != 0)
171 hints->window_group = window_group;
172 hints->flags |= WindowGroupHint;
176 hints->flags |= XUrgencyHint;
178 XSetWMHints(_ecore_x_disp, win, hints);
180 } /* ecore_x_icccm_hints_set */
183 ecore_x_icccm_hints_get(Ecore_X_Window win,
185 Ecore_X_Window_State_Hint *initial_state,
186 Ecore_X_Pixmap *icon_pixmap,
187 Ecore_X_Pixmap *icon_mask,
188 Ecore_X_Window *icon_window,
189 Ecore_X_Window *window_group, int *is_urgent)
193 LOGFN(__FILE__, __LINE__, __FUNCTION__);
198 *initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
215 hints = XGetWMHints(_ecore_x_disp, win);
218 if ((hints->flags & InputHint) && (accepts_focus))
226 if ((hints->flags & StateHint) && (initial_state))
228 if (hints->initial_state == WithdrawnState)
229 *initial_state = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
230 else if (hints->initial_state == NormalState)
231 *initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
232 else if (hints->initial_state == IconicState)
233 *initial_state = ECORE_X_WINDOW_STATE_HINT_ICONIC;
236 if ((hints->flags & IconPixmapHint) && (icon_pixmap))
237 *icon_pixmap = hints->icon_pixmap;
239 if ((hints->flags & IconMaskHint) && (icon_mask))
240 *icon_mask = hints->icon_mask;
242 if ((hints->flags & IconWindowHint) && (icon_window))
243 *icon_window = hints->icon_window;
245 if ((hints->flags & WindowGroupHint) && (window_group))
246 *window_group = hints->window_group;
248 if ((hints->flags & XUrgencyHint) && (is_urgent))
256 } /* ecore_x_icccm_hints_get */
259 ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
261 Ecore_X_Gravity gravity,
262 int min_w, int min_h,
263 int max_w, int max_h,
264 int base_w, int base_h,
265 int step_x, int step_y,
266 double min_aspect, double max_aspect)
271 LOGFN(__FILE__, __LINE__, __FUNCTION__);
272 if (!XGetWMNormalHints(_ecore_x_disp, win, &hint, &mask))
273 memset(&hint, 0, sizeof(XSizeHints));
277 hint.flags |= USPosition;
279 if (gravity != ECORE_X_GRAVITY_NW)
281 hint.flags |= PWinGravity;
282 hint.win_gravity = gravity;
285 if ((min_w > 0) || (min_h > 0))
287 hint.flags |= PMinSize;
288 hint.min_width = min_w;
289 hint.min_height = min_h;
292 if ((max_w > 0) || (max_h > 0))
294 hint.flags |= PMaxSize;
295 hint.max_width = max_w;
296 hint.max_height = max_h;
299 if ((base_w > 0) || (base_h > 0))
301 hint.flags |= PBaseSize;
302 hint.base_width = base_w;
303 hint.base_height = base_h;
306 if ((step_x > 1) || (step_y > 1))
308 hint.flags |= PResizeInc;
309 hint.width_inc = step_x;
310 hint.height_inc = step_y;
313 if ((min_aspect > 0.0) || (max_aspect > 0.0))
315 hint.flags |= PAspect;
316 hint.min_aspect.x = min_aspect * 10000;
317 hint.min_aspect.y = 10000;
318 hint.max_aspect.x = max_aspect * 10000;
319 hint.max_aspect.y = 10000;
322 XSetWMNormalHints(_ecore_x_disp, win, &hint);
323 } /* ecore_x_icccm_size_pos_hints_set */
326 ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
328 Ecore_X_Gravity *gravity,
329 int *min_w, int *min_h,
330 int *max_w, int *max_h,
331 int *base_w, int *base_h,
332 int *step_x, int *step_y,
333 double *min_aspect, double *max_aspect)
338 int minw = 0, minh = 0;
339 int maxw = 32767, maxh = 32767;
340 int basew = -1, baseh = -1;
341 int stepx = -1, stepy = -1;
342 double mina = 0.0, maxa = 0.0;
344 LOGFN(__FILE__, __LINE__, __FUNCTION__);
345 if (!XGetWMNormalHints(_ecore_x_disp, win, &hint, &mask))
348 if ((hint.flags & USPosition) || ((hint.flags & PPosition)))
353 else if (request_pos)
356 if (hint.flags & PWinGravity)
359 *gravity = hint.win_gravity;
362 *gravity = ECORE_X_GRAVITY_NW;
364 if (hint.flags & PMinSize)
366 minw = hint.min_width;
367 minh = hint.min_height;
370 if (hint.flags & PMaxSize)
372 maxw = hint.max_width;
373 maxh = hint.max_height;
381 if (hint.flags & PBaseSize)
383 basew = hint.base_width;
384 baseh = hint.base_height;
392 if (hint.flags & PResizeInc)
394 stepx = hint.width_inc;
395 stepy = hint.height_inc;
403 if (hint.flags & PAspect)
405 if (hint.min_aspect.y > 0)
406 mina = ((double)hint.min_aspect.x) / ((double)hint.min_aspect.y);
408 if (hint.max_aspect.y > 0)
409 maxa = ((double)hint.max_aspect.x) / ((double)hint.max_aspect.y);
443 } /* ecore_x_icccm_size_pos_hints_get */
446 ecore_x_icccm_title_set(Ecore_X_Window win, const char *t)
455 LOGFN(__FILE__, __LINE__, __FUNCTION__);
457 #ifdef X_HAVE_UTF8_STRING
460 Xutf8TextListToTextProperty(_ecore_x_disp, list, 1, XUTF8StringStyle,
462 #else /* ifdef X_HAVE_UTF8_STRING */
465 XmbTextListToTextProperty(_ecore_x_disp, list, 1, XStdICCTextStyle,
467 #endif /* ifdef X_HAVE_UTF8_STRING */
470 XSetWMName(_ecore_x_disp, win, &xprop);
474 else if (XStringListToTextProperty(list, 1, &xprop) >= Success)
476 XSetWMName(_ecore_x_disp, win, &xprop);
482 } /* ecore_x_icccm_title_set */
485 ecore_x_icccm_title_get(Ecore_X_Window win)
489 LOGFN(__FILE__, __LINE__, __FUNCTION__);
491 if (XGetWMName(_ecore_x_disp, win, &xprop) >= Success)
500 if (xprop.encoding == ECORE_X_ATOM_UTF8_STRING)
501 t = strdup((char *)xprop.value);
504 /* convert to utf8 */
505 #ifdef X_HAVE_UTF8_STRING
506 ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop,
508 #else /* ifdef X_HAVE_UTF8_STRING */
509 ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop,
511 #endif /* ifdef X_HAVE_UTF8_STRING */
513 if ((ret == XLocaleNotSupported) ||
514 (ret == XNoMemory) || (ret == XConverterNotFound))
515 t = strdup((char *)xprop.value);
516 else if ((ret >= Success) && (num > 0))
520 XFreeStringList(list);
531 } /* ecore_x_icccm_title_get */
534 * Set protocol atoms explicitly
535 * @param win The Window
536 * @param protos An array of protocol atoms
537 * @param num the number of members of the array
540 ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win,
541 Ecore_X_Atom *protos,
544 LOGFN(__FILE__, __LINE__, __FUNCTION__);
546 XSetWMProtocols(_ecore_x_disp, win, (Atom *)(protos), num);
548 XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_PROTOCOLS);
549 } /* ecore_x_icccm_protocol_atoms_set */
552 * Set or unset a wm protocol property.
553 * @param win The Window
554 * @param protocol The protocol to enable/disable
558 ecore_x_icccm_protocol_set(Ecore_X_Window win,
559 Ecore_X_WM_Protocol protocol, int on)
563 int protos_count = 0;
567 /* Check for invalid values */
568 if (protocol >= ECORE_X_WM_PROTOCOL_NUM)
571 LOGFN(__FILE__, __LINE__, __FUNCTION__);
572 proto = _ecore_x_atoms_wm_protocols[protocol];
574 if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
580 for (i = 0; i < protos_count; i++)
582 if (protos[i] == proto)
591 Atom *new_protos = NULL;
596 new_protos = malloc((protos_count + 1) * sizeof(Atom));
600 for (i = 0; i < protos_count; i++)
601 new_protos[i] = protos[i];
602 new_protos[protos_count] = proto;
603 XSetWMProtocols(_ecore_x_disp, win, new_protos, protos_count + 1);
611 for (i = 0; i < protos_count; i++)
613 if (protos[i] == proto)
617 for (j = i + 1; j < protos_count; j++)
618 protos[j - 1] = protos[j];
619 if (protos_count > 1)
620 XSetWMProtocols(_ecore_x_disp, win, protos,
623 XDeleteProperty(_ecore_x_disp, win,
624 ECORE_X_ATOM_WM_PROTOCOLS);
634 } /* ecore_x_icccm_protocol_set */
637 * Determines whether a protocol is set for a window.
638 * @param win The Window
639 * @param protocol The protocol to query
640 * @return 1 if the protocol is set, else 0.
643 ecore_x_icccm_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol protocol)
645 Atom proto, *protos = NULL;
646 int i, ret = 0, protos_count = 0;
648 /* check for invalid values */
649 if (protocol >= ECORE_X_WM_PROTOCOL_NUM)
652 LOGFN(__FILE__, __LINE__, __FUNCTION__);
653 proto = _ecore_x_atoms_wm_protocols[protocol];
655 if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
658 for (i = 0; i < protos_count; i++)
659 if (protos[i] == proto)
669 } /* ecore_x_icccm_protocol_isset */
672 * Set a window name & class.
673 * @param win The window
674 * @param n The name string
675 * @param c The class string
677 * Set a window name * class
680 ecore_x_icccm_name_class_set(Ecore_X_Window win, const char *n, const char *c)
684 xch = XAllocClassHint();
688 LOGFN(__FILE__, __LINE__, __FUNCTION__);
689 xch->res_name = (char *)n;
690 xch->res_class = (char *)c;
691 XSetClassHint(_ecore_x_disp, win, xch);
693 } /* ecore_x_icccm_name_class_set */
696 * Get a window name & class.
697 * @param win The window
698 * @param n The name string
699 * @param c The class string
701 * Get a window name * class
704 ecore_x_icccm_name_class_get(Ecore_X_Window win, char **n, char **c)
708 LOGFN(__FILE__, __LINE__, __FUNCTION__);
716 xch.res_class = NULL;
717 if (XGetClassHint(_ecore_x_disp, win, &xch))
721 *n = strdup(xch.res_name);
725 *c = strdup(xch.res_class);
728 XFree(xch.res_class);
730 } /* ecore_x_icccm_name_class_get */
733 * Get a window client machine string.
734 * @param win The window
735 * @return The windows client machine string
737 * Return the client machine of a window. String must be free'd when done with.
740 ecore_x_icccm_client_machine_get(Ecore_X_Window win)
744 LOGFN(__FILE__, __LINE__, __FUNCTION__);
745 name = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_CLIENT_MACHINE);
747 } /* ecore_x_icccm_client_machine_get */
750 * Sets the WM_COMMAND property for @a win.
752 * @param win The window.
753 * @param argc Number of arguments.
754 * @param argv Arguments.
757 ecore_x_icccm_command_set(Ecore_X_Window win, int argc, char **argv)
759 LOGFN(__FILE__, __LINE__, __FUNCTION__);
760 XSetCommand(_ecore_x_disp, win, argv, argc);
761 } /* ecore_x_icccm_command_set */
764 * Get the WM_COMMAND property for @a win.
766 * Return the command of a window. String must be free'd when done with.
768 * @param win The window.
769 * @param argc Number of arguments.
770 * @param argv Arguments.
773 ecore_x_icccm_command_get(Ecore_X_Window win, int *argc, char ***argv)
784 LOGFN(__FILE__, __LINE__, __FUNCTION__);
785 if (!XGetCommand(_ecore_x_disp, win, &v, &c))
801 (*argv) = malloc(c * sizeof(char *));
811 for (i = 0; i < c; i++)
814 (*argv)[i] = strdup(v[i]);
816 (*argv)[i] = strdup("");
821 } /* ecore_x_icccm_command_get */
824 * Set a window icon name.
825 * @param win The window
826 * @param t The icon name string
828 * Set a window icon name
831 ecore_x_icccm_icon_name_set(Ecore_X_Window win, const char *t)
837 LOGFN(__FILE__, __LINE__, __FUNCTION__);
839 #ifdef X_HAVE_UTF8_STRING
841 ret = Xutf8TextListToTextProperty(_ecore_x_disp, list, 1,
842 XUTF8StringStyle, &xprop);
843 #else /* ifdef X_HAVE_UTF8_STRING */
845 ret = XmbTextListToTextProperty(_ecore_x_disp, list, 1,
846 XStdICCTextStyle, &xprop);
847 #endif /* ifdef X_HAVE_UTF8_STRING */
850 XSetWMIconName(_ecore_x_disp, win, &xprop);
854 else if (XStringListToTextProperty(list, 1, &xprop) >= Success)
856 XSetWMIconName(_ecore_x_disp, win, &xprop);
862 } /* ecore_x_icccm_icon_name_set */
865 * Get a window icon name.
866 * @param win The window
867 * @return The windows icon name string
869 * Return the icon name of a window. String must be free'd when done with.
872 ecore_x_icccm_icon_name_get(Ecore_X_Window win)
876 LOGFN(__FILE__, __LINE__, __FUNCTION__);
878 if (XGetWMIconName(_ecore_x_disp, win, &xprop) >= Success)
887 if (xprop.encoding == ECORE_X_ATOM_UTF8_STRING)
888 t = strdup((char *)xprop.value);
891 /* convert to utf8 */
892 #ifdef X_HAVE_UTF8_STRING
893 ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop,
895 #else /* ifdef X_HAVE_UTF8_STRING */
896 ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop,
898 #endif /* ifdef X_HAVE_UTF8_STRING */
900 if ((ret == XLocaleNotSupported) ||
901 (ret == XNoMemory) || (ret == XConverterNotFound))
902 t = strdup((char *)xprop.value);
903 else if (ret >= Success)
905 if ((num >= 1) && (list))
909 XFreeStringList(list);
921 } /* ecore_x_icccm_icon_name_get */
924 * Add a subwindow to the list of windows that need a different colormap installed.
925 * @param win The toplevel window
926 * @param subwin The subwindow to be added to the colormap windows list
929 ecore_x_icccm_colormap_window_set(Ecore_X_Window win, Ecore_X_Window subwin)
932 unsigned char *old_data = NULL;
933 unsigned char *data = NULL;
934 Window *oldset = NULL;
935 Window *newset = NULL;
937 LOGFN(__FILE__, __LINE__, __FUNCTION__);
938 if (!ecore_x_window_prop_property_get(win,
939 ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
940 XA_WINDOW, 32, &old_data, &num))
942 newset = calloc(1, sizeof(Window));
948 data = (unsigned char *)newset;
952 newset = calloc(num + 1, sizeof(Window));
953 oldset = (Window *)old_data;
957 for (i = 0; i < num; ++i)
959 if (oldset[i] == subwin)
969 newset[i] = oldset[i];
972 newset[num++] = subwin;
976 data = (unsigned char *)newset;
979 ecore_x_window_prop_property_set(win,
980 ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
981 XA_WINDOW, 32, data, num);
983 } /* ecore_x_icccm_colormap_window_set */
986 * Remove a window from the list of colormap windows.
987 * @param win The toplevel window
988 * @param subwin The window to be removed from the colormap window list.
991 ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, Ecore_X_Window subwin)
993 int num = 0, i, j, k = 0;
994 unsigned char *old_data = NULL;
995 unsigned char *data = NULL;
996 Window *oldset = NULL;
997 Window *newset = NULL;
999 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1000 if (!ecore_x_window_prop_property_get(win,
1001 ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
1002 XA_WINDOW, 32, &old_data, &num))
1005 oldset = (Window *)old_data;
1006 for (i = 0; i < num; i++)
1008 if (oldset[i] == subwin)
1012 XDeleteProperty(_ecore_x_disp,
1013 win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS);
1022 newset = calloc(num - 1, sizeof(Window));
1023 data = (unsigned char *)newset;
1024 for (j = 0; j < num; ++j)
1025 if (oldset[j] != subwin)
1026 newset[k++] = oldset[j];
1028 ecore_x_window_prop_property_set(
1030 ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
1047 } /* ecore_x_icccm_colormap_window_unset */
1050 * Specify that a window is transient for another top-level window and should be handled accordingly.
1051 * @param win the transient window
1052 * @param forwin the toplevel window
1055 ecore_x_icccm_transient_for_set(Ecore_X_Window win, Ecore_X_Window forwin)
1057 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1058 XSetTransientForHint(_ecore_x_disp, win, forwin);
1059 } /* ecore_x_icccm_transient_for_set */
1062 * Remove the transient_for setting from a window.
1066 ecore_x_icccm_transient_for_unset(Ecore_X_Window win)
1068 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1069 XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_TRANSIENT_FOR);
1070 } /* ecore_x_icccm_transient_for_unset */
1073 * Get the window this window is transient for, if any.
1074 * @param win The window to check
1075 * @return The window ID of the top-level window, or 0 if the property does not exist.
1078 ecore_x_icccm_transient_for_get(Ecore_X_Window win)
1082 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1083 if (XGetTransientForHint(_ecore_x_disp, win, &forwin))
1084 return (Ecore_X_Window)forwin;
1087 } /* ecore_x_icccm_transient_for_get */
1090 * Set the window role hint.
1091 * @param win The window
1092 * @param role The role string
1095 ecore_x_icccm_window_role_set(Ecore_X_Window win, const char *role)
1097 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1098 ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_WINDOW_ROLE,
1100 } /* ecore_x_icccm_window_role_set */
1103 * Get the window role.
1104 * @param win The window
1105 * @return The window's role string.
1108 ecore_x_icccm_window_role_get(Ecore_X_Window win)
1110 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1111 return ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_WINDOW_ROLE);
1112 } /* ecore_x_icccm_window_role_get */
1115 * Set the window's client leader.
1116 * @param win The window
1117 * @param l The client leader window
1119 * All non-transient top-level windows created by an app other than
1120 * the main window must have this property set to the app's main window.
1123 ecore_x_icccm_client_leader_set(Ecore_X_Window win, Ecore_X_Window l)
1125 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1126 ecore_x_window_prop_window_set(win, ECORE_X_ATOM_WM_CLIENT_LEADER,
1128 } /* ecore_x_icccm_client_leader_set */
1131 * Get the window's client leader.
1132 * @param win The window
1133 * @return The window's client leader window, or 0 if unset */
1135 ecore_x_icccm_client_leader_get(Ecore_X_Window win)
1139 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1140 if (ecore_x_window_prop_window_get(win, ECORE_X_ATOM_WM_CLIENT_LEADER,
1145 } /* ecore_x_icccm_client_leader_get */
1148 ecore_x_icccm_iconic_request_send(Ecore_X_Window win, Ecore_X_Window root)
1155 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1157 root = DefaultRootWindow(_ecore_x_disp);
1159 xev.xclient.type = ClientMessage;
1160 xev.xclient.serial = 0;
1161 xev.xclient.send_event = True;
1162 xev.xclient.display = _ecore_x_disp;
1163 xev.xclient.window = win;
1164 xev.xclient.format = 32;
1165 xev.xclient.message_type = ECORE_X_ATOM_WM_CHANGE_STATE;
1166 xev.xclient.data.l[0] = IconicState;
1168 XSendEvent(_ecore_x_disp, root, False,
1169 SubstructureNotifyMask | SubstructureRedirectMask, &xev);
1170 } /* ecore_x_icccm_iconic_request_send */
1172 /* FIXME: there are older E hints, gnome hints and mwm hints and new netwm */
1173 /* hints. each should go in their own file/section so we know which */
1174 /* is which. also older kde hints too. we should try support as much */
1175 /* as makese sense to support */