2009-01-31 10:33:39 -08:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
2010-08-02 10:47:49 -07:00
|
|
|
#endif /* ifdef HAVE_CONFIG_H */
|
2009-01-31 10:33:39 -08:00
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2003-09-23 01:09:32 -07:00
|
|
|
#include "Ecore.h"
|
|
|
|
#include "ecore_x_private.h"
|
|
|
|
#include "Ecore_X.h"
|
|
|
|
|
|
|
|
/**
|
2004-08-12 04:29:19 -07:00
|
|
|
* @defgroup Ecore_X_Window_Shape X Window Shape Functions
|
2003-09-23 01:09:32 -07:00
|
|
|
*
|
2004-08-12 04:29:19 -07:00
|
|
|
* These functions use the shape extension of the X server to change
|
|
|
|
* shape of given windows.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sets the 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 shape of the
|
|
|
|
* window.
|
|
|
|
* @ingroup Ecore_X_Window_Shape
|
2003-09-23 01:09:32 -07:00
|
|
|
*/
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2003-09-23 01:09:32 -07:00
|
|
|
ecore_x_window_shape_mask_set(Ecore_X_Window win, Ecore_X_Pixmap mask)
|
|
|
|
{
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2003-09-23 01:09:32 -07:00
|
|
|
XShapeCombineMask(_ecore_x_disp, win, ShapeBounding, 0, 0, mask, ShapeSet);
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_window_shape_mask_set */
|
2005-04-13 08:47:53 -07:00
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-04-13 08:47:53 -07:00
|
|
|
ecore_x_window_shape_window_set(Ecore_X_Window win, Ecore_X_Window shape_win)
|
|
|
|
{
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2010-07-27 22:23:42 -07:00
|
|
|
XShapeCombineShape(_ecore_x_disp,
|
|
|
|
win,
|
|
|
|
ShapeBounding,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
shape_win,
|
|
|
|
ShapeBounding,
|
|
|
|
ShapeSet);
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_window_shape_window_set */
|
2005-04-13 08:47:53 -07:00
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2010-07-27 22:23:42 -07:00
|
|
|
ecore_x_window_shape_window_set_xy(Ecore_X_Window win,
|
|
|
|
Ecore_X_Window shape_win,
|
2010-08-02 10:47:49 -07:00
|
|
|
int x,
|
|
|
|
int y)
|
2005-04-13 08:47:53 -07:00
|
|
|
{
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2010-07-27 22:23:42 -07:00
|
|
|
XShapeCombineShape(_ecore_x_disp,
|
|
|
|
win,
|
|
|
|
ShapeBounding,
|
|
|
|
x,
|
|
|
|
y,
|
|
|
|
shape_win,
|
|
|
|
ShapeBounding,
|
|
|
|
ShapeSet);
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_window_shape_window_set_xy */
|
2005-04-13 08:47:53 -07:00
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2010-07-27 22:23:42 -07:00
|
|
|
ecore_x_window_shape_rectangle_set(Ecore_X_Window win,
|
2010-08-02 10:47:49 -07:00
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int w,
|
|
|
|
int h)
|
2005-04-13 08:47:53 -07:00
|
|
|
{
|
|
|
|
XRectangle rect;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2005-04-13 08:47:53 -07:00
|
|
|
rect.x = x;
|
|
|
|
rect.y = y;
|
|
|
|
rect.width = w;
|
|
|
|
rect.height = h;
|
2010-07-27 22:23:42 -07:00
|
|
|
XShapeCombineRectangles(_ecore_x_disp,
|
|
|
|
win,
|
|
|
|
ShapeBounding,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
&rect,
|
|
|
|
1,
|
|
|
|
ShapeSet,
|
|
|
|
Unsorted);
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_window_shape_rectangle_set */
|
2005-04-13 08:47:53 -07:00
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_x_window_shape_rectangles_set(Ecore_X_Window win,
|
2010-07-27 22:23:42 -07:00
|
|
|
Ecore_X_Rectangle *rects,
|
2010-08-02 10:47:49 -07:00
|
|
|
int num)
|
2005-04-13 08:47:53 -07:00
|
|
|
{
|
|
|
|
XRectangle *rect = NULL;
|
|
|
|
int i;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2005-04-13 08:47:53 -07:00
|
|
|
if (num > 0)
|
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
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;
|
2005-04-13 08:47:53 -07:00
|
|
|
}
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
XShapeCombineRectangles(_ecore_x_disp,
|
|
|
|
win,
|
|
|
|
ShapeBounding,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
rect,
|
|
|
|
num,
|
|
|
|
ShapeSet,
|
|
|
|
Unsorted);
|
|
|
|
if (rect)
|
|
|
|
free(rect);
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_window_shape_rectangles_set */
|
2005-04-13 08:47:53 -07:00
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2005-04-13 08:47:53 -07:00
|
|
|
ecore_x_window_shape_window_add(Ecore_X_Window win, Ecore_X_Window shape_win)
|
|
|
|
{
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2010-07-27 22:23:42 -07:00
|
|
|
XShapeCombineShape(_ecore_x_disp,
|
|
|
|
win,
|
|
|
|
ShapeBounding,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
shape_win,
|
|
|
|
ShapeBounding,
|
|
|
|
ShapeUnion);
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_window_shape_window_add */
|
2005-04-13 08:47:53 -07:00
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2010-07-27 22:23:42 -07:00
|
|
|
ecore_x_window_shape_window_add_xy(Ecore_X_Window win,
|
|
|
|
Ecore_X_Window shape_win,
|
2010-08-02 10:47:49 -07:00
|
|
|
int x,
|
|
|
|
int y)
|
2005-04-13 08:47:53 -07:00
|
|
|
{
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2010-07-27 22:23:42 -07:00
|
|
|
XShapeCombineShape(_ecore_x_disp,
|
|
|
|
win,
|
|
|
|
ShapeBounding,
|
|
|
|
x,
|
|
|
|
y,
|
|
|
|
shape_win,
|
|
|
|
ShapeBounding,
|
|
|
|
ShapeUnion);
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_window_shape_window_add_xy */
|
2005-04-13 08:47:53 -07:00
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2010-07-27 22:23:42 -07:00
|
|
|
ecore_x_window_shape_rectangle_add(Ecore_X_Window win,
|
2010-08-02 10:47:49 -07:00
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int w,
|
|
|
|
int h)
|
2005-04-13 08:47:53 -07:00
|
|
|
{
|
|
|
|
XRectangle rect;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2005-04-13 08:47:53 -07:00
|
|
|
rect.x = x;
|
|
|
|
rect.y = y;
|
|
|
|
rect.width = w;
|
|
|
|
rect.height = h;
|
2010-07-27 22:23:42 -07:00
|
|
|
XShapeCombineRectangles(_ecore_x_disp,
|
|
|
|
win,
|
|
|
|
ShapeBounding,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
&rect,
|
|
|
|
1,
|
|
|
|
ShapeUnion,
|
|
|
|
Unsorted);
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_window_shape_rectangle_add */
|
2005-04-13 08:47:53 -07:00
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2010-07-27 22:23:42 -07:00
|
|
|
ecore_x_window_shape_rectangle_clip(Ecore_X_Window win,
|
2010-08-02 10:47:49 -07:00
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int w,
|
|
|
|
int h)
|
2005-04-22 22:06:18 -07:00
|
|
|
{
|
|
|
|
XRectangle rect;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2005-04-22 22:06:18 -07:00
|
|
|
rect.x = x;
|
|
|
|
rect.y = y;
|
|
|
|
rect.width = w;
|
|
|
|
rect.height = h;
|
2010-07-27 22:23:42 -07:00
|
|
|
XShapeCombineRectangles(_ecore_x_disp,
|
|
|
|
win,
|
|
|
|
ShapeBounding,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
&rect,
|
|
|
|
1,
|
|
|
|
ShapeIntersect,
|
|
|
|
Unsorted);
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_window_shape_rectangle_clip */
|
2005-04-22 22:06:18 -07:00
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2010-08-02 10:47:49 -07:00
|
|
|
ecore_x_window_shape_rectangles_add(Ecore_X_Window win,
|
2010-07-27 22:23:42 -07:00
|
|
|
Ecore_X_Rectangle *rects,
|
2010-08-02 10:47:49 -07:00
|
|
|
int num)
|
2005-04-13 08:47:53 -07:00
|
|
|
{
|
|
|
|
XRectangle *rect = NULL;
|
|
|
|
int i;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2005-04-13 08:47:53 -07:00
|
|
|
if (num > 0)
|
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
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;
|
2005-04-13 08:47:53 -07:00
|
|
|
}
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
XShapeCombineRectangles(_ecore_x_disp,
|
|
|
|
win,
|
|
|
|
ShapeBounding,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
rect,
|
|
|
|
num,
|
|
|
|
ShapeUnion,
|
|
|
|
Unsorted);
|
|
|
|
if (rect)
|
|
|
|
free(rect);
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_window_shape_rectangles_add */
|
2005-04-13 08:47:53 -07:00
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI Ecore_X_Rectangle *
|
2005-04-13 08:47:53 -07:00
|
|
|
ecore_x_window_shape_rectangles_get(Ecore_X_Window win, int *num_ret)
|
|
|
|
{
|
|
|
|
XRectangle *rect;
|
|
|
|
Ecore_X_Rectangle *rects = NULL;
|
|
|
|
int i, num = 0, ord;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2005-04-13 08:47:53 -07:00
|
|
|
rect = XShapeGetRectangles(_ecore_x_disp, win, ShapeBounding, &num, &ord);
|
|
|
|
if (rect)
|
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
XFree(rect);
|
2005-04-13 08:47:53 -07:00
|
|
|
}
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
if (num_ret)
|
|
|
|
*num_ret = num;
|
|
|
|
|
2005-04-13 08:47:53 -07:00
|
|
|
return rects;
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_window_shape_rectangles_get */
|
2005-04-13 08:47:53 -07:00
|
|
|
|
2006-01-06 12:22:09 -08:00
|
|
|
EAPI void
|
2010-09-26 10:49:05 -07:00
|
|
|
ecore_x_window_shape_events_select(Ecore_X_Window win, Eina_Bool on)
|
2005-04-13 08:47:53 -07:00
|
|
|
{
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2005-04-13 08:47:53 -07:00
|
|
|
if (on)
|
2010-07-27 22:23:42 -07:00
|
|
|
XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask);
|
2005-04-13 08:47:53 -07:00
|
|
|
else
|
2010-07-27 22:23:42 -07:00
|
|
|
XShapeSelectInput(_ecore_x_disp, win, 0);
|
2010-08-02 10:47:49 -07:00
|
|
|
} /* ecore_x_window_shape_events_select */
|
2008-01-10 23:33:57 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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)
|
|
|
|
{
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2008-01-10 23:33:57 -08:00
|
|
|
#ifdef ShapeInput
|
2010-07-27 22:23:42 -07:00
|
|
|
XShapeCombineMask(_ecore_x_disp, win, ShapeInput, 0, 0, mask, ShapeSet);
|
2010-08-02 10:47:49 -07:00
|
|
|
#else /* ifdef ShapeInput */
|
2008-01-10 23:33:57 -08:00
|
|
|
XShapeCombineMask(_ecore_x_disp, win, ShapeBounding, 0, 0, mask, ShapeSet);
|
2010-08-02 10:47:49 -07:00
|
|
|
#endif /* ifdef ShapeInput */
|
|
|
|
} /* ecore_x_window_shape_input_mask_set */
|
2008-01-10 23:33:57 -08:00
|
|
|
|