Replace ClutterPoint by graphene_point_t

Remove the tests for ClutterPoint since it's
corresponding code moved to private ClutterStage
methods.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
This commit is contained in:
Georges Basile Stavracas Neto 2019-02-20 11:53:44 -03:00
parent cd293f764e
commit 160cc9182d
48 changed files with 275 additions and 606 deletions

View File

@ -163,7 +163,7 @@ struct _SizeRequest
struct _ClutterLayoutInfo struct _ClutterLayoutInfo
{ {
/* fixed position coordinates */ /* fixed position coordinates */
ClutterPoint fixed_pos; graphene_point_t fixed_pos;
ClutterMargin margin; ClutterMargin margin;
@ -209,7 +209,7 @@ struct _ClutterTransformInfo
gfloat z_position; gfloat z_position;
/* transformation center */ /* transformation center */
ClutterPoint pivot; graphene_point_t pivot;
gfloat pivot_z; gfloat pivot_z;
CoglMatrix transform; CoglMatrix transform;

View File

@ -1288,7 +1288,7 @@ static gboolean
_clutter_actor_transform_local_box_to_stage (ClutterActor *self, _clutter_actor_transform_local_box_to_stage (ClutterActor *self,
ClutterStage *stage, ClutterStage *stage,
const ClutterActorBox *box, const ClutterActorBox *box,
ClutterPoint vertices[4]) graphene_point_t vertices[4])
{ {
CoglFramebuffer *fb = cogl_get_draw_framebuffer (); CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
CoglMatrix stage_transform, inv_stage_transform; CoglMatrix stage_transform, inv_stage_transform;
@ -1344,7 +1344,7 @@ clutter_actor_pick_box (ClutterActor *self,
const ClutterActorBox *box) const ClutterActorBox *box)
{ {
ClutterStage *stage; ClutterStage *stage;
ClutterPoint vertices[4]; graphene_point_t vertices[4];
g_return_if_fail (CLUTTER_IS_ACTOR (self)); g_return_if_fail (CLUTTER_IS_ACTOR (self));
g_return_if_fail (box != NULL); g_return_if_fail (box != NULL);
@ -1363,7 +1363,7 @@ _clutter_actor_push_pick_clip (ClutterActor *self,
const ClutterActorBox *clip) const ClutterActorBox *clip)
{ {
ClutterStage *stage; ClutterStage *stage;
ClutterPoint vertices[4]; graphene_point_t vertices[4];
stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self)); stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self));
@ -4477,7 +4477,7 @@ static const ClutterTransformInfo default_transform_info = {
0.f, /* z-position */ 0.f, /* z-position */
CLUTTER_POINT_INIT_ZERO, /* pivot */ GRAPHENE_POINT_INIT_ZERO, /* pivot */
0.f, /* pivot-z */ 0.f, /* pivot-z */
CLUTTER_MATRIX_INIT_IDENTITY, CLUTTER_MATRIX_INIT_IDENTITY,
@ -4556,8 +4556,8 @@ _clutter_actor_get_transform_info (ClutterActor *self)
} }
static inline void static inline void
clutter_actor_set_pivot_point_internal (ClutterActor *self, clutter_actor_set_pivot_point_internal (ClutterActor *self,
const ClutterPoint *pivot) const graphene_point_t *pivot)
{ {
ClutterTransformInfo *info; ClutterTransformInfo *info;
@ -5134,7 +5134,7 @@ clutter_actor_set_property (GObject *object,
case PROP_POSITION: case PROP_POSITION:
{ {
const ClutterPoint *pos = g_value_get_boxed (value); const graphene_point_t *pos = g_value_get_boxed (value);
if (pos != NULL) if (pos != NULL)
clutter_actor_set_position (actor, pos->x, pos->y); clutter_actor_set_position (actor, pos->x, pos->y);
@ -5239,10 +5239,10 @@ clutter_actor_set_property (GObject *object,
case PROP_PIVOT_POINT: case PROP_PIVOT_POINT:
{ {
const ClutterPoint *pivot = g_value_get_boxed (value); const graphene_point_t *pivot = g_value_get_boxed (value);
if (pivot == NULL) if (pivot == NULL)
pivot = clutter_point_zero (); pivot = graphene_point_zero ();
clutter_actor_set_pivot_point (actor, pivot->x, pivot->y); clutter_actor_set_pivot_point (actor, pivot->x, pivot->y);
} }
@ -5488,11 +5488,11 @@ clutter_actor_get_property (GObject *object,
case PROP_POSITION: case PROP_POSITION:
{ {
ClutterPoint position; graphene_point_t position;
clutter_point_init (&position, graphene_point_init (&position,
clutter_actor_get_x (actor), clutter_actor_get_x (actor),
clutter_actor_get_y (actor)); clutter_actor_get_y (actor));
g_value_set_boxed (value, &position); g_value_set_boxed (value, &position);
} }
break; break;
@ -6500,7 +6500,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
g_param_spec_boxed ("position", g_param_spec_boxed ("position",
P_("Position"), P_("Position"),
P_("The position of the origin of the actor"), P_("The position of the origin of the actor"),
CLUTTER_TYPE_POINT, GRAPHENE_TYPE_POINT,
G_PARAM_READWRITE | G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS | G_PARAM_STATIC_STRINGS |
CLUTTER_PARAM_ANIMATABLE); CLUTTER_PARAM_ANIMATABLE);
@ -7055,7 +7055,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
g_param_spec_boxed ("pivot-point", g_param_spec_boxed ("pivot-point",
P_("Pivot Point"), P_("Pivot Point"),
P_("The point around which the scaling and rotation occur"), P_("The point around which the scaling and rotation occur"),
CLUTTER_TYPE_POINT, GRAPHENE_TYPE_POINT,
G_PARAM_READWRITE | G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS | G_PARAM_STATIC_STRINGS |
CLUTTER_PARAM_ANIMATABLE); CLUTTER_PARAM_ANIMATABLE);
@ -10399,17 +10399,17 @@ clutter_actor_set_position (ClutterActor *self,
gfloat x, gfloat x,
gfloat y) gfloat y)
{ {
ClutterPoint new_position; graphene_point_t new_position;
ClutterPoint cur_position; graphene_point_t cur_position;
g_return_if_fail (CLUTTER_IS_ACTOR (self)); g_return_if_fail (CLUTTER_IS_ACTOR (self));
clutter_point_init (&new_position, x, y); graphene_point_init (&new_position, x, y);
cur_position.x = clutter_actor_get_x (self); cur_position.x = clutter_actor_get_x (self);
cur_position.y = clutter_actor_get_y (self); cur_position.y = clutter_actor_get_y (self);
if (!clutter_point_equals (&cur_position, &new_position)) if (!graphene_point_equal (&cur_position, &new_position))
_clutter_actor_create_transition (self, obj_props[PROP_POSITION], _clutter_actor_create_transition (self, obj_props[PROP_POSITION],
&cur_position, &cur_position,
&new_position); &new_position);
@ -11363,8 +11363,8 @@ clutter_actor_set_y_internal (ClutterActor *self,
} }
static void static void
clutter_actor_set_position_internal (ClutterActor *self, clutter_actor_set_position_internal (ClutterActor *self,
const ClutterPoint *position) const graphene_point_t *position)
{ {
ClutterActorPrivate *priv = self->priv; ClutterActorPrivate *priv = self->priv;
ClutterLayoutInfo *linfo; ClutterLayoutInfo *linfo;
@ -11373,7 +11373,7 @@ clutter_actor_set_position_internal (ClutterActor *self,
linfo = _clutter_actor_get_layout_info (self); linfo = _clutter_actor_get_layout_info (self);
if (priv->position_set && if (priv->position_set &&
clutter_point_equals (position, &linfo->fixed_pos)) graphene_point_equal (position, &linfo->fixed_pos))
return; return;
clutter_actor_store_old_geometry (self, &old); clutter_actor_store_old_geometry (self, &old);
@ -12192,7 +12192,7 @@ clutter_actor_set_pivot_point (ClutterActor *self,
gfloat pivot_x, gfloat pivot_x,
gfloat pivot_y) gfloat pivot_y)
{ {
ClutterPoint pivot = CLUTTER_POINT_INIT (pivot_x, pivot_y); graphene_point_t pivot = GRAPHENE_POINT_INIT (pivot_x, pivot_y);
const ClutterTransformInfo *info; const ClutterTransformInfo *info;
g_return_if_fail (CLUTTER_IS_ACTOR (self)); g_return_if_fail (CLUTTER_IS_ACTOR (self));
@ -18377,7 +18377,7 @@ clutter_actor_get_layout_manager (ClutterActor *self)
} }
static const ClutterLayoutInfo default_layout_info = { static const ClutterLayoutInfo default_layout_info = {
CLUTTER_POINT_INIT_ZERO, /* fixed-pos */ GRAPHENE_POINT_INIT_ZERO, /* fixed-pos */
{ 0, 0, 0, 0 }, /* margin */ { 0, 0, 0, 0 }, /* margin */
CLUTTER_ACTOR_ALIGN_FILL, /* x-align */ CLUTTER_ACTOR_ALIGN_FILL, /* x-align */
CLUTTER_ACTOR_ALIGN_FILL, /* y-align */ CLUTTER_ACTOR_ALIGN_FILL, /* y-align */

View File

@ -93,7 +93,6 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterMatrix, clutter_matrix_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintNode, clutter_paint_node_unref) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintNode, clutter_paint_node_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintVolume, clutter_paint_volume_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPaintVolume, clutter_paint_volume_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPathNode, clutter_path_node_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPathNode, clutter_path_node_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterPoint, clutter_point_free)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterRect, clutter_rect_free) G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterRect, clutter_rect_free)
#endif /* __GI_SCANNER__ */ #endif /* __GI_SCANNER__ */

View File

@ -212,256 +212,6 @@ G_DEFINE_BOXED_TYPE (ClutterMargin, clutter_margin,
/*
* ClutterPoint
*/
static const ClutterPoint _clutter_point_zero = CLUTTER_POINT_INIT_ZERO;
/**
* clutter_point_zero:
*
* A point centered at (0, 0).
*
* The returned value can be used as a guard.
*
* Return value: a point centered in (0, 0); the returned #ClutterPoint
* is owned by Clutter and it should not be modified or freed.
*
* Since: 1.12
*/
const ClutterPoint *
clutter_point_zero (void)
{
return &_clutter_point_zero;
}
/**
* clutter_point_alloc: (constructor)
*
* Allocates a new #ClutterPoint.
*
* Return value: (transfer full): the newly allocated #ClutterPoint.
* Use clutter_point_free() to free its resources.
*
* Since: 1.12
*/
ClutterPoint *
clutter_point_alloc (void)
{
return g_slice_new0 (ClutterPoint);
}
/**
* clutter_point_init:
* @point: a #ClutterPoint
* @x: the X coordinate of the point
* @y: the Y coordinate of the point
*
* Initializes @point with the given coordinates.
*
* Return value: (transfer none): the initialized #ClutterPoint
*
* Since: 1.12
*/
ClutterPoint *
clutter_point_init (ClutterPoint *point,
float x,
float y)
{
g_return_val_if_fail (point != NULL, NULL);
point->x = x;
point->y = y;
return point;
}
/**
* clutter_point_copy:
* @point: a #ClutterPoint
*
* Creates a new #ClutterPoint with the same coordinates of @point.
*
* Return value: (transfer full): a newly allocated #ClutterPoint.
* Use clutter_point_free() to free its resources.
*
* Since: 1.12
*/
ClutterPoint *
clutter_point_copy (const ClutterPoint *point)
{
return g_slice_dup (ClutterPoint, point);
}
/**
* clutter_point_free:
* @point: a #ClutterPoint
*
* Frees the resources allocated for @point.
*
* Since: 1.12
*/
void
clutter_point_free (ClutterPoint *point)
{
if (point != NULL && point != &_clutter_point_zero)
g_slice_free (ClutterPoint, point);
}
/**
* clutter_point_equals:
* @a: the first #ClutterPoint to compare
* @b: the second #ClutterPoint to compare
*
* Compares two #ClutterPoint for equality.
*
* Return value: %TRUE if the #ClutterPoints are equal
*
* Since: 1.12
*/
gboolean
clutter_point_equals (const ClutterPoint *a,
const ClutterPoint *b)
{
if (a == b)
return TRUE;
if (a == NULL || b == NULL)
return FALSE;
return fabsf (a->x - b->x) < FLOAT_EPSILON &&
fabsf (a->y - b->y) < FLOAT_EPSILON;
}
/**
* clutter_point_distance:
* @a: a #ClutterPoint
* @b: a #ClutterPoint
* @x_distance: (out) (allow-none): return location for the horizontal
* distance between the points
* @y_distance: (out) (allow-none): return location for the vertical
* distance between the points
*
* Computes the distance between two #ClutterPoint.
*
* Return value: the distance between the points.
*
* Since: 1.12
*/
float
clutter_point_distance (const ClutterPoint *a,
const ClutterPoint *b,
float *x_distance,
float *y_distance)
{
float x_d, y_d;
g_return_val_if_fail (a != NULL, 0.f);
g_return_val_if_fail (b != NULL, 0.f);
if (clutter_point_equals (a, b))
return 0.f;
x_d = (a->x - b->x);
y_d = (a->y - b->y);
if (x_distance != NULL)
*x_distance = fabsf (x_d);
if (y_distance != NULL)
*y_distance = fabsf (y_d);
return sqrt ((x_d * x_d) + (y_d * y_d));
}
static gboolean
clutter_point_progress (const GValue *a,
const GValue *b,
gdouble progress,
GValue *retval)
{
const ClutterPoint *ap = g_value_get_boxed (a);
const ClutterPoint *bp = g_value_get_boxed (b);
ClutterPoint res = CLUTTER_POINT_INIT (0, 0);
res.x = ap->x + (bp->x - ap->x) * progress;
res.y = ap->y + (bp->y - ap->y) * progress;
g_value_set_boxed (retval, &res);
return TRUE;
}
G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterPoint, clutter_point,
clutter_point_copy,
clutter_point_free,
CLUTTER_REGISTER_INTERVAL_PROGRESS (clutter_point_progress))
static int
clutter_point_compare_line (const ClutterPoint *p,
const ClutterPoint *a,
const ClutterPoint *b)
{
float x1 = b->x - a->x;
float y1 = b->y - a->y;
float x2 = p->x - a->x;
float y2 = p->y - a->y;
float cross_z = x1 * y2 - y1 * x2;
if (cross_z > 0.f)
return 1;
else if (cross_z < 0.f)
return -1;
else
return 0;
}
/**
* clutter_point_inside_quadrilateral:
* @point: a #ClutterPoint to test
* @vertices: array of vertices of the quadrilateral, in either clockwise or
* anticlockwise order.
*
* Determines whether a point is inside the convex quadrilateral provided,
* or on any of its edges or vertices.
*
* Returns: %TRUE if @point is inside or touching the quadrilateral
*/
gboolean
clutter_point_inside_quadrilateral (const ClutterPoint *point,
const ClutterPoint *vertices)
{
unsigned int i;
int first_side;
first_side = 0;
for (i = 0; i < 4; i++)
{
int side;
side = clutter_point_compare_line (point,
&vertices[i],
&vertices[(i + 1) % 4]);
if (side)
{
if (first_side == 0)
first_side = side;
else if (side != first_side)
return FALSE;
}
}
if (first_side == 0)
return FALSE;
return TRUE;
}
/* /*
* ClutterRect * ClutterRect
*/ */
@ -645,7 +395,7 @@ clutter_rect_equals (ClutterRect *a,
clutter_rect_normalize_internal (a); clutter_rect_normalize_internal (a);
clutter_rect_normalize_internal (b); clutter_rect_normalize_internal (b);
return clutter_point_equals (&a->origin, &b->origin) && return graphene_point_equal (&a->origin, &b->origin) &&
graphene_size_equal (&a->size, &b->size); graphene_size_equal (&a->size, &b->size);
} }
@ -678,7 +428,7 @@ clutter_rect_normalize (ClutterRect *rect)
/** /**
* clutter_rect_get_center: * clutter_rect_get_center:
* @rect: a #ClutterRect * @rect: a #ClutterRect
* @center: (out caller-allocates): a #ClutterPoint * @center: (out caller-allocates): a #graphene_point_t
* *
* Retrieves the center of @rect, after normalizing the rectangle, * Retrieves the center of @rect, after normalizing the rectangle,
* and updates @center with the correct coordinates. * and updates @center with the correct coordinates.
@ -686,8 +436,8 @@ clutter_rect_normalize (ClutterRect *rect)
* Since: 1.12 * Since: 1.12
*/ */
void void
clutter_rect_get_center (ClutterRect *rect, clutter_rect_get_center (ClutterRect *rect,
ClutterPoint *center) graphene_point_t *center)
{ {
g_return_if_fail (rect != NULL); g_return_if_fail (rect != NULL);
g_return_if_fail (center != NULL); g_return_if_fail (center != NULL);
@ -711,8 +461,8 @@ clutter_rect_get_center (ClutterRect *rect,
* Since: 1.12 * Since: 1.12
*/ */
gboolean gboolean
clutter_rect_contains_point (ClutterRect *rect, clutter_rect_contains_point (ClutterRect *rect,
ClutterPoint *point) graphene_point_t *point)
{ {
g_return_val_if_fail (rect != NULL, FALSE); g_return_val_if_fail (rect != NULL, FALSE);
g_return_val_if_fail (point != NULL, FALSE); g_return_val_if_fail (point != NULL, FALSE);

View File

@ -370,7 +370,7 @@ clutter_event_get_coords (const ClutterEvent *event,
gfloat *x, gfloat *x,
gfloat *y) gfloat *y)
{ {
ClutterPoint coords; graphene_point_t coords;
g_return_if_fail (event != NULL); g_return_if_fail (event != NULL);
@ -386,15 +386,15 @@ clutter_event_get_coords (const ClutterEvent *event,
/** /**
* clutter_event_get_position: * clutter_event_get_position:
* @event: a #ClutterEvent * @event: a #ClutterEvent
* @position: a #ClutterPoint * @position: a #graphene_point_t
* *
* Retrieves the event coordinates as a #ClutterPoint. * Retrieves the event coordinates as a #graphene_point_t.
* *
* Since: 1.12 * Since: 1.12
*/ */
void void
clutter_event_get_position (const ClutterEvent *event, clutter_event_get_position (const ClutterEvent *event,
ClutterPoint *position) graphene_point_t *position)
{ {
g_return_if_fail (event != NULL); g_return_if_fail (event != NULL);
g_return_if_fail (position != NULL); g_return_if_fail (position != NULL);
@ -415,42 +415,42 @@ clutter_event_get_position (const ClutterEvent *event,
case CLUTTER_PAD_BUTTON_RELEASE: case CLUTTER_PAD_BUTTON_RELEASE:
case CLUTTER_PAD_STRIP: case CLUTTER_PAD_STRIP:
case CLUTTER_PAD_RING: case CLUTTER_PAD_RING:
clutter_point_init (position, 0.f, 0.f); graphene_point_init (position, 0.f, 0.f);
break; break;
case CLUTTER_ENTER: case CLUTTER_ENTER:
case CLUTTER_LEAVE: case CLUTTER_LEAVE:
clutter_point_init (position, event->crossing.x, event->crossing.y); graphene_point_init (position, event->crossing.x, event->crossing.y);
break; break;
case CLUTTER_BUTTON_PRESS: case CLUTTER_BUTTON_PRESS:
case CLUTTER_BUTTON_RELEASE: case CLUTTER_BUTTON_RELEASE:
clutter_point_init (position, event->button.x, event->button.y); graphene_point_init (position, event->button.x, event->button.y);
break; break;
case CLUTTER_MOTION: case CLUTTER_MOTION:
clutter_point_init (position, event->motion.x, event->motion.y); graphene_point_init (position, event->motion.x, event->motion.y);
break; break;
case CLUTTER_TOUCH_BEGIN: case CLUTTER_TOUCH_BEGIN:
case CLUTTER_TOUCH_UPDATE: case CLUTTER_TOUCH_UPDATE:
case CLUTTER_TOUCH_END: case CLUTTER_TOUCH_END:
case CLUTTER_TOUCH_CANCEL: case CLUTTER_TOUCH_CANCEL:
clutter_point_init (position, event->touch.x, event->touch.y); graphene_point_init (position, event->touch.x, event->touch.y);
break; break;
case CLUTTER_SCROLL: case CLUTTER_SCROLL:
clutter_point_init (position, event->scroll.x, event->scroll.y); graphene_point_init (position, event->scroll.x, event->scroll.y);
break; break;
case CLUTTER_TOUCHPAD_PINCH: case CLUTTER_TOUCHPAD_PINCH:
clutter_point_init (position, event->touchpad_pinch.x, graphene_point_init (position, event->touchpad_pinch.x,
event->touchpad_pinch.y); event->touchpad_pinch.y);
break; break;
case CLUTTER_TOUCHPAD_SWIPE: case CLUTTER_TOUCHPAD_SWIPE:
clutter_point_init (position, event->touchpad_swipe.x, graphene_point_init (position, event->touchpad_swipe.x,
event->touchpad_swipe.y); event->touchpad_swipe.y);
break; break;
} }
@ -1796,12 +1796,12 @@ float
clutter_event_get_distance (const ClutterEvent *source, clutter_event_get_distance (const ClutterEvent *source,
const ClutterEvent *target) const ClutterEvent *target)
{ {
ClutterPoint p0, p1; graphene_point_t p0, p1;
clutter_event_get_position (source, &p0); clutter_event_get_position (source, &p0);
clutter_event_get_position (source, &p1); clutter_event_get_position (source, &p1);
return clutter_point_distance (&p0, &p1, NULL, NULL); return graphene_point_distance (&p0, &p1, NULL, NULL);
} }
/** /**
@ -1822,17 +1822,17 @@ double
clutter_event_get_angle (const ClutterEvent *source, clutter_event_get_angle (const ClutterEvent *source,
const ClutterEvent *target) const ClutterEvent *target)
{ {
ClutterPoint p0, p1; graphene_point_t p0, p1;
float x_distance, y_distance; float x_distance, y_distance;
double angle; double angle;
clutter_event_get_position (source, &p0); clutter_event_get_position (source, &p0);
clutter_event_get_position (target, &p1); clutter_event_get_position (target, &p1);
if (clutter_point_equals (&p0, &p1)) if (graphene_point_equal (&p0, &p1))
return 0; return 0;
clutter_point_distance (&p0, &p1, &x_distance, &y_distance); graphene_point_distance (&p0, &p1, &x_distance, &y_distance);
angle = atan2 (x_distance, y_distance); angle = atan2 (x_distance, y_distance);

View File

@ -686,7 +686,7 @@ void clutter_event_get_coords (const ClutterEv
gfloat *y); gfloat *y);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_event_get_position (const ClutterEvent *event, void clutter_event_get_position (const ClutterEvent *event,
ClutterPoint *position); graphene_point_t *position);
CLUTTER_EXPORT CLUTTER_EXPORT
float clutter_event_get_distance (const ClutterEvent *source, float clutter_event_get_distance (const ClutterEvent *source,
const ClutterEvent *target); const ClutterEvent *target);

View File

@ -29,6 +29,23 @@
#include "clutter-private.h" #include "clutter-private.h"
#include "clutter-types.h" #include "clutter-types.h"
static gboolean
graphene_point_progress (const GValue *a,
const GValue *b,
double progress,
GValue *retval)
{
const graphene_point_t *ap = g_value_get_boxed (a);
const graphene_point_t *bp = g_value_get_boxed (b);
graphene_point_t res;
graphene_point_interpolate (ap, bp, progress, &res);
g_value_set_boxed (retval, &res);
return TRUE;
}
static gboolean static gboolean
graphene_point3d_progress (const GValue *a, graphene_point3d_progress (const GValue *a,
const GValue *b, const GValue *b,
@ -66,6 +83,8 @@ graphene_size_progress (const GValue *a,
void void
clutter_graphene_init (void) clutter_graphene_init (void)
{ {
clutter_interval_register_progress_func (GRAPHENE_TYPE_POINT,
graphene_point_progress);
clutter_interval_register_progress_func (GRAPHENE_TYPE_POINT3D, clutter_interval_register_progress_func (GRAPHENE_TYPE_POINT3D,
graphene_point3d_progress); graphene_point3d_progress);
clutter_interval_register_progress_func (GRAPHENE_TYPE_SIZE, clutter_interval_register_progress_func (GRAPHENE_TYPE_SIZE,

View File

@ -991,7 +991,7 @@ clutter_input_device_get_enabled (ClutterInputDevice *device)
gboolean gboolean
clutter_input_device_get_coords (ClutterInputDevice *device, clutter_input_device_get_coords (ClutterInputDevice *device,
ClutterEventSequence *sequence, ClutterEventSequence *sequence,
ClutterPoint *point) graphene_point_t *point)
{ {
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE); g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
g_return_val_if_fail (point != NULL, FALSE); g_return_val_if_fail (point != NULL, FALSE);
@ -1038,7 +1038,7 @@ _clutter_input_device_update (ClutterInputDevice *device,
ClutterStage *stage; ClutterStage *stage;
ClutterActor *new_cursor_actor; ClutterActor *new_cursor_actor;
ClutterActor *old_cursor_actor; ClutterActor *old_cursor_actor;
ClutterPoint point = { -1, -1 }; graphene_point_t point = GRAPHENE_POINT_INIT (-1.0f, -1.0f);
ClutterInputDeviceType device_type = device->device_type; ClutterInputDeviceType device_type = device->device_type;
g_assert (device_type != CLUTTER_KEYBOARD_DEVICE && g_assert (device_type != CLUTTER_KEYBOARD_DEVICE &&

View File

@ -58,7 +58,7 @@ gint clutter_input_device_get_device_id (ClutterInputDev
CLUTTER_EXPORT CLUTTER_EXPORT
gboolean clutter_input_device_get_coords (ClutterInputDevice *device, gboolean clutter_input_device_get_coords (ClutterInputDevice *device,
ClutterEventSequence *sequence, ClutterEventSequence *sequence,
ClutterPoint *point); graphene_point_t *point);
CLUTTER_EXPORT CLUTTER_EXPORT
ClutterModifierType clutter_input_device_get_modifier_state (ClutterInputDevice *device); ClutterModifierType clutter_input_device_get_modifier_state (ClutterInputDevice *device);
CLUTTER_EXPORT CLUTTER_EXPORT

View File

@ -492,8 +492,8 @@ _clutter_script_parse_color (ClutterScript *script,
} }
static gboolean static gboolean
parse_point_from_array (JsonArray *array, parse_point_from_array (JsonArray *array,
ClutterPoint *point) graphene_point_t *point)
{ {
if (json_array_get_length (array) != 2) if (json_array_get_length (array) != 2)
return FALSE; return FALSE;
@ -505,8 +505,8 @@ parse_point_from_array (JsonArray *array,
} }
static gboolean static gboolean
parse_point_from_object (JsonObject *object, parse_point_from_object (JsonObject *object,
ClutterPoint *point) graphene_point_t *point)
{ {
if (json_object_has_member (object, "x")) if (json_object_has_member (object, "x"))
point->x = json_object_get_double_member (object, "x"); point->x = json_object_get_double_member (object, "x");
@ -522,9 +522,9 @@ parse_point_from_object (JsonObject *object,
} }
gboolean gboolean
_clutter_script_parse_point (ClutterScript *script, _clutter_script_parse_point (ClutterScript *script,
JsonNode *node, JsonNode *node,
ClutterPoint *point) graphene_point_t *point)
{ {
g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE); g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE);
g_return_val_if_fail (node != NULL, FALSE); g_return_val_if_fail (node != NULL, FALSE);
@ -1364,9 +1364,9 @@ _clutter_script_parse_node (ClutterScript *script,
return TRUE; return TRUE;
} }
} }
else if (p_type == CLUTTER_TYPE_POINT) else if (p_type == GRAPHENE_TYPE_POINT)
{ {
ClutterPoint point = CLUTTER_POINT_INIT_ZERO; graphene_point_t point = GRAPHENE_POINT_INIT_ZERO;
if (_clutter_script_parse_point (script, node, &point)) if (_clutter_script_parse_point (script, node, &point))
{ {
@ -1441,9 +1441,9 @@ _clutter_script_parse_node (ClutterScript *script,
return TRUE; return TRUE;
} }
} }
else if (G_VALUE_HOLDS (value, CLUTTER_TYPE_POINT)) else if (G_VALUE_HOLDS (value, GRAPHENE_TYPE_POINT))
{ {
ClutterPoint point = CLUTTER_POINT_INIT_ZERO; graphene_point_t point = GRAPHENE_POINT_INIT_ZERO;
if (_clutter_script_parse_point (script, node, &point)) if (_clutter_script_parse_point (script, node, &point))
{ {

View File

@ -130,9 +130,9 @@ gboolean _clutter_script_parse_color (ClutterScript *script,
ClutterColor *color); ClutterColor *color);
GObject *_clutter_script_parse_alpha (ClutterScript *script, GObject *_clutter_script_parse_alpha (ClutterScript *script,
JsonNode *node); JsonNode *node);
gboolean _clutter_script_parse_point (ClutterScript *script, gboolean _clutter_script_parse_point (ClutterScript *script,
JsonNode *node, JsonNode *node,
ClutterPoint *point); graphene_point_t *point);
gboolean _clutter_script_parse_size (ClutterScript *script, gboolean _clutter_script_parse_size (ClutterScript *script,
JsonNode *node, JsonNode *node,
graphene_size_t *size); graphene_size_t *size);

View File

@ -56,7 +56,7 @@
struct _ClutterScrollActorPrivate struct _ClutterScrollActorPrivate
{ {
ClutterPoint scroll_to; graphene_point_t scroll_to;
ClutterScrollMode scroll_mode; ClutterScrollMode scroll_mode;
@ -94,19 +94,19 @@ G_DEFINE_TYPE_WITH_CODE (ClutterScrollActor, clutter_scroll_actor, CLUTTER_TYPE_
clutter_animatable_iface_init)) clutter_animatable_iface_init))
static void static void
clutter_scroll_actor_set_scroll_to_internal (ClutterScrollActor *self, clutter_scroll_actor_set_scroll_to_internal (ClutterScrollActor *self,
const ClutterPoint *point) const graphene_point_t *point)
{ {
ClutterScrollActorPrivate *priv = self->priv; ClutterScrollActorPrivate *priv = self->priv;
ClutterActor *actor = CLUTTER_ACTOR (self); ClutterActor *actor = CLUTTER_ACTOR (self);
ClutterMatrix m = CLUTTER_MATRIX_INIT_IDENTITY; ClutterMatrix m = CLUTTER_MATRIX_INIT_IDENTITY;
float dx, dy; float dx, dy;
if (clutter_point_equals (&priv->scroll_to, point)) if (graphene_point_equal (&priv->scroll_to, point))
return; return;
if (point == NULL) if (point == NULL)
clutter_point_init (&priv->scroll_to, 0.f, 0.f); graphene_point_init (&priv->scroll_to, 0.f, 0.f);
else else
priv->scroll_to = *point; priv->scroll_to = *point;
@ -216,7 +216,7 @@ clutter_scroll_actor_set_final_state (ClutterAnimatable *animatable,
if (strcmp (property_name, "scroll-to") == 0) if (strcmp (property_name, "scroll-to") == 0)
{ {
ClutterScrollActor *self = CLUTTER_SCROLL_ACTOR (animatable); ClutterScrollActor *self = CLUTTER_SCROLL_ACTOR (animatable);
const ClutterPoint *point = g_value_get_boxed (value); const graphene_point_t *point = g_value_get_boxed (value);
clutter_scroll_actor_set_scroll_to_internal (self, point); clutter_scroll_actor_set_scroll_to_internal (self, point);
} }
@ -248,7 +248,7 @@ clutter_animatable_iface_init (ClutterAnimatableInterface *iface)
g_param_spec_boxed ("scroll-to", g_param_spec_boxed ("scroll-to",
"Scroll To", "Scroll To",
"The point to scroll the actor to", "The point to scroll the actor to",
CLUTTER_TYPE_POINT, GRAPHENE_TYPE_POINT,
G_PARAM_READWRITE | G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS | G_PARAM_STATIC_STRINGS |
CLUTTER_PARAM_ANIMATABLE); CLUTTER_PARAM_ANIMATABLE);
@ -322,7 +322,7 @@ clutter_scroll_actor_get_scroll_mode (ClutterScrollActor *actor)
/** /**
* clutter_scroll_actor_scroll_to_point: * clutter_scroll_actor_scroll_to_point:
* @actor: a #ClutterScrollActor * @actor: a #ClutterScrollActor
* @point: a #ClutterPoint * @point: a #graphene_point_t
* *
* Scrolls the contents of @actor so that @point is the new origin * Scrolls the contents of @actor so that @point is the new origin
* of the visible area. * of the visible area.
@ -335,8 +335,8 @@ clutter_scroll_actor_get_scroll_mode (ClutterScrollActor *actor)
* Since: 1.12 * Since: 1.12
*/ */
void void
clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor, clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
const ClutterPoint *point) const graphene_point_t *point)
{ {
ClutterScrollActorPrivate *priv; ClutterScrollActorPrivate *priv;
const ClutterAnimationInfo *info; const ClutterAnimationInfo *info;
@ -390,10 +390,10 @@ clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
/* if a transition already exist, update its bounds */ /* if a transition already exist, update its bounds */
clutter_transition_set_from (priv->transition, clutter_transition_set_from (priv->transition,
CLUTTER_TYPE_POINT, GRAPHENE_TYPE_POINT,
&priv->scroll_to); &priv->scroll_to);
clutter_transition_set_to (priv->transition, clutter_transition_set_to (priv->transition,
CLUTTER_TYPE_POINT, GRAPHENE_TYPE_POINT,
point); point);
/* always use the current easing state */ /* always use the current easing state */

View File

@ -86,8 +86,8 @@ CLUTTER_EXPORT
ClutterScrollMode clutter_scroll_actor_get_scroll_mode (ClutterScrollActor *actor); ClutterScrollMode clutter_scroll_actor_get_scroll_mode (ClutterScrollActor *actor);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor, void clutter_scroll_actor_scroll_to_point (ClutterScrollActor *actor,
const ClutterPoint *point); const graphene_point_t *point);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor, void clutter_scroll_actor_scroll_to_rect (ClutterScrollActor *actor,
const ClutterRect *rect); const ClutterRect *rect);

View File

@ -79,12 +79,12 @@ gint64 _clutter_stage_get_update_time (ClutterStage *stage);
void _clutter_stage_clear_update_time (ClutterStage *stage); void _clutter_stage_clear_update_time (ClutterStage *stage);
gboolean _clutter_stage_has_full_redraw_queued (ClutterStage *stage); gboolean _clutter_stage_has_full_redraw_queued (ClutterStage *stage);
void clutter_stage_log_pick (ClutterStage *stage, void clutter_stage_log_pick (ClutterStage *stage,
const ClutterPoint *vertices, const graphene_point_t *vertices,
ClutterActor *actor); ClutterActor *actor);
void clutter_stage_push_pick_clip (ClutterStage *stage, void clutter_stage_push_pick_clip (ClutterStage *stage,
const ClutterPoint *vertices); const graphene_point_t *vertices);
void clutter_stage_pop_pick_clip (ClutterStage *stage); void clutter_stage_pop_pick_clip (ClutterStage *stage);

View File

@ -107,7 +107,7 @@ struct _ClutterStageQueueRedrawEntry
typedef struct _PickRecord typedef struct _PickRecord
{ {
ClutterPoint vertex[4]; graphene_point_t vertex[4];
ClutterActor *actor; ClutterActor *actor;
int clip_stack_top; int clip_stack_top;
} PickRecord; } PickRecord;
@ -115,7 +115,7 @@ typedef struct _PickRecord
typedef struct _PickClipRecord typedef struct _PickClipRecord
{ {
int prev; int prev;
ClutterPoint vertex[4]; graphene_point_t vertex[4];
} PickClipRecord; } PickClipRecord;
struct _ClutterStagePrivate struct _ClutterStagePrivate
@ -376,9 +376,9 @@ _clutter_stage_clear_pick_stack (ClutterStage *stage)
} }
void void
clutter_stage_log_pick (ClutterStage *stage, clutter_stage_log_pick (ClutterStage *stage,
const ClutterPoint *vertices, const graphene_point_t *vertices,
ClutterActor *actor) ClutterActor *actor)
{ {
ClutterStagePrivate *priv; ClutterStagePrivate *priv;
PickRecord rec; PickRecord rec;
@ -390,7 +390,7 @@ clutter_stage_log_pick (ClutterStage *stage,
g_assert (!priv->pick_stack_frozen); g_assert (!priv->pick_stack_frozen);
memcpy (rec.vertex, vertices, 4 * sizeof (ClutterPoint)); memcpy (rec.vertex, vertices, 4 * sizeof (graphene_point_t));
rec.actor = actor; rec.actor = actor;
rec.clip_stack_top = priv->pick_clip_stack_top; rec.clip_stack_top = priv->pick_clip_stack_top;
@ -398,8 +398,8 @@ clutter_stage_log_pick (ClutterStage *stage,
} }
void void
clutter_stage_push_pick_clip (ClutterStage *stage, clutter_stage_push_pick_clip (ClutterStage *stage,
const ClutterPoint *vertices) const graphene_point_t *vertices)
{ {
ClutterStagePrivate *priv; ClutterStagePrivate *priv;
PickClipRecord clip; PickClipRecord clip;
@ -411,7 +411,7 @@ clutter_stage_push_pick_clip (ClutterStage *stage,
g_assert (!priv->pick_stack_frozen); g_assert (!priv->pick_stack_frozen);
clip.prev = priv->pick_clip_stack_top; clip.prev = priv->pick_clip_stack_top;
memcpy (clip.vertex, vertices, 4 * sizeof (ClutterPoint)); memcpy (clip.vertex, vertices, 4 * sizeof (graphene_point_t));
g_array_append_val (priv->pick_clip_stack, clip); g_array_append_val (priv->pick_clip_stack, clip);
priv->pick_clip_stack_top = priv->pick_clip_stack->len - 1; priv->pick_clip_stack_top = priv->pick_clip_stack->len - 1;
@ -444,7 +444,7 @@ clutter_stage_pop_pick_clip (ClutterStage *stage)
} }
static gboolean static gboolean
is_quadrilateral_axis_aligned_rectangle (const ClutterPoint *vertices) is_quadrilateral_axis_aligned_rectangle (const graphene_point_t *vertices)
{ {
int i; int i;
@ -462,8 +462,8 @@ is_quadrilateral_axis_aligned_rectangle (const ClutterPoint *vertices)
} }
static gboolean static gboolean
is_inside_axis_aligned_rectangle (const ClutterPoint *point, is_inside_axis_aligned_rectangle (const graphene_point_t *point,
const ClutterPoint *vertices) const graphene_point_t *vertices)
{ {
float min_x = FLT_MAX; float min_x = FLT_MAX;
float max_x = FLT_MIN; float max_x = FLT_MIN;
@ -485,15 +485,70 @@ is_inside_axis_aligned_rectangle (const ClutterPoint *point,
point->y < max_y); point->y < max_y);
} }
static int
clutter_point_compare_line (const graphene_point_t *p,
const graphene_point_t *a,
const graphene_point_t *b)
{
graphene_vec3_t vec_pa;
graphene_vec3_t vec_pb;
graphene_vec3_t cross;
float cross_z;
graphene_vec3_init (&vec_pa, p->x - a->x, p->y - a->y, 0.f);
graphene_vec3_init (&vec_pb, p->x - b->x, p->y - b->y, 0.f);
graphene_vec3_cross (&vec_pa, &vec_pb, &cross);
cross_z = graphene_vec3_get_z (&cross);
if (cross_z > 0.f)
return 1;
else if (cross_z < 0.f)
return -1;
else
return 0;
}
static gboolean static gboolean
is_inside_input_region (const ClutterPoint *point, is_inside_unaligned_rectangle (const graphene_point_t *point,
const ClutterPoint *vertices) const graphene_point_t *vertices)
{
unsigned int i;
int first_side;
first_side = 0;
for (i = 0; i < 4; i++)
{
int side;
side = clutter_point_compare_line (point,
&vertices[i],
&vertices[(i + 1) % 4]);
if (side)
{
if (first_side == 0)
first_side = side;
else if (side != first_side)
return FALSE;
}
}
if (first_side == 0)
return FALSE;
return TRUE;
}
static gboolean
is_inside_input_region (const graphene_point_t *point,
const graphene_point_t *vertices)
{ {
if (is_quadrilateral_axis_aligned_rectangle (vertices)) if (is_quadrilateral_axis_aligned_rectangle (vertices))
return is_inside_axis_aligned_rectangle (point, vertices); return is_inside_axis_aligned_rectangle (point, vertices);
else else
return clutter_point_inside_quadrilateral (point, vertices); return is_inside_unaligned_rectangle (point, vertices);
} }
static gboolean static gboolean
@ -502,7 +557,7 @@ pick_record_contains_pixel (ClutterStage *stage,
int x, int x,
int y) int y)
{ {
const ClutterPoint point = CLUTTER_POINT_INIT (x, y); const graphene_point_t point = GRAPHENE_POINT_INIT (x, y);
ClutterStagePrivate *priv; ClutterStagePrivate *priv;
int clip_index; int clip_index;
@ -1367,7 +1422,7 @@ _clutter_stage_check_updated_pointers (ClutterStage *stage)
GSList *updating = NULL; GSList *updating = NULL;
const GSList *devices; const GSList *devices;
cairo_rectangle_int_t clip; cairo_rectangle_int_t clip;
ClutterPoint point; graphene_point_t point;
gboolean has_clip; gboolean has_clip;
has_clip = _clutter_stage_window_get_redraw_clip_bounds (priv->impl, &clip); has_clip = _clutter_stage_window_get_redraw_clip_bounds (priv->impl, &clip);

View File

@ -145,8 +145,8 @@ struct _ClutterTimelinePrivate
ClutterStepMode step_mode; ClutterStepMode step_mode;
/* cubic-bezier() parameters */ /* cubic-bezier() parameters */
ClutterPoint cb_1; graphene_point_t cb_1;
ClutterPoint cb_2; graphene_point_t cb_2;
guint is_playing : 1; guint is_playing : 1;
@ -846,8 +846,8 @@ clutter_timeline_init (ClutterTimeline *self)
self->priv->step_mode = CLUTTER_STEP_MODE_END; self->priv->step_mode = CLUTTER_STEP_MODE_END;
/* default cubic-bezier() paramereters are (0, 0, 1, 1) */ /* default cubic-bezier() paramereters are (0, 0, 1, 1) */
clutter_point_init (&self->priv->cb_1, 0, 0); graphene_point_init (&self->priv->cb_1, 0, 0);
clutter_point_init (&self->priv->cb_2, 1, 1); graphene_point_init (&self->priv->cb_2, 1, 1);
} }
struct CheckIfMarkerHitClosure struct CheckIfMarkerHitClosure
@ -2485,9 +2485,9 @@ clutter_timeline_get_step_progress (ClutterTimeline *timeline,
* Since: 1.12 * Since: 1.12
*/ */
void void
clutter_timeline_set_cubic_bezier_progress (ClutterTimeline *timeline, clutter_timeline_set_cubic_bezier_progress (ClutterTimeline *timeline,
const ClutterPoint *c_1, const graphene_point_t *c_1,
const ClutterPoint *c_2) const graphene_point_t *c_2)
{ {
ClutterTimelinePrivate *priv; ClutterTimelinePrivate *priv;
@ -2522,9 +2522,9 @@ clutter_timeline_set_cubic_bezier_progress (ClutterTimeline *timeline,
* Since: 1.12 * Since: 1.12
*/ */
gboolean gboolean
clutter_timeline_get_cubic_bezier_progress (ClutterTimeline *timeline, clutter_timeline_get_cubic_bezier_progress (ClutterTimeline *timeline,
ClutterPoint *c_1, graphene_point_t *c_1,
ClutterPoint *c_2) graphene_point_t *c_2)
{ {
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), FALSE); g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), FALSE);

View File

@ -208,13 +208,13 @@ gboolean clutter_timeline_get_step_progress
gint *n_steps, gint *n_steps,
ClutterStepMode *step_mode); ClutterStepMode *step_mode);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_timeline_set_cubic_bezier_progress (ClutterTimeline *timeline, void clutter_timeline_set_cubic_bezier_progress (ClutterTimeline *timeline,
const ClutterPoint *c_1, const graphene_point_t *c_1,
const ClutterPoint *c_2); const graphene_point_t *c_2);
CLUTTER_EXPORT CLUTTER_EXPORT
gboolean clutter_timeline_get_cubic_bezier_progress (ClutterTimeline *timeline, gboolean clutter_timeline_get_cubic_bezier_progress (ClutterTimeline *timeline,
ClutterPoint *c_1, graphene_point_t *c_1,
ClutterPoint *c_2); graphene_point_t *c_2);
CLUTTER_EXPORT CLUTTER_EXPORT
gint64 clutter_timeline_get_duration_hint (ClutterTimeline *timeline); gint64 clutter_timeline_get_duration_hint (ClutterTimeline *timeline);

View File

@ -44,7 +44,6 @@ G_BEGIN_DECLS
#define CLUTTER_TYPE_MATRIX (clutter_matrix_get_type ()) #define CLUTTER_TYPE_MATRIX (clutter_matrix_get_type ())
#define CLUTTER_TYPE_PAINT_VOLUME (clutter_paint_volume_get_type ()) #define CLUTTER_TYPE_PAINT_VOLUME (clutter_paint_volume_get_type ())
#define CLUTTER_TYPE_PERSPECTIVE (clutter_perspective_get_type ()) #define CLUTTER_TYPE_PERSPECTIVE (clutter_perspective_get_type ())
#define CLUTTER_TYPE_POINT (clutter_point_get_type ())
#define CLUTTER_TYPE_RECT (clutter_rect_get_type ()) #define CLUTTER_TYPE_RECT (clutter_rect_get_type ())
typedef struct _ClutterActor ClutterActor; typedef struct _ClutterActor ClutterActor;
@ -82,7 +81,6 @@ typedef struct _ClutterGeometry ClutterGeometry; /* XXX:2.0 - re
typedef struct _ClutterKnot ClutterKnot; typedef struct _ClutterKnot ClutterKnot;
typedef struct _ClutterMargin ClutterMargin; typedef struct _ClutterMargin ClutterMargin;
typedef struct _ClutterPerspective ClutterPerspective; typedef struct _ClutterPerspective ClutterPerspective;
typedef struct _ClutterPoint ClutterPoint;
typedef struct _ClutterRect ClutterRect; typedef struct _ClutterRect ClutterRect;
typedef struct _ClutterAlpha ClutterAlpha; typedef struct _ClutterAlpha ClutterAlpha;
@ -133,73 +131,6 @@ typedef struct _ClutterShader ClutterShader; /* deprecated */
*/ */
typedef struct _ClutterPaintVolume ClutterPaintVolume; typedef struct _ClutterPaintVolume ClutterPaintVolume;
/**
* ClutterPoint:
* @x: X coordinate, in pixels
* @y: Y coordinate, in pixels
*
* A point in 2D space.
*
* Since: 1.12
*/
struct _ClutterPoint
{
float x;
float y;
};
/**
* CLUTTER_POINT_INIT:
* @x: X coordinate
* @y: Y coordinate
*
* A simple macro for initializing a #ClutterPoint when declaring it, e.g.:
*
* |[
* ClutterPoint p = CLUTTER_POINT_INIT (100, 100);
* ]|
*
* Since: 1.12
*/
#define CLUTTER_POINT_INIT(x,y) { (x), (y) }
/**
* CLUTTER_POINT_INIT_ZERO:
*
* A simple macro for initializing a #ClutterPoint to (0, 0) when
* declaring it.
*
* Since: 1.12
*/
#define CLUTTER_POINT_INIT_ZERO CLUTTER_POINT_INIT (0.f, 0.f)
CLUTTER_EXPORT
GType clutter_point_get_type (void) G_GNUC_CONST;
CLUTTER_EXPORT
const ClutterPoint * clutter_point_zero (void);
CLUTTER_EXPORT
ClutterPoint * clutter_point_alloc (void);
CLUTTER_EXPORT
ClutterPoint * clutter_point_init (ClutterPoint *point,
float x,
float y);
CLUTTER_EXPORT
ClutterPoint * clutter_point_copy (const ClutterPoint *point);
CLUTTER_EXPORT
void clutter_point_free (ClutterPoint *point);
CLUTTER_EXPORT
gboolean clutter_point_equals (const ClutterPoint *a,
const ClutterPoint *b);
CLUTTER_EXPORT
float clutter_point_distance (const ClutterPoint *a,
const ClutterPoint *b,
float *x_distance,
float *y_distance);
CLUTTER_EXPORT
gboolean clutter_point_inside_quadrilateral (const ClutterPoint *point,
const ClutterPoint *vertices);
/** /**
* ClutterRect: * ClutterRect:
* @origin: the origin of the rectangle * @origin: the origin of the rectangle
@ -223,7 +154,7 @@ gboolean clutter_point_inside_quadrilateral (const ClutterPoint *point,
*/ */
struct _ClutterRect struct _ClutterRect
{ {
ClutterPoint origin; graphene_point_t origin;
graphene_size_t size; graphene_size_t size;
}; };
@ -279,10 +210,10 @@ CLUTTER_EXPORT
ClutterRect * clutter_rect_normalize (ClutterRect *rect); ClutterRect * clutter_rect_normalize (ClutterRect *rect);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_rect_get_center (ClutterRect *rect, void clutter_rect_get_center (ClutterRect *rect,
ClutterPoint *center); graphene_point_t *center);
CLUTTER_EXPORT CLUTTER_EXPORT
gboolean clutter_rect_contains_point (ClutterRect *rect, gboolean clutter_rect_contains_point (ClutterRect *rect,
ClutterPoint *point); graphene_point_t *point);
CLUTTER_EXPORT CLUTTER_EXPORT
gboolean clutter_rect_contains_rect (ClutterRect *a, gboolean clutter_rect_contains_rect (ClutterRect *a,
ClutterRect *b); ClutterRect *b);

View File

@ -80,9 +80,9 @@ struct _ClutterZoomActionPrivate
ZoomPoint points[2]; ZoomPoint points[2];
ClutterPoint initial_focal_point; graphene_point_t initial_focal_point;
ClutterPoint focal_point; graphene_point_t focal_point;
ClutterPoint transformed_focal_point; graphene_point_t transformed_focal_point;
gfloat initial_x; gfloat initial_x;
gfloat initial_y; gfloat initial_y;
@ -238,7 +238,7 @@ clutter_zoom_action_gesture_cancel (ClutterGestureAction *action,
static gboolean static gboolean
clutter_zoom_action_real_zoom (ClutterZoomAction *action, clutter_zoom_action_real_zoom (ClutterZoomAction *action,
ClutterActor *actor, ClutterActor *actor,
ClutterPoint *focal_point, graphene_point_t *focal_point,
gdouble factor) gdouble factor)
{ {
ClutterZoomActionPrivate *priv = action->priv; ClutterZoomActionPrivate *priv = action->priv;
@ -400,7 +400,7 @@ clutter_zoom_action_class_init (ClutterZoomActionClass *klass)
_clutter_marshal_BOOLEAN__OBJECT_BOXED_DOUBLE, _clutter_marshal_BOOLEAN__OBJECT_BOXED_DOUBLE,
G_TYPE_BOOLEAN, 3, G_TYPE_BOOLEAN, 3,
CLUTTER_TYPE_ACTOR, CLUTTER_TYPE_ACTOR,
CLUTTER_TYPE_POINT, GRAPHENE_TYPE_POINT,
G_TYPE_DOUBLE); G_TYPE_DOUBLE);
} }
@ -478,7 +478,7 @@ clutter_zoom_action_get_zoom_axis (ClutterZoomAction *action)
/** /**
* clutter_zoom_action_get_focal_point: * clutter_zoom_action_get_focal_point:
* @action: a #ClutterZoomAction * @action: a #ClutterZoomAction
* @point: (out): a #ClutterPoint * @point: (out): a #graphene_point_t
* *
* Retrieves the focal point of the current zoom * Retrieves the focal point of the current zoom
* *
@ -486,7 +486,7 @@ clutter_zoom_action_get_zoom_axis (ClutterZoomAction *action)
*/ */
void void
clutter_zoom_action_get_focal_point (ClutterZoomAction *action, clutter_zoom_action_get_focal_point (ClutterZoomAction *action,
ClutterPoint *point) graphene_point_t *point)
{ {
g_return_if_fail (CLUTTER_IS_ZOOM_ACTION (action)); g_return_if_fail (CLUTTER_IS_ZOOM_ACTION (action));
g_return_if_fail (point != NULL); g_return_if_fail (point != NULL);
@ -497,7 +497,7 @@ clutter_zoom_action_get_focal_point (ClutterZoomAction *action,
/** /**
* clutter_zoom_action_get_transformed_focal_point: * clutter_zoom_action_get_transformed_focal_point:
* @action: a #ClutterZoomAction * @action: a #ClutterZoomAction
* @point: (out): a #ClutterPoint * @point: (out): a #graphene_point_t
* *
* Retrieves the focal point relative to the actor's coordinates of * Retrieves the focal point relative to the actor's coordinates of
* the current zoom * the current zoom
@ -506,7 +506,7 @@ clutter_zoom_action_get_focal_point (ClutterZoomAction *action,
*/ */
void void
clutter_zoom_action_get_transformed_focal_point (ClutterZoomAction *action, clutter_zoom_action_get_transformed_focal_point (ClutterZoomAction *action,
ClutterPoint *point) graphene_point_t *point)
{ {
g_return_if_fail (CLUTTER_IS_ZOOM_ACTION (action)); g_return_if_fail (CLUTTER_IS_ZOOM_ACTION (action));
g_return_if_fail (point != NULL); g_return_if_fail (point != NULL);

View File

@ -79,7 +79,7 @@ struct _ClutterZoomActionClass
/*< public >*/ /*< public >*/
gboolean (* zoom) (ClutterZoomAction *action, gboolean (* zoom) (ClutterZoomAction *action,
ClutterActor *actor, ClutterActor *actor,
ClutterPoint *focal_point, graphene_point_t *focal_point,
gdouble factor); gdouble factor);
/*< private >*/ /*< private >*/
@ -104,10 +104,10 @@ ClutterZoomAxis clutter_zoom_action_get_zoom_axis (ClutterZoomActi
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_zoom_action_get_focal_point (ClutterZoomAction *action, void clutter_zoom_action_get_focal_point (ClutterZoomAction *action,
ClutterPoint *point); graphene_point_t *point);
CLUTTER_EXPORT CLUTTER_EXPORT
void clutter_zoom_action_get_transformed_focal_point (ClutterZoomAction *action, void clutter_zoom_action_get_transformed_focal_point (ClutterZoomAction *action,
ClutterPoint *point); graphene_point_t *point);
G_END_DECLS G_END_DECLS

View File

@ -258,7 +258,7 @@ meta_backend_monitors_changed (MetaBackend *backend)
meta_backend_get_monitor_manager (backend); meta_backend_get_monitor_manager (backend);
ClutterDeviceManager *manager = clutter_device_manager_get_default (); ClutterDeviceManager *manager = clutter_device_manager_get_default ();
ClutterInputDevice *device = clutter_device_manager_get_core_device (manager, CLUTTER_POINTER_DEVICE); ClutterInputDevice *device = clutter_device_manager_get_core_device (manager, CLUTTER_POINTER_DEVICE);
ClutterPoint point; graphene_point_t point;
meta_backend_sync_screen_size (backend); meta_backend_sync_screen_size (backend);

View File

@ -315,13 +315,13 @@ meta_cursor_renderer_set_position (MetaCursorRenderer *renderer,
meta_cursor_renderer_update_cursor (renderer, priv->displayed_cursor); meta_cursor_renderer_update_cursor (renderer, priv->displayed_cursor);
} }
ClutterPoint graphene_point_t
meta_cursor_renderer_get_position (MetaCursorRenderer *renderer) meta_cursor_renderer_get_position (MetaCursorRenderer *renderer)
{ {
MetaCursorRendererPrivate *priv = MetaCursorRendererPrivate *priv =
meta_cursor_renderer_get_instance_private (renderer); meta_cursor_renderer_get_instance_private (renderer);
return (ClutterPoint) { return (graphene_point_t) {
.x = priv->current_x, .x = priv->current_x,
.y = priv->current_y .y = priv->current_y
}; };

View File

@ -62,7 +62,7 @@ void meta_cursor_renderer_set_cursor (MetaCursorRenderer *renderer,
void meta_cursor_renderer_set_position (MetaCursorRenderer *renderer, void meta_cursor_renderer_set_position (MetaCursorRenderer *renderer,
float x, float x,
float y); float y);
ClutterPoint meta_cursor_renderer_get_position (MetaCursorRenderer *renderer); graphene_point_t meta_cursor_renderer_get_position (MetaCursorRenderer *renderer);
void meta_cursor_renderer_force_update (MetaCursorRenderer *renderer); void meta_cursor_renderer_force_update (MetaCursorRenderer *renderer);
MetaCursorSprite * meta_cursor_renderer_get_cursor (MetaCursorRenderer *renderer); MetaCursorSprite * meta_cursor_renderer_get_cursor (MetaCursorRenderer *renderer);

View File

@ -407,7 +407,7 @@ get_pointer_position_clutter (int *x,
{ {
ClutterDeviceManager *cmanager; ClutterDeviceManager *cmanager;
ClutterInputDevice *cdevice; ClutterInputDevice *cdevice;
ClutterPoint point; graphene_point_t point;
cmanager = clutter_device_manager_get_default (); cmanager = clutter_device_manager_get_default ();
cdevice = clutter_device_manager_get_core_device (cmanager, CLUTTER_POINTER_DEVICE); cdevice = clutter_device_manager_get_core_device (cmanager, CLUTTER_POINTER_DEVICE);

View File

@ -167,7 +167,7 @@ is_cursor_in_stream (MetaScreenCastMonitorStreamSrc *monitor_src)
} }
else else
{ {
ClutterPoint cursor_position; graphene_point_t cursor_position;
cursor_position = meta_cursor_renderer_get_position (cursor_renderer); cursor_position = meta_cursor_renderer_get_position (cursor_renderer);
return clutter_rect_contains_point (&logical_monitor_rect, return clutter_rect_contains_point (&logical_monitor_rect,
@ -384,7 +384,7 @@ meta_screen_cast_monitor_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc
ClutterRect logical_monitor_rect; ClutterRect logical_monitor_rect;
MetaRendererView *view; MetaRendererView *view;
float view_scale; float view_scale;
ClutterPoint cursor_position; graphene_point_t cursor_position;
int x, y; int x, y;
cursor_sprite = meta_cursor_renderer_get_cursor (cursor_renderer); cursor_sprite = meta_cursor_renderer_get_cursor (cursor_renderer);

View File

@ -112,8 +112,8 @@ maybe_draw_cursor_sprite (MetaScreenCastWindowStreamSrc *window_src,
MetaCursorSprite *cursor_sprite; MetaCursorSprite *cursor_sprite;
CoglTexture *cursor_texture; CoglTexture *cursor_texture;
MetaScreenCastWindow *screen_cast_window; MetaScreenCastWindow *screen_cast_window;
ClutterPoint cursor_position; graphene_point_t cursor_position;
ClutterPoint relative_cursor_position; graphene_point_t relative_cursor_position;
cairo_surface_t *cursor_surface; cairo_surface_t *cursor_surface;
uint8_t *cursor_surface_data; uint8_t *cursor_surface_data;
GError *error = NULL; GError *error = NULL;
@ -298,7 +298,7 @@ is_cursor_in_stream (MetaScreenCastWindowStreamSrc *window_src)
MetaCursorRenderer *cursor_renderer = MetaCursorRenderer *cursor_renderer =
meta_backend_get_cursor_renderer (backend); meta_backend_get_cursor_renderer (backend);
MetaCursorSprite *cursor_sprite; MetaCursorSprite *cursor_sprite;
ClutterPoint cursor_position; graphene_point_t cursor_position;
MetaScreenCastWindow *screen_cast_window; MetaScreenCastWindow *screen_cast_window;
cursor_sprite = meta_cursor_renderer_get_cursor (cursor_renderer); cursor_sprite = meta_cursor_renderer_get_cursor (cursor_renderer);
@ -423,9 +423,9 @@ meta_screen_cast_window_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc
meta_backend_get_cursor_renderer (backend); meta_backend_get_cursor_renderer (backend);
MetaScreenCastWindow *screen_cast_window = window_src->screen_cast_window; MetaScreenCastWindow *screen_cast_window = window_src->screen_cast_window;
MetaCursorSprite *cursor_sprite; MetaCursorSprite *cursor_sprite;
ClutterPoint cursor_position; graphene_point_t cursor_position;
float scale; float scale;
ClutterPoint relative_cursor_position; graphene_point_t relative_cursor_position;
int x, y; int x, y;
cursor_sprite = meta_cursor_renderer_get_cursor (cursor_renderer); cursor_sprite = meta_cursor_renderer_get_cursor (cursor_renderer);

View File

@ -54,9 +54,9 @@ meta_screen_cast_window_transform_relative_position (MetaScreenCastWindow *scree
gboolean gboolean
meta_screen_cast_window_transform_cursor_position (MetaScreenCastWindow *screen_cast_window, meta_screen_cast_window_transform_cursor_position (MetaScreenCastWindow *screen_cast_window,
MetaCursorSprite *cursor_sprite, MetaCursorSprite *cursor_sprite,
ClutterPoint *cursor_position, graphene_point_t *cursor_position,
float *out_cursor_scale, float *out_cursor_scale,
ClutterPoint *out_relative_cursor_position) graphene_point_t *out_relative_cursor_position)
{ {
MetaScreenCastWindowInterface *iface = MetaScreenCastWindowInterface *iface =
META_SCREEN_CAST_WINDOW_GET_IFACE (screen_cast_window); META_SCREEN_CAST_WINDOW_GET_IFACE (screen_cast_window);

View File

@ -48,9 +48,9 @@ struct _MetaScreenCastWindowInterface
gboolean (*transform_cursor_position) (MetaScreenCastWindow *screen_cast_window, gboolean (*transform_cursor_position) (MetaScreenCastWindow *screen_cast_window,
MetaCursorSprite *cursor_sprite, MetaCursorSprite *cursor_sprite,
ClutterPoint *cursor_position, graphene_point_t *cursor_position,
float *out_cursor_scale, float *out_cursor_scale,
ClutterPoint *out_relative_cursor_position); graphene_point_t *out_relative_cursor_position);
void (*capture_into) (MetaScreenCastWindow *screen_cast_window, void (*capture_into) (MetaScreenCastWindow *screen_cast_window,
MetaRectangle *bounds, MetaRectangle *bounds,
@ -70,9 +70,9 @@ void meta_screen_cast_window_transform_relative_position (MetaScreenCastWindow *
gboolean meta_screen_cast_window_transform_cursor_position (MetaScreenCastWindow *screen_cast_window, gboolean meta_screen_cast_window_transform_cursor_position (MetaScreenCastWindow *screen_cast_window,
MetaCursorSprite *cursor_sprite, MetaCursorSprite *cursor_sprite,
ClutterPoint *cursor_position, graphene_point_t *cursor_position,
float *out_cursor_scale, float *out_cursor_scale,
ClutterPoint *out_relative_cursor_position); graphene_point_t *out_relative_cursor_position);
void meta_screen_cast_window_capture_into (MetaScreenCastWindow *screen_cast_window, void meta_screen_cast_window_capture_into (MetaScreenCastWindow *screen_cast_window,
MetaRectangle *bounds, MetaRectangle *bounds,

View File

@ -150,7 +150,7 @@ constrain_all_screen_monitors (ClutterInputDevice *device,
float *x, float *x,
float *y) float *y)
{ {
ClutterPoint current; graphene_point_t current;
float cx, cy; float cx, cy;
GList *logical_monitors, *l; GList *logical_monitors, *l;

View File

@ -468,7 +468,7 @@ meta_barrier_manager_native_process (MetaBarrierManagerNative *manager,
float *x, float *x,
float *y) float *y)
{ {
ClutterPoint prev_pos; graphene_point_t prev_pos;
float prev_x; float prev_x;
float prev_y; float prev_y;
float orig_x = *x; float orig_x = *x;

View File

@ -380,7 +380,7 @@ notify_pinch_gesture_event (ClutterInputDevice *input_device,
MetaSeatNative *seat; MetaSeatNative *seat;
ClutterStage *stage; ClutterStage *stage;
ClutterEvent *event = NULL; ClutterEvent *event = NULL;
ClutterPoint pos; graphene_point_t pos;
/* We can drop the event on the floor if no stage has been /* We can drop the event on the floor if no stage has been
* associated with the device yet. */ * associated with the device yet. */
@ -427,7 +427,7 @@ notify_swipe_gesture_event (ClutterInputDevice *input_device,
MetaSeatNative *seat; MetaSeatNative *seat;
ClutterStage *stage; ClutterStage *stage;
ClutterEvent *event = NULL; ClutterEvent *event = NULL;
ClutterPoint pos; graphene_point_t pos;
/* We can drop the event on the floor if no stage has been /* We can drop the event on the floor if no stage has been
* associated with the device yet. */ * associated with the device yet. */

View File

@ -571,7 +571,7 @@ meta_seat_native_notify_button (MetaSeatNative *seat,
if (clutter_input_device_get_device_type (input_device) == CLUTTER_TABLET_DEVICE) if (clutter_input_device_get_device_type (input_device) == CLUTTER_TABLET_DEVICE)
{ {
ClutterPoint point; graphene_point_t point;
clutter_input_device_get_coords (input_device, NULL, &point); clutter_input_device_get_coords (input_device, NULL, &point);
event->button.x = point.x; event->button.x = point.x;

View File

@ -39,7 +39,7 @@ struct _MetaTouchState
int device_slot; int device_slot;
int seat_slot; int seat_slot;
ClutterPoint coords; graphene_point_t coords;
}; };
struct _MetaSeatNative struct _MetaSeatNative

View File

@ -207,7 +207,7 @@ meta_dnd_actor_drag_finish (MetaDnDActor *self,
if (CLUTTER_ACTOR_IS_VISIBLE (self->drag_origin)) if (CLUTTER_ACTOR_IS_VISIBLE (self->drag_origin))
{ {
float anchor_x, anchor_y; float anchor_x, anchor_y;
ClutterPoint dest; graphene_point_t dest;
clutter_actor_get_transformed_position (self->drag_origin, clutter_actor_get_transformed_position (self->drag_origin,
&dest.x, &dest.y); &dest.x, &dest.y);

View File

@ -241,7 +241,7 @@ void
meta_feedback_actor_update (MetaFeedbackActor *self, meta_feedback_actor_update (MetaFeedbackActor *self,
const ClutterEvent *event) const ClutterEvent *event)
{ {
ClutterPoint point; graphene_point_t point;
g_return_if_fail (META_IS_FEEDBACK_ACTOR (self)); g_return_if_fail (META_IS_FEEDBACK_ACTOR (self));
g_return_if_fail (event != NULL); g_return_if_fail (event != NULL);

View File

@ -1174,9 +1174,9 @@ meta_window_actor_transform_relative_position (MetaScreenCastWindow *screen_cast
static gboolean static gboolean
meta_window_actor_transform_cursor_position (MetaScreenCastWindow *screen_cast_window, meta_window_actor_transform_cursor_position (MetaScreenCastWindow *screen_cast_window,
MetaCursorSprite *cursor_sprite, MetaCursorSprite *cursor_sprite,
ClutterPoint *cursor_position, graphene_point_t *cursor_position,
float *out_cursor_scale, float *out_cursor_scale,
ClutterPoint *out_relative_cursor_position) graphene_point_t *out_relative_cursor_position)
{ {
MetaWindowActor *window_actor = META_WINDOW_ACTOR (screen_cast_window); MetaWindowActor *window_actor = META_WINDOW_ACTOR (screen_cast_window);
MetaWindowActorPrivate *priv = MetaWindowActorPrivate *priv =

View File

@ -264,7 +264,7 @@ clutter_test_run (void)
typedef struct { typedef struct {
ClutterActor *stage; ClutterActor *stage;
ClutterPoint point; graphene_point_t point;
gpointer result; gpointer result;
@ -339,10 +339,10 @@ on_key_press_event (ClutterActor *stage,
* Since: 1.18 * Since: 1.18
*/ */
gboolean gboolean
clutter_test_check_actor_at_point (ClutterActor *stage, clutter_test_check_actor_at_point (ClutterActor *stage,
const ClutterPoint *point, const graphene_point_t *point,
ClutterActor *actor, ClutterActor *actor,
ClutterActor **result) ClutterActor **result)
{ {
ValidateData *data; ValidateData *data;
guint press_id = 0; guint press_id = 0;
@ -401,10 +401,10 @@ clutter_test_check_actor_at_point (ClutterActor *stage,
* Since: 1.18 * Since: 1.18
*/ */
gboolean gboolean
clutter_test_check_color_at_point (ClutterActor *stage, clutter_test_check_color_at_point (ClutterActor *stage,
const ClutterPoint *point, const graphene_point_t *point,
const ClutterColor *color, const ClutterColor *color,
ClutterColor *result) ClutterColor *result)
{ {
ValidateData *data; ValidateData *data;
gboolean retval; gboolean retval;

View File

@ -121,7 +121,7 @@ ClutterActor * clutter_test_get_stage (void);
#define clutter_test_assert_actor_at_point(stage,point,actor) \ #define clutter_test_assert_actor_at_point(stage,point,actor) \
G_STMT_START { \ G_STMT_START { \
const ClutterPoint *__p = (point); \ const graphene_point_t *__p = (point); \
ClutterActor *__actor = (actor); \ ClutterActor *__actor = (actor); \
ClutterActor *__stage = (stage); \ ClutterActor *__stage = (stage); \
ClutterActor *__res; \ ClutterActor *__res; \
@ -141,7 +141,7 @@ G_STMT_START { \
#define clutter_test_assert_color_at_point(stage,point,color) \ #define clutter_test_assert_color_at_point(stage,point,color) \
G_STMT_START { \ G_STMT_START { \
const ClutterPoint *__p = (point); \ const graphene_point_t *__p = (point); \
const ClutterColor *__c = (color); \ const ClutterColor *__c = (color); \
ClutterActor *__stage = (stage); \ ClutterActor *__stage = (stage); \
ClutterColor __res; \ ClutterColor __res; \
@ -158,15 +158,15 @@ G_STMT_START { \
} G_STMT_END } G_STMT_END
CLUTTER_EXPORT CLUTTER_EXPORT
gboolean clutter_test_check_actor_at_point (ClutterActor *stage, gboolean clutter_test_check_actor_at_point (ClutterActor *stage,
const ClutterPoint *point, const graphene_point_t *point,
ClutterActor *actor, ClutterActor *actor,
ClutterActor **result); ClutterActor **result);
CLUTTER_EXPORT CLUTTER_EXPORT
gboolean clutter_test_check_color_at_point (ClutterActor *stage, gboolean clutter_test_check_color_at_point (ClutterActor *stage,
const ClutterPoint *point, const graphene_point_t *point,
const ClutterColor *color, const ClutterColor *color,
ClutterColor *result); ClutterColor *result);
G_END_DECLS G_END_DECLS

View File

@ -8,7 +8,7 @@ actor_basic_layout (void)
ClutterActor *stage = clutter_test_get_stage (); ClutterActor *stage = clutter_test_get_stage ();
ClutterActor *vase; ClutterActor *vase;
ClutterActor *flower[3]; ClutterActor *flower[3];
ClutterPoint p; graphene_point_t p;
vase = clutter_actor_new (); vase = clutter_actor_new ();
clutter_actor_set_name (vase, "Vase"); clutter_actor_set_name (vase, "Vase");
@ -33,13 +33,13 @@ actor_basic_layout (void)
clutter_actor_set_name (flower[2], "Green Flower"); clutter_actor_set_name (flower[2], "Green Flower");
clutter_actor_add_child (vase, flower[2]); clutter_actor_add_child (vase, flower[2]);
clutter_point_init (&p, 50, 50); graphene_point_init (&p, 50, 50);
clutter_test_assert_actor_at_point (stage, &p, flower[0]); clutter_test_assert_actor_at_point (stage, &p, flower[0]);
clutter_point_init (&p, 150, 50); graphene_point_init (&p, 150, 50);
clutter_test_assert_actor_at_point (stage, &p, flower[1]); clutter_test_assert_actor_at_point (stage, &p, flower[1]);
clutter_point_init (&p, 250, 50); graphene_point_init (&p, 250, 50);
clutter_test_assert_actor_at_point (stage, &p, flower[2]); clutter_test_assert_actor_at_point (stage, &p, flower[2]);
} }
@ -49,7 +49,7 @@ actor_margin_layout (void)
ClutterActor *stage = clutter_test_get_stage (); ClutterActor *stage = clutter_test_get_stage ();
ClutterActor *vase; ClutterActor *vase;
ClutterActor *flower[3]; ClutterActor *flower[3];
ClutterPoint p; graphene_point_t p;
vase = clutter_actor_new (); vase = clutter_actor_new ();
clutter_actor_set_name (vase, "Vase"); clutter_actor_set_name (vase, "Vase");
@ -78,13 +78,13 @@ actor_margin_layout (void)
clutter_actor_set_margin_bottom (flower[2], 6); clutter_actor_set_margin_bottom (flower[2], 6);
clutter_actor_add_child (vase, flower[2]); clutter_actor_add_child (vase, flower[2]);
clutter_point_init (&p, 0, 7); graphene_point_init (&p, 0, 7);
clutter_test_assert_actor_at_point (stage, &p, flower[0]); clutter_test_assert_actor_at_point (stage, &p, flower[0]);
clutter_point_init (&p, 106, 50); graphene_point_init (&p, 106, 50);
clutter_test_assert_actor_at_point (stage, &p, flower[1]); clutter_test_assert_actor_at_point (stage, &p, flower[1]);
clutter_point_init (&p, 212, 7); graphene_point_init (&p, 212, 7);
clutter_test_assert_actor_at_point (stage, &p, flower[2]); clutter_test_assert_actor_at_point (stage, &p, flower[2]);
} }

View File

@ -33,7 +33,6 @@ clutter_conform_tests_general_tests = [
'interval', 'interval',
'script-parser', 'script-parser',
'units', 'units',
'point',
] ]
clutter_conform_tests_deprecated_tests = [ clutter_conform_tests_deprecated_tests = [

View File

@ -1,84 +0,0 @@
#include "tests/clutter-test-utils.h"
#include <clutter/clutter.h>
static void
point_on_nonempty_quadrilateral (void)
{
int p;
static const ClutterPoint vertices[4] =
{
{ 1.f, 2.f },
{ 6.f, 3.f },
{ 7.f, 6.f },
{ 0.f, 5.f }
};
static const ClutterPoint points_inside[] =
{
{ 2.f, 3.f },
{ 1.f, 4.f },
{ 5.f, 5.f },
{ 4.f, 3.f },
};
static const ClutterPoint points_outside[] =
{
{ 3.f, 1.f },
{ 7.f, 4.f },
{ 4.f, 6.f },
{ 99.f, -77.f },
{ -1.f, 3.f },
{ -8.f, -8.f },
{ 11.f, 4.f },
{ -7.f, 4.f },
};
for (p = 0; p < G_N_ELEMENTS (points_inside); p++)
{
const ClutterPoint *point = &points_inside[p];
g_assert_true (clutter_point_inside_quadrilateral (point, vertices));
}
for (p = 0; p < G_N_ELEMENTS (points_outside); p++)
{
const ClutterPoint *point = &points_outside[p];
g_assert_false (clutter_point_inside_quadrilateral (point, vertices));
}
}
static void
point_on_empty_quadrilateral (void)
{
int p;
static const ClutterPoint vertices[4] =
{
{ 5.f, 6.f },
{ 5.f, 6.f },
{ 5.f, 6.f },
{ 5.f, 6.f },
};
static const ClutterPoint points_outside[] =
{
{ 3.f, 1.f },
{ 7.f, 4.f },
{ 4.f, 6.f },
{ 99.f, -77.f },
{ -1.f, 3.f },
{ -8.f, -8.f },
};
for (p = 0; p < G_N_ELEMENTS (points_outside); p++)
{
const ClutterPoint *point = &points_outside[p];
g_assert_false (clutter_point_inside_quadrilateral (point, vertices));
}
g_assert_false (clutter_point_inside_quadrilateral (&vertices[0], vertices));
}
CLUTTER_TEST_SUITE (
CLUTTER_TEST_UNIT ("/point/on_nonempty_quadrilateral", point_on_nonempty_quadrilateral)
CLUTTER_TEST_UNIT ("/point/on_empty_quadrilateral", point_on_empty_quadrilateral)
)

View File

@ -218,7 +218,7 @@ input_cb (ClutterActor *actor,
{ {
ClutterActor *stage = clutter_actor_get_stage (actor); ClutterActor *stage = clutter_actor_get_stage (actor);
ClutterActor *source_actor = clutter_event_get_source (event); ClutterActor *source_actor = clutter_event_get_source (event);
ClutterPoint position; graphene_point_t position;
gchar *state; gchar *state;
gchar keybuf[128]; gchar keybuf[128];
gint device_id; gint device_id;

View File

@ -622,7 +622,7 @@ meta_pointer_confinement_wayland_maybe_warp (MetaPointerConfinementWayland *self
{ {
MetaWaylandSeat *seat; MetaWaylandSeat *seat;
MetaWaylandSurface *surface; MetaWaylandSurface *surface;
ClutterPoint point; graphene_point_t point;
float sx; float sx;
float sy; float sy;
cairo_region_t *region; cairo_region_t *region;

View File

@ -186,7 +186,7 @@ meta_wayland_cursor_surface_is_on_logical_monitor (MetaWaylandSurfaceRole *role,
META_WAYLAND_CURSOR_SURFACE (surface->role); META_WAYLAND_CURSOR_SURFACE (surface->role);
MetaWaylandCursorSurfacePrivate *priv = MetaWaylandCursorSurfacePrivate *priv =
meta_wayland_cursor_surface_get_instance_private (cursor_surface); meta_wayland_cursor_surface_get_instance_private (cursor_surface);
ClutterPoint point; graphene_point_t point;
ClutterRect logical_monitor_rect; ClutterRect logical_monitor_rect;
if (!priv->cursor_renderer) if (!priv->cursor_renderer)

View File

@ -1161,7 +1161,7 @@ meta_wayland_data_device_start_drag (MetaWaylandDataDevice *data
{ {
MetaWaylandSeat *seat = wl_container_of (data_device, seat, data_device); MetaWaylandSeat *seat = wl_container_of (data_device, seat, data_device);
MetaWaylandDragGrab *drag_grab; MetaWaylandDragGrab *drag_grab;
ClutterPoint pos, surface_pos; graphene_point_t pos, surface_pos;
ClutterModifierType modifiers; ClutterModifierType modifiers;
MetaSurfaceActor *surface_actor; MetaSurfaceActor *surface_actor;

View File

@ -72,7 +72,7 @@ dnd_surface_find_logical_monitor (MetaWaylandActorSurface *actor_surface)
meta_backend_get_cursor_renderer (backend); meta_backend_get_cursor_renderer (backend);
MetaMonitorManager *monitor_manager = MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend); meta_backend_get_monitor_manager (backend);
ClutterPoint pointer_pos; graphene_point_t pointer_pos;
pointer_pos = meta_cursor_renderer_get_position (cursor_renderer); pointer_pos = meta_cursor_renderer_get_position (cursor_renderer);
return meta_monitor_manager_get_logical_monitor_at (monitor_manager, return meta_monitor_manager_get_logical_monitor_at (monitor_manager,

View File

@ -926,7 +926,7 @@ meta_wayland_pointer_set_focus (MetaWaylandPointer *pointer,
if (surface != NULL) if (surface != NULL)
{ {
struct wl_client *client = wl_resource_get_client (surface->resource); struct wl_client *client = wl_resource_get_client (surface->resource);
ClutterPoint pos; graphene_point_t pos;
pointer->focus_surface = surface; pointer->focus_surface = surface;
@ -1039,7 +1039,7 @@ meta_wayland_pointer_get_relative_coordinates (MetaWaylandPointer *pointer,
wl_fixed_t *sy) wl_fixed_t *sy)
{ {
float xf = 0.0f, yf = 0.0f; float xf = 0.0f, yf = 0.0f;
ClutterPoint pos; graphene_point_t pos;
clutter_input_device_get_coords (pointer->device, NULL, &pos); clutter_input_device_get_coords (pointer->device, NULL, &pos);
meta_wayland_surface_get_relative_coordinates (surface, pos.x, pos.y, &xf, &yf); meta_wayland_surface_get_relative_coordinates (surface, pos.x, pos.y, &xf, &yf);

View File

@ -519,7 +519,7 @@ meta_x11_drag_dest_update (MetaWaylandDataDevice *data_device,
MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default (); MetaWaylandCompositor *compositor = meta_wayland_compositor_get_default ();
MetaXWaylandDnd *dnd = compositor->xwayland_manager.dnd; MetaXWaylandDnd *dnd = compositor->xwayland_manager.dnd;
MetaWaylandSeat *seat = compositor->seat; MetaWaylandSeat *seat = compositor->seat;
ClutterPoint pos; graphene_point_t pos;
clutter_input_device_get_coords (seat->pointer->device, NULL, &pos); clutter_input_device_get_coords (seat->pointer->device, NULL, &pos);
xdnd_send_position (dnd, dnd->dnd_dest, xdnd_send_position (dnd, dnd->dnd_dest,
@ -602,7 +602,7 @@ pick_drop_surface (MetaWaylandCompositor *compositor,
{ {
MetaDisplay *display = meta_get_display (); MetaDisplay *display = meta_get_display ();
MetaWindow *focus_window = NULL; MetaWindow *focus_window = NULL;
ClutterPoint pos; graphene_point_t pos;
clutter_event_get_coords (event, &pos.x, &pos.y); clutter_event_get_coords (event, &pos.x, &pos.y);
focus_window = meta_stack_get_default_focus_window_at_point (display->stack, focus_window = meta_stack_get_default_focus_window_at_point (display->stack,
@ -793,7 +793,7 @@ meta_xwayland_dnd_handle_client_message (MetaWaylandCompositor *compositor,
else if (event->message_type == xdnd_atoms[ATOM_DND_POSITION]) else if (event->message_type == xdnd_atoms[ATOM_DND_POSITION])
{ {
ClutterEvent *motion; ClutterEvent *motion;
ClutterPoint pos; graphene_point_t pos;
uint32_t action = 0; uint32_t action = 0;
dnd->client_message_timestamp = event->data.l[3]; dnd->client_message_timestamp = event->data.l[3];