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
{
/* fixed position coordinates */
ClutterPoint fixed_pos;
graphene_point_t fixed_pos;
ClutterMargin margin;
@ -209,7 +209,7 @@ struct _ClutterTransformInfo
gfloat z_position;
/* transformation center */
ClutterPoint pivot;
graphene_point_t pivot;
gfloat pivot_z;
CoglMatrix transform;

View File

@ -1288,7 +1288,7 @@ static gboolean
_clutter_actor_transform_local_box_to_stage (ClutterActor *self,
ClutterStage *stage,
const ClutterActorBox *box,
ClutterPoint vertices[4])
graphene_point_t vertices[4])
{
CoglFramebuffer *fb = cogl_get_draw_framebuffer ();
CoglMatrix stage_transform, inv_stage_transform;
@ -1344,7 +1344,7 @@ clutter_actor_pick_box (ClutterActor *self,
const ClutterActorBox *box)
{
ClutterStage *stage;
ClutterPoint vertices[4];
graphene_point_t vertices[4];
g_return_if_fail (CLUTTER_IS_ACTOR (self));
g_return_if_fail (box != NULL);
@ -1363,7 +1363,7 @@ _clutter_actor_push_pick_clip (ClutterActor *self,
const ClutterActorBox *clip)
{
ClutterStage *stage;
ClutterPoint vertices[4];
graphene_point_t vertices[4];
stage = CLUTTER_STAGE (_clutter_actor_get_stage_internal (self));
@ -4477,7 +4477,7 @@ static const ClutterTransformInfo default_transform_info = {
0.f, /* z-position */
CLUTTER_POINT_INIT_ZERO, /* pivot */
GRAPHENE_POINT_INIT_ZERO, /* pivot */
0.f, /* pivot-z */
CLUTTER_MATRIX_INIT_IDENTITY,
@ -4557,7 +4557,7 @@ _clutter_actor_get_transform_info (ClutterActor *self)
static inline void
clutter_actor_set_pivot_point_internal (ClutterActor *self,
const ClutterPoint *pivot)
const graphene_point_t *pivot)
{
ClutterTransformInfo *info;
@ -5134,7 +5134,7 @@ clutter_actor_set_property (GObject *object,
case PROP_POSITION:
{
const ClutterPoint *pos = g_value_get_boxed (value);
const graphene_point_t *pos = g_value_get_boxed (value);
if (pos != NULL)
clutter_actor_set_position (actor, pos->x, pos->y);
@ -5239,10 +5239,10 @@ clutter_actor_set_property (GObject *object,
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)
pivot = clutter_point_zero ();
pivot = graphene_point_zero ();
clutter_actor_set_pivot_point (actor, pivot->x, pivot->y);
}
@ -5488,9 +5488,9 @@ clutter_actor_get_property (GObject *object,
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_y (actor));
g_value_set_boxed (value, &position);
@ -6500,7 +6500,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
g_param_spec_boxed ("position",
P_("Position"),
P_("The position of the origin of the actor"),
CLUTTER_TYPE_POINT,
GRAPHENE_TYPE_POINT,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS |
CLUTTER_PARAM_ANIMATABLE);
@ -7055,7 +7055,7 @@ clutter_actor_class_init (ClutterActorClass *klass)
g_param_spec_boxed ("pivot-point",
P_("Pivot Point"),
P_("The point around which the scaling and rotation occur"),
CLUTTER_TYPE_POINT,
GRAPHENE_TYPE_POINT,
G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS |
CLUTTER_PARAM_ANIMATABLE);
@ -10399,17 +10399,17 @@ clutter_actor_set_position (ClutterActor *self,
gfloat x,
gfloat y)
{
ClutterPoint new_position;
ClutterPoint cur_position;
graphene_point_t new_position;
graphene_point_t cur_position;
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.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],
&cur_position,
&new_position);
@ -11364,7 +11364,7 @@ clutter_actor_set_y_internal (ClutterActor *self,
static void
clutter_actor_set_position_internal (ClutterActor *self,
const ClutterPoint *position)
const graphene_point_t *position)
{
ClutterActorPrivate *priv = self->priv;
ClutterLayoutInfo *linfo;
@ -11373,7 +11373,7 @@ clutter_actor_set_position_internal (ClutterActor *self,
linfo = _clutter_actor_get_layout_info (self);
if (priv->position_set &&
clutter_point_equals (position, &linfo->fixed_pos))
graphene_point_equal (position, &linfo->fixed_pos))
return;
clutter_actor_store_old_geometry (self, &old);
@ -12192,7 +12192,7 @@ clutter_actor_set_pivot_point (ClutterActor *self,
gfloat pivot_x,
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;
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 = {
CLUTTER_POINT_INIT_ZERO, /* fixed-pos */
GRAPHENE_POINT_INIT_ZERO, /* fixed-pos */
{ 0, 0, 0, 0 }, /* margin */
CLUTTER_ACTOR_ALIGN_FILL, /* x-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 (ClutterPaintVolume, clutter_paint_volume_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)
#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
*/
@ -645,7 +395,7 @@ clutter_rect_equals (ClutterRect *a,
clutter_rect_normalize_internal (a);
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);
}
@ -678,7 +428,7 @@ clutter_rect_normalize (ClutterRect *rect)
/**
* clutter_rect_get_center:
* @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,
* and updates @center with the correct coordinates.
@ -687,7 +437,7 @@ clutter_rect_normalize (ClutterRect *rect)
*/
void
clutter_rect_get_center (ClutterRect *rect,
ClutterPoint *center)
graphene_point_t *center)
{
g_return_if_fail (rect != NULL);
g_return_if_fail (center != NULL);
@ -712,7 +462,7 @@ clutter_rect_get_center (ClutterRect *rect,
*/
gboolean
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 (point != NULL, FALSE);

View File

@ -370,7 +370,7 @@ clutter_event_get_coords (const ClutterEvent *event,
gfloat *x,
gfloat *y)
{
ClutterPoint coords;
graphene_point_t coords;
g_return_if_fail (event != NULL);
@ -386,15 +386,15 @@ clutter_event_get_coords (const ClutterEvent *event,
/**
* clutter_event_get_position:
* @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
*/
void
clutter_event_get_position (const ClutterEvent *event,
ClutterPoint *position)
graphene_point_t *position)
{
g_return_if_fail (event != NULL);
g_return_if_fail (position != NULL);
@ -415,41 +415,41 @@ clutter_event_get_position (const ClutterEvent *event,
case CLUTTER_PAD_BUTTON_RELEASE:
case CLUTTER_PAD_STRIP:
case CLUTTER_PAD_RING:
clutter_point_init (position, 0.f, 0.f);
graphene_point_init (position, 0.f, 0.f);
break;
case CLUTTER_ENTER:
case CLUTTER_LEAVE:
clutter_point_init (position, event->crossing.x, event->crossing.y);
graphene_point_init (position, event->crossing.x, event->crossing.y);
break;
case CLUTTER_BUTTON_PRESS:
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;
case CLUTTER_MOTION:
clutter_point_init (position, event->motion.x, event->motion.y);
graphene_point_init (position, event->motion.x, event->motion.y);
break;
case CLUTTER_TOUCH_BEGIN:
case CLUTTER_TOUCH_UPDATE:
case CLUTTER_TOUCH_END:
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;
case CLUTTER_SCROLL:
clutter_point_init (position, event->scroll.x, event->scroll.y);
graphene_point_init (position, event->scroll.x, event->scroll.y);
break;
case CLUTTER_TOUCHPAD_PINCH:
clutter_point_init (position, event->touchpad_pinch.x,
graphene_point_init (position, event->touchpad_pinch.x,
event->touchpad_pinch.y);
break;
case CLUTTER_TOUCHPAD_SWIPE:
clutter_point_init (position, event->touchpad_swipe.x,
graphene_point_init (position, event->touchpad_swipe.x,
event->touchpad_swipe.y);
break;
}
@ -1796,12 +1796,12 @@ float
clutter_event_get_distance (const ClutterEvent *source,
const ClutterEvent *target)
{
ClutterPoint p0, p1;
graphene_point_t p0, p1;
clutter_event_get_position (source, &p0);
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,
const ClutterEvent *target)
{
ClutterPoint p0, p1;
graphene_point_t p0, p1;
float x_distance, y_distance;
double angle;
clutter_event_get_position (source, &p0);
clutter_event_get_position (target, &p1);
if (clutter_point_equals (&p0, &p1))
if (graphene_point_equal (&p0, &p1))
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);

View File

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

View File

@ -29,6 +29,23 @@
#include "clutter-private.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
graphene_point3d_progress (const GValue *a,
const GValue *b,
@ -66,6 +83,8 @@ graphene_size_progress (const GValue *a,
void
clutter_graphene_init (void)
{
clutter_interval_register_progress_func (GRAPHENE_TYPE_POINT,
graphene_point_progress);
clutter_interval_register_progress_func (GRAPHENE_TYPE_POINT3D,
graphene_point3d_progress);
clutter_interval_register_progress_func (GRAPHENE_TYPE_SIZE,

View File

@ -991,7 +991,7 @@ clutter_input_device_get_enabled (ClutterInputDevice *device)
gboolean
clutter_input_device_get_coords (ClutterInputDevice *device,
ClutterEventSequence *sequence,
ClutterPoint *point)
graphene_point_t *point)
{
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
g_return_val_if_fail (point != NULL, FALSE);
@ -1038,7 +1038,7 @@ _clutter_input_device_update (ClutterInputDevice *device,
ClutterStage *stage;
ClutterActor *new_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;
g_assert (device_type != CLUTTER_KEYBOARD_DEVICE &&

View File

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

View File

@ -493,7 +493,7 @@ _clutter_script_parse_color (ClutterScript *script,
static gboolean
parse_point_from_array (JsonArray *array,
ClutterPoint *point)
graphene_point_t *point)
{
if (json_array_get_length (array) != 2)
return FALSE;
@ -506,7 +506,7 @@ parse_point_from_array (JsonArray *array,
static gboolean
parse_point_from_object (JsonObject *object,
ClutterPoint *point)
graphene_point_t *point)
{
if (json_object_has_member (object, "x"))
point->x = json_object_get_double_member (object, "x");
@ -524,7 +524,7 @@ parse_point_from_object (JsonObject *object,
gboolean
_clutter_script_parse_point (ClutterScript *script,
JsonNode *node,
ClutterPoint *point)
graphene_point_t *point)
{
g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), FALSE);
g_return_val_if_fail (node != NULL, FALSE);
@ -1364,9 +1364,9 @@ _clutter_script_parse_node (ClutterScript *script,
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))
{
@ -1441,9 +1441,9 @@ _clutter_script_parse_node (ClutterScript *script,
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))
{

View File

@ -132,7 +132,7 @@ GObject *_clutter_script_parse_alpha (ClutterScript *script,
JsonNode *node);
gboolean _clutter_script_parse_point (ClutterScript *script,
JsonNode *node,
ClutterPoint *point);
graphene_point_t *point);
gboolean _clutter_script_parse_size (ClutterScript *script,
JsonNode *node,
graphene_size_t *size);

View File

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

View File

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

View File

@ -80,11 +80,11 @@ void _clutter_stage_clear_update_time (ClutterStage *stage);
gboolean _clutter_stage_has_full_redraw_queued (ClutterStage *stage);
void clutter_stage_log_pick (ClutterStage *stage,
const ClutterPoint *vertices,
const graphene_point_t *vertices,
ClutterActor *actor);
void clutter_stage_push_pick_clip (ClutterStage *stage,
const ClutterPoint *vertices);
const graphene_point_t *vertices);
void clutter_stage_pop_pick_clip (ClutterStage *stage);

View File

@ -107,7 +107,7 @@ struct _ClutterStageQueueRedrawEntry
typedef struct _PickRecord
{
ClutterPoint vertex[4];
graphene_point_t vertex[4];
ClutterActor *actor;
int clip_stack_top;
} PickRecord;
@ -115,7 +115,7 @@ typedef struct _PickRecord
typedef struct _PickClipRecord
{
int prev;
ClutterPoint vertex[4];
graphene_point_t vertex[4];
} PickClipRecord;
struct _ClutterStagePrivate
@ -377,7 +377,7 @@ _clutter_stage_clear_pick_stack (ClutterStage *stage)
void
clutter_stage_log_pick (ClutterStage *stage,
const ClutterPoint *vertices,
const graphene_point_t *vertices,
ClutterActor *actor)
{
ClutterStagePrivate *priv;
@ -390,7 +390,7 @@ clutter_stage_log_pick (ClutterStage *stage,
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.clip_stack_top = priv->pick_clip_stack_top;
@ -399,7 +399,7 @@ clutter_stage_log_pick (ClutterStage *stage,
void
clutter_stage_push_pick_clip (ClutterStage *stage,
const ClutterPoint *vertices)
const graphene_point_t *vertices)
{
ClutterStagePrivate *priv;
PickClipRecord clip;
@ -411,7 +411,7 @@ clutter_stage_push_pick_clip (ClutterStage *stage,
g_assert (!priv->pick_stack_frozen);
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);
priv->pick_clip_stack_top = priv->pick_clip_stack->len - 1;
@ -444,7 +444,7 @@ clutter_stage_pop_pick_clip (ClutterStage *stage)
}
static gboolean
is_quadrilateral_axis_aligned_rectangle (const ClutterPoint *vertices)
is_quadrilateral_axis_aligned_rectangle (const graphene_point_t *vertices)
{
int i;
@ -462,8 +462,8 @@ is_quadrilateral_axis_aligned_rectangle (const ClutterPoint *vertices)
}
static gboolean
is_inside_axis_aligned_rectangle (const ClutterPoint *point,
const ClutterPoint *vertices)
is_inside_axis_aligned_rectangle (const graphene_point_t *point,
const graphene_point_t *vertices)
{
float min_x = FLT_MAX;
float max_x = FLT_MIN;
@ -485,15 +485,70 @@ is_inside_axis_aligned_rectangle (const ClutterPoint *point,
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
is_inside_input_region (const ClutterPoint *point,
const ClutterPoint *vertices)
is_inside_unaligned_rectangle (const graphene_point_t *point,
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))
return is_inside_axis_aligned_rectangle (point, vertices);
else
return clutter_point_inside_quadrilateral (point, vertices);
return is_inside_unaligned_rectangle (point, vertices);
}
static gboolean
@ -502,7 +557,7 @@ pick_record_contains_pixel (ClutterStage *stage,
int x,
int y)
{
const ClutterPoint point = CLUTTER_POINT_INIT (x, y);
const graphene_point_t point = GRAPHENE_POINT_INIT (x, y);
ClutterStagePrivate *priv;
int clip_index;
@ -1367,7 +1422,7 @@ _clutter_stage_check_updated_pointers (ClutterStage *stage)
GSList *updating = NULL;
const GSList *devices;
cairo_rectangle_int_t clip;
ClutterPoint point;
graphene_point_t point;
gboolean has_clip;
has_clip = _clutter_stage_window_get_redraw_clip_bounds (priv->impl, &clip);

View File

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

View File

@ -209,12 +209,12 @@ gboolean clutter_timeline_get_step_progress
ClutterStepMode *step_mode);
CLUTTER_EXPORT
void clutter_timeline_set_cubic_bezier_progress (ClutterTimeline *timeline,
const ClutterPoint *c_1,
const ClutterPoint *c_2);
const graphene_point_t *c_1,
const graphene_point_t *c_2);
CLUTTER_EXPORT
gboolean clutter_timeline_get_cubic_bezier_progress (ClutterTimeline *timeline,
ClutterPoint *c_1,
ClutterPoint *c_2);
graphene_point_t *c_1,
graphene_point_t *c_2);
CLUTTER_EXPORT
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_PAINT_VOLUME (clutter_paint_volume_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 ())
typedef struct _ClutterActor ClutterActor;
@ -82,7 +81,6 @@ typedef struct _ClutterGeometry ClutterGeometry; /* XXX:2.0 - re
typedef struct _ClutterKnot ClutterKnot;
typedef struct _ClutterMargin ClutterMargin;
typedef struct _ClutterPerspective ClutterPerspective;
typedef struct _ClutterPoint ClutterPoint;
typedef struct _ClutterRect ClutterRect;
typedef struct _ClutterAlpha ClutterAlpha;
@ -133,73 +131,6 @@ typedef struct _ClutterShader ClutterShader; /* deprecated */
*/
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:
* @origin: the origin of the rectangle
@ -223,7 +154,7 @@ gboolean clutter_point_inside_quadrilateral (const ClutterPoint *point,
*/
struct _ClutterRect
{
ClutterPoint origin;
graphene_point_t origin;
graphene_size_t size;
};
@ -279,10 +210,10 @@ CLUTTER_EXPORT
ClutterRect * clutter_rect_normalize (ClutterRect *rect);
CLUTTER_EXPORT
void clutter_rect_get_center (ClutterRect *rect,
ClutterPoint *center);
graphene_point_t *center);
CLUTTER_EXPORT
gboolean clutter_rect_contains_point (ClutterRect *rect,
ClutterPoint *point);
graphene_point_t *point);
CLUTTER_EXPORT
gboolean clutter_rect_contains_rect (ClutterRect *a,
ClutterRect *b);

View File

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

View File

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

View File

@ -258,7 +258,7 @@ meta_backend_monitors_changed (MetaBackend *backend)
meta_backend_get_monitor_manager (backend);
ClutterDeviceManager *manager = clutter_device_manager_get_default ();
ClutterInputDevice *device = clutter_device_manager_get_core_device (manager, CLUTTER_POINTER_DEVICE);
ClutterPoint point;
graphene_point_t point;
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);
}
ClutterPoint
graphene_point_t
meta_cursor_renderer_get_position (MetaCursorRenderer *renderer)
{
MetaCursorRendererPrivate *priv =
meta_cursor_renderer_get_instance_private (renderer);
return (ClutterPoint) {
return (graphene_point_t) {
.x = priv->current_x,
.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,
float x,
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);
MetaCursorSprite * meta_cursor_renderer_get_cursor (MetaCursorRenderer *renderer);

View File

@ -407,7 +407,7 @@ get_pointer_position_clutter (int *x,
{
ClutterDeviceManager *cmanager;
ClutterInputDevice *cdevice;
ClutterPoint point;
graphene_point_t point;
cmanager = clutter_device_manager_get_default ();
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
{
ClutterPoint cursor_position;
graphene_point_t cursor_position;
cursor_position = meta_cursor_renderer_get_position (cursor_renderer);
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;
MetaRendererView *view;
float view_scale;
ClutterPoint cursor_position;
graphene_point_t cursor_position;
int x, y;
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;
CoglTexture *cursor_texture;
MetaScreenCastWindow *screen_cast_window;
ClutterPoint cursor_position;
ClutterPoint relative_cursor_position;
graphene_point_t cursor_position;
graphene_point_t relative_cursor_position;
cairo_surface_t *cursor_surface;
uint8_t *cursor_surface_data;
GError *error = NULL;
@ -298,7 +298,7 @@ is_cursor_in_stream (MetaScreenCastWindowStreamSrc *window_src)
MetaCursorRenderer *cursor_renderer =
meta_backend_get_cursor_renderer (backend);
MetaCursorSprite *cursor_sprite;
ClutterPoint cursor_position;
graphene_point_t cursor_position;
MetaScreenCastWindow *screen_cast_window;
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);
MetaScreenCastWindow *screen_cast_window = window_src->screen_cast_window;
MetaCursorSprite *cursor_sprite;
ClutterPoint cursor_position;
graphene_point_t cursor_position;
float scale;
ClutterPoint relative_cursor_position;
graphene_point_t relative_cursor_position;
int x, y;
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
meta_screen_cast_window_transform_cursor_position (MetaScreenCastWindow *screen_cast_window,
MetaCursorSprite *cursor_sprite,
ClutterPoint *cursor_position,
graphene_point_t *cursor_position,
float *out_cursor_scale,
ClutterPoint *out_relative_cursor_position)
graphene_point_t *out_relative_cursor_position)
{
MetaScreenCastWindowInterface *iface =
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,
MetaCursorSprite *cursor_sprite,
ClutterPoint *cursor_position,
graphene_point_t *cursor_position,
float *out_cursor_scale,
ClutterPoint *out_relative_cursor_position);
graphene_point_t *out_relative_cursor_position);
void (*capture_into) (MetaScreenCastWindow *screen_cast_window,
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,
MetaCursorSprite *cursor_sprite,
ClutterPoint *cursor_position,
graphene_point_t *cursor_position,
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,
MetaRectangle *bounds,

View File

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

View File

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

View File

@ -380,7 +380,7 @@ notify_pinch_gesture_event (ClutterInputDevice *input_device,
MetaSeatNative *seat;
ClutterStage *stage;
ClutterEvent *event = NULL;
ClutterPoint pos;
graphene_point_t pos;
/* We can drop the event on the floor if no stage has been
* associated with the device yet. */
@ -427,7 +427,7 @@ notify_swipe_gesture_event (ClutterInputDevice *input_device,
MetaSeatNative *seat;
ClutterStage *stage;
ClutterEvent *event = NULL;
ClutterPoint pos;
graphene_point_t pos;
/* We can drop the event on the floor if no stage has been
* 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)
{
ClutterPoint point;
graphene_point_t point;
clutter_input_device_get_coords (input_device, NULL, &point);
event->button.x = point.x;

View File

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

View File

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

View File

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

View File

@ -1174,9 +1174,9 @@ meta_window_actor_transform_relative_position (MetaScreenCastWindow *screen_cast
static gboolean
meta_window_actor_transform_cursor_position (MetaScreenCastWindow *screen_cast_window,
MetaCursorSprite *cursor_sprite,
ClutterPoint *cursor_position,
graphene_point_t *cursor_position,
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);
MetaWindowActorPrivate *priv =

View File

@ -264,7 +264,7 @@ clutter_test_run (void)
typedef struct {
ClutterActor *stage;
ClutterPoint point;
graphene_point_t point;
gpointer result;
@ -340,7 +340,7 @@ on_key_press_event (ClutterActor *stage,
*/
gboolean
clutter_test_check_actor_at_point (ClutterActor *stage,
const ClutterPoint *point,
const graphene_point_t *point,
ClutterActor *actor,
ClutterActor **result)
{
@ -402,7 +402,7 @@ clutter_test_check_actor_at_point (ClutterActor *stage,
*/
gboolean
clutter_test_check_color_at_point (ClutterActor *stage,
const ClutterPoint *point,
const graphene_point_t *point,
const ClutterColor *color,
ClutterColor *result)
{

View File

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

View File

@ -8,7 +8,7 @@ actor_basic_layout (void)
ClutterActor *stage = clutter_test_get_stage ();
ClutterActor *vase;
ClutterActor *flower[3];
ClutterPoint p;
graphene_point_t p;
vase = clutter_actor_new ();
clutter_actor_set_name (vase, "Vase");
@ -33,13 +33,13 @@ actor_basic_layout (void)
clutter_actor_set_name (flower[2], "Green Flower");
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_point_init (&p, 150, 50);
graphene_point_init (&p, 150, 50);
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]);
}
@ -49,7 +49,7 @@ actor_margin_layout (void)
ClutterActor *stage = clutter_test_get_stage ();
ClutterActor *vase;
ClutterActor *flower[3];
ClutterPoint p;
graphene_point_t p;
vase = clutter_actor_new ();
clutter_actor_set_name (vase, "Vase");
@ -78,13 +78,13 @@ actor_margin_layout (void)
clutter_actor_set_margin_bottom (flower[2], 6);
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_point_init (&p, 106, 50);
graphene_point_init (&p, 106, 50);
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]);
}

View File

@ -33,7 +33,6 @@ clutter_conform_tests_general_tests = [
'interval',
'script-parser',
'units',
'point',
]
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 *source_actor = clutter_event_get_source (event);
ClutterPoint position;
graphene_point_t position;
gchar *state;
gchar keybuf[128];
gint device_id;

View File

@ -622,7 +622,7 @@ meta_pointer_confinement_wayland_maybe_warp (MetaPointerConfinementWayland *self
{
MetaWaylandSeat *seat;
MetaWaylandSurface *surface;
ClutterPoint point;
graphene_point_t point;
float sx;
float sy;
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);
MetaWaylandCursorSurfacePrivate *priv =
meta_wayland_cursor_surface_get_instance_private (cursor_surface);
ClutterPoint point;
graphene_point_t point;
ClutterRect logical_monitor_rect;
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);
MetaWaylandDragGrab *drag_grab;
ClutterPoint pos, surface_pos;
graphene_point_t pos, surface_pos;
ClutterModifierType modifiers;
MetaSurfaceActor *surface_actor;

View File

@ -72,7 +72,7 @@ dnd_surface_find_logical_monitor (MetaWaylandActorSurface *actor_surface)
meta_backend_get_cursor_renderer (backend);
MetaMonitorManager *monitor_manager =
meta_backend_get_monitor_manager (backend);
ClutterPoint pointer_pos;
graphene_point_t pointer_pos;
pointer_pos = meta_cursor_renderer_get_position (cursor_renderer);
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)
{
struct wl_client *client = wl_resource_get_client (surface->resource);
ClutterPoint pos;
graphene_point_t pos;
pointer->focus_surface = surface;
@ -1039,7 +1039,7 @@ meta_wayland_pointer_get_relative_coordinates (MetaWaylandPointer *pointer,
wl_fixed_t *sy)
{
float xf = 0.0f, yf = 0.0f;
ClutterPoint pos;
graphene_point_t pos;
clutter_input_device_get_coords (pointer->device, NULL, &pos);
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 ();
MetaXWaylandDnd *dnd = compositor->xwayland_manager.dnd;
MetaWaylandSeat *seat = compositor->seat;
ClutterPoint pos;
graphene_point_t pos;
clutter_input_device_get_coords (seat->pointer->device, NULL, &pos);
xdnd_send_position (dnd, dnd->dnd_dest,
@ -602,7 +602,7 @@ pick_drop_surface (MetaWaylandCompositor *compositor,
{
MetaDisplay *display = meta_get_display ();
MetaWindow *focus_window = NULL;
ClutterPoint pos;
graphene_point_t pos;
clutter_event_get_coords (event, &pos.x, &pos.y);
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])
{
ClutterEvent *motion;
ClutterPoint pos;
graphene_point_t pos;
uint32_t action = 0;
dnd->client_message_timestamp = event->data.l[3];