aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/ecore/src/lib/ecore_x/ecore_x_fixes.c
diff options
context:
space:
mode:
authorxcomputerman <xcomputerman>2006-05-19 14:23:04 +0000
committerxcomputerman <xcomputerman@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>2006-05-19 14:23:04 +0000
commit0e8e8f2fd1f277c7d4d4fb760c20e5a6e04203da (patch)
treefce4ef4aabf3eca772e9e4c62d7822bd4ba9ac31 /legacy/ecore/src/lib/ecore_x/ecore_x_fixes.c
parent1. fix ecore to build again (xcomp - u need to cvs add and commit your 2 new (diff)
downloadefl-0e8e8f2fd1f277c7d4d4fb760c20e5a6e04203da.tar.gz
Oops. I was up too late last night. Caught a couple of critters too.
SVN revision: 22740
Diffstat (limited to 'legacy/ecore/src/lib/ecore_x/ecore_x_fixes.c')
-rw-r--r--legacy/ecore/src/lib/ecore_x/ecore_x_fixes.c239
1 files changed, 239 insertions, 0 deletions
diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x_fixes.c b/legacy/ecore/src/lib/ecore_x/ecore_x_fixes.c
new file mode 100644
index 0000000000..38231c9746
--- /dev/null
+++ b/legacy/ecore/src/lib/ecore_x/ecore_x_fixes.c
@@ -0,0 +1,239 @@
+/*
+ * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
+ */
+
+#include "ecore_x_private.h"
+#include "Ecore_X.h"
+
+static int _fixes_available;
+static int _fixes_major, _fixes_minor;
+
+void
+_ecore_x_fixes_init(void)
+{
+#ifdef ECORE_XFIXES
+ _fixes_major = 3;
+ _fixes_minor = 0;
+
+ if (XFixesQueryVersion(_ecore_x_disp, &_fixes_major, &_fixes_minor))
+ _fixes_available = 1;
+ else
+ _fixes_available = 0;
+#else
+ _fixes_available = 0;
+#endif
+}
+
+/* I don't know what to call this function. */
+static XRectangle *
+_ecore_x_rectangle_ecore_to_x(Ecore_X_Rectangle *rects, int num)
+{
+ XRectangle *xrect;
+ int i;
+
+ if (num == 0) return NULL;
+
+ xrect = malloc(sizeof(XRectangle) * num);
+ if (!xrect) return NULL;
+ for (i = 0; i < num; i++)
+ {
+ xrect[i].x = rects[i].x;
+ xrect[i].y = rects[i].y;
+ xrect[i].width = rects[i].width;
+ xrect[i].height = rects[i].height;
+ }
+ return xrect;
+}
+
+static Ecore_X_Rectangle *
+_ecore_x_rectangle_x_to_ecore(XRectangle *xrect, int num)
+{
+ Ecore_X_Rectangle *rects;
+ int i;
+
+ if (num == 0) return NULL;
+ rects = malloc(sizeof(Ecore_X_Rectangle) * num);
+ if (!rects) return NULL;
+ for (i = 0; i < num; i++)
+ {
+ rects[i].x = xrect[i].x;
+ rects[i].y = xrect[i].y;
+ rects[i].width = xrect[i].width;
+ rects[i].height = xrect[i].height;
+ }
+ return rects;
+}
+
+EAPI Ecore_X_Region
+ecore_x_region_new(Ecore_X_Rectangle *rects, int num)
+{
+#ifdef ECORE_XFIXES
+ Ecore_X_Region region;
+ XRectangle *xrect;
+
+ xrect = _ecore_x_rectangle_ecore_to_x(rects, num);
+ region = XFixesCreateRegion(_ecore_x_disp, xrect, num);
+ return region;
+#else
+ return 0;
+#endif
+}
+
+EAPI Ecore_X_Region
+ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap)
+{
+#ifdef ECORE_XFIXES
+ Ecore_X_Region region;
+
+ region = XFixesCreateRegionFromBitmap(_ecore_x_disp, bitmap);
+ return region;
+#else
+ return 0;
+#endif
+}
+
+EAPI Ecore_X_Region
+ecore_x_region_new_from_window(Ecore_X_Window win, Ecore_X_Region_Type type)
+{
+#ifdef ECORE_XFIXES
+ Ecore_X_Region region;
+
+ region = XFixesCreateRegionFromWindow(_ecore_x_disp, win, type);
+ return region;
+#else
+ return 0;
+#endif
+}
+
+EAPI Ecore_X_Region
+ecore_x_region_new_from_gc(Ecore_X_GC gc)
+{
+#ifdef ECORE_XFIXES
+ Ecore_X_Region region;
+
+ region = XFixesCreateRegionFromGC(_ecore_x_disp, gc);
+ return region;
+#else
+ return 0;
+#endif
+}
+
+EAPI Ecore_X_Region
+ecore_x_region_new_from_picture(Ecore_X_Picture picture)
+{
+#ifdef ECORE_XFIXES
+ Ecore_X_Region region;
+
+ region = XFixesCreateRegionFromPicture(_ecore_x_disp, picture);
+ return region;
+#else
+ return 0;
+#endif
+}
+
+EAPI void
+ecore_x_region_del(Ecore_X_Region region)
+{
+#ifdef ECORE_XFIXES
+ XFixesDestroyRegion(_ecore_x_disp, region);
+#endif
+}
+
+EAPI void
+ecore_x_region_set(Ecore_X_Region region, Ecore_X_Rectangle *rects, int num)
+{
+#ifdef ECORE_XFIXES
+ XRectangle *xrect = _ecore_x_rectangle_ecore_to_x(rects, num);
+ XFixesSetRegion(_ecore_x_disp, region, xrect, num);
+#endif
+}
+
+EAPI void
+ecore_x_region_copy(Ecore_X_Region dest, Ecore_X_Region source)
+{
+#ifdef ECORE_XFIXES
+ XFixesCopyRegion(_ecore_x_disp, dest, source);
+#endif
+}
+
+EAPI void
+ecore_x_region_combine(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Region source2)
+{
+#ifdef ECORE_XFIXES
+ XFixesUnionRegion(_ecore_x_disp, dest, source1, source2);
+#endif
+}
+
+EAPI void
+ecore_x_region_intersect(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Region source2)
+{
+#ifdef ECORE_XFIXES
+ XFixesIntersectRegion(_ecore_x_disp, dest, source1, source2);
+#endif
+}
+
+EAPI void
+ecore_x_region_subtract(Ecore_X_Region dest, Ecore_X_Region source1, Ecore_X_Region source2)
+{
+#ifdef ECORE_XFIXES
+ XFixesSubtractRegion(_ecore_x_disp, dest, source1, source2);
+#endif
+}
+
+EAPI void
+ecore_x_region_invert(Ecore_X_Region dest, Ecore_X_Rectangle *bounds, Ecore_X_Region source)
+{
+#ifdef ECORE_XFIXES
+ XRectangle *xbound;
+ int num = 0;
+
+ while(bounds + num) num++;
+ xbound = _ecore_x_rectangle_ecore_to_x(bounds, num);
+
+ XFixesInvertRegion(_ecore_x_disp, dest, xbound, source);
+#endif
+}
+
+EAPI void
+ecore_x_region_translate(Ecore_X_Region region, int dx, int dy)
+{
+#ifdef ECORE_XFIXES
+ XFixesTranslateRegion(_ecore_x_disp, region, dx, dy);
+#endif
+}
+
+EAPI void
+ecore_x_region_extents(Ecore_X_Region dest, Ecore_X_Region source)
+{
+#ifdef ECORE_XFIXES
+ XFixesRegionExtents(_ecore_x_disp, dest, source);
+#endif
+}
+
+EAPI Ecore_X_Rectangle *
+ecore_x_region_fetch(Ecore_X_Region region, int *num, Ecore_X_Rectangle *bounds){
+#ifdef ECORE_XFIXES
+ Ecore_X_Rectangle *rects;
+ XRectangle *xrect, xbound;
+
+ xrect = XFixesFetchRegionAndBounds(_ecore_x_disp, region, num, &xbound);
+ rects = _ecore_x_rectangle_x_to_ecore(xrect, *num);
+ (*bounds).x = xbound.x;
+ (*bounds).y = xbound.y;
+ (*bounds).width = xbound.width;
+ (*bounds).height = xbound.height;
+ return rects;
+#else
+ return NULL;
+#endif
+}
+
+EAPI void
+ecore_x_region_expand(Ecore_X_Region dest, Ecore_X_Region source, unsigned int left, unsigned int right, unsigned int top, unsigned int bottom)
+{
+#ifdef ECORE_XFIXES
+ XFixesExpandRegion(_ecore_x_disp, dest, source, left, right, top, bottom);
+#endif
+}
+
+