aboutsummaryrefslogtreecommitdiffstats
path: root/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c
diff options
context:
space:
mode:
authorDoyun Kang <doyoun.kang@samsung.com>2011-04-13 09:06:05 +0000
committerCarsten Haitzler <raster@rasterman.com>2011-04-13 09:06:05 +0000
commit631f94a5231a9789f75cb59389ede41cb4b7c692 (patch)
treebefd3b97688604313bec34822137b5e0f14cd55e /legacy/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c
parentEvas font-engine: Fix the fallback fribidi shaper. (diff)
downloadefl-631f94a5231a9789f75cb59389ede41cb4b7c692.tar.gz
From: Doyun Kang <doyoun.kang@samsung.com>
Add support for shape input setting and modification (with fixes/modifications and extensions added tomake it more complete). SVN revision: 58621
Diffstat (limited to 'legacy/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c')
-rw-r--r--legacy/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c450
1 files changed, 393 insertions, 57 deletions
diff --git a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c
index f0362d358f..7ffc39fe2c 100644
--- a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c
+++ b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c
@@ -29,6 +29,25 @@ ecore_x_window_shape_mask_set(Ecore_X_Window win, Ecore_X_Pixmap mask)
XShapeCombineMask(_ecore_x_disp, win, ShapeBounding, 0, 0, mask, ShapeSet);
} /* ecore_x_window_shape_mask_set */
+/**
+ * Sets the input shape of the given window to that given by the pixmap @p mask.
+ * @param win The given window.
+ * @param mask A 1-bit depth pixmap that provides the new input shape of the
+ * window.
+ * @ingroup Ecore_X_Window_Shape
+ */
+EAPI void
+ecore_x_window_shape_input_mask_set(Ecore_X_Window win, Ecore_X_Pixmap mask)
+{
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+#ifdef ShapeInput
+ XShapeCombineMask(_ecore_x_disp, win, ShapeInput, 0, 0, mask, ShapeSet);
+#else /* ifdef ShapeInput */
+ return;
+ win = mask = 0;
+#endif /* ifdef ShapeInput */
+} /* ecore_x_window_shape_input_mask_set */
+
EAPI void
ecore_x_window_shape_window_set(Ecore_X_Window win, Ecore_X_Window shape_win)
{
@@ -44,6 +63,26 @@ ecore_x_window_shape_window_set(Ecore_X_Window win, Ecore_X_Window shape_win)
} /* ecore_x_window_shape_window_set */
EAPI void
+ecore_x_window_shape_input_window_set(Ecore_X_Window win,
+ Ecore_X_Window shape_win)
+{
+#ifdef ShapeInput
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ XShapeCombineShape(_ecore_x_disp,
+ win,
+ ShapeInput,
+ 0,
+ 0,
+ shape_win,
+ ShapeInput,
+ ShapeSet);
+#else
+ return;
+ win = shape_win = 0;
+#endif
+} /* ecore_x_window_shape_input_window_set */
+
+EAPI void
ecore_x_window_shape_window_set_xy(Ecore_X_Window win,
Ecore_X_Window shape_win,
int x,
@@ -61,6 +100,28 @@ ecore_x_window_shape_window_set_xy(Ecore_X_Window win,
} /* ecore_x_window_shape_window_set_xy */
EAPI void
+ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win,
+ Ecore_X_Window shape_win,
+ int x,
+ int y)
+{
+#ifdef ShapeInput
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ XShapeCombineShape(_ecore_x_disp,
+ win,
+ ShapeInput,
+ x,
+ y,
+ shape_win,
+ ShapeInput,
+ ShapeSet);
+#else
+ return;
+ win = shape_win = x = y = 0;
+#endif
+} /* ecore_x_window_shape_input_window_set_xy */
+
+EAPI void
ecore_x_window_shape_rectangle_set(Ecore_X_Window win,
int x,
int y,
@@ -86,29 +147,58 @@ ecore_x_window_shape_rectangle_set(Ecore_X_Window win,
} /* ecore_x_window_shape_rectangle_set */
EAPI void
+ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h)
+{
+#ifdef ShapeInput
+ XRectangle rect;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ rect.x = x;
+ rect.y = y;
+ rect.width = w;
+ rect.height = h;
+ XShapeCombineRectangles(_ecore_x_disp,
+ win,
+ ShapeInput,
+ 0,
+ 0,
+ &rect,
+ 1,
+ ShapeSet,
+ Unsorted);
+#else
+ return;
+ win = x = y = w = h = 0;
+#endif
+} /* ecore_x_window_shape_input_rectangle_set */
+
+EAPI void
ecore_x_window_shape_rectangles_set(Ecore_X_Window win,
Ecore_X_Rectangle *rects,
int num)
{
+#ifdef ShapeInput
XRectangle *rect = NULL;
int i;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ if (!rects) return;
if (num > 0)
{
rect = malloc(sizeof(XRectangle) * num);
- if (rect)
- for (i = 0; i < num; i++)
- {
- rect[i].x = rects[i].x;
- rect[i].y = rects[i].y;
- rect[i].width = rects[i].width;
- rect[i].height = rects[i].height;
- }
- else
- num = 0;
+ if (!rect) return;
+ for (i = 0; i < num; i++)
+ {
+ rect[i].x = rects[i].x;
+ rect[i].y = rects[i].y;
+ rect[i].width = rects[i].width;
+ rect[i].height = rects[i].height;
+ }
}
-
XShapeCombineRectangles(_ecore_x_disp,
win,
ShapeBounding,
@@ -118,11 +208,108 @@ ecore_x_window_shape_rectangles_set(Ecore_X_Window win,
num,
ShapeSet,
Unsorted);
- if (rect)
- free(rect);
+ if (rect) free(rect);
+#else
+ return;
+ win = rects = num = 0;
+#endif
} /* ecore_x_window_shape_rectangles_set */
EAPI void
+ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win,
+ Ecore_X_Rectangle *rects,
+ int num)
+{
+#ifdef ShapeInput
+ XRectangle *rect = NULL;
+ int i;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ if (!rects) return;
+ if (num > 0)
+ {
+ rect = malloc(sizeof(XRectangle) * num);
+ if (!rect) return;
+ for (i = 0; i < num; i++)
+ {
+ rect[i].x = rects[i].x;
+ rect[i].y = rects[i].y;
+ rect[i].width = rects[i].width;
+ rect[i].height = rects[i].height;
+ }
+ }
+ XShapeCombineRectangles(_ecore_x_disp,
+ win,
+ ShapeInput,
+ 0,
+ 0,
+ rect,
+ num,
+ ShapeSet,
+ Unsorted);
+ if (rect) free(rect);
+#else
+ return;
+ win = rects = num = 0;
+#endif
+} /* ecore_x_window_shape_input_rectangles_set */
+
+EAPI void
+ecore_x_window_shape_rectangle_subtract(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h)
+{
+ XRectangle rect;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ rect.x = x;
+ rect.y = y;
+ rect.width = w;
+ rect.height = h;
+ XShapeCombineRectangles(_ecore_x_disp,
+ win,
+ ShapeBounding,
+ 0,
+ 0,
+ &rect,
+ 1,
+ ShapeSubtract,
+ Unsorted);
+} /* ecore_x_window_shape_rectangle_subtract */
+
+EAPI void
+ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h)
+{
+#ifdef ShapeInput
+ XRectangle rect;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ rect.x = x;
+ rect.y = y;
+ rect.width = w;
+ rect.height = h;
+ XShapeCombineRectangles(_ecore_x_disp,
+ win,
+ ShapeInput,
+ 0,
+ 0,
+ &rect,
+ 1,
+ ShapeSubtract,
+ Unsorted);
+#else
+ return;
+ win = x = y = w = h = 0;
+#endif
+} /* ecore_x_window_shape_input_rectangle_subtract */
+
+EAPI void
ecore_x_window_shape_window_add(Ecore_X_Window win, Ecore_X_Window shape_win)
{
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -154,6 +341,28 @@ ecore_x_window_shape_window_add_xy(Ecore_X_Window win,
} /* ecore_x_window_shape_window_add_xy */
EAPI void
+ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win,
+ Ecore_X_Window shape_win,
+ int x,
+ int y)
+{
+#ifdef ShapeInput
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ XShapeCombineShape(_ecore_x_disp,
+ win,
+ ShapeInput,
+ x,
+ y,
+ shape_win,
+ ShapeInput,
+ ShapeUnion);
+#else
+ return;
+ win = shape_win = x = y = 0;
+#endif
+} /* ecore_x_window_shape_input_window_add_xy */
+
+EAPI void
ecore_x_window_shape_rectangle_add(Ecore_X_Window win,
int x,
int y,
@@ -179,6 +388,36 @@ ecore_x_window_shape_rectangle_add(Ecore_X_Window win,
} /* ecore_x_window_shape_rectangle_add */
EAPI void
+ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h)
+{
+#ifdef ShapeInput
+ XRectangle rect;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ rect.x = x;
+ rect.y = y;
+ rect.width = w;
+ rect.height = h;
+ XShapeCombineRectangles(_ecore_x_disp,
+ win,
+ ShapeInput,
+ 0,
+ 0,
+ &rect,
+ 1,
+ ShapeUnion,
+ Unsorted);
+#else
+ return;
+ win = x = y = w = h = 0;
+#endif
+} /* ecore_x_window_shape_input_rectangle_add */
+
+EAPI void
ecore_x_window_shape_rectangle_clip(Ecore_X_Window win,
int x,
int y,
@@ -204,6 +443,36 @@ ecore_x_window_shape_rectangle_clip(Ecore_X_Window win,
} /* ecore_x_window_shape_rectangle_clip */
EAPI void
+ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win,
+ int x,
+ int y,
+ int w,
+ int h)
+{
+#ifdef ShapeInput
+ XRectangle rect;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ rect.x = x;
+ rect.y = y;
+ rect.width = w;
+ rect.height = h;
+ XShapeCombineRectangles(_ecore_x_disp,
+ win,
+ ShapeInput,
+ 0,
+ 0,
+ &rect,
+ 1,
+ ShapeIntersect,
+ Unsorted);
+#else
+ return;
+ win = x = y = w = h = 0;
+#endif
+} /* ecore_x_window_shape_input_rectangle_clip */
+
+EAPI void
ecore_x_window_shape_rectangles_add(Ecore_X_Window win,
Ecore_X_Rectangle *rects,
int num)
@@ -215,18 +484,16 @@ ecore_x_window_shape_rectangles_add(Ecore_X_Window win,
if (num > 0)
{
rect = malloc(sizeof(XRectangle) * num);
- if (rect)
- for (i = 0; i < num; i++)
- {
- rect[i].x = rects[i].x;
- rect[i].y = rects[i].y;
- rect[i].width = rects[i].width;
- rect[i].height = rects[i].height;
- }
- else
- num = 0;
+ if (!rect) return;
+ for (i = 0; i < num; i++)
+ {
+ rect[i].x = rects[i].x;
+ rect[i].y = rects[i].y;
+ rect[i].width = rects[i].width;
+ rect[i].height = rects[i].height;
+ }
}
-
+
XShapeCombineRectangles(_ecore_x_disp,
win,
ShapeBounding,
@@ -236,10 +503,48 @@ ecore_x_window_shape_rectangles_add(Ecore_X_Window win,
num,
ShapeUnion,
Unsorted);
- if (rect)
- free(rect);
+ if (rect) free(rect);
} /* ecore_x_window_shape_rectangles_add */
+EAPI void
+ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win,
+ Ecore_X_Rectangle *rects,
+ int num)
+{
+#ifdef ShapeInput
+ XRectangle *rect = NULL;
+ int i;
+
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ if (num > 0)
+ {
+ rect = malloc(sizeof(XRectangle) * num);
+ if (!rect) return;
+ for (i = 0; i < num; i++)
+ {
+ rect[i].x = rects[i].x;
+ rect[i].y = rects[i].y;
+ rect[i].width = rects[i].width;
+ rect[i].height = rects[i].height;
+ }
+ }
+
+ XShapeCombineRectangles(_ecore_x_disp,
+ win,
+ ShapeBounding,
+ 0,
+ 0,
+ rect,
+ num,
+ ShapeUnion,
+ Unsorted);
+ if (rect) free(rect);
+#else
+ return;
+ win = rects = num = 0;
+#endif
+} /* ecore_x_window_shape_input_rectangles_add */
+
EAPI Ecore_X_Rectangle *
ecore_x_window_shape_rectangles_get(Ecore_X_Window win, int *num_ret)
{
@@ -251,24 +556,74 @@ ecore_x_window_shape_rectangles_get(Ecore_X_Window win, int *num_ret)
rect = XShapeGetRectangles(_ecore_x_disp, win, ShapeBounding, &num, &ord);
if (rect)
{
+ if (num < 1)
+ {
+ XFree(rect);
+ if (num_ret) *num_ret = 0;
+ return NULL;
+ }
rects = malloc(sizeof(Ecore_X_Rectangle) * num);
- if (rects)
- for (i = 0; i < num; i++)
- {
- rects[i].x = rect[i].x;
- rects[i].y = rect[i].y;
- rects[i].width = rect[i].width;
- rects[i].height = rect[i].height;
- }
-
+ if (!rects)
+ {
+ XFree(rect);
+ if (num_ret) *num_ret = 0;
+ return NULL;
+ }
+ for (i = 0; i < num; i++)
+ {
+ rects[i].x = rect[i].x;
+ rects[i].y = rect[i].y;
+ rects[i].width = rect[i].width;
+ rects[i].height = rect[i].height;
+ }
XFree(rect);
}
+ if (num_ret) *num_ret = num;
+ return rects;
+} /* ecore_x_window_shape_rectangles_get */
- if (num_ret)
- *num_ret = num;
+EAPI Ecore_X_Rectangle *
+ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win, int *num_ret)
+{
+#ifdef ShapeInput
+ XRectangle *rect;
+ Ecore_X_Rectangle *rects = NULL;
+ int i, num = 0, ord;
+ LOGFN(__FILE__, __LINE__, __FUNCTION__);
+ rect = XShapeGetRectangles(_ecore_x_disp, win, ShapeInput, &num, &ord);
+ if (rect)
+ {
+ if (num < 1)
+ {
+ XFree(rect);
+ if (num_ret) *num_ret = 0;
+ return NULL;
+ }
+ rects = malloc(sizeof(Ecore_X_Rectangle) * num);
+ if (!rects)
+ {
+ XFree(rect);
+ if (num_ret) *num_ret = 0;
+ return NULL;
+ }
+ for (i = 0; i < num; i++)
+ {
+ rects[i].x = rect[i].x;
+ rects[i].y = rect[i].y;
+ rects[i].width = rect[i].width;
+ rects[i].height = rect[i].height;
+ }
+ XFree(rect);
+ }
+ if (num_ret) *num_ret = num;
return rects;
-} /* ecore_x_window_shape_rectangles_get */
+#else
+ if (num_ret) *num_ret = 0;
+ return NULL;
+ win = 0;
+#endif
+} /* ecore_x_window_shape_input_rectangles_get */
EAPI void
ecore_x_window_shape_events_select(Ecore_X_Window win, Eina_Bool on)
@@ -279,22 +634,3 @@ ecore_x_window_shape_events_select(Ecore_X_Window win, Eina_Bool on)
else
XShapeSelectInput(_ecore_x_disp, win, 0);
} /* ecore_x_window_shape_events_select */
-
-/**
- * Sets the input shape of the given window to that given by the pixmap @p mask.
- * @param win The given window.
- * @param mask A 2-bit depth pixmap that provides the new input shape of the
- * window.
- * @ingroup Ecore_X_Window_Shape
- */
-EAPI void
-ecore_x_window_shape_input_mask_set(Ecore_X_Window win, Ecore_X_Pixmap mask)
-{
- LOGFN(__FILE__, __LINE__, __FUNCTION__);
-#ifdef ShapeInput
- XShapeCombineMask(_ecore_x_disp, win, ShapeInput, 0, 0, mask, ShapeSet);
-#else /* ifdef ShapeInput */
- XShapeCombineMask(_ecore_x_disp, win, ShapeBounding, 0, 0, mask, ShapeSet);
-#endif /* ifdef ShapeInput */
-} /* ecore_x_window_shape_input_mask_set */
-