2 #include "ecore_x_private.h"
6 * @defgroup Ecore_X_Window_Shape X Window Shape Functions
8 * These functions use the shape extension of the X server to change
9 * shape of given windows.
13 * Sets the shape of the given window to that given by the pixmap @p mask.
14 * @param win The given window.
15 * @param mask A 2-bit depth pixmap that provides the new shape of the
17 * @ingroup Ecore_X_Window_Shape
20 ecore_x_window_shape_mask_set(Ecore_X_Window win, Ecore_X_Pixmap mask)
22 XShapeCombineMask(_ecore_x_disp, win, ShapeBounding, 0, 0, mask, ShapeSet);
26 ecore_x_window_shape_window_set(Ecore_X_Window win, Ecore_X_Window shape_win)
28 XShapeCombineShape(_ecore_x_disp, win, ShapeBounding, 0, 0, shape_win, ShapeBounding, ShapeSet);
32 ecore_x_window_shape_window_set_xy(Ecore_X_Window win, Ecore_X_Window shape_win, int x, int y)
34 XShapeCombineShape(_ecore_x_disp, win, ShapeBounding, x, y, shape_win, ShapeBounding, ShapeSet);
38 ecore_x_window_shape_rectangle_set(Ecore_X_Window win, int x, int y, int w, int h)
46 XShapeCombineRectangles(_ecore_x_disp, win, ShapeBounding, 0, 0, &rect, 1, ShapeSet, Unsorted);
50 ecore_x_window_shape_rectangles_set(Ecore_X_Window win, Ecore_X_Rectangle *rects, int num)
52 XRectangle *rect = NULL;
57 rect = malloc(sizeof(XRectangle) * num);
60 for (i = 0; i < num; i++)
62 rect[i].x = rects[i].x;
63 rect[i].y = rects[i].y;
64 rect[i].width = rects[i].width;
65 rect[i].height = rects[i].height;
71 XShapeCombineRectangles(_ecore_x_disp, win, ShapeBounding, 0, 0, rect, num, ShapeSet, Unsorted);
76 ecore_x_window_shape_window_add(Ecore_X_Window win, Ecore_X_Window shape_win)
78 XShapeCombineShape(_ecore_x_disp, win, ShapeBounding, 0, 0, shape_win, ShapeBounding, ShapeUnion);
82 ecore_x_window_shape_window_add_xy(Ecore_X_Window win, Ecore_X_Window shape_win, int x, int y)
84 XShapeCombineShape(_ecore_x_disp, win, ShapeBounding, x, y, shape_win, ShapeBounding, ShapeUnion);
88 ecore_x_window_shape_rectangle_add(Ecore_X_Window win, int x, int y, int w, int h)
96 XShapeCombineRectangles(_ecore_x_disp, win, ShapeBounding, 0, 0, &rect, 1, ShapeUnion, Unsorted);
100 ecore_x_window_shape_rectangle_clip(Ecore_X_Window win, int x, int y, int w, int h)
108 XShapeCombineRectangles(_ecore_x_disp, win, ShapeBounding, 0, 0, &rect, 1, ShapeIntersect, Unsorted);
112 ecore_x_window_shape_rectangles_add(Ecore_X_Window win, Ecore_X_Rectangle *rects, int num)
114 XRectangle *rect = NULL;
119 rect = malloc(sizeof(XRectangle) * num);
122 for (i = 0; i < num; i++)
124 rect[i].x = rects[i].x;
125 rect[i].y = rects[i].y;
126 rect[i].width = rects[i].width;
127 rect[i].height = rects[i].height;
133 XShapeCombineRectangles(_ecore_x_disp, win, ShapeBounding, 0, 0, rect, num, ShapeUnion, Unsorted);
134 if (rect) free(rect);
137 EAPI Ecore_X_Rectangle *
138 ecore_x_window_shape_rectangles_get(Ecore_X_Window win, int *num_ret)
141 Ecore_X_Rectangle *rects = NULL;
144 rect = XShapeGetRectangles(_ecore_x_disp, win, ShapeBounding, &num, &ord);
147 rects = malloc(sizeof(Ecore_X_Rectangle) * num);
150 for (i = 0; i < num; i++)
152 rects[i].x = rect[i].x;
153 rects[i].y = rect[i].y;
154 rects[i].width = rect[i].width;
155 rects[i].height = rect[i].height;
160 if (num_ret) *num_ret = num;
165 ecore_x_window_shape_events_select(Ecore_X_Window win, int on)
168 XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask);
170 XShapeSelectInput(_ecore_x_disp, win, 0);
174 * Sets the input shape of the given window to that given by the pixmap @p mask.
175 * @param win The given window.
176 * @param mask A 2-bit depth pixmap that provides the new input shape of the
178 * @ingroup Ecore_X_Window_Shape
181 ecore_x_window_shape_input_mask_set(Ecore_X_Window win, Ecore_X_Pixmap mask)
184 XShapeCombineMask(_ecore_x_disp, win, ShapeInput, 0, 0, mask, ShapeSet);
186 XShapeCombineMask(_ecore_x_disp, win, ShapeBounding, 0, 0, mask, ShapeSet);