3 #endif /* ifdef HAVE_CONFIG_H */
7 #include "ecore_x_private.h"
10 static int _fixes_available;
12 static int _fixes_major, _fixes_minor;
13 #endif /* ifdef ECORE_XFIXES */
16 _ecore_x_fixes_init(void)
22 LOGFN(__FILE__, __LINE__, __FUNCTION__);
24 EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
26 if (XFixesQueryVersion(_ecore_x_disp, &_fixes_major, &_fixes_minor))
30 ECORE_X_EVENT_FIXES_SELECTION_NOTIFY = ecore_event_type_new();
35 #else /* ifdef ECORE_XFIXES */
37 #endif /* ifdef ECORE_XFIXES */
41 /* I don't know what to call this function. */
43 _ecore_x_rectangle_ecore_to_x(Ecore_X_Rectangle *rects,
52 xrect = malloc(sizeof(XRectangle) * num);
56 for (i = 0; i < num; i++)
58 xrect[i].x = rects[i].x;
59 xrect[i].y = rects[i].y;
60 xrect[i].width = rects[i].width;
61 xrect[i].height = rects[i].height;
66 static Ecore_X_Rectangle *
67 _ecore_x_rectangle_x_to_ecore(XRectangle *xrect,
70 Ecore_X_Rectangle *rects;
76 rects = malloc(sizeof(Ecore_X_Rectangle) * num);
80 for (i = 0; i < num; i++)
82 rects[i].x = xrect[i].x;
83 rects[i].y = xrect[i].y;
84 rects[i].width = xrect[i].width;
85 rects[i].height = xrect[i].height;
90 #endif /* ifdef ECORE_XFIXES */
93 ecore_x_fixes_selection_notification_request(Ecore_X_Atom selection)
95 EINA_SAFETY_ON_NULL_RETURN_VAL(_ecore_x_disp, EINA_FALSE);
100 XFixesSelectSelectionInput (_ecore_x_disp,
101 DefaultRootWindow(_ecore_x_disp),
103 XFixesSetSelectionOwnerNotifyMask |
104 XFixesSelectionWindowDestroyNotifyMask |
105 XFixesSelectionClientCloseNotifyMask);
113 ecore_x_region_new(Ecore_X_Rectangle *rects,
116 EINA_SAFETY_ON_NULL_RETURN_VAL(_ecore_x_disp, 0);
119 Ecore_X_Region region;
122 LOGFN(__FILE__, __LINE__, __FUNCTION__);
123 xrect = _ecore_x_rectangle_ecore_to_x(rects, num);
124 region = XFixesCreateRegion(_ecore_x_disp, xrect, num);
127 #else /* ifdef ECORE_XFIXES */
129 #endif /* ifdef ECORE_XFIXES */
133 ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap)
135 EINA_SAFETY_ON_NULL_RETURN_VAL(_ecore_x_disp, 0);
137 Ecore_X_Region region;
139 LOGFN(__FILE__, __LINE__, __FUNCTION__);
140 region = XFixesCreateRegionFromBitmap(_ecore_x_disp, bitmap);
141 if (_ecore_xlib_sync) ecore_x_sync();
143 #else /* ifdef ECORE_XFIXES */
145 #endif /* ifdef ECORE_XFIXES */
149 ecore_x_region_new_from_window(Ecore_X_Window win,
150 Ecore_X_Region_Type type)
152 EINA_SAFETY_ON_NULL_RETURN_VAL(_ecore_x_disp, 0);
154 Ecore_X_Region region;
156 LOGFN(__FILE__, __LINE__, __FUNCTION__);
157 region = XFixesCreateRegionFromWindow(_ecore_x_disp, win, type);
158 if (_ecore_xlib_sync) ecore_x_sync();
160 #else /* ifdef ECORE_XFIXES */
162 #endif /* ifdef ECORE_XFIXES */
166 ecore_x_region_new_from_gc(Ecore_X_GC gc)
168 EINA_SAFETY_ON_NULL_RETURN_VAL(_ecore_x_disp, 0);
170 Ecore_X_Region region;
172 LOGFN(__FILE__, __LINE__, __FUNCTION__);
173 region = XFixesCreateRegionFromGC(_ecore_x_disp, gc);
174 if (_ecore_xlib_sync) ecore_x_sync();
176 #else /* ifdef ECORE_XFIXES */
178 #endif /* ifdef ECORE_XFIXES */
182 ecore_x_region_new_from_picture(Ecore_X_Picture picture)
184 EINA_SAFETY_ON_NULL_RETURN_VAL(_ecore_x_disp, 0);
186 Ecore_X_Region region;
188 LOGFN(__FILE__, __LINE__, __FUNCTION__);
189 region = XFixesCreateRegionFromPicture(_ecore_x_disp, picture);
190 if (_ecore_xlib_sync) ecore_x_sync();
192 #else /* ifdef ECORE_XFIXES */
194 #endif /* ifdef ECORE_XFIXES */
198 ecore_x_region_free(Ecore_X_Region region)
200 EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
202 LOGFN(__FILE__, __LINE__, __FUNCTION__);
203 XFixesDestroyRegion(_ecore_x_disp, region);
204 #endif /* ifdef ECORE_XFIXES */
208 ecore_x_region_set(Ecore_X_Region region,
209 Ecore_X_Rectangle *rects,
212 EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
214 XRectangle *xrect = _ecore_x_rectangle_ecore_to_x(rects, num);
215 LOGFN(__FILE__, __LINE__, __FUNCTION__);
216 XFixesSetRegion(_ecore_x_disp, region, xrect, num);
217 if (_ecore_xlib_sync) ecore_x_sync();
218 #endif /* ifdef ECORE_XFIXES */
222 ecore_x_region_copy(Ecore_X_Region dest,
223 Ecore_X_Region source)
225 EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
227 LOGFN(__FILE__, __LINE__, __FUNCTION__);
228 XFixesCopyRegion(_ecore_x_disp, dest, source);
229 if (_ecore_xlib_sync) ecore_x_sync();
230 #endif /* ifdef ECORE_XFIXES */
234 ecore_x_region_combine(Ecore_X_Region dest,
235 Ecore_X_Region source1,
236 Ecore_X_Region source2)
238 EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
240 LOGFN(__FILE__, __LINE__, __FUNCTION__);
241 XFixesUnionRegion(_ecore_x_disp, dest, source1, source2);
242 if (_ecore_xlib_sync) ecore_x_sync();
243 #endif /* ifdef ECORE_XFIXES */
247 ecore_x_region_intersect(Ecore_X_Region dest,
248 Ecore_X_Region source1,
249 Ecore_X_Region source2)
251 EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
253 LOGFN(__FILE__, __LINE__, __FUNCTION__);
254 XFixesIntersectRegion(_ecore_x_disp, dest, source1, source2);
255 if (_ecore_xlib_sync) ecore_x_sync();
256 #endif /* ifdef ECORE_XFIXES */
260 ecore_x_region_subtract(Ecore_X_Region dest,
261 Ecore_X_Region source1,
262 Ecore_X_Region source2)
264 EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
266 LOGFN(__FILE__, __LINE__, __FUNCTION__);
267 XFixesSubtractRegion(_ecore_x_disp, dest, source1, source2);
268 if (_ecore_xlib_sync) ecore_x_sync();
269 #endif /* ifdef ECORE_XFIXES */
273 ecore_x_region_invert(Ecore_X_Region dest,
274 Ecore_X_Rectangle *bounds,
275 Ecore_X_Region source)
277 EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
282 LOGFN(__FILE__, __LINE__, __FUNCTION__);
283 xbound = _ecore_x_rectangle_ecore_to_x(bounds, num);
285 XFixesInvertRegion(_ecore_x_disp, dest, xbound, source);
286 if (_ecore_xlib_sync) ecore_x_sync();
288 #endif /* ifdef ECORE_XFIXES */
292 ecore_x_region_translate(Ecore_X_Region region,
296 EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
298 LOGFN(__FILE__, __LINE__, __FUNCTION__);
299 XFixesTranslateRegion(_ecore_x_disp, region, dx, dy);
300 if (_ecore_xlib_sync) ecore_x_sync();
301 #endif /* ifdef ECORE_XFIXES */
305 ecore_x_region_extents(Ecore_X_Region dest,
306 Ecore_X_Region source)
308 EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
310 LOGFN(__FILE__, __LINE__, __FUNCTION__);
311 XFixesRegionExtents(_ecore_x_disp, dest, source);
312 if (_ecore_xlib_sync) ecore_x_sync();
313 #endif /* ifdef ECORE_XFIXES */
316 EAPI Ecore_X_Rectangle *
317 ecore_x_region_fetch(Ecore_X_Region region,
319 Ecore_X_Rectangle *bounds)
321 EINA_SAFETY_ON_NULL_RETURN_VAL(_ecore_x_disp, NULL);
323 Ecore_X_Rectangle *rects;
324 XRectangle *xrect, xbound;
326 LOGFN(__FILE__, __LINE__, __FUNCTION__);
327 xrect = XFixesFetchRegionAndBounds(_ecore_x_disp, region, num, &xbound);
328 if (_ecore_xlib_sync) ecore_x_sync();
329 rects = _ecore_x_rectangle_x_to_ecore(xrect, *num);
330 (*bounds).x = xbound.x;
331 (*bounds).y = xbound.y;
332 (*bounds).width = xbound.width;
333 (*bounds).height = xbound.height;
336 #else /* ifdef ECORE_XFIXES */
338 #endif /* ifdef ECORE_XFIXES */
342 ecore_x_region_expand(Ecore_X_Region dest,
343 Ecore_X_Region source,
349 EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
351 LOGFN(__FILE__, __LINE__, __FUNCTION__);
352 XFixesExpandRegion(_ecore_x_disp, dest, source, left, right, top, bottom);
353 if (_ecore_xlib_sync) ecore_x_sync();
354 #endif /* ifdef ECORE_XFIXES */
358 ecore_x_region_gc_clip_set(Ecore_X_Region region,
363 EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
365 LOGFN(__FILE__, __LINE__, __FUNCTION__);
366 XFixesSetGCClipRegion(_ecore_x_disp, gc, x_origin, y_origin, region);
367 if (_ecore_xlib_sync) ecore_x_sync();
368 #endif /* ifdef ECORE_XFIXES */
372 ecore_x_region_window_shape_set(Ecore_X_Region region,
374 Ecore_X_Shape_Type type,
378 EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
380 LOGFN(__FILE__, __LINE__, __FUNCTION__);
381 XFixesSetWindowShapeRegion(_ecore_x_disp,
387 if (_ecore_xlib_sync) ecore_x_sync();
388 #endif /* ifdef ECORE_XFIXES */
392 ecore_x_region_picture_clip_set(Ecore_X_Region region,
393 Ecore_X_Picture picture,
397 EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
399 LOGFN(__FILE__, __LINE__, __FUNCTION__);
400 XFixesSetPictureClipRegion(_ecore_x_disp,
405 if (_ecore_xlib_sync) ecore_x_sync();
406 #endif /* ifdef ECORE_XFIXES */