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
|
|
|
|
2007-03-08 17:11:09 -08:00
|
|
|
#include "ecore_x_private.h"
|
|
|
|
|
2007-03-15 15:21:28 -07:00
|
|
|
/**
|
|
|
|
* @defgroup Ecore_X_Drawable_Group X Drawable Functions
|
2012-12-28 12:46:54 -08:00
|
|
|
* @ingroup Ecore_X_Group
|
2007-03-15 15:21:28 -07:00
|
|
|
*
|
|
|
|
* Functions that operate on drawables.
|
|
|
|
*/
|
|
|
|
|
2007-03-08 17:11:09 -08:00
|
|
|
/**
|
|
|
|
* Retrieves the geometry of the given drawable.
|
2011-10-20 22:40:59 -07:00
|
|
|
* @param d The given drawable.
|
2007-03-08 17:11:09 -08:00
|
|
|
* @param x Pointer to an integer into which the X position is to be stored.
|
|
|
|
* @param y Pointer to an integer into which the Y position is to be stored.
|
|
|
|
* @param w Pointer to an integer into which the width is to be stored.
|
|
|
|
* @param h Pointer to an integer into which the height is to be stored.
|
2007-03-15 15:21:28 -07:00
|
|
|
* @ingroup Ecore_X_Drawable_Group
|
2007-03-08 17:11:09 -08:00
|
|
|
*/
|
|
|
|
EAPI void
|
2010-07-27 22:23:42 -07:00
|
|
|
ecore_x_drawable_geometry_get(Ecore_X_Drawable d,
|
2011-12-03 12:05:48 -08:00
|
|
|
int *x,
|
|
|
|
int *y,
|
|
|
|
int *w,
|
|
|
|
int *h)
|
2007-03-08 17:11:09 -08:00
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
Window dummy_win;
|
|
|
|
int ret_x, ret_y;
|
|
|
|
unsigned int ret_w, ret_h, dummy_border, dummy_depth;
|
2007-03-08 17:11:09 -08:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2016-02-12 05:27:35 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
|
2007-03-08 17:11:09 -08:00
|
|
|
if (!XGetGeometry(_ecore_x_disp, d, &dummy_win, &ret_x, &ret_y,
|
|
|
|
&ret_w, &ret_h, &dummy_border, &dummy_depth))
|
2010-07-27 22:23:42 -07:00
|
|
|
{
|
|
|
|
ret_x = 0;
|
|
|
|
ret_y = 0;
|
|
|
|
ret_w = 0;
|
|
|
|
ret_h = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (x)
|
2011-10-20 22:40:59 -07:00
|
|
|
*x = ret_x;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
if (y)
|
2011-10-20 22:40:59 -07:00
|
|
|
*y = ret_y;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
if (w)
|
2011-10-20 22:40:59 -07:00
|
|
|
*w = (int)ret_w;
|
2010-07-27 22:23:42 -07:00
|
|
|
|
|
|
|
if (h)
|
2011-10-20 22:40:59 -07:00
|
|
|
*h = (int)ret_h;
|
2013-07-17 22:17:40 -07:00
|
|
|
if (_ecore_xlib_sync) ecore_x_sync();
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2007-03-08 17:11:09 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves the width of the border of the given drawable.
|
|
|
|
* @param d The given drawable.
|
|
|
|
* @return The border width of the given drawable.
|
2007-03-15 15:21:28 -07:00
|
|
|
* @ingroup Ecore_X_Drawable_Group
|
2007-03-08 17:11:09 -08:00
|
|
|
*/
|
|
|
|
EAPI int
|
|
|
|
ecore_x_drawable_border_width_get(Ecore_X_Drawable d)
|
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
Window dummy_win;
|
|
|
|
int dummy_x, dummy_y;
|
|
|
|
unsigned int dummy_w, dummy_h, border_ret, dummy_depth;
|
2007-03-08 17:11:09 -08:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2016-02-12 05:27:35 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(_ecore_x_disp, 0);
|
2007-03-08 17:11:09 -08:00
|
|
|
if (!XGetGeometry(_ecore_x_disp, d, &dummy_win, &dummy_x, &dummy_y,
|
|
|
|
&dummy_w, &dummy_h, &border_ret, &dummy_depth))
|
2011-10-20 22:40:59 -07:00
|
|
|
border_ret = 0;
|
2013-07-17 22:17:40 -07:00
|
|
|
if (_ecore_xlib_sync) ecore_x_sync();
|
2010-07-27 22:23:42 -07:00
|
|
|
return (int)border_ret;
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2007-03-08 17:11:09 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieves the depth of the given drawable.
|
|
|
|
* @param d The given drawable.
|
|
|
|
* @return The depth of the given drawable.
|
2007-03-15 15:21:28 -07:00
|
|
|
* @ingroup Ecore_X_Drawable_Group
|
2007-03-08 17:11:09 -08:00
|
|
|
*/
|
|
|
|
EAPI int
|
|
|
|
ecore_x_drawable_depth_get(Ecore_X_Drawable d)
|
|
|
|
{
|
2010-07-27 22:23:42 -07:00
|
|
|
Window dummy_win;
|
|
|
|
int dummy_x, dummy_y;
|
|
|
|
unsigned int dummy_w, dummy_h, dummy_border, depth_ret;
|
2007-03-08 17:11:09 -08:00
|
|
|
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2016-02-12 05:27:35 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN_VAL(_ecore_x_disp, 0);
|
2007-03-08 17:11:09 -08:00
|
|
|
if (!XGetGeometry(_ecore_x_disp, d, &dummy_win, &dummy_x, &dummy_y,
|
|
|
|
&dummy_w, &dummy_h, &dummy_border, &depth_ret))
|
2011-10-20 22:40:59 -07:00
|
|
|
depth_ret = 0;
|
2013-07-17 22:17:40 -07:00
|
|
|
if (_ecore_xlib_sync) ecore_x_sync();
|
2010-07-27 22:23:42 -07:00
|
|
|
return (int)depth_ret;
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2009-04-25 00:16:26 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Fill the specified rectangle on a drawable.
|
|
|
|
* @param d The given drawable.
|
|
|
|
* @param gc The graphic context that controls the fill rules.
|
|
|
|
* @param x The X coordinate of the top-left corner of the rectangle.
|
|
|
|
* @param y The Y coordinate of the top-left corner of the rectangle.
|
|
|
|
* @param width The width of the rectangle.
|
|
|
|
* @param height The height of the rectangle.
|
|
|
|
*/
|
|
|
|
EAPI void
|
2010-07-27 22:23:42 -07:00
|
|
|
ecore_x_drawable_rectangle_fill(Ecore_X_Drawable d,
|
2011-12-03 12:05:48 -08:00
|
|
|
Ecore_X_GC gc,
|
|
|
|
int x,
|
|
|
|
int y,
|
|
|
|
int width,
|
|
|
|
int height)
|
2009-04-25 00:16:26 -07:00
|
|
|
{
|
2010-02-25 04:19:02 -08:00
|
|
|
LOGFN(__FILE__, __LINE__, __FUNCTION__);
|
2016-02-12 05:27:35 -08:00
|
|
|
EINA_SAFETY_ON_NULL_RETURN(_ecore_x_disp);
|
2009-04-25 00:16:26 -07:00
|
|
|
XFillRectangle(_ecore_x_disp, d, gc, x, y, width, height);
|
2013-07-17 22:17:40 -07:00
|
|
|
if (_ecore_xlib_sync) ecore_x_sync();
|
2011-12-03 11:41:12 -08:00
|
|
|
}
|
2010-08-02 10:47:49 -07:00
|
|
|
|