2 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
11 #include "ecore_x_private.h"
14 static int _fixes_available;
16 static int _fixes_major, _fixes_minor;
20 _ecore_x_fixes_init(void)
26 LOGFN(__FILE__, __LINE__, __FUNCTION__);
27 if (XFixesQueryVersion(_ecore_x_disp, &_fixes_major, &_fixes_minor))
37 /* I don't know what to call this function. */
39 _ecore_x_rectangle_ecore_to_x(Ecore_X_Rectangle *rects, int num)
44 if (num == 0) return NULL;
46 xrect = malloc(sizeof(XRectangle) * num);
47 if (!xrect) return NULL;
48 for (i = 0; i < num; i++)
50 xrect[i].x = rects[i].x;
51 xrect[i].y = rects[i].y;
52 xrect[i].width = rects[i].width;
53 xrect[i].height = rects[i].height;
58 static Ecore_X_Rectangle *
59 _ecore_x_rectangle_x_to_ecore(XRectangle *xrect, int num)
61 Ecore_X_Rectangle *rects;
64 if (num == 0) return NULL;
65 rects = malloc(sizeof(Ecore_X_Rectangle) * num);
66 if (!rects) return NULL;
67 for (i = 0; i < num; i++)
69 rects[i].x = xrect[i].x;
70 rects[i].y = xrect[i].y;
71 rects[i].width = xrect[i].width;
72 rects[i].height = xrect[i].height;
79 ecore_x_region_new(Ecore_X_Rectangle *rects, int num)
82 Ecore_X_Region region;
85 LOGFN(__FILE__, __LINE__, __FUNCTION__);
86 xrect = _ecore_x_rectangle_ecore_to_x(rects, num);
87 region = XFixesCreateRegion(_ecore_x_disp, xrect, num);
96 ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap)
99 Ecore_X_Region region;
101 LOGFN(__FILE__, __LINE__, __FUNCTION__);
102 region = XFixesCreateRegionFromBitmap(_ecore_x_disp, bitmap);
110 ecore_x_region_new_from_window(Ecore_X_Window win, Ecore_X_Region_Type type)
113 Ecore_X_Region region;
115 LOGFN(__FILE__, __LINE__, __FUNCTION__);
116 region = XFixesCreateRegionFromWindow(_ecore_x_disp, win, type);
124 ecore_x_region_new_from_gc(Ecore_X_GC gc)
127 Ecore_X_Region region;
129 LOGFN(__FILE__, __LINE__, __FUNCTION__);
130 region = XFixesCreateRegionFromGC(_ecore_x_disp, gc);
138 ecore_x_region_new_from_picture(Ecore_X_Picture picture)
141 Ecore_X_Region region;
143 LOGFN(__FILE__, __LINE__, __FUNCTION__);
144 region = XFixesCreateRegionFromPicture(_ecore_x_disp, picture);
152 ecore_x_region_free(Ecore_X_Region region)
155 LOGFN(__FILE__, __LINE__, __FUNCTION__);
156 XFixesDestroyRegion(_ecore_x_disp, region);
161 ecore_x_region_set(Ecore_X_Region region, Ecore_X_Rectangle *rects, int num)
164 XRectangle *xrect = _ecore_x_rectangle_ecore_to_x(rects, num);
165 LOGFN(__FILE__, __LINE__, __FUNCTION__);
166 XFixesSetRegion(_ecore_x_disp, region, xrect, num);
171 ecore_x_region_copy(Ecore_X_Region dest, Ecore_X_Region source)
174 LOGFN(__FILE__, __LINE__, __FUNCTION__);
175 XFixesCopyRegion(_ecore_x_disp, dest, source);
180 ecore_x_region_combine(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Region source2)
183 LOGFN(__FILE__, __LINE__, __FUNCTION__);
184 XFixesUnionRegion(_ecore_x_disp, dest, source1, source2);
189 ecore_x_region_intersect(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Region source2)
192 LOGFN(__FILE__, __LINE__, __FUNCTION__);
193 XFixesIntersectRegion(_ecore_x_disp, dest, source1, source2);
198 ecore_x_region_subtract(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Region source2)
201 LOGFN(__FILE__, __LINE__, __FUNCTION__);
202 XFixesSubtractRegion(_ecore_x_disp, dest, source1, source2);
207 ecore_x_region_invert(Ecore_X_Region dest, Ecore_X_Rectangle *bounds, Ecore_X_Region source)
213 LOGFN(__FILE__, __LINE__, __FUNCTION__);
214 while (bounds + num) num++;
215 xbound = _ecore_x_rectangle_ecore_to_x(bounds, num);
217 XFixesInvertRegion(_ecore_x_disp, dest, xbound, source);
222 ecore_x_region_translate(Ecore_X_Region region, int dx, int dy)
225 LOGFN(__FILE__, __LINE__, __FUNCTION__);
226 XFixesTranslateRegion(_ecore_x_disp, region, dx, dy);
231 ecore_x_region_extents(Ecore_X_Region dest, Ecore_X_Region source)
234 LOGFN(__FILE__, __LINE__, __FUNCTION__);
235 XFixesRegionExtents(_ecore_x_disp, dest, source);
239 EAPI Ecore_X_Rectangle *
240 ecore_x_region_fetch(Ecore_X_Region region, int *num, Ecore_X_Rectangle *bounds){
242 Ecore_X_Rectangle *rects;
243 XRectangle *xrect, xbound;
245 LOGFN(__FILE__, __LINE__, __FUNCTION__);
246 xrect = XFixesFetchRegionAndBounds(_ecore_x_disp, region, num, &xbound);
247 rects = _ecore_x_rectangle_x_to_ecore(xrect, *num);
248 (*bounds).x = xbound.x;
249 (*bounds).y = xbound.y;
250 (*bounds).width = xbound.width;
251 (*bounds).height = xbound.height;
259 ecore_x_region_expand(Ecore_X_Region dest, Ecore_X_Region source, unsigned int left, unsigned int right, unsigned int top, unsigned int bottom)
262 LOGFN(__FILE__, __LINE__, __FUNCTION__);
263 XFixesExpandRegion(_ecore_x_disp, dest, source, left, right, top, bottom);
268 ecore_x_region_gc_clip_set(Ecore_X_Region region, Ecore_X_GC gc, int x_origin, int y_origin)
271 LOGFN(__FILE__, __LINE__, __FUNCTION__);
272 XFixesSetGCClipRegion(_ecore_x_disp, gc, x_origin, y_origin, region);
277 ecore_x_region_window_shape_set(Ecore_X_Region region, Ecore_X_Window win, Ecore_X_Shape_Type type, int x_offset, int y_offset)
280 LOGFN(__FILE__, __LINE__, __FUNCTION__);
281 XFixesSetWindowShapeRegion(_ecore_x_disp, win, type, x_offset, y_offset, region);
286 ecore_x_region_picture_clip_set(Ecore_X_Region region, Ecore_X_Picture picture, int x_origin, int y_origin)
289 LOGFN(__FILE__, __LINE__, __FUNCTION__);
290 XFixesSetPictureClipRegion(_ecore_x_disp, picture, x_origin, y_origin, region);