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,
128 Eina_Bool accepts_focus,
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,
138 hints = XAllocWMHints();
142 LOGFN(__FILE__, __LINE__, __FUNCTION__);
143 hints->flags = InputHint | StateHint;
144 hints->input = accepts_focus;
145 if (initial_state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN)
146 hints->initial_state = WithdrawnState;
147 else if (initial_state == ECORE_X_WINDOW_STATE_HINT_NORMAL)
148 hints->initial_state = NormalState;
149 else if (initial_state == ECORE_X_WINDOW_STATE_HINT_ICONIC)
150 hints->initial_state = IconicState;
152 if (icon_pixmap != 0)
154 hints->icon_pixmap = icon_pixmap;
155 hints->flags |= IconPixmapHint;
160 hints->icon_mask = icon_mask;
161 hints->flags |= IconMaskHint;
164 if (icon_window != 0)
166 hints->icon_window = icon_window;
167 hints->flags |= IconWindowHint;
170 if (window_group != 0)
172 hints->window_group = window_group;
173 hints->flags |= WindowGroupHint;
177 hints->flags |= XUrgencyHint;
179 XSetWMHints(_ecore_x_disp, win, hints);
181 } /* ecore_x_icccm_hints_set */
184 ecore_x_icccm_hints_get(Ecore_X_Window win,
185 Eina_Bool *accepts_focus,
186 Ecore_X_Window_State_Hint *initial_state,
187 Ecore_X_Pixmap *icon_pixmap,
188 Ecore_X_Pixmap *icon_mask,
189 Ecore_X_Window *icon_window,
190 Ecore_X_Window *window_group,
191 Eina_Bool *is_urgent)
195 LOGFN(__FILE__, __LINE__, __FUNCTION__);
197 *accepts_focus = EINA_TRUE;
200 *initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
215 *is_urgent = EINA_FALSE;
217 hints = XGetWMHints(_ecore_x_disp, win);
220 if ((hints->flags & InputHint) && (accepts_focus))
223 *accepts_focus = EINA_TRUE;
225 *accepts_focus = EINA_FALSE;
228 if ((hints->flags & StateHint) && (initial_state))
230 if (hints->initial_state == WithdrawnState)
231 *initial_state = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN;
232 else if (hints->initial_state == NormalState)
233 *initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL;
234 else if (hints->initial_state == IconicState)
235 *initial_state = ECORE_X_WINDOW_STATE_HINT_ICONIC;
238 if ((hints->flags & IconPixmapHint) && (icon_pixmap))
239 *icon_pixmap = hints->icon_pixmap;
241 if ((hints->flags & IconMaskHint) && (icon_mask))
242 *icon_mask = hints->icon_mask;
244 if ((hints->flags & IconWindowHint) && (icon_window))
245 *icon_window = hints->icon_window;
247 if ((hints->flags & WindowGroupHint) && (window_group))
248 *window_group = hints->window_group;
250 if ((hints->flags & XUrgencyHint) && (is_urgent))
251 *is_urgent = EINA_TRUE;
258 } /* ecore_x_icccm_hints_get */
261 ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win,
262 Eina_Bool request_pos,
263 Ecore_X_Gravity gravity,
264 int min_w, int min_h,
265 int max_w, int max_h,
266 int base_w, int base_h,
267 int step_x, int step_y,
268 double min_aspect, double max_aspect)
273 LOGFN(__FILE__, __LINE__, __FUNCTION__);
274 if (!XGetWMNormalHints(_ecore_x_disp, win, &hint, &mask))
275 memset(&hint, 0, sizeof(XSizeHints));
279 hint.flags |= USPosition;
281 if (gravity != ECORE_X_GRAVITY_NW)
283 hint.flags |= PWinGravity;
284 hint.win_gravity = gravity;
287 if ((min_w > 0) || (min_h > 0))
289 hint.flags |= PMinSize;
290 hint.min_width = min_w;
291 hint.min_height = min_h;
294 if ((max_w > 0) || (max_h > 0))
296 hint.flags |= PMaxSize;
297 hint.max_width = max_w;
298 hint.max_height = max_h;
301 if ((base_w > 0) || (base_h > 0))
303 hint.flags |= PBaseSize;
304 hint.base_width = base_w;
305 hint.base_height = base_h;
308 if ((step_x > 1) || (step_y > 1))
310 hint.flags |= PResizeInc;
311 hint.width_inc = step_x;
312 hint.height_inc = step_y;
315 if ((min_aspect > 0.0) || (max_aspect > 0.0))
317 hint.flags |= PAspect;
318 hint.min_aspect.x = min_aspect * 10000;
319 hint.min_aspect.y = 10000;
320 hint.max_aspect.x = max_aspect * 10000;
321 hint.max_aspect.y = 10000;
324 XSetWMNormalHints(_ecore_x_disp, win, &hint);
325 } /* ecore_x_icccm_size_pos_hints_set */
328 ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win,
329 Eina_Bool *request_pos,
330 Ecore_X_Gravity *gravity,
331 int *min_w, int *min_h,
332 int *max_w, int *max_h,
333 int *base_w, int *base_h,
334 int *step_x, int *step_y,
335 double *min_aspect, double *max_aspect)
340 int minw = 0, minh = 0;
341 int maxw = 32767, maxh = 32767;
342 int basew = -1, baseh = -1;
343 int stepx = -1, stepy = -1;
344 double mina = 0.0, maxa = 0.0;
346 LOGFN(__FILE__, __LINE__, __FUNCTION__);
347 if (!XGetWMNormalHints(_ecore_x_disp, win, &hint, &mask))
350 if ((hint.flags & USPosition) || ((hint.flags & PPosition)))
353 *request_pos = EINA_TRUE;
355 else if (request_pos)
356 *request_pos = EINA_FALSE;
358 if (hint.flags & PWinGravity)
361 *gravity = hint.win_gravity;
364 *gravity = ECORE_X_GRAVITY_NW;
366 if (hint.flags & PMinSize)
368 minw = hint.min_width;
369 minh = hint.min_height;
372 if (hint.flags & PMaxSize)
374 maxw = hint.max_width;
375 maxh = hint.max_height;
383 if (hint.flags & PBaseSize)
385 basew = hint.base_width;
386 baseh = hint.base_height;
394 if (hint.flags & PResizeInc)
396 stepx = hint.width_inc;
397 stepy = hint.height_inc;
405 if (hint.flags & PAspect)
407 if (hint.min_aspect.y > 0)
408 mina = ((double)hint.min_aspect.x) / ((double)hint.min_aspect.y);
410 if (hint.max_aspect.y > 0)
411 maxa = ((double)hint.max_aspect.x) / ((double)hint.max_aspect.y);
445 } /* ecore_x_icccm_size_pos_hints_get */
448 ecore_x_icccm_title_set(Ecore_X_Window win, const char *t)
457 LOGFN(__FILE__, __LINE__, __FUNCTION__);
459 #ifdef X_HAVE_UTF8_STRING
462 Xutf8TextListToTextProperty(_ecore_x_disp, list, 1, XUTF8StringStyle,
464 #else /* ifdef X_HAVE_UTF8_STRING */
467 XmbTextListToTextProperty(_ecore_x_disp, list, 1, XStdICCTextStyle,
469 #endif /* ifdef X_HAVE_UTF8_STRING */
472 XSetWMName(_ecore_x_disp, win, &xprop);
476 else if (XStringListToTextProperty(list, 1, &xprop) >= Success)
478 XSetWMName(_ecore_x_disp, win, &xprop);
484 } /* ecore_x_icccm_title_set */
487 ecore_x_icccm_title_get(Ecore_X_Window win)
491 LOGFN(__FILE__, __LINE__, __FUNCTION__);
493 if (XGetWMName(_ecore_x_disp, win, &xprop) >= Success)
502 if (xprop.encoding == ECORE_X_ATOM_UTF8_STRING)
503 t = strdup((char *)xprop.value);
506 /* convert to utf8 */
507 #ifdef X_HAVE_UTF8_STRING
508 ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop,
510 #else /* ifdef X_HAVE_UTF8_STRING */
511 ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop,
513 #endif /* ifdef X_HAVE_UTF8_STRING */
515 if ((ret == XLocaleNotSupported) ||
516 (ret == XNoMemory) || (ret == XConverterNotFound))
517 t = strdup((char *)xprop.value);
518 else if ((ret >= Success) && (num > 0))
522 XFreeStringList(list);
533 } /* ecore_x_icccm_title_get */
536 * Set protocol atoms explicitly
537 * @param win The Window
538 * @param protos An array of protocol atoms
539 * @param num the number of members of the array
542 ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win,
543 Ecore_X_Atom *protos,
546 LOGFN(__FILE__, __LINE__, __FUNCTION__);
548 XSetWMProtocols(_ecore_x_disp, win, (Atom *)(protos), num);
550 XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_PROTOCOLS);
551 } /* ecore_x_icccm_protocol_atoms_set */
554 * Set or unset a wm protocol property.
555 * @param win The Window
556 * @param protocol The protocol to enable/disable
560 ecore_x_icccm_protocol_set(Ecore_X_Window win,
561 Ecore_X_WM_Protocol protocol,
566 int protos_count = 0;
570 /* Check for invalid values */
571 if (protocol >= ECORE_X_WM_PROTOCOL_NUM)
574 LOGFN(__FILE__, __LINE__, __FUNCTION__);
575 proto = _ecore_x_atoms_wm_protocols[protocol];
577 if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
583 for (i = 0; i < protos_count; i++)
585 if (protos[i] == proto)
594 Atom *new_protos = NULL;
599 new_protos = malloc((protos_count + 1) * sizeof(Atom));
603 for (i = 0; i < protos_count; i++)
604 new_protos[i] = protos[i];
605 new_protos[protos_count] = proto;
606 XSetWMProtocols(_ecore_x_disp, win, new_protos, protos_count + 1);
614 for (i = 0; i < protos_count; i++)
616 if (protos[i] == proto)
620 for (j = i + 1; j < protos_count; j++)
621 protos[j - 1] = protos[j];
622 if (protos_count > 1)
623 XSetWMProtocols(_ecore_x_disp, win, protos,
626 XDeleteProperty(_ecore_x_disp, win,
627 ECORE_X_ATOM_WM_PROTOCOLS);
637 } /* ecore_x_icccm_protocol_set */
640 * Determines whether a protocol is set for a window.
641 * @param win The Window
642 * @param protocol The protocol to query
643 * @return 1 if the protocol is set, else 0.
646 ecore_x_icccm_protocol_isset(Ecore_X_Window win, Ecore_X_WM_Protocol protocol)
648 Atom proto, *protos = NULL;
649 int i, protos_count = 0;
650 Eina_Bool ret = EINA_FALSE;
652 /* check for invalid values */
653 if (protocol >= ECORE_X_WM_PROTOCOL_NUM)
656 LOGFN(__FILE__, __LINE__, __FUNCTION__);
657 proto = _ecore_x_atoms_wm_protocols[protocol];
659 if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count))
662 for (i = 0; i < protos_count; i++)
663 if (protos[i] == proto)
673 } /* ecore_x_icccm_protocol_isset */
676 * Set a window name & class.
677 * @param win The window
678 * @param n The name string
679 * @param c The class string
681 * Set a window name * class
684 ecore_x_icccm_name_class_set(Ecore_X_Window win, const char *n, const char *c)
688 xch = XAllocClassHint();
692 LOGFN(__FILE__, __LINE__, __FUNCTION__);
693 xch->res_name = (char *)n;
694 xch->res_class = (char *)c;
695 XSetClassHint(_ecore_x_disp, win, xch);
697 } /* ecore_x_icccm_name_class_set */
700 * Get a window name & class.
701 * @param win The window
702 * @param n The name string
703 * @param c The class string
705 * Get a window name * class
708 ecore_x_icccm_name_class_get(Ecore_X_Window win, char **n, char **c)
712 LOGFN(__FILE__, __LINE__, __FUNCTION__);
720 xch.res_class = NULL;
721 if (XGetClassHint(_ecore_x_disp, win, &xch))
725 *n = strdup(xch.res_name);
729 *c = strdup(xch.res_class);
732 XFree(xch.res_class);
734 } /* ecore_x_icccm_name_class_get */
737 * Get a window client machine string.
738 * @param win The window
739 * @return The windows client machine string
741 * Return the client machine of a window. String must be free'd when done with.
744 ecore_x_icccm_client_machine_get(Ecore_X_Window win)
748 LOGFN(__FILE__, __LINE__, __FUNCTION__);
749 name = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_CLIENT_MACHINE);
751 } /* ecore_x_icccm_client_machine_get */
754 * Sets the WM_COMMAND property for @a win.
756 * @param win The window.
757 * @param argc Number of arguments.
758 * @param argv Arguments.
761 ecore_x_icccm_command_set(Ecore_X_Window win, int argc, char **argv)
763 LOGFN(__FILE__, __LINE__, __FUNCTION__);
764 XSetCommand(_ecore_x_disp, win, argv, argc);
765 } /* ecore_x_icccm_command_set */
768 * Get the WM_COMMAND property for @a win.
770 * Return the command of a window. String must be free'd when done with.
772 * @param win The window.
773 * @param argc Number of arguments.
774 * @param argv Arguments.
777 ecore_x_icccm_command_get(Ecore_X_Window win, int *argc, char ***argv)
788 LOGFN(__FILE__, __LINE__, __FUNCTION__);
789 if (!XGetCommand(_ecore_x_disp, win, &v, &c))
805 (*argv) = malloc(c * sizeof(char *));
815 for (i = 0; i < c; i++)
818 (*argv)[i] = strdup(v[i]);
820 (*argv)[i] = strdup("");
825 } /* ecore_x_icccm_command_get */
828 * Set a window icon name.
829 * @param win The window
830 * @param t The icon name string
832 * Set a window icon name
835 ecore_x_icccm_icon_name_set(Ecore_X_Window win, const char *t)
841 LOGFN(__FILE__, __LINE__, __FUNCTION__);
843 #ifdef X_HAVE_UTF8_STRING
845 ret = Xutf8TextListToTextProperty(_ecore_x_disp, list, 1,
846 XUTF8StringStyle, &xprop);
847 #else /* ifdef X_HAVE_UTF8_STRING */
849 ret = XmbTextListToTextProperty(_ecore_x_disp, list, 1,
850 XStdICCTextStyle, &xprop);
851 #endif /* ifdef X_HAVE_UTF8_STRING */
854 XSetWMIconName(_ecore_x_disp, win, &xprop);
858 else if (XStringListToTextProperty(list, 1, &xprop) >= Success)
860 XSetWMIconName(_ecore_x_disp, win, &xprop);
866 } /* ecore_x_icccm_icon_name_set */
869 * Get a window icon name.
870 * @param win The window
871 * @return The windows icon name string
873 * Return the icon name of a window. String must be free'd when done with.
876 ecore_x_icccm_icon_name_get(Ecore_X_Window win)
880 LOGFN(__FILE__, __LINE__, __FUNCTION__);
882 if (XGetWMIconName(_ecore_x_disp, win, &xprop) >= Success)
891 if (xprop.encoding == ECORE_X_ATOM_UTF8_STRING)
892 t = strdup((char *)xprop.value);
895 /* convert to utf8 */
896 #ifdef X_HAVE_UTF8_STRING
897 ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop,
899 #else /* ifdef X_HAVE_UTF8_STRING */
900 ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop,
902 #endif /* ifdef X_HAVE_UTF8_STRING */
904 if ((ret == XLocaleNotSupported) ||
905 (ret == XNoMemory) || (ret == XConverterNotFound))
906 t = strdup((char *)xprop.value);
907 else if (ret >= Success)
909 if ((num >= 1) && (list))
913 XFreeStringList(list);
925 } /* ecore_x_icccm_icon_name_get */
928 * Add a subwindow to the list of windows that need a different colormap installed.
929 * @param win The toplevel window
930 * @param subwin The subwindow to be added to the colormap windows list
933 ecore_x_icccm_colormap_window_set(Ecore_X_Window win, Ecore_X_Window subwin)
936 unsigned char *old_data = NULL;
937 unsigned char *data = NULL;
938 Window *oldset = NULL;
939 Window *newset = NULL;
941 LOGFN(__FILE__, __LINE__, __FUNCTION__);
942 if (!ecore_x_window_prop_property_get(win,
943 ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
944 XA_WINDOW, 32, &old_data, &num))
946 newset = calloc(1, sizeof(Window));
952 data = (unsigned char *)newset;
956 newset = calloc(num + 1, sizeof(Window));
957 oldset = (Window *)old_data;
961 for (i = 0; i < num; ++i)
963 if (oldset[i] == subwin)
973 newset[i] = oldset[i];
976 newset[num++] = subwin;
980 data = (unsigned char *)newset;
983 ecore_x_window_prop_property_set(win,
984 ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
985 XA_WINDOW, 32, data, num);
987 } /* ecore_x_icccm_colormap_window_set */
990 * Remove a window from the list of colormap windows.
991 * @param win The toplevel window
992 * @param subwin The window to be removed from the colormap window list.
995 ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, Ecore_X_Window subwin)
997 int num = 0, i, j, k = 0;
998 unsigned char *old_data = NULL;
999 unsigned char *data = NULL;
1000 Window *oldset = NULL;
1001 Window *newset = NULL;
1003 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1004 if (!ecore_x_window_prop_property_get(win,
1005 ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
1006 XA_WINDOW, 32, &old_data, &num))
1009 oldset = (Window *)old_data;
1010 for (i = 0; i < num; i++)
1012 if (oldset[i] == subwin)
1016 XDeleteProperty(_ecore_x_disp,
1017 win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS);
1026 newset = calloc(num - 1, sizeof(Window));
1027 data = (unsigned char *)newset;
1028 for (j = 0; j < num; ++j)
1029 if (oldset[j] != subwin)
1030 newset[k++] = oldset[j];
1032 ecore_x_window_prop_property_set(
1034 ECORE_X_ATOM_WM_COLORMAP_WINDOWS,
1051 } /* ecore_x_icccm_colormap_window_unset */
1054 * Specify that a window is transient for another top-level window and should be handled accordingly.
1055 * @param win the transient window
1056 * @param forwin the toplevel window
1059 ecore_x_icccm_transient_for_set(Ecore_X_Window win, Ecore_X_Window forwin)
1061 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1062 XSetTransientForHint(_ecore_x_disp, win, forwin);
1063 } /* ecore_x_icccm_transient_for_set */
1066 * Remove the transient_for setting from a window.
1070 ecore_x_icccm_transient_for_unset(Ecore_X_Window win)
1072 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1073 XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_TRANSIENT_FOR);
1074 } /* ecore_x_icccm_transient_for_unset */
1077 * Get the window this window is transient for, if any.
1078 * @param win The window to check
1079 * @return The window ID of the top-level window, or 0 if the property does not exist.
1082 ecore_x_icccm_transient_for_get(Ecore_X_Window win)
1086 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1087 if (XGetTransientForHint(_ecore_x_disp, win, &forwin))
1088 return (Ecore_X_Window)forwin;
1091 } /* ecore_x_icccm_transient_for_get */
1094 * Set the window role hint.
1095 * @param win The window
1096 * @param role The role string
1099 ecore_x_icccm_window_role_set(Ecore_X_Window win, const char *role)
1101 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1102 ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_WINDOW_ROLE,
1104 } /* ecore_x_icccm_window_role_set */
1107 * Get the window role.
1108 * @param win The window
1109 * @return The window's role string.
1112 ecore_x_icccm_window_role_get(Ecore_X_Window win)
1114 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1115 return ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_WINDOW_ROLE);
1116 } /* ecore_x_icccm_window_role_get */
1119 * Set the window's client leader.
1120 * @param win The window
1121 * @param l The client leader window
1123 * All non-transient top-level windows created by an app other than
1124 * the main window must have this property set to the app's main window.
1127 ecore_x_icccm_client_leader_set(Ecore_X_Window win, Ecore_X_Window l)
1129 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1130 ecore_x_window_prop_window_set(win, ECORE_X_ATOM_WM_CLIENT_LEADER,
1132 } /* ecore_x_icccm_client_leader_set */
1135 * Get the window's client leader.
1136 * @param win The window
1137 * @return The window's client leader window, or 0 if unset */
1139 ecore_x_icccm_client_leader_get(Ecore_X_Window win)
1143 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1144 if (ecore_x_window_prop_window_get(win, ECORE_X_ATOM_WM_CLIENT_LEADER,
1149 } /* ecore_x_icccm_client_leader_get */
1152 ecore_x_icccm_iconic_request_send(Ecore_X_Window win, Ecore_X_Window root)
1159 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1161 root = DefaultRootWindow(_ecore_x_disp);
1163 xev.xclient.type = ClientMessage;
1164 xev.xclient.serial = 0;
1165 xev.xclient.send_event = True;
1166 xev.xclient.display = _ecore_x_disp;
1167 xev.xclient.window = win;
1168 xev.xclient.format = 32;
1169 xev.xclient.message_type = ECORE_X_ATOM_WM_CHANGE_STATE;
1170 xev.xclient.data.l[0] = IconicState;
1172 XSendEvent(_ecore_x_disp, root, False,
1173 SubstructureNotifyMask | SubstructureRedirectMask, &xev);
1174 } /* ecore_x_icccm_iconic_request_send */
1176 /* FIXME: there are older E hints, gnome hints and mwm hints and new netwm */
1177 /* hints. each should go in their own file/section so we know which */
1178 /* is which. also older kde hints too. we should try support as much */
1179 /* as makese sense to support */