3 #endif /* ifdef HAVE_CONFIG_H */
8 #include "ecore_x_private.h"
12 * @defgroup Ecore_X_Window_Shape X Window Shape Functions
14 * These functions use the shape extension of the X server to change
15 * shape of given windows.
19 * Sets the shape of the given window to that given by the pixmap @p mask.
20 * @param win The given window.
21 * @param mask A 2-bit depth pixmap that provides the new shape of the
23 * @ingroup Ecore_X_Window_Shape
26 ecore_x_window_shape_mask_set(Ecore_X_Window win,
29 LOGFN(__FILE__, __LINE__, __FUNCTION__);
30 XShapeCombineMask(_ecore_x_disp, win, ShapeBounding, 0, 0, mask, ShapeSet);
34 * Sets the input shape of the given window to that given by the pixmap @p mask.
35 * @param win The given window.
36 * @param mask A 1-bit depth pixmap that provides the new input shape of the
38 * @ingroup Ecore_X_Window_Shape
41 ecore_x_window_shape_input_mask_set(Ecore_X_Window win,
44 LOGFN(__FILE__, __LINE__, __FUNCTION__);
46 XShapeCombineMask(_ecore_x_disp, win, ShapeInput, 0, 0, mask, ShapeSet);
47 #else /* ifdef ShapeInput */
50 #endif /* ifdef ShapeInput */
54 ecore_x_window_shape_window_set(Ecore_X_Window win,
55 Ecore_X_Window shape_win)
57 LOGFN(__FILE__, __LINE__, __FUNCTION__);
58 XShapeCombineShape(_ecore_x_disp,
69 ecore_x_window_shape_input_window_set(Ecore_X_Window win,
70 Ecore_X_Window shape_win)
73 LOGFN(__FILE__, __LINE__, __FUNCTION__);
74 XShapeCombineShape(_ecore_x_disp,
89 ecore_x_window_shape_window_set_xy(Ecore_X_Window win,
90 Ecore_X_Window shape_win,
94 LOGFN(__FILE__, __LINE__, __FUNCTION__);
95 XShapeCombineShape(_ecore_x_disp,
106 ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win,
107 Ecore_X_Window shape_win,
112 LOGFN(__FILE__, __LINE__, __FUNCTION__);
113 XShapeCombineShape(_ecore_x_disp,
123 win = shape_win = x = y = 0;
128 ecore_x_window_shape_rectangle_set(Ecore_X_Window win,
136 LOGFN(__FILE__, __LINE__, __FUNCTION__);
141 XShapeCombineRectangles(_ecore_x_disp,
153 ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win,
162 LOGFN(__FILE__, __LINE__, __FUNCTION__);
167 XShapeCombineRectangles(_ecore_x_disp,
178 win = x = y = w = h = 0;
183 ecore_x_window_shape_rectangles_set(Ecore_X_Window win,
184 Ecore_X_Rectangle *rects,
188 XRectangle *rect = NULL;
191 LOGFN(__FILE__, __LINE__, __FUNCTION__);
195 rect = malloc(sizeof(XRectangle) * num);
197 for (i = 0; i < num; i++)
199 rect[i].x = rects[i].x;
200 rect[i].y = rects[i].y;
201 rect[i].width = rects[i].width;
202 rect[i].height = rects[i].height;
205 XShapeCombineRectangles(_ecore_x_disp,
214 if (rect) free(rect);
217 win = rects = num = 0;
222 ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win,
223 Ecore_X_Rectangle *rects,
227 XRectangle *rect = NULL;
230 LOGFN(__FILE__, __LINE__, __FUNCTION__);
234 rect = malloc(sizeof(XRectangle) * num);
236 for (i = 0; i < num; i++)
238 rect[i].x = rects[i].x;
239 rect[i].y = rects[i].y;
240 rect[i].width = rects[i].width;
241 rect[i].height = rects[i].height;
244 XShapeCombineRectangles(_ecore_x_disp,
253 if (rect) free(rect);
256 win = rects = num = 0;
261 ecore_x_window_shape_rectangle_subtract(Ecore_X_Window win,
269 LOGFN(__FILE__, __LINE__, __FUNCTION__);
274 XShapeCombineRectangles(_ecore_x_disp,
286 ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win,
295 LOGFN(__FILE__, __LINE__, __FUNCTION__);
300 XShapeCombineRectangles(_ecore_x_disp,
311 win = x = y = w = h = 0;
316 ecore_x_window_shape_window_add(Ecore_X_Window win,
317 Ecore_X_Window shape_win)
319 LOGFN(__FILE__, __LINE__, __FUNCTION__);
320 XShapeCombineShape(_ecore_x_disp,
331 ecore_x_window_shape_window_add_xy(Ecore_X_Window win,
332 Ecore_X_Window shape_win,
336 LOGFN(__FILE__, __LINE__, __FUNCTION__);
337 XShapeCombineShape(_ecore_x_disp,
348 ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win,
349 Ecore_X_Window shape_win,
354 LOGFN(__FILE__, __LINE__, __FUNCTION__);
355 XShapeCombineShape(_ecore_x_disp,
365 win = shape_win = x = y = 0;
370 ecore_x_window_shape_rectangle_add(Ecore_X_Window win,
378 LOGFN(__FILE__, __LINE__, __FUNCTION__);
383 XShapeCombineRectangles(_ecore_x_disp,
395 ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win,
404 LOGFN(__FILE__, __LINE__, __FUNCTION__);
409 XShapeCombineRectangles(_ecore_x_disp,
420 win = x = y = w = h = 0;
425 ecore_x_window_shape_rectangle_clip(Ecore_X_Window win,
433 LOGFN(__FILE__, __LINE__, __FUNCTION__);
438 XShapeCombineRectangles(_ecore_x_disp,
450 ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win,
459 LOGFN(__FILE__, __LINE__, __FUNCTION__);
464 XShapeCombineRectangles(_ecore_x_disp,
475 win = x = y = w = h = 0;
480 ecore_x_window_shape_rectangles_add(Ecore_X_Window win,
481 Ecore_X_Rectangle *rects,
484 XRectangle *rect = NULL;
487 LOGFN(__FILE__, __LINE__, __FUNCTION__);
490 rect = malloc(sizeof(XRectangle) * num);
492 for (i = 0; i < num; i++)
494 rect[i].x = rects[i].x;
495 rect[i].y = rects[i].y;
496 rect[i].width = rects[i].width;
497 rect[i].height = rects[i].height;
501 XShapeCombineRectangles(_ecore_x_disp,
510 if (rect) free(rect);
514 ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win,
515 Ecore_X_Rectangle *rects,
519 XRectangle *rect = NULL;
522 LOGFN(__FILE__, __LINE__, __FUNCTION__);
525 rect = malloc(sizeof(XRectangle) * num);
527 for (i = 0; i < num; i++)
529 rect[i].x = rects[i].x;
530 rect[i].y = rects[i].y;
531 rect[i].width = rects[i].width;
532 rect[i].height = rects[i].height;
536 XShapeCombineRectangles(_ecore_x_disp,
545 if (rect) free(rect);
548 win = rects = num = 0;
552 EAPI Ecore_X_Rectangle *
553 ecore_x_window_shape_rectangles_get(Ecore_X_Window win,
557 Ecore_X_Rectangle *rects = NULL;
560 LOGFN(__FILE__, __LINE__, __FUNCTION__);
561 rect = XShapeGetRectangles(_ecore_x_disp, win, ShapeBounding, &num, &ord);
567 if (num_ret) *num_ret = 0;
570 rects = malloc(sizeof(Ecore_X_Rectangle) * num);
574 if (num_ret) *num_ret = 0;
577 for (i = 0; i < num; i++)
579 rects[i].x = rect[i].x;
580 rects[i].y = rect[i].y;
581 rects[i].width = rect[i].width;
582 rects[i].height = rect[i].height;
586 if (num_ret) *num_ret = num;
590 EAPI Ecore_X_Rectangle *
591 ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win,
594 Ecore_X_Rectangle *rects = NULL;
599 LOGFN(__FILE__, __LINE__, __FUNCTION__);
600 rect = XShapeGetRectangles(_ecore_x_disp, win, ShapeInput, &num, &ord);
606 if (num_ret) *num_ret = 0;
609 rects = malloc(sizeof(Ecore_X_Rectangle) * num);
613 if (num_ret) *num_ret = 0;
616 for (i = 0; i < num; i++)
618 rects[i].x = rect[i].x;
619 rects[i].y = rect[i].y;
620 rects[i].width = rect[i].width;
621 rects[i].height = rect[i].height;
625 if (num_ret) *num_ret = num;
628 // have to return fake shape input rect of size of window
632 if (num_ret) *num_ret = 0;
633 rects = malloc(sizeof(Ecore_X_Rectangle));
634 if (!rects) return NULL;
635 if (!XGetGeometry(_ecore_x_disp, win, &dw,
636 &(rects[0].x), &(rects[0].y),
637 &(rects[0].width), &(rects[0].height),
643 if (num_ret) *num_ret = 1;
649 ecore_x_window_shape_events_select(Ecore_X_Window win,
652 LOGFN(__FILE__, __LINE__, __FUNCTION__);
654 XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask);
656 XShapeSelectInput(_ecore_x_disp, win, 0);