Initialize Tizen 2.3
[framework/uifw/ecore.git] / mobile / src / lib / ecore_x / xcb / ecore_xcb_window_shape.c
1 #include "ecore_xcb_private.h"
2 #ifdef ECORE_XCB_SHAPE
3 # include <xcb/shape.h>
4 #endif
5
6 /**
7  * @defgroup Ecore_X_Window_Shape X Window Shape Functions
8  *
9  * These functions use the shape extension of the X server to change
10  * shape of given windows.
11  */
12
13 /**
14  * Sets the input shape of the given window to that given by the pixmap @p mask.
15  * @param   win  The given window.
16  * @param   mask A 1-bit depth pixmap that provides the new input shape of the
17  *               window.
18  * @ingroup Ecore_X_Window_Shape
19  */
20 EAPI void
21 ecore_x_window_shape_input_mask_set(Ecore_X_Window win,
22                                     Ecore_X_Pixmap mask)
23 {
24    LOGFN(__FILE__, __LINE__, __FUNCTION__);
25    CHECK_XCB_CONN;
26
27 #ifdef ECORE_XCB_SHAPE
28    xcb_shape_mask(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT,
29                   win, 0, 0, mask);
30 //   ecore_x_flush();
31 #else
32    return;
33    win = 0;
34    mask = 0;
35 #endif
36 }
37
38 /**
39  * Sets the shape of the given window to that given by the pixmap @p mask.
40  * @param   win  The given window.
41  * @param   mask A 2-bit depth pixmap that provides the new shape of the
42  *               window.
43  * @ingroup Ecore_X_Window_Shape
44  */
45 EAPI void
46 ecore_x_window_shape_mask_set(Ecore_X_Window win,
47                               Ecore_X_Pixmap mask)
48 {
49    LOGFN(__FILE__, __LINE__, __FUNCTION__);
50    CHECK_XCB_CONN;
51
52 #ifdef ECORE_XCB_SHAPE
53    xcb_shape_mask(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING,
54                   win, 0, 0, mask);
55 //   ecore_x_flush();
56 #else
57    return;
58    win = 0;
59    mask = 0;
60 #endif
61 }
62
63 EAPI void
64 ecore_x_window_shape_window_set(Ecore_X_Window win,
65                                 Ecore_X_Window shape_win)
66 {
67    LOGFN(__FILE__, __LINE__, __FUNCTION__);
68    CHECK_XCB_CONN;
69
70 #ifdef ECORE_XCB_SHAPE
71    xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING,
72                      XCB_SHAPE_SK_BOUNDING, win, 0, 0, shape_win);
73 //   ecore_x_flush();
74 #else
75    return;
76    win = 0;
77    shape_win = 0;
78 #endif
79 }
80
81 EAPI void
82 ecore_x_window_shape_window_set_xy(Ecore_X_Window win,
83                                    Ecore_X_Window shape_win,
84                                    int            x,
85                                    int            y)
86 {
87    LOGFN(__FILE__, __LINE__, __FUNCTION__);
88    CHECK_XCB_CONN;
89
90 #ifdef ECORE_XCB_SHAPE
91    xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING,
92                      XCB_SHAPE_SK_BOUNDING, win, x, y, shape_win);
93 //   ecore_x_flush();
94 #else
95    return;
96    win = 0;
97    shape_win = 0;
98    x = 0;
99    y = 0;
100 #endif
101 }
102
103 EAPI void
104 ecore_x_window_shape_rectangle_set(Ecore_X_Window win,
105                                    int            x,
106                                    int            y,
107                                    int            w,
108                                    int            h)
109 {
110 #ifdef ECORE_XCB_SHAPE
111    xcb_rectangle_t rect;
112 #endif
113
114    LOGFN(__FILE__, __LINE__, __FUNCTION__);
115    CHECK_XCB_CONN;
116
117 #ifdef ECORE_XCB_SHAPE
118    rect.x = x;
119    rect.y = y;
120    rect.width = w;
121    rect.height = h;
122    xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET,
123                         XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
124                         win, 0, 0, 1, &rect);
125 //   ecore_x_flush();
126 #else
127    return;
128    win = 0;
129    x = 0;
130    y = 0;
131    w = 0;
132    h = 0;
133 #endif
134 }
135
136 EAPI void
137 ecore_x_window_shape_rectangles_set(Ecore_X_Window     win,
138                                     Ecore_X_Rectangle *rects,
139                                     int                num)
140 {
141 #ifdef ECORE_XCB_SHAPE
142    xcb_rectangle_t *rect = NULL;
143 #endif
144
145    LOGFN(__FILE__, __LINE__, __FUNCTION__);
146    CHECK_XCB_CONN;
147
148    if (!rects) return;
149
150 #ifdef ECORE_XCB_SHAPE
151    if (num > 0)
152      {
153         int i = 0;
154
155         if (!(rect = malloc(sizeof(xcb_rectangle_t) * num)))
156           return;
157
158         for (i = 0; i < num; i++)
159           {
160              rect[i].x = rects[i].x;
161              rect[i].y = rects[i].y;
162              rect[i].width = rects[i].width;
163              rect[i].height = rects[i].height;
164           }
165      }
166    xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET,
167                         XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
168                         win, 0, 0, num, (xcb_rectangle_t *)rect);
169
170    if (rect) free(rect);
171 //   ecore_x_flush();
172 #else
173    return;
174    win = 0;
175    num = 0;
176    rects = NULL;
177 #endif
178 }
179
180 EAPI void
181 ecore_x_window_shape_window_add(Ecore_X_Window win,
182                                 Ecore_X_Window shape_win)
183 {
184    LOGFN(__FILE__, __LINE__, __FUNCTION__);
185    CHECK_XCB_CONN;
186
187 #ifdef ECORE_XCB_SHAPE
188    xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
189                      XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING,
190                      win, 0, 0, shape_win);
191 //   ecore_x_flush();
192 #else
193    return;
194    win = 0;
195    shape_win = 0;
196 #endif
197 }
198
199 EAPI void
200 ecore_x_window_shape_window_add_xy(Ecore_X_Window win,
201                                    Ecore_X_Window shape_win,
202                                    int            x,
203                                    int            y)
204 {
205    LOGFN(__FILE__, __LINE__, __FUNCTION__);
206    CHECK_XCB_CONN;
207
208 #ifdef ECORE_XCB_SHAPE
209    xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
210                      XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING,
211                      win, x, y, shape_win);
212 //   ecore_x_flush();
213 #else
214    return;
215    win = 0;
216    shape_win = 0;
217    x = 0;
218    y = 0;
219 #endif
220 }
221
222 EAPI void
223 ecore_x_window_shape_rectangle_add(Ecore_X_Window win,
224                                    int            x,
225                                    int            y,
226                                    int            w,
227                                    int            h)
228 {
229 #ifdef ECORE_XCB_SHAPE
230    xcb_rectangle_t rect;
231 #endif
232
233    LOGFN(__FILE__, __LINE__, __FUNCTION__);
234    CHECK_XCB_CONN;
235
236 #ifdef ECORE_XCB_SHAPE
237    rect.x = x;
238    rect.y = y;
239    rect.width = w;
240    rect.height = h;
241    xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
242                         XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
243                         win, 0, 0, 1, &rect);
244 //   ecore_x_flush();
245 #else
246    return;
247    win = 0;
248    x = 0;
249    y = 0;
250    w = 0;
251    h = 0;
252 #endif
253 }
254
255 EAPI void
256 ecore_x_window_shape_rectangle_subtract(Ecore_X_Window win,
257                                         int            x,
258                                         int            y,
259                                         int            w,
260                                         int            h)
261 {
262 #ifdef ECORE_XCB_SHAPE
263    xcb_rectangle_t rect;
264 #endif
265
266    LOGFN(__FILE__, __LINE__, __FUNCTION__);
267    CHECK_XCB_CONN;
268
269 #ifdef ECORE_XCB_SHAPE
270    rect.x = x;
271    rect.y = y;
272    rect.width = w;
273    rect.height = h;
274    xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SUBTRACT,
275                         XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
276                         win, 0, 0, 1, &rect);
277 //   ecore_x_flush();
278 #else
279    return;
280    win = 0;
281    x = 0;
282    y = 0;
283    w = 0;
284    h = 0;
285 #endif
286 }
287
288 EAPI void
289 ecore_x_window_shape_rectangle_clip(Ecore_X_Window win,
290                                     int            x,
291                                     int            y,
292                                     int            w,
293                                     int            h)
294 {
295 #ifdef ECORE_XCB_SHAPE
296    xcb_rectangle_t rect;
297 #endif
298
299    LOGFN(__FILE__, __LINE__, __FUNCTION__);
300    CHECK_XCB_CONN;
301
302 #ifdef ECORE_XCB_SHAPE
303    rect.x = x;
304    rect.y = y;
305    rect.width = w;
306    rect.height = h;
307    xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_INTERSECT,
308                         XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
309                         win, 0, 0, 1, &rect);
310 //   ecore_x_flush();
311 #else
312    return;
313    win = 0;
314    x = 0;
315    y = 0;
316    w = 0;
317    h = 0;
318 #endif
319 }
320
321 EAPI void
322 ecore_x_window_shape_rectangles_add(Ecore_X_Window     win,
323                                     Ecore_X_Rectangle *rects,
324                                     int                num)
325 {
326 #ifdef ECORE_XCB_SHAPE
327    xcb_rectangle_t *rect = NULL;
328 #endif
329
330    LOGFN(__FILE__, __LINE__, __FUNCTION__);
331    CHECK_XCB_CONN;
332
333 #ifdef ECORE_XCB_SHAPE
334    if (num > 0)
335      {
336         int i = 0;
337
338         if (!(rect = malloc(sizeof(xcb_rectangle_t) * num)))
339           return;
340
341         for (i = 0; i < num; i++)
342           {
343              rect[i].x = rects[i].x;
344              rect[i].y = rects[i].y;
345              rect[i].width = rects[i].width;
346              rect[i].height = rects[i].height;
347           }
348      }
349
350    xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
351                         XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED,
352                         win, 0, 0, num, (xcb_rectangle_t *)&rect);
353
354    if (rect) free(rect);
355 //   ecore_x_flush();
356 #else
357    return;
358    win = 0;
359    num = 0;
360    rects = NULL;
361 #endif
362 }
363
364 EAPI Ecore_X_Rectangle *
365 ecore_x_window_shape_rectangles_get(Ecore_X_Window win,
366                                     int           *num_ret)
367 {
368    Ecore_X_Rectangle *rects = NULL;
369 #ifdef ECORE_XCB_SHAPE
370    xcb_shape_get_rectangles_cookie_t cookie;
371    xcb_shape_get_rectangles_reply_t *reply;
372    xcb_rectangle_t *r;
373    unsigned int i = 0;
374 #endif
375
376    LOGFN(__FILE__, __LINE__, __FUNCTION__);
377    CHECK_XCB_CONN;
378
379    if (num_ret) *num_ret = 0;
380
381 #ifdef ECORE_XCB_SHAPE
382    cookie =
383      xcb_shape_get_rectangles(_ecore_xcb_conn, win, XCB_SHAPE_SK_BOUNDING);
384    reply = xcb_shape_get_rectangles_reply(_ecore_xcb_conn, cookie, NULL);
385    if (!reply) return NULL;
386    if (num_ret) *num_ret = reply->rectangles_len;
387
388    if (reply->rectangles_len < 1)
389      {
390         free(reply);
391         if (num_ret) *num_ret = 0;
392         return NULL;
393      }
394
395    rects = malloc(sizeof(Ecore_X_Rectangle) * reply->rectangles_len);
396    if (!rects)
397      {
398         free(reply);
399         if (num_ret) *num_ret = 0;
400         return NULL;
401      }
402    r = xcb_shape_get_rectangles_rectangles(reply);
403    for (i = 0; i < reply->rectangles_len; i++)
404      {
405         rects[i].x = r[i].x;
406         rects[i].y = r[i].y;
407         rects[i].width = r[i].width;
408         rects[i].height = r[i].height;
409      }
410
411    free(reply);
412
413    return rects;
414 #else
415    return rects;
416    win = 0;
417 #endif
418 }
419
420 EAPI void
421 ecore_x_window_shape_events_select(Ecore_X_Window win,
422                                    Eina_Bool      on)
423 {
424    LOGFN(__FILE__, __LINE__, __FUNCTION__);
425    CHECK_XCB_CONN;
426
427 #ifdef ECORE_XCB_SHAPE
428    xcb_shape_select_input(_ecore_xcb_conn, win, on);
429 //   ecore_x_flush();
430 #else
431    return;
432    win = 0;
433    on = 0;
434 #endif
435 }
436
437 EAPI Ecore_X_Rectangle *
438 ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win,
439                                           int           *num_ret)
440 {
441    Ecore_X_Rectangle *rects = NULL;
442 #ifdef ECORE_XCB_SHAPE
443    xcb_shape_get_rectangles_cookie_t cookie;
444    xcb_shape_get_rectangles_reply_t *reply;
445    xcb_rectangle_t *r;
446    unsigned int i = 0;
447 #endif
448
449    LOGFN(__FILE__, __LINE__, __FUNCTION__);
450    CHECK_XCB_CONN;
451
452    if (num_ret) *num_ret = 0;
453
454 #ifdef ECORE_XCB_SHAPE
455    cookie =
456      xcb_shape_get_rectangles(_ecore_xcb_conn, win, XCB_SHAPE_SK_INPUT);
457    reply = xcb_shape_get_rectangles_reply(_ecore_xcb_conn, cookie, NULL);
458    if (!reply) return NULL;
459    if (num_ret) *num_ret = reply->rectangles_len;
460
461    if (reply->rectangles_len < 1)
462      {
463         free(reply);
464         if (num_ret) *num_ret = 0;
465         return NULL;
466      }
467
468    rects = malloc(sizeof(Ecore_X_Rectangle) * reply->rectangles_len);
469    if (!rects)
470      {
471         free(reply);
472         if (num_ret) *num_ret = 0;
473         return NULL;
474      }
475    r = xcb_shape_get_rectangles_rectangles(reply);
476    for (i = 0; i < reply->rectangles_len; i++)
477      {
478         rects[i].x = r[i].x;
479         rects[i].y = r[i].y;
480         rects[i].width = r[i].width;
481         rects[i].height = r[i].height;
482      }
483
484    free(reply);
485
486    return rects;
487 #else
488    xcb_get_geometry_cookie_t cookie;
489    xcb_get_geometry_reply_t *reply;
490
491    if (!(rects = malloc(sizeof(Ecore_X_Rectangle))))
492      return NULL;
493
494    /* get geometry */
495    cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, win);
496    reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL);
497    if (reply)
498      {
499         rects[0].x = reply->x;
500         rects[0].y = reply->y;
501         rects[0].width = reply->width;
502         rects[0].height = reply->height;
503         free(reply);
504      }
505    if (num_ret) *num_ret = 1;
506    return rects;
507 #endif
508 }
509
510 EAPI void
511 ecore_x_window_shape_input_rectangles_set(Ecore_X_Window     win,
512                                           Ecore_X_Rectangle *rects,
513                                           int                num)
514 {
515 #ifdef ECORE_XCB_SHAPE
516    xcb_rectangle_t *rect = NULL;
517 #endif
518
519    LOGFN(__FILE__, __LINE__, __FUNCTION__);
520    CHECK_XCB_CONN;
521
522    if (!rects) return;
523
524 #ifdef ECORE_XCB_SHAPE
525    if (num > 0)
526      {
527         int i = 0;
528
529         if (!(rect = malloc(sizeof(xcb_rectangle_t) * num)))
530           return;
531
532         for (i = 0; i < num; i++)
533           {
534              rect[i].x = rects[i].x;
535              rect[i].y = rects[i].y;
536              rect[i].width = rects[i].width;
537              rect[i].height = rects[i].height;
538           }
539      }
540    xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET,
541                         XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
542                         win, 0, 0, num, (xcb_rectangle_t *)rect);
543
544    if (rect) free(rect);
545 //   ecore_x_flush();
546 #else
547    return;
548    win = 0;
549    num = 0;
550    rects = NULL;
551 #endif
552 }
553
554 EAPI void
555 ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win,
556                                               int            x,
557                                               int            y,
558                                               int            w,
559                                               int            h)
560 {
561 #ifdef ECORE_XCB_SHAPE
562    xcb_rectangle_t rect;
563 #endif
564
565    LOGFN(__FILE__, __LINE__, __FUNCTION__);
566    CHECK_XCB_CONN;
567
568 #ifdef ECORE_XCB_SHAPE
569    rect.x = x;
570    rect.y = y;
571    rect.width = w;
572    rect.height = h;
573    xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SUBTRACT,
574                         XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
575                         win, 0, 0, 1, &rect);
576 //   ecore_x_flush();
577 #else
578    return;
579    win = 0;
580    x = 0;
581    y = 0;
582    w = 0;
583    h = 0;
584 #endif
585 }
586
587 EAPI void
588 ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win,
589                                          int            x,
590                                          int            y,
591                                          int            w,
592                                          int            h)
593 {
594 #ifdef ECORE_XCB_SHAPE
595    xcb_rectangle_t rect;
596 #endif
597
598    LOGFN(__FILE__, __LINE__, __FUNCTION__);
599    CHECK_XCB_CONN;
600
601 #ifdef ECORE_XCB_SHAPE
602    rect.x = x;
603    rect.y = y;
604    rect.width = w;
605    rect.height = h;
606    xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
607                         XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
608                         win, 0, 0, 1, &rect);
609 //   ecore_x_flush();
610 #else
611    return;
612    win = 0;
613    x = 0;
614    y = 0;
615    w = 0;
616    h = 0;
617 #endif
618 }
619
620 EAPI void
621 ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win,
622                                          int            x,
623                                          int            y,
624                                          int            w,
625                                          int            h)
626 {
627 #ifdef ECORE_XCB_SHAPE
628    xcb_rectangle_t rect;
629 #endif
630
631    LOGFN(__FILE__, __LINE__, __FUNCTION__);
632    CHECK_XCB_CONN;
633
634 #ifdef ECORE_XCB_SHAPE
635    rect.x = x;
636    rect.y = y;
637    rect.width = w;
638    rect.height = h;
639    xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET,
640                         XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
641                         win, 0, 0, 1, &rect);
642 //   ecore_x_flush();
643 #else
644    return;
645    win = 0;
646    x = 0;
647    y = 0;
648    w = 0;
649    h = 0;
650 #endif
651 }
652
653 EAPI void
654 ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win,
655                                          Ecore_X_Window shape_win,
656                                          int            x,
657                                          int            y)
658 {
659    LOGFN(__FILE__, __LINE__, __FUNCTION__);
660    CHECK_XCB_CONN;
661
662 #ifdef ECORE_XCB_SHAPE
663    xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT,
664                      XCB_SHAPE_SK_INPUT, win, x, y, shape_win);
665 //   ecore_x_flush();
666 #else
667    return;
668    win = 0;
669    shape_win = 0;
670    x = 0;
671    y = 0;
672 #endif
673 }
674
675 EAPI void
676 ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win,
677                                          Ecore_X_Window shape_win,
678                                          int            x,
679                                          int            y)
680 {
681    LOGFN(__FILE__, __LINE__, __FUNCTION__);
682    CHECK_XCB_CONN;
683
684 #ifdef ECORE_XCB_SHAPE
685    xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_INPUT,
686                      XCB_SHAPE_SK_INPUT, win, x, y, shape_win);
687 //   ecore_x_flush();
688 #else
689    return;
690    win = 0;
691    shape_win = 0;
692    x = 0;
693    y = 0;
694 #endif
695 }
696
697 EAPI void
698 ecore_x_window_shape_input_window_set(Ecore_X_Window win,
699                                       Ecore_X_Window shape_win)
700 {
701    LOGFN(__FILE__, __LINE__, __FUNCTION__);
702    CHECK_XCB_CONN;
703
704 #ifdef ECORE_XCB_SHAPE
705    xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT,
706                      XCB_SHAPE_SK_INPUT, win, 0, 0, shape_win);
707 //   ecore_x_flush();
708 #else
709    return;
710    win = 0;
711    shape_win = 0;
712 #endif
713 }
714
715 EAPI void
716 ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win,
717                                           int            x,
718                                           int            y,
719                                           int            w,
720                                           int            h)
721 {
722 #ifdef ECORE_XCB_SHAPE
723    xcb_rectangle_t rect;
724 #endif
725
726    LOGFN(__FILE__, __LINE__, __FUNCTION__);
727    CHECK_XCB_CONN;
728
729 #ifdef ECORE_XCB_SHAPE
730    rect.x = x;
731    rect.y = y;
732    rect.width = w;
733    rect.height = h;
734    xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_INTERSECT,
735                         XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
736                         win, 0, 0, 1, &rect);
737 //   ecore_x_flush();
738 #else
739    return;
740    win = 0;
741    x = 0;
742    y = 0;
743    w = 0;
744    h = 0;
745 #endif
746 }
747
748 EAPI void
749 ecore_x_window_shape_input_rectangles_add(Ecore_X_Window     win,
750                                           Ecore_X_Rectangle *rects,
751                                           int                num)
752 {
753 #ifdef ECORE_XCB_SHAPE
754    xcb_rectangle_t *rect = NULL;
755 #endif
756
757    LOGFN(__FILE__, __LINE__, __FUNCTION__);
758    CHECK_XCB_CONN;
759
760 #ifdef ECORE_XCB_SHAPE
761    if (num > 0)
762      {
763         int i = 0;
764
765         if (!(rect = malloc(sizeof(xcb_rectangle_t) * num)))
766           return;
767
768         for (i = 0; i < num; i++)
769           {
770              rect[i].x = rects[i].x;
771              rect[i].y = rects[i].y;
772              rect[i].width = rects[i].width;
773              rect[i].height = rects[i].height;
774           }
775      }
776
777    xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION,
778                         XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED,
779                         win, 0, 0, num, (xcb_rectangle_t *)&rect);
780
781    if (rect) free(rect);
782 //   ecore_x_flush();
783 #else
784    return;
785    win = 0;
786    num = 0;
787    rects = NULL;
788 #endif
789 }
790