3 #endif /* ifdef HAVE_CONFIG_H */
8 #include "ecore_x_private.h"
12 * @defgroup Ecore_X_Window_Shape X Window Shape Functions
13 * @ingroup Ecore_X_Group
15 * These functions use the shape extension of the X server to change
16 * shape of given windows.
20 * Sets the shape of the given window to that given by the pixmap @p mask.
21 * @param win The given window.
22 * @param mask A 2-bit depth pixmap that provides the new shape of the
24 * @ingroup Ecore_X_Window_Shape
27 ecore_x_window_shape_mask_set(Ecore_X_Window win,
30 LOGFN(__FILE__, __LINE__, __FUNCTION__);
31 XShapeCombineMask(_ecore_x_disp, win, ShapeBounding, 0, 0, mask, ShapeSet);
32 if (_ecore_xlib_sync) ecore_x_sync();
36 * Sets the input shape of the given window to that given by the pixmap @p mask.
37 * @param win The given window.
38 * @param mask A 1-bit depth pixmap that provides the new input shape of the
40 * @ingroup Ecore_X_Window_Shape
43 ecore_x_window_shape_input_mask_set(Ecore_X_Window win,
46 LOGFN(__FILE__, __LINE__, __FUNCTION__);
48 XShapeCombineMask(_ecore_x_disp, win, ShapeInput, 0, 0, mask, ShapeSet);
49 if (_ecore_xlib_sync) ecore_x_sync();
50 #else /* ifdef ShapeInput */
53 #endif /* ifdef ShapeInput */
57 ecore_x_window_shape_window_set(Ecore_X_Window win,
58 Ecore_X_Window shape_win)
60 LOGFN(__FILE__, __LINE__, __FUNCTION__);
61 XShapeCombineShape(_ecore_x_disp,
69 if (_ecore_xlib_sync) ecore_x_sync();
73 ecore_x_window_shape_input_window_set(Ecore_X_Window win,
74 Ecore_X_Window shape_win)
77 LOGFN(__FILE__, __LINE__, __FUNCTION__);
78 XShapeCombineShape(_ecore_x_disp,
86 if (_ecore_xlib_sync) ecore_x_sync();
94 ecore_x_window_shape_window_set_xy(Ecore_X_Window win,
95 Ecore_X_Window shape_win,
99 LOGFN(__FILE__, __LINE__, __FUNCTION__);
100 XShapeCombineShape(_ecore_x_disp,
108 if (_ecore_xlib_sync) ecore_x_sync();
112 ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win,
113 Ecore_X_Window shape_win,
118 LOGFN(__FILE__, __LINE__, __FUNCTION__);
119 XShapeCombineShape(_ecore_x_disp,
127 if (_ecore_xlib_sync) ecore_x_sync();
130 win = shape_win = x = y = 0;
135 ecore_x_window_shape_rectangle_set(Ecore_X_Window win,
143 LOGFN(__FILE__, __LINE__, __FUNCTION__);
148 XShapeCombineRectangles(_ecore_x_disp,
157 if (_ecore_xlib_sync) ecore_x_sync();
161 ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win,
170 LOGFN(__FILE__, __LINE__, __FUNCTION__);
175 XShapeCombineRectangles(_ecore_x_disp,
184 if (_ecore_xlib_sync) ecore_x_sync();
187 win = x = y = w = h = 0;
192 ecore_x_window_shape_rectangles_set(Ecore_X_Window win,
193 Ecore_X_Rectangle *rects,
197 XRectangle *rect = NULL;
200 LOGFN(__FILE__, __LINE__, __FUNCTION__);
204 rect = malloc(sizeof(XRectangle) * num);
206 for (i = 0; i < num; i++)
208 rect[i].x = rects[i].x;
209 rect[i].y = rects[i].y;
210 rect[i].width = rects[i].width;
211 rect[i].height = rects[i].height;
214 XShapeCombineRectangles(_ecore_x_disp,
223 if (_ecore_xlib_sync) ecore_x_sync();
224 if (rect) free(rect);
227 win = rects = num = 0;
232 ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win,
233 Ecore_X_Rectangle *rects,
237 XRectangle *rect = NULL;
240 LOGFN(__FILE__, __LINE__, __FUNCTION__);
244 rect = malloc(sizeof(XRectangle) * num);
246 for (i = 0; i < num; i++)
248 rect[i].x = rects[i].x;
249 rect[i].y = rects[i].y;
250 rect[i].width = rects[i].width;
251 rect[i].height = rects[i].height;
254 XShapeCombineRectangles(_ecore_x_disp,
263 if (_ecore_xlib_sync) ecore_x_sync();
264 if (rect) free(rect);
267 win = rects = num = 0;
272 ecore_x_window_shape_rectangle_subtract(Ecore_X_Window win,
280 LOGFN(__FILE__, __LINE__, __FUNCTION__);
285 XShapeCombineRectangles(_ecore_x_disp,
294 if (_ecore_xlib_sync) ecore_x_sync();
298 ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win,
307 LOGFN(__FILE__, __LINE__, __FUNCTION__);
312 XShapeCombineRectangles(_ecore_x_disp,
321 if (_ecore_xlib_sync) ecore_x_sync();
324 win = x = y = w = h = 0;
329 ecore_x_window_shape_window_add(Ecore_X_Window win,
330 Ecore_X_Window shape_win)
332 LOGFN(__FILE__, __LINE__, __FUNCTION__);
333 XShapeCombineShape(_ecore_x_disp,
341 if (_ecore_xlib_sync) ecore_x_sync();
345 ecore_x_window_shape_window_add_xy(Ecore_X_Window win,
346 Ecore_X_Window shape_win,
350 LOGFN(__FILE__, __LINE__, __FUNCTION__);
351 XShapeCombineShape(_ecore_x_disp,
359 if (_ecore_xlib_sync) ecore_x_sync();
363 ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win,
364 Ecore_X_Window shape_win,
369 LOGFN(__FILE__, __LINE__, __FUNCTION__);
370 XShapeCombineShape(_ecore_x_disp,
378 if (_ecore_xlib_sync) ecore_x_sync();
381 win = shape_win = x = y = 0;
386 ecore_x_window_shape_rectangle_add(Ecore_X_Window win,
394 LOGFN(__FILE__, __LINE__, __FUNCTION__);
399 XShapeCombineRectangles(_ecore_x_disp,
408 if (_ecore_xlib_sync) ecore_x_sync();
412 ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win,
421 LOGFN(__FILE__, __LINE__, __FUNCTION__);
426 XShapeCombineRectangles(_ecore_x_disp,
435 if (_ecore_xlib_sync) ecore_x_sync();
438 win = x = y = w = h = 0;
443 ecore_x_window_shape_rectangle_clip(Ecore_X_Window win,
451 LOGFN(__FILE__, __LINE__, __FUNCTION__);
456 XShapeCombineRectangles(_ecore_x_disp,
465 if (_ecore_xlib_sync) ecore_x_sync();
469 ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win,
478 LOGFN(__FILE__, __LINE__, __FUNCTION__);
483 XShapeCombineRectangles(_ecore_x_disp,
492 if (_ecore_xlib_sync) ecore_x_sync();
495 win = x = y = w = h = 0;
500 ecore_x_window_shape_rectangles_add(Ecore_X_Window win,
501 Ecore_X_Rectangle *rects,
504 XRectangle *rect = NULL;
507 LOGFN(__FILE__, __LINE__, __FUNCTION__);
510 rect = malloc(sizeof(XRectangle) * num);
512 for (i = 0; i < num; i++)
514 rect[i].x = rects[i].x;
515 rect[i].y = rects[i].y;
516 rect[i].width = rects[i].width;
517 rect[i].height = rects[i].height;
521 XShapeCombineRectangles(_ecore_x_disp,
530 if (_ecore_xlib_sync) ecore_x_sync();
531 if (rect) free(rect);
535 ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win,
536 Ecore_X_Rectangle *rects,
540 XRectangle *rect = NULL;
543 LOGFN(__FILE__, __LINE__, __FUNCTION__);
546 rect = malloc(sizeof(XRectangle) * num);
548 for (i = 0; i < num; i++)
550 rect[i].x = rects[i].x;
551 rect[i].y = rects[i].y;
552 rect[i].width = rects[i].width;
553 rect[i].height = rects[i].height;
557 XShapeCombineRectangles(_ecore_x_disp,
566 if (_ecore_xlib_sync) ecore_x_sync();
567 if (rect) free(rect);
570 win = rects = num = 0;
574 EAPI Ecore_X_Rectangle *
575 ecore_x_window_shape_rectangles_get(Ecore_X_Window win,
579 Ecore_X_Rectangle *rects = NULL;
582 LOGFN(__FILE__, __LINE__, __FUNCTION__);
583 rect = XShapeGetRectangles(_ecore_x_disp, win, ShapeBounding, &num, &ord);
584 if (_ecore_xlib_sync) ecore_x_sync();
590 if (num_ret) *num_ret = 0;
593 rects = malloc(sizeof(Ecore_X_Rectangle) * num);
597 if (num_ret) *num_ret = 0;
600 for (i = 0; i < num; i++)
602 rects[i].x = rect[i].x;
603 rects[i].y = rect[i].y;
604 rects[i].width = rect[i].width;
605 rects[i].height = rect[i].height;
609 if (num_ret) *num_ret = num;
613 EAPI Ecore_X_Rectangle *
614 ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win,
617 Ecore_X_Rectangle *rects = NULL;
622 LOGFN(__FILE__, __LINE__, __FUNCTION__);
623 rect = XShapeGetRectangles(_ecore_x_disp, win, ShapeInput, &num, &ord);
624 if (_ecore_xlib_sync) ecore_x_sync();
630 if (num_ret) *num_ret = 0;
633 rects = malloc(sizeof(Ecore_X_Rectangle) * num);
637 if (num_ret) *num_ret = 0;
640 for (i = 0; i < num; i++)
642 rects[i].x = rect[i].x;
643 rects[i].y = rect[i].y;
644 rects[i].width = rect[i].width;
645 rects[i].height = rect[i].height;
649 if (num_ret) *num_ret = num;
652 // have to return fake shape input rect of size of window
656 if (num_ret) *num_ret = 0;
657 rects = malloc(sizeof(Ecore_X_Rectangle));
658 if (!rects) return NULL;
659 if (!XGetGeometry(_ecore_x_disp, win, &dw,
660 &(rects[0].x), &(rects[0].y),
661 &(rects[0].width), &(rects[0].height),
664 if (_ecore_xlib_sync) ecore_x_sync();
668 if (_ecore_xlib_sync) ecore_x_sync();
669 if (num_ret) *num_ret = 1;
675 ecore_x_window_shape_events_select(Ecore_X_Window win,
678 LOGFN(__FILE__, __LINE__, __FUNCTION__);
680 XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask);
682 XShapeSelectInput(_ecore_x_disp, win, 0);
683 if (_ecore_xlib_sync) ecore_x_sync();