svn update: 48958 (latest:48959)
[framework/uifw/ecore.git] / src / lib / ecore_x / xlib / ecore_x_window.c
1 /*
2  * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
3  */
4
5 #ifdef HAVE_CONFIG_H
6 # include <config.h>
7 #endif
8
9 #include <stdlib.h>
10 #include <sys/types.h>
11 #include <unistd.h>
12
13 #include "Ecore.h"
14 #include "ecore_x_private.h"
15 #include "Ecore_X.h"
16 #include "Ecore_X_Atoms.h"
17
18 static int             ignore_num = 0;
19 static Ecore_X_Window *ignore_list = NULL;
20
21 /**
22  * @defgroup Ecore_X_Window_Create_Group X Window Creation Functions
23  *
24  * Functions that can be used to create an X window.
25  */
26
27 /**
28  * Creates a new window.
29  * @param   parent The parent window to use.  If @p parent is @c 0, the root
30  *                 window of the default display is used.
31  * @param   x      X position.
32  * @param   y      Y position.
33  * @param   w      Width.
34  * @param   h      Height.
35  * @return  The new window handle.
36  * @ingroup Ecore_X_Window_Create_Group
37  */
38 EAPI Ecore_X_Window
39 ecore_x_window_new(Ecore_X_Window parent, int x, int y, int w, int h)
40 {
41    Window               win;
42    XSetWindowAttributes attr;
43    
44    LOGFN(__FILE__, __LINE__, __FUNCTION__);
45    if (parent == 0) parent = DefaultRootWindow(_ecore_x_disp);
46    attr.backing_store         = NotUseful;
47    attr.override_redirect     = False;
48    attr.border_pixel          = 0;
49    attr.background_pixmap     = None;
50    attr.bit_gravity            = NorthWestGravity;
51    attr.win_gravity            = NorthWestGravity;
52    attr.save_under            = False;
53    attr.do_not_propagate_mask = NoEventMask;
54    attr.event_mask            = KeyPressMask |
55                                 KeyReleaseMask |
56                                 ButtonPressMask |
57                                 ButtonReleaseMask |
58                                 EnterWindowMask |
59                                 LeaveWindowMask |
60                                 PointerMotionMask |
61                                 ExposureMask |
62                                 VisibilityChangeMask |
63                                 StructureNotifyMask |
64                                 FocusChangeMask |
65                                 PropertyChangeMask |
66                                 ColormapChangeMask;
67    win = XCreateWindow(_ecore_x_disp, parent,
68                        x, y, w, h, 0,
69                        CopyFromParent, /*DefaultDepth(_ecore_x_disp, DefaultScreen(_ecore_x_disp)),*/
70                        InputOutput, 
71                        CopyFromParent, /*DefaultVisual(_ecore_x_disp, DefaultScreen(_ecore_x_disp)),*/
72                        CWBackingStore |
73                        CWOverrideRedirect | 
74 /*                     CWColormap | */
75                        CWBorderPixel |
76                        CWBackPixmap | 
77                        CWSaveUnder | 
78                        CWDontPropagate | 
79                        CWEventMask |
80                        CWBitGravity |
81                        CWWinGravity,
82                        &attr);
83
84    if (parent == DefaultRootWindow(_ecore_x_disp)) ecore_x_window_defaults_set(win);
85    return win;
86 }
87
88 /**
89  * Creates a window with the override redirect attribute set to @c True.
90  * @param   parent The parent window to use.  If @p parent is @c 0, the root
91  *                 window of the default display is used.
92  * @param   x      X position.
93  * @param   y      Y position.
94  * @param   w      Width.
95  * @param   h      Height.
96  * @return  The new window handle.
97  * @ingroup Ecore_X_Window_Create_Group
98  */
99 EAPI Ecore_X_Window
100 ecore_x_window_override_new(Ecore_X_Window parent, int x, int y, int w, int h)
101 {
102    Window               win;
103    XSetWindowAttributes attr;
104    
105    LOGFN(__FILE__, __LINE__, __FUNCTION__);
106    if (parent == 0) parent = DefaultRootWindow(_ecore_x_disp);
107    attr.backing_store         = NotUseful;
108    attr.override_redirect     = True;
109    attr.border_pixel          = 0;
110    attr.background_pixmap     = None;
111    attr.bit_gravity           = NorthWestGravity;
112    attr.win_gravity           = NorthWestGravity;
113    attr.save_under            = False;
114    attr.do_not_propagate_mask = NoEventMask;
115    attr.event_mask            = KeyPressMask |
116                                 KeyReleaseMask |
117                                 ButtonPressMask |
118                                 ButtonReleaseMask |
119                                 EnterWindowMask |
120                                 LeaveWindowMask |
121                                 PointerMotionMask |
122                                 ExposureMask |
123                                 VisibilityChangeMask |
124                                 StructureNotifyMask |
125                                 FocusChangeMask |
126                                 PropertyChangeMask |
127                                 ColormapChangeMask;
128    win = XCreateWindow(_ecore_x_disp, parent,
129                        x, y, w, h, 0,
130                        CopyFromParent, /*DefaultDepth(_ecore_x_disp, DefaultScreen(_ecore_x_disp)),*/
131                        InputOutput, 
132                        CopyFromParent, /*DefaultVisual(_ecore_x_disp, DefaultScreen(_ecore_x_disp)),*/
133                        CWBackingStore |
134                        CWOverrideRedirect | 
135 /*                     CWColormap | */
136                        CWBorderPixel |
137                        CWBackPixmap | 
138                        CWSaveUnder | 
139                        CWDontPropagate | 
140                        CWEventMask |
141                        CWBitGravity |
142                        CWWinGravity,
143                        &attr);
144    return win;
145 }
146
147 /**
148  * Creates a new input window.
149  * @param   parent The parent window to use.    If @p parent is @c 0, the root
150  *                 window of the default display is used.
151  * @param   x      X position.
152  * @param   y      Y position.
153  * @param   w      Width.
154  * @param   h      Height.
155  * @return  The new window.
156  * @ingroup Ecore_X_Window_Create_Group
157  */
158 EAPI Ecore_X_Window
159 ecore_x_window_input_new(Ecore_X_Window parent, int x, int y, int w, int h)
160 {
161    Window               win;
162    XSetWindowAttributes attr;
163    
164    LOGFN(__FILE__, __LINE__, __FUNCTION__);
165    if (parent == 0) parent = DefaultRootWindow(_ecore_x_disp);
166    attr.override_redirect     = True;
167    attr.do_not_propagate_mask = NoEventMask;
168    attr.event_mask            = KeyPressMask |
169                                 KeyReleaseMask |
170                                 ButtonPressMask |
171                                 ButtonReleaseMask |
172                                 EnterWindowMask |
173                                 LeaveWindowMask |
174                                 PointerMotionMask |
175                                 ExposureMask |
176                                 VisibilityChangeMask |
177                                 StructureNotifyMask |
178                                 FocusChangeMask |
179                                 PropertyChangeMask |
180                                 ColormapChangeMask;
181    win = XCreateWindow(_ecore_x_disp, parent,
182                        x, y, w, h, 0,
183                        CopyFromParent, 
184                        InputOnly,
185                        CopyFromParent, /*DefaultVisual(_ecore_x_disp, DefaultScreen(_ecore_x_disp)),*/
186                        CWOverrideRedirect | 
187                        CWDontPropagate | 
188                        CWEventMask,
189                        &attr);
190
191    if (parent == DefaultRootWindow(_ecore_x_disp))
192      {
193      }
194    return win;
195 }
196
197 /**
198  * @defgroup Ecore_X_Window_Properties_Group X Window Property Functions
199  *
200  * Functions that set window properties.
201  */
202
203 /**
204  * Sets the default properties for the given window.
205  *
206  * The default properties set for the window are @c WM_CLIENT_MACHINE and
207  * @c _NET_WM_PID.
208  *
209  * @param   win The given window.
210  * @ingroup Ecore_X_Window_Properties_Groups
211  */
212 EAPI void
213 ecore_x_window_defaults_set(Ecore_X_Window win)
214 {
215    long pid;
216    char buf[MAXHOSTNAMELEN];
217    char *hostname[1];
218    int argc;
219    char **argv;
220    XTextProperty xprop;
221
222    LOGFN(__FILE__, __LINE__, __FUNCTION__);
223    /*
224     * Set WM_CLIENT_MACHINE.
225     */
226    gethostname(buf, MAXHOSTNAMELEN);
227    buf[MAXHOSTNAMELEN - 1] = '\0';
228    hostname[0] = buf;
229    /* The ecore function uses UTF8 which Xlib may not like (especially
230     * with older clients) */
231    /* ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_CLIENT_MACHINE,
232                                   (char *)buf); */
233    if (XStringListToTextProperty(hostname, 1, &xprop))
234      {
235         XSetWMClientMachine(_ecore_x_disp, win, &xprop);
236         XFree(xprop.value);
237      }
238
239    /*
240     * Set _NET_WM_PID
241     */
242    pid = getpid();
243    ecore_x_netwm_pid_set(win, pid);
244
245    ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL);
246
247    ecore_app_args_get(&argc, &argv);
248    ecore_x_icccm_command_set(win, argc, argv);
249 }
250
251 EAPI void
252 ecore_x_window_configure(Ecore_X_Window win,
253                          Ecore_X_Window_Configure_Mask mask,
254                          int x, int y, int w, int h,
255                          int border_width, Ecore_X_Window sibling,
256                          int stack_mode)
257 {
258    XWindowChanges xwc;
259
260    if (!win) return;
261    
262    LOGFN(__FILE__, __LINE__, __FUNCTION__);
263
264    xwc.x = x;
265    xwc.y = y;
266    xwc.width = w;
267    xwc.height = h;
268    xwc.border_width = border_width;
269    xwc.sibling = sibling;
270    xwc.stack_mode = stack_mode;
271
272    XConfigureWindow(_ecore_x_disp, win, mask, &xwc);
273 }
274
275 /**
276  * @defgroup Ecore_X_Window_Destroy_Group X Window Destroy Functions
277  *
278  * Functions to destroy X windows.
279  */
280
281 /**
282  * Deletes the given window.
283  * @param   win The given window.
284  * @ingroup Ecore_X_Window_Destroy_Group
285  */
286 EAPI void
287 ecore_x_window_free(Ecore_X_Window win)
288 {
289    /* sorry sir, deleting the root window doesn't sound like
290     * a smart idea.
291     */
292    LOGFN(__FILE__, __LINE__, __FUNCTION__);
293    if (win) XDestroyWindow(_ecore_x_disp, win);
294 }
295
296 /**
297  * Set if a window should be ignored.
298  * @param   win The given window.
299  * @param   ignore if to ignore
300  */
301 EAPI void
302 ecore_x_window_ignore_set(Ecore_X_Window win, int ignore)
303 {
304    int i, j;
305
306    LOGFN(__FILE__, __LINE__, __FUNCTION__);
307    if (ignore)
308      {
309         if (ignore_list)
310           {
311              for (i = 0; i < ignore_num; i++)
312                {
313                   if (win == ignore_list[i])
314                     return;
315                }
316              ignore_list = realloc(ignore_list, (ignore_num + 1) * sizeof(Ecore_X_Window));
317              if (!ignore_list) return;
318              ignore_list[ignore_num++] = win;
319           }
320         else
321           {
322              ignore_num = 0;
323              ignore_list = malloc(sizeof(Ecore_X_Window));
324              ignore_list[ignore_num++] = win;
325           }
326      }
327    else
328      {
329         if (!ignore_list) return;
330         for (i = 0, j = 0; i < ignore_num; i++)
331           {
332              if (win != ignore_list[i])
333                ignore_list[i] = ignore_list[j++];
334              else
335                ignore_num--;
336           }
337         ignore_list = realloc(ignore_list, ignore_num * sizeof(Ecore_X_Window));
338      }
339 }
340
341 /**
342  * Get the ignore list
343  * @param   num number of windows in the list
344  * @return  list of windows to ignore
345  */
346 EAPI Ecore_X_Window *
347 ecore_x_window_ignore_list(int *num)
348 {
349    if (num) *num = ignore_num;
350    return ignore_list;
351 }
352
353 /**
354  * Sends a delete request to the given window.
355  * @param   win The given window.
356  * @ingroup Ecore_X_Window_Destroy_Group
357  */
358 EAPI void
359 ecore_x_window_delete_request_send(Ecore_X_Window win)
360 {
361    XEvent xev;
362
363    /* sorry sir, deleting the root window doesn't sound like
364     * a smart idea.
365     */
366    if (!win) return;
367
368    LOGFN(__FILE__, __LINE__, __FUNCTION__);
369    xev.xclient.type = ClientMessage;
370    xev.xclient.display = _ecore_x_disp;
371    xev.xclient.window = win;
372    xev.xclient.message_type = ECORE_X_ATOM_WM_PROTOCOLS;
373    xev.xclient.format = 32;
374    xev.xclient.data.l[0] = ECORE_X_ATOM_WM_DELETE_WINDOW;
375    xev.xclient.data.l[1] = CurrentTime;
376
377    XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev);
378 }
379
380 /**
381  * @defgroup Ecore_X_Window_Visibility_Group X Window Visibility Functions
382  *
383  * Functions to access and change the visibility of X windows.
384  */
385
386 /**
387  * Shows a window.
388  *
389  * Synonymous to "mapping" a window in X Window System terminology.
390  *
391  * @param   win The window to show.
392  * @ingroup Ecore_X_Window_Visibility
393  */
394 EAPI void
395 ecore_x_window_show(Ecore_X_Window win)
396 {
397    LOGFN(__FILE__, __LINE__, __FUNCTION__);
398    XMapWindow(_ecore_x_disp, win);
399 }
400
401 /**
402  * Hides a window.
403  *
404  * Synonymous to "unmapping" a window in X Window System terminology.
405  *
406  * @param   win The window to hide.
407  * @ingroup Ecore_X_Window_Visibility
408  */
409 EAPI void
410 ecore_x_window_hide(Ecore_X_Window win)
411 {
412    XEvent xev;
413    Window root;
414    int idum;
415    unsigned int uidum;
416
417    /* ICCCM: SEND unmap event... */
418    LOGFN(__FILE__, __LINE__, __FUNCTION__);
419    root = win;
420    if (ScreenCount(_ecore_x_disp) == 1)
421      root = DefaultRootWindow(_ecore_x_disp);
422    else
423      XGetGeometry(_ecore_x_disp, win, &root, &idum, &idum, &uidum, &uidum, &uidum, &uidum);
424    xev.xunmap.type = UnmapNotify;
425    xev.xunmap.serial = 0;
426    xev.xunmap.send_event = True;
427    xev.xunmap.display = _ecore_x_disp;
428    xev.xunmap.event = root;
429    xev.xunmap.window = win;
430    xev.xunmap.from_configure = False;
431    XSendEvent(_ecore_x_disp, xev.xunmap.event, False,
432               SubstructureRedirectMask | SubstructureNotifyMask, &xev);
433    XUnmapWindow(_ecore_x_disp, win);
434 }
435
436 /**
437  * @defgroup Ecore_X_Window_Geometry_Group X Window Geometry Functions
438  *
439  * Functions that change or retrieve the geometry of X windows.
440  */
441
442 /**
443  * Moves a window to the position @p x, @p y.
444  *
445  * The position is relative to the upper left hand corner of the
446  * parent window.
447  *
448  * @param   win The window to move.
449  * @param   x   X position.
450  * @param   y   Y position.
451  * @ingroup Ecore_X_Window_Geometry_Group
452  */
453 EAPI void
454 ecore_x_window_move(Ecore_X_Window win, int x, int y)
455 {
456    LOGFN(__FILE__, __LINE__, __FUNCTION__);
457    XMoveWindow(_ecore_x_disp, win, x, y);
458 }
459
460 /**
461  * Resizes a window.
462  * @param   win The window to resize.
463  * @param   w   New width of the window.
464  * @param   h   New height of the window.
465  * @ingroup Ecore_X_Window_Geometry_Group
466  */
467 EAPI void
468 ecore_x_window_resize(Ecore_X_Window win, int w, int h)
469 {
470    LOGFN(__FILE__, __LINE__, __FUNCTION__);
471    if (w < 1) w = 1;
472    if (h < 1) h = 1;
473    XResizeWindow(_ecore_x_disp, win, w, h);
474 }
475
476 /**
477  * Moves and resizes a window.
478  * @param   win The window to move and resize.
479  * @param   x   New X position of the window.
480  * @param   y   New Y position of the window.
481  * @param   w   New width of the window.
482  * @param   h   New height of the window.
483  * @ingroup Ecore_X_Window_Geometry_Group
484  */
485 EAPI void
486 ecore_x_window_move_resize(Ecore_X_Window win, int x, int y, int w, int h)
487 {
488    LOGFN(__FILE__, __LINE__, __FUNCTION__);
489    if (w < 1) w = 1;
490    if (h < 1) h = 1;
491    XMoveResizeWindow(_ecore_x_disp, win, x, y, w, h);
492 }
493
494 /**
495  * @defgroup Ecore_X_Window_Focus_Functions X Window Focus Functions
496  *
497  * Functions that give the focus to an X Window.
498  */
499
500 /**
501  * Sets the focus to the window @p win.
502  * @param   win The window to focus.
503  * @ingroup Ecore_X_Window_Focus_Functions
504  */
505 EAPI void
506 ecore_x_window_focus(Ecore_X_Window win)
507 {
508    LOGFN(__FILE__, __LINE__, __FUNCTION__);
509    if (win == 0) win = DefaultRootWindow(_ecore_x_disp);   
510 //   XSetInputFocus(_ecore_x_disp, win, RevertToNone, CurrentTime);
511 //   XSetInputFocus(_ecore_x_disp, win, RevertToPointerRoot, CurrentTime);
512    XSetInputFocus(_ecore_x_disp, win, RevertToParent, CurrentTime);
513 }
514
515 /**
516  * Sets the focus to the given window at a specific time.
517  * @param   win The window to focus.
518  * @param   t   When to set the focus to the window.
519  * @ingroup Ecore_X_Window_Focus_Functions
520  */
521 EAPI void
522 ecore_x_window_focus_at_time(Ecore_X_Window win, Ecore_X_Time t)
523 {
524    LOGFN(__FILE__, __LINE__, __FUNCTION__);
525    if (win == 0) win = DefaultRootWindow(_ecore_x_disp);   
526 //   XSetInputFocus(_ecore_x_disp, win, RevertToNone, t);
527 //   XSetInputFocus(_ecore_x_disp, win, PointerRoot, t);
528    XSetInputFocus(_ecore_x_disp, win, RevertToParent, t);
529 }
530
531 /**
532  * gets the focus to the window @p win.
533  * @return  The window that has focus.
534  * @ingroup Ecore_X_Window_Focus_Functions
535  */
536 EAPI Ecore_X_Window
537 ecore_x_window_focus_get(void)
538 {
539    Window win;
540    int revert_mode;
541    
542    LOGFN(__FILE__, __LINE__, __FUNCTION__);
543    win = 0;
544    XGetInputFocus(_ecore_x_disp, &win, &revert_mode);
545    return win;
546 }
547
548 /**
549  * @defgroup Ecore_X_Window_Z_Order_Group X Window Z Order Functions
550  *
551  * Functions that change the Z order of X windows.
552  */
553
554 /**
555  * Raises the given window.
556  * @param   win The window to raise.
557  * @ingroup Ecore_X_Window_Z_Order_Group
558  */
559 EAPI void
560 ecore_x_window_raise(Ecore_X_Window win)
561 {
562    LOGFN(__FILE__, __LINE__, __FUNCTION__);
563    XRaiseWindow(_ecore_x_disp, win);
564 }
565
566 /**
567  * Lowers the given window.
568  * @param   win The window to lower.
569  * @ingroup Ecore_X_Window_Z_Order_Group
570  */
571 EAPI void
572 ecore_x_window_lower(Ecore_X_Window win)
573 {
574    LOGFN(__FILE__, __LINE__, __FUNCTION__);
575    XLowerWindow(_ecore_x_disp, win);
576 }
577
578 /**
579  * @defgroup Ecore_X_Window_Parent_Group X Window Parent Functions
580  *
581  * Functions that retrieve or changes the parent window of a window.
582  */
583
584 /**
585  * Moves a window to within another window at a given position.
586  * @param   win        The window to reparent.
587  * @param   new_parent The new parent window.
588  * @param   x          X position within new parent window.
589  * @param   y          Y position within new parent window.
590  * @ingroup Ecore_X_Window_Parent_Group
591  */
592 EAPI void
593 ecore_x_window_reparent(Ecore_X_Window win, Ecore_X_Window new_parent, int x, int y)
594 {
595    LOGFN(__FILE__, __LINE__, __FUNCTION__);
596    if (new_parent == 0) new_parent = DefaultRootWindow(_ecore_x_disp);   
597    XReparentWindow(_ecore_x_disp, win, new_parent, x, y);
598 }
599
600 /**
601  * Retrieves the size of the given window.
602  * @param   win The given window.
603  * @param   w   Pointer to an integer into which the width is to be stored.
604  * @param   h   Pointer to an integer into which the height is to be stored.
605  * @ingroup Ecore_X_Window_Geometry_Group
606  */
607 EAPI void
608 ecore_x_window_size_get(Ecore_X_Window win, int *w, int *h)
609 {
610    int dummy_x, dummy_y;
611    
612    LOGFN(__FILE__, __LINE__, __FUNCTION__);
613    if (win == 0)  win = DefaultRootWindow(_ecore_x_disp);
614    ecore_x_drawable_geometry_get(win, &dummy_x, &dummy_y, w, h);
615 }
616
617 /**
618  * Retrieves the geometry of the given window.
619  * @param   win The given window.
620  * @param   x   Pointer to an integer in which the X position is to be stored.
621  * @param   y   Pointer to an integer in which the Y position is to be stored.
622  * @param   w   Pointer to an integer in which the width is to be stored.
623  * @param   h   Pointer to an integer in which the height is to be stored.
624  * @ingroup Ecore_X_Window_Geometry_Group
625  */
626 EAPI void
627 ecore_x_window_geometry_get(Ecore_X_Window win, int *x, int *y, int *w, int *h)
628 {
629    LOGFN(__FILE__, __LINE__, __FUNCTION__);
630    if (!win) win = DefaultRootWindow(_ecore_x_disp);
631    ecore_x_drawable_geometry_get(win, x, y, w, h);
632 }
633
634 /**
635  * Retrieves the width of the border of the given window.
636  * @param   win The given window.
637  * @return  Width of the border of @p win.
638  * @ingroup Ecore_X_Window_Geometry_Group
639  */
640 EAPI int
641 ecore_x_window_border_width_get(Ecore_X_Window win)
642 {
643    LOGFN(__FILE__, __LINE__, __FUNCTION__);
644    /* doesn't make sense to call this on a root window */
645    if (!win) return 0;
646    return ecore_x_drawable_border_width_get(win);
647 }
648
649 /**
650  * Sets the width of the border of the given window.
651  * @param   win The given window.
652  * @param   width The new border width.
653  * @ingroup Ecore_X_Window_Geometry_Group
654  */
655 EAPI void
656 ecore_x_window_border_width_set(Ecore_X_Window win, int width)
657 {
658    LOGFN(__FILE__, __LINE__, __FUNCTION__);
659    /* doesn't make sense to call this on a root window */
660    if (!win) return;
661    XSetWindowBorderWidth (_ecore_x_disp, win, width);
662 }
663
664 /**
665  * Retrieves the depth of the given window.
666  * @param  win The given window.
667  * @return Depth of the window.
668  */
669 EAPI int
670 ecore_x_window_depth_get(Ecore_X_Window win)
671 {
672    LOGFN(__FILE__, __LINE__, __FUNCTION__);
673    return ecore_x_drawable_depth_get(win);
674 }
675   
676 /**
677  * To be documented.
678  *
679  * FIXME: To be fixed.
680  */
681 EAPI void
682 ecore_x_window_cursor_show(Ecore_X_Window win, int show)
683 {
684    LOGFN(__FILE__, __LINE__, __FUNCTION__);
685    if (win == 0) win = DefaultRootWindow(_ecore_x_disp);
686    if (!show)
687      {
688         Cursor              c;
689         XColor              cl;
690         Pixmap              p, m;
691         GC                  gc;
692         XGCValues           gcv;
693         
694         p = XCreatePixmap(_ecore_x_disp, win, 1, 1, 1);
695         m = XCreatePixmap(_ecore_x_disp, win, 1, 1, 1);
696         gc = XCreateGC(_ecore_x_disp, m, 0, &gcv);
697         XSetForeground(_ecore_x_disp, gc, 0);
698         XDrawPoint(_ecore_x_disp, m, gc, 0, 0);
699         XFreeGC(_ecore_x_disp, gc);
700         c = XCreatePixmapCursor(_ecore_x_disp, p, m, &cl, &cl, 0, 0);
701         XDefineCursor(_ecore_x_disp, win, c);
702         XFreeCursor(_ecore_x_disp, c);
703         XFreePixmap(_ecore_x_disp, p);
704         XFreePixmap(_ecore_x_disp, m);
705      }
706    else
707      {
708         XDefineCursor(_ecore_x_disp, win, 0);   
709      }
710 }
711
712 EAPI void
713 ecore_x_window_cursor_set(Ecore_X_Window win, Ecore_X_Cursor c)
714 {
715    LOGFN(__FILE__, __LINE__, __FUNCTION__);
716    if (c == 0)
717      XUndefineCursor(_ecore_x_disp, win);
718    else
719      XDefineCursor(_ecore_x_disp, win, c);
720 }
721
722 /**
723  * Finds out whether the given window is currently visible.
724  * @param   win The given window.
725  * @return  1 if the window is visible, otherwise 0.
726  * @ingroup Ecore_X_Window_Visibility_Group
727  */
728 EAPI int
729 ecore_x_window_visible_get(Ecore_X_Window win)
730 {
731    XWindowAttributes attr;
732
733    LOGFN(__FILE__, __LINE__, __FUNCTION__);
734    return (XGetWindowAttributes(_ecore_x_disp, win, &attr) &&
735            (attr.map_state == IsViewable));
736 }
737
738
739
740 typedef struct _Shadow Shadow;
741 struct _Shadow
742 {
743    Shadow         *parent;
744    Shadow        **children;
745    Window          win;
746    int             children_num;
747    short           x, y;
748    unsigned short  w, h;
749 };
750
751 static Shadow **shadow_base = NULL;
752 static int shadow_num = 0;
753
754 static Shadow *
755 _ecore_x_window_tree_walk(Window win)
756 {
757    Window           *list = NULL;
758    Window            parent_win = 0, root_win = 0;
759    unsigned int      num;
760    Shadow           *s, **sl;
761    XWindowAttributes att;
762
763    if (!XGetWindowAttributes(_ecore_x_disp, win, &att)) return NULL;
764 //   if (att.class == InputOnly) return NULL;
765    if (att.map_state != IsViewable) return NULL;
766    
767    s = calloc(1, sizeof(Shadow));
768    if (!s) return NULL;
769    s->win = win;
770    s->x = att.x;
771    s->y = att.y;
772    s->w = att.width;
773    s->h = att.height;
774    if (XQueryTree(_ecore_x_disp, s->win, &root_win, &parent_win,
775                    &list, &num))
776      {
777         s->children = calloc(1, sizeof(Shadow *) * num);
778         if (s->children)
779           {
780              size_t i, j;
781              s->children_num = num;
782              for (i = 0; i < num; i++)
783                {
784                   s->children[i] = _ecore_x_window_tree_walk(list[i]);
785                   if (s->children[i]) s->children[i]->parent = s;
786                }
787              /* compress list down */
788              j = 0;
789              for (i = 0; i < num; i++)
790                {
791                   if (s->children[i])
792                     {
793                        s->children[j] = s->children[i];
794                        j++;
795                     }
796                }
797              if (j == 0)
798                {
799                   free(s->children);
800                   s->children = NULL;
801                   s->children_num = 0;
802                }
803              else
804                {
805                   s->children_num = j;
806                   sl = realloc(s->children, sizeof(Shadow *) * j);
807                   if (sl) s->children = sl;
808                }
809           }
810      }
811    if (list) XFree(list);
812    return s;
813 }
814
815 static void
816 _ecore_x_window_tree_shadow_free1(Shadow *s)
817 {
818    int i;
819
820    if (!s) return;
821    if (s->children)
822      {
823         for (i = 0; i < s->children_num; i++)
824           {
825              if (s->children[i])
826                _ecore_x_window_tree_shadow_free1(s->children[i]);
827           }
828         free(s->children);
829      }
830    free(s);
831 }
832
833 static void
834 _ecore_x_window_tree_shadow_free(void)
835 {
836    int i;
837    
838    if (!shadow_base) return;
839    for (i = 0; i < shadow_num; i++)
840      {
841         if (!shadow_base[i]) continue;
842         _ecore_x_window_tree_shadow_free1(shadow_base[i]);
843      }
844    free(shadow_base);
845    shadow_base = NULL;
846    shadow_num = 0;
847 }
848
849 static void
850 _ecore_x_window_tree_shadow_populate(void)
851 {
852    Ecore_X_Window   *roots;
853    int               i, num;
854    
855    roots = ecore_x_window_root_list(&num);
856    if (roots)
857      {
858         shadow_base = calloc(1, sizeof(Shadow *) * num);
859         if (shadow_base)
860           {
861              shadow_num = num;
862              for (i = 0; i < num; i++)
863                shadow_base[i] = _ecore_x_window_tree_walk(roots[i]);
864           }
865         free(roots);
866      }
867 }
868
869 /*
870 static int shadow_count = 0;
871
872 static void
873 _ecore_x_window_tree_shadow_start(void)
874 {
875    shadow_count++;
876    if (shadow_count > 1) return;
877    _ecore_x_window_tree_shadow_populate();
878 }
879
880 static void
881 _ecore_x_window_tree_shadow_stop(void)
882 {
883    shadow_count--;
884    if (shadow_count != 0) return;
885    _ecore_x_window_tree_shadow_free();
886 }
887 */
888
889 static Shadow *
890 _ecore_x_window_shadow_tree_find_shadow(Shadow *s, Window win)
891 {
892    Shadow *ss;
893    int i;
894
895    if (s->win == win) return s;
896    if (s->children)
897      {
898         for (i = 0; i < s->children_num; i++)
899           {
900              if (!s->children[i]) continue;
901              if ((ss = _ecore_x_window_shadow_tree_find_shadow(s->children[i], win)))
902                return ss;
903           }
904      }
905    return NULL;
906 }
907
908 static Shadow *
909 _ecore_x_window_shadow_tree_find(Window base)
910 {
911    Shadow *s;
912    int i;
913
914    for (i = 0; i < shadow_num; i++)
915      {
916         if (!shadow_base[i]) continue;
917         if ((s = _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], base)))
918           return s;
919      }
920    return NULL;
921 }
922
923 static Window
924 _ecore_x_window_shadow_tree_at_xy_get_shadow(Shadow *s, int bx, int by, int x, int y,
925                                              Ecore_X_Window *skip, int skip_num)
926 {
927    Window child;
928    int i, j;
929    int wx, wy;
930    
931    wx = s->x + bx;
932    wy = s->y + by;
933    if (!((x >= wx) && (y >= wy) && (x < (wx + s->w)) && (y < (wy + s->h))))
934      return 0;
935    if (s->children)
936      {
937         int skipit = 0;
938         
939         for (i = s->children_num - 1; i >= 0; --i)
940           {
941              if (!s->children[i]) continue;
942              skipit = 0;
943              if (skip)
944                {
945                   for (j = 0; j < skip_num; j++)
946                     {
947                        if (s->children[i]->win == skip[j])
948                          {
949                             skipit = 1;
950                             goto onward;
951                          }
952                     }
953                }
954              onward:
955              if (!skipit)
956                {
957                   if ((child = _ecore_x_window_shadow_tree_at_xy_get_shadow(s->children[i], wx, wy, x, y, skip, skip_num)))
958                     {
959                        return child;
960                     }
961                }
962           }
963      }
964    return s->win;
965 }
966
967 static Window
968 _ecore_x_window_shadow_tree_at_xy_get(Window base, int bx, int by, int x, int y,
969                                       Ecore_X_Window *skip, int skip_num)
970 {
971    Shadow *s;
972    
973    if (!shadow_base)
974      {
975         _ecore_x_window_tree_shadow_populate();
976         if (!shadow_base) return 0;
977      }
978    s = _ecore_x_window_shadow_tree_find(base);
979    if (!s) return 0;
980    return _ecore_x_window_shadow_tree_at_xy_get_shadow(s, bx, by, x, y, skip, skip_num);
981 }
982
983 /**
984  * Retrieves the top, visible window at the given location,
985  * but skips the windows in the list. This uses a shadow tree built from the
986  * window tree that is only updated the first time
987  * ecore_x_window_shadow_tree_at_xy_with_skip_get() is called, or the next time
988  * it is called after a  ecore_x_window_shadow_tree_flush()
989  * @param   base The base window to start searching from (normally root).
990  * @param   x The given X position.
991  * @param   y The given Y position.
992  * @return  The window at that position.
993  * @ingroup Ecore_X_Window_Geometry_Group
994  */
995 EAPI Ecore_X_Window
996 ecore_x_window_shadow_tree_at_xy_with_skip_get(Ecore_X_Window base, int x, int y, Ecore_X_Window *skip, int skip_num)
997 {
998    LOGFN(__FILE__, __LINE__, __FUNCTION__);
999    return _ecore_x_window_shadow_tree_at_xy_get(base, 0, 0, x, y, skip, skip_num);
1000 }
1001
1002 /**
1003  * Retrieves the parent window a given window has. This uses the shadow window
1004  * tree.
1005  * @param   root The root window of @p win - if 0, this will be automatically determined with extra processing overhead
1006  * @param   win The window to get the parent window of
1007  * @return  The parent window of @p win
1008  * @ingroup Ecore_X_Window_Geometry_Group
1009  */
1010 EAPI Ecore_X_Window
1011 ecore_x_window_shadow_parent_get(Ecore_X_Window root __UNUSED__, Ecore_X_Window win)
1012 {
1013    Shadow *s;
1014    int i;
1015    
1016    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1017    if (!shadow_base)
1018      {
1019         _ecore_x_window_tree_shadow_populate();
1020         if (!shadow_base) return 0;
1021      }
1022    for (i = 0; i < shadow_num; i++)
1023      {
1024         if (!shadow_base[i]) continue;
1025         s = _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], win);
1026         if (s)
1027           {
1028              if (!s->parent) return 0;
1029              return s->parent->win;
1030           }
1031      }
1032    return 0;
1033 }
1034
1035 /**
1036  * Flushes the window shadow tree so nothing is stored.
1037  * @ingroup Ecore_X_Window_Geometry_Group
1038  */
1039 EAPI void
1040 ecore_x_window_shadow_tree_flush(void)
1041 {
1042    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1043    _ecore_x_window_tree_shadow_free();
1044 }
1045
1046 /**
1047  * Retrieves the root window a given window is on.
1048  * @param   win The window to get the root window of
1049  * @return  The root window of @p win
1050  * @ingroup Ecore_X_Window_Geometry_Group
1051  */
1052 EAPI Ecore_X_Window
1053 ecore_x_window_root_get(Ecore_X_Window win)
1054 {
1055    XWindowAttributes att;
1056
1057    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1058    if (!XGetWindowAttributes(_ecore_x_disp, win, &att)) return 0;
1059    return att.root;
1060 }
1061
1062 static Window
1063 _ecore_x_window_at_xy_get(Window base, int bx, int by, int x, int y,
1064                           Ecore_X_Window *skip, int skip_num)
1065 {
1066    Window           *list = NULL;
1067    Window            parent_win = 0, child = 0, root_win = 0;
1068    int               i, j, wx, wy, ww, wh;
1069    unsigned int      num;
1070
1071    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1072    if (!ecore_x_window_visible_get(base))
1073      return 0;
1074
1075    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1076    ecore_x_window_geometry_get(base, &wx, &wy, &ww, &wh);
1077    wx += bx;
1078    wy += by;
1079
1080    if (!((x >= wx) && (y >= wy) && (x < (wx + ww)) && (y < (wy + wh))))
1081      return 0;
1082
1083    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1084    if (!XQueryTree(_ecore_x_disp, base, &root_win, &parent_win, &list, &num))
1085      return base;
1086
1087    if (list)
1088      {
1089         int skipit = 0;
1090         
1091         for (i = num - 1; i >= 0; --i)
1092           {
1093              skipit = 0;
1094              
1095              if (skip)
1096                {
1097                   for (j = 0; j < skip_num; j++)
1098                     {
1099                        if (list[i] == skip[j])
1100                          {
1101                             skipit = 1;
1102                             goto onward;
1103                          }
1104                     }
1105                }
1106              onward:
1107              if (!skipit)
1108                {
1109                   if ((child = _ecore_x_window_at_xy_get(list[i], wx, wy, x, y, skip, skip_num)))
1110                     {
1111                        XFree(list);
1112                        return child;
1113                     }
1114                }
1115           }
1116         XFree(list);
1117      }
1118    return base;
1119 }
1120
1121 /**
1122  * Retrieves the top, visible window at the given location.
1123  * @param   x The given X position.
1124  * @param   y The given Y position.
1125  * @return  The window at that position.
1126  * @ingroup Ecore_X_Window_Geometry_Group
1127  */
1128 EAPI Ecore_X_Window
1129 ecore_x_window_at_xy_get(int x, int y)
1130 {
1131    Ecore_X_Window    win, root;
1132    
1133    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1134    /* FIXME: Proper function to determine current root/virtual root
1135     * window missing here */
1136    root = DefaultRootWindow(_ecore_x_disp);
1137    
1138    ecore_x_grab();
1139    win = _ecore_x_window_at_xy_get(root, 0, 0, x, y, NULL, 0);
1140    ecore_x_ungrab();
1141    
1142    return win ? win : root;
1143 }
1144
1145 /**
1146  * Retrieves the top, visible window at the given location,
1147  * but skips the windows in the list.
1148  * @param   x The given X position.
1149  * @param   y The given Y position.
1150  * @return  The window at that position.
1151  * @ingroup Ecore_X_Window_Geometry_Group
1152  */
1153 EAPI Ecore_X_Window
1154 ecore_x_window_at_xy_with_skip_get(int x, int y, Ecore_X_Window *skip, int skip_num)
1155 {
1156    Ecore_X_Window    win, root;
1157    
1158    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1159    /* FIXME: Proper function to determine current root/virtual root
1160     * window missing here */
1161    root = DefaultRootWindow(_ecore_x_disp);
1162    
1163    ecore_x_grab();
1164    win = _ecore_x_window_at_xy_get(root, 0, 0, x, y, skip, skip_num);
1165    ecore_x_ungrab();
1166    
1167    return win ? win : root;
1168 }
1169
1170 EAPI Ecore_X_Window
1171 ecore_x_window_at_xy_begin_get(Ecore_X_Window begin, int x, int y)
1172 {
1173    Ecore_X_Window    win;
1174    
1175    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1176    ecore_x_grab();
1177    win = _ecore_x_window_at_xy_get(begin, 0, 0, x, y, NULL, 0);
1178    ecore_x_ungrab();
1179    
1180    return win ? win : begin;
1181 }
1182
1183 /**
1184  * Retrieves the parent window of the given window.
1185  * @param   win The given window.
1186  * @return  The parent window of @p win.
1187  * @ingroup Ecore_X_Window_Parent_Group
1188  */
1189 EAPI Ecore_X_Window
1190 ecore_x_window_parent_get(Ecore_X_Window win)
1191 {
1192    Window         root, parent, *children = NULL;
1193    unsigned int   num;
1194
1195    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1196    if (!XQueryTree(_ecore_x_disp, win, &root, &parent, &children, &num))
1197       return 0;
1198    if (children)
1199       XFree(children);
1200
1201    return parent;
1202 }
1203
1204 /**
1205  * Sets the background color of the given window.
1206  * @param win   The given window
1207  * @param r     red value (0...65536, 16 bits)
1208  * @param g     green value (0...65536, 16 bits)
1209  * @param b     blue value (0...65536, 16 bits)
1210  */
1211 EAPI void
1212 ecore_x_window_background_color_set(Ecore_X_Window win, unsigned short r,
1213                                     unsigned short g, unsigned short b)
1214 {
1215    XSetWindowAttributes attr;
1216    Colormap map;
1217    XColor col;
1218
1219    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1220    col.red = r;
1221    col.green = g;
1222    col.blue = b;
1223
1224    map = DefaultColormap(_ecore_x_disp, DefaultScreen(_ecore_x_disp));
1225    XAllocColor(_ecore_x_disp, map, &col);
1226
1227    attr.background_pixel = col.pixel;
1228    XChangeWindowAttributes(_ecore_x_disp, win, CWBackPixel, &attr);
1229 }
1230
1231 EAPI void
1232 ecore_x_window_gravity_set(Ecore_X_Window win, Ecore_X_Gravity grav)
1233 {
1234    XSetWindowAttributes att;
1235    
1236    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1237    att.win_gravity = grav;
1238    XChangeWindowAttributes(_ecore_x_disp, win, CWWinGravity, &att);
1239 }
1240
1241 EAPI void
1242 ecore_x_window_pixel_gravity_set(Ecore_X_Window win, Ecore_X_Gravity grav)
1243 {
1244    XSetWindowAttributes att;
1245    
1246    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1247    att.bit_gravity = grav;
1248    XChangeWindowAttributes(_ecore_x_disp, win, CWBitGravity, &att);
1249 }
1250
1251 EAPI void
1252 ecore_x_window_pixmap_set(Ecore_X_Window win, Ecore_X_Pixmap pmap)
1253 {
1254    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1255    XSetWindowBackgroundPixmap(_ecore_x_disp, win, pmap);
1256 }
1257
1258 EAPI void
1259 ecore_x_window_area_clear(Ecore_X_Window win, int x, int y, int w, int h)
1260 {
1261    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1262    XClearArea(_ecore_x_disp, win, x, y, w, h, False);
1263 }
1264
1265 EAPI void
1266 ecore_x_window_area_expose(Ecore_X_Window win, int x, int y, int w, int h)
1267 {
1268    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1269    XClearArea(_ecore_x_disp, win, x, y, w, h, True);
1270 }
1271
1272 EAPI void
1273 ecore_x_window_override_set(Ecore_X_Window win, int override)
1274 {
1275    XSetWindowAttributes att;
1276    
1277    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1278    att.override_redirect = override;
1279    XChangeWindowAttributes(_ecore_x_disp, win, CWOverrideRedirect, &att);
1280 }
1281
1282 #ifdef ECORE_XRENDER   
1283 static Ecore_X_Window
1284 _ecore_x_window_argb_internal_new(Ecore_X_Window parent, int x, int y, int w, int h, int override, int saveunder)
1285 {
1286    Window                win;
1287    XSetWindowAttributes  attr;
1288    XWindowAttributes     att;
1289    XVisualInfo          *xvi;
1290    XVisualInfo           vi_in;
1291    int                   nvi, i, scr = 0;
1292    XRenderPictFormat    *fmt;
1293    Visual               *vis;
1294    
1295    if (parent == 0)
1296      {
1297         parent = DefaultRootWindow(_ecore_x_disp);
1298         scr = DefaultScreen(_ecore_x_disp);
1299      }
1300    else
1301      {
1302         /* ewww - round trip */
1303         XGetWindowAttributes(_ecore_x_disp, parent, &att);
1304         for (i = 0; i < ScreenCount(_ecore_x_disp); i++)
1305           {
1306              if (att.screen == ScreenOfDisplay(_ecore_x_disp, i))
1307                {
1308                   scr = i;
1309                   break;
1310                }
1311           }
1312      }
1313    vi_in.screen = scr;
1314    vi_in.depth = 32;
1315    vi_in.class = TrueColor;
1316    xvi = XGetVisualInfo(_ecore_x_disp,
1317                         VisualScreenMask |
1318                         VisualDepthMask |
1319                         VisualClassMask,
1320                         &vi_in,
1321                         &nvi);
1322    if (xvi == NULL) return 0;
1323    vis = NULL;
1324    for (i = 0; i < nvi; i++)
1325      {
1326         fmt = XRenderFindVisualFormat(_ecore_x_disp, xvi[i].visual);
1327         if ((fmt->type == PictTypeDirect) && (fmt->direct.alphaMask))
1328           {
1329              vis = xvi[i].visual;
1330              break;
1331           }
1332      }
1333    XFree (xvi);
1334    
1335    attr.backing_store         = NotUseful;
1336    attr.override_redirect     = override;
1337    attr.colormap              = XCreateColormap(_ecore_x_disp, parent,
1338                                                 vis, AllocNone);
1339    attr.border_pixel          = 0;
1340    attr.background_pixmap     = None;
1341    attr.bit_gravity           = NorthWestGravity;
1342    attr.win_gravity           = NorthWestGravity;
1343    attr.save_under            = saveunder;
1344    attr.do_not_propagate_mask = NoEventMask;
1345    attr.event_mask            = KeyPressMask |
1346                                 KeyReleaseMask |
1347                                 ButtonPressMask |
1348                                 ButtonReleaseMask |
1349                                 EnterWindowMask |
1350                                 LeaveWindowMask |
1351                                 PointerMotionMask |
1352                                 ExposureMask |
1353                                 VisibilityChangeMask |
1354                                 StructureNotifyMask |
1355                                 FocusChangeMask |
1356                                 PropertyChangeMask |
1357                                 ColormapChangeMask;
1358    win = XCreateWindow(_ecore_x_disp, parent,
1359                        x, y, w, h, 0,
1360                        32, 
1361                        InputOutput, 
1362                        vis,
1363                        CWBackingStore |
1364                        CWOverrideRedirect | 
1365                        CWColormap |
1366                        CWBorderPixel |
1367                        CWBackPixmap | 
1368                        CWSaveUnder | 
1369                        CWDontPropagate | 
1370                        CWEventMask |
1371                        CWBitGravity |
1372                        CWWinGravity,
1373                        &attr);
1374    XFreeColormap(_ecore_x_disp, attr.colormap);
1375
1376    if (parent == DefaultRootWindow(_ecore_x_disp)) ecore_x_window_defaults_set(win);
1377    return win;
1378 }
1379 #endif
1380
1381 EAPI int
1382 ecore_x_window_argb_get(Ecore_X_Window win)
1383 {
1384 #ifdef ECORE_XRENDER   
1385    XWindowAttributes att;
1386    XRenderPictFormat *fmt;
1387
1388    att.visual = 0;
1389    if (!XGetWindowAttributes(_ecore_x_disp, win, &att)) return 0;
1390    fmt = XRenderFindVisualFormat(_ecore_x_disp, att.visual);
1391    if (!fmt) return 0;
1392    if ((fmt->type == PictTypeDirect) && (fmt->direct.alphaMask)) return 1;
1393    return 0;
1394 #else
1395    return 0;
1396 #endif   
1397 }
1398
1399 /**
1400  * Creates a new window.
1401  * @param   parent The parent window to use.  If @p parent is @c 0, the root
1402  *                 window of the default display is used.
1403  * @param   x      X position.
1404  * @param   y      Y position.
1405  * @param   w      Width.
1406  * @param   h      Height.
1407  * @return  The new window handle.
1408  * @ingroup Ecore_X_Window_Create_Group
1409  */
1410 EAPI Ecore_X_Window
1411 ecore_x_window_manager_argb_new(Ecore_X_Window parent, int x, int y, int w, int h)
1412 {
1413 #ifdef ECORE_XRENDER   
1414    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1415    return _ecore_x_window_argb_internal_new(parent, x, y, w, h, 1, 0);
1416 #else
1417    return 0;
1418 #endif   
1419 }
1420
1421 /**
1422  * Creates a new window.
1423  * @param   parent The parent window to use.  If @p parent is @c 0, the root
1424  *                 window of the default display is used.
1425  * @param   x      X position.
1426  * @param   y      Y position.
1427  * @param   w      Width.
1428  * @param   h      Height.
1429  * @return  The new window handle.
1430  * @ingroup Ecore_X_Window_Create_Group
1431  */
1432 EAPI Ecore_X_Window
1433 ecore_x_window_argb_new(Ecore_X_Window parent, int x, int y, int w, int h)
1434 {
1435 #ifdef ECORE_XRENDER   
1436    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1437    return _ecore_x_window_argb_internal_new(parent, x, y, w, h, 0, 0);
1438 #else
1439    return 0;
1440 #endif   
1441 }
1442
1443 /**
1444  * Creates a window with the override redirect attribute set to @c True.
1445  * @param   parent The parent window to use.  If @p parent is @c 0, the root
1446  *                 window of the default display is used.
1447  * @param   x      X position.
1448  * @param   y      Y position.
1449  * @param   w      Width.
1450  * @param   h      Height.
1451  * @return  The new window handle.
1452  * @ingroup Ecore_X_Window_Create_Group
1453  */
1454 EAPI Ecore_X_Window
1455 ecore_x_window_override_argb_new(Ecore_X_Window parent, int x, int y, int w, int h)
1456 {
1457 #ifdef ECORE_XRENDER   
1458    LOGFN(__FILE__, __LINE__, __FUNCTION__);
1459    return _ecore_x_window_argb_internal_new(parent, x, y, w, h, 1, 0);
1460 #else
1461    return 0;
1462 #endif   
1463 }