Remove Units from the public API

With the recent change to internal floating point values, ClutterUnit
has become a redundant type, defined to be a float. All integer entry
points are being internally converted to floating point values to be
passed to the GL pipeline with the least amount of conversion.

ClutterUnit is thus exposed as just a "pixel with fractionary bits",
and not -- as users might think -- as generic, resolution and device
independent units. not that it was the case, but a definitive amount
of people was convinced it did provide this "feature", and was flummoxed
about the mere existence of this type.

So, having ClutterUnit exposed in the public API doubles the entry
points and has the following disadvantages:

  - we have to maintain twice the amount of entry points in ClutterActor
  - we still do an integer-to-float implicit conversion
  - we introduce a weird impedance between pixels and "pixels with
    fractionary bits"
  - language bindings will have to choose what to bind, and resort
    to manually overriding the API
    + *except* for language bindings based on GObject-Introspection, as
      they cannot do manual overrides, thus will replicate the entire
      set of entry points

For these reason, we should coalesces every Actor entry point for
pixels and for ClutterUnit into a single entry point taking a float,
like:

  void clutter_actor_set_x (ClutterActor *self,
                            gfloat        x);
  void clutter_actor_get_size (ClutterActor *self,
                               gfloat       *width,
                               gfloat       *height);
  gfloat clutter_actor_get_height (ClutterActor *self);

etc.

The issues I have identified are:

  - we'll have a two cases of compiler warnings:
    - printf() format of the return values from %d to %f
    - clutter_actor_get_size() taking floats instead of unsigned ints
  - we'll have a problem with varargs when passing an integer instead
    of a floating point value, except on 64bit platforms where the
    size of a float is the same as the size of an int

To be clear: the *intent* of the API should not change -- we still use
pixels everywhere -- but:

  - we remove ambiguity in the API with regard to pixels and units
  - we remove entry points we get to maintain for the whole 1.0
    version of the API
  - we make things simpler to bind for both manual language bindings
    and automatic (gobject-introspection based) ones
  - we have the simplest API possible while still exposing the
    capabilities of the underlying GL implementation
This commit is contained in:
Emmanuele Bassi 2009-05-06 16:44:47 +01:00
parent c2abdd5e82
commit d6d208da7d
40 changed files with 1346 additions and 2065 deletions

File diff suppressed because it is too large Load Diff

View File

@ -129,15 +129,15 @@ typedef enum
* *
* Bounding box of an actor. The coordinates of the top left and right bottom * Bounding box of an actor. The coordinates of the top left and right bottom
* corners of an actor. The coordinates of the two points are expressed in * corners of an actor. The coordinates of the two points are expressed in
* #ClutterUnit<!-- -->s, that is are device-independent. If you want to obtain * pixels with sub-pixel precision
* the box dimensions in pixels, use clutter_actor_get_geometry().
*/ */
struct _ClutterActorBox struct _ClutterActorBox
{ {
ClutterUnit x1; gfloat x1;
ClutterUnit y1; gfloat y1;
ClutterUnit x2;
ClutterUnit y2; gfloat x2;
gfloat y2;
}; };
GType clutter_actor_box_get_type (void) G_GNUC_CONST; GType clutter_actor_box_get_type (void) G_GNUC_CONST;
@ -238,13 +238,13 @@ struct _ClutterActorClass
/* size negotiation */ /* size negotiation */
void (* get_preferred_width) (ClutterActor *actor, void (* get_preferred_width) (ClutterActor *actor,
ClutterUnit for_height, gfloat for_height,
ClutterUnit *min_width_p, gfloat *min_width_p,
ClutterUnit *natural_width_p); gfloat *natural_width_p);
void (* get_preferred_height) (ClutterActor *actor, void (* get_preferred_height) (ClutterActor *actor,
ClutterUnit for_width, gfloat for_width,
ClutterUnit *min_height_p, gfloat *min_height_p,
ClutterUnit *natural_height_p); gfloat *natural_height_p);
void (* allocate) (ClutterActor *actor, void (* allocate) (ClutterActor *actor,
const ClutterActorBox *box, const ClutterActorBox *box,
gboolean absolute_origin_changed); gboolean absolute_origin_changed);
@ -302,18 +302,18 @@ void clutter_actor_destroy (ClutterActor
/* size negotiation */ /* size negotiation */
void clutter_actor_get_preferred_width (ClutterActor *self, void clutter_actor_get_preferred_width (ClutterActor *self,
ClutterUnit for_height, gfloat for_height,
ClutterUnit *min_width_p, gfloat *min_width_p,
ClutterUnit *natural_width_p); gfloat *natural_width_p);
void clutter_actor_get_preferred_height (ClutterActor *self, void clutter_actor_get_preferred_height (ClutterActor *self,
ClutterUnit for_width, gfloat for_width,
ClutterUnit *min_height_p, gfloat *min_height_p,
ClutterUnit *natural_height_p); gfloat *natural_height_p);
void clutter_actor_get_preferred_size (ClutterActor *self, void clutter_actor_get_preferred_size (ClutterActor *self,
ClutterUnit *min_width_p, gfloat *min_width_p,
ClutterUnit *min_height_p, gfloat *min_height_p,
ClutterUnit *natural_width_p, gfloat *natural_width_p,
ClutterUnit *natural_height_p); gfloat *natural_height_p);
void clutter_actor_allocate (ClutterActor *self, void clutter_actor_allocate (ClutterActor *self,
const ClutterActorBox *box, const ClutterActorBox *box,
gboolean absolute_origin_changed); gboolean absolute_origin_changed);
@ -337,100 +337,60 @@ void clutter_actor_set_geometry (ClutterActor
void clutter_actor_get_geometry (ClutterActor *self, void clutter_actor_get_geometry (ClutterActor *self,
ClutterGeometry *geometry); ClutterGeometry *geometry);
void clutter_actor_set_size (ClutterActor *self, void clutter_actor_set_size (ClutterActor *self,
gint width, gfloat width,
gint height); gfloat height);
void clutter_actor_set_sizeu (ClutterActor *self,
ClutterUnit width,
ClutterUnit height);
void clutter_actor_get_size (ClutterActor *self, void clutter_actor_get_size (ClutterActor *self,
guint *width, gfloat *width,
guint *height); gfloat *height);
void clutter_actor_get_sizeu (ClutterActor *self,
ClutterUnit *width,
ClutterUnit *height);
void clutter_actor_get_transformed_size (ClutterActor *self, void clutter_actor_get_transformed_size (ClutterActor *self,
guint *width, gfloat *width,
guint *height); gfloat *height);
void clutter_actor_get_transformed_sizeu (ClutterActor *self,
ClutterUnit *width,
ClutterUnit *height);
void clutter_actor_set_position (ClutterActor *self, void clutter_actor_set_position (ClutterActor *self,
gint x, gfloat x,
gint y); gfloat y);
void clutter_actor_set_positionu (ClutterActor *self,
ClutterUnit x,
ClutterUnit y);
void clutter_actor_get_position (ClutterActor *self, void clutter_actor_get_position (ClutterActor *self,
gint *x, gfloat *x,
gint *y); gfloat *y);
void clutter_actor_get_positionu (ClutterActor *self,
ClutterUnit *x,
ClutterUnit *y);
void clutter_actor_get_transformed_position (ClutterActor *self, void clutter_actor_get_transformed_position (ClutterActor *self,
gint *x, gfloat *x,
gint *y); gfloat *y);
void clutter_actor_get_transformed_positionu (ClutterActor *self,
ClutterUnit *x,
ClutterUnit *y);
gboolean clutter_actor_get_fixed_position_set (ClutterActor *self); gboolean clutter_actor_get_fixed_position_set (ClutterActor *self);
void clutter_actor_set_fixed_position_set (ClutterActor *self, void clutter_actor_set_fixed_position_set (ClutterActor *self,
gboolean is_set); gboolean is_set);
guint clutter_actor_get_width (ClutterActor *self); gfloat clutter_actor_get_width (ClutterActor *self);
ClutterUnit clutter_actor_get_widthu (ClutterActor *self); gfloat clutter_actor_get_height (ClutterActor *self);
guint clutter_actor_get_height (ClutterActor *self);
ClutterUnit clutter_actor_get_heightu (ClutterActor *self);
void clutter_actor_set_width (ClutterActor *self, void clutter_actor_set_width (ClutterActor *self,
guint width); gfloat width);
void clutter_actor_set_widthu (ClutterActor *self,
ClutterUnit width);
void clutter_actor_set_height (ClutterActor *self, void clutter_actor_set_height (ClutterActor *self,
guint height); gfloat height);
void clutter_actor_set_heightu (ClutterActor *self, gfloat clutter_actor_get_x (ClutterActor *self);
ClutterUnit height); gfloat clutter_actor_get_y (ClutterActor *self);
gint clutter_actor_get_x (ClutterActor *self);
ClutterUnit clutter_actor_get_xu (ClutterActor *self);
gint clutter_actor_get_y (ClutterActor *self);
ClutterUnit clutter_actor_get_yu (ClutterActor *self);
void clutter_actor_set_x (ClutterActor *self, void clutter_actor_set_x (ClutterActor *self,
gint x); gfloat x);
void clutter_actor_set_xu (ClutterActor *self,
ClutterUnit x);
void clutter_actor_set_y (ClutterActor *self, void clutter_actor_set_y (ClutterActor *self,
gint y); gfloat y);
void clutter_actor_set_yu (ClutterActor *self,
ClutterUnit y);
void clutter_actor_set_rotation (ClutterActor *self, void clutter_actor_set_rotation (ClutterActor *self,
ClutterRotateAxis axis, ClutterRotateAxis axis,
gdouble angle, gdouble angle,
gint x, gfloat x,
gint y, gfloat y,
gint z); gfloat z);
void clutter_actor_set_rotationu (ClutterActor *self,
ClutterRotateAxis axis,
gdouble angle,
ClutterUnit x,
ClutterUnit y,
ClutterUnit z);
void clutter_actor_set_z_rotation_from_gravity (ClutterActor *self, void clutter_actor_set_z_rotation_from_gravity (ClutterActor *self,
gdouble angle, gdouble angle,
ClutterGravity gravity); ClutterGravity gravity);
gdouble clutter_actor_get_rotation (ClutterActor *self, gdouble clutter_actor_get_rotation (ClutterActor *self,
ClutterRotateAxis axis, ClutterRotateAxis axis,
gint *x, gfloat *x,
gint *y, gfloat *y,
gint *z); gfloat *z);
gdouble clutter_actor_get_rotationu (ClutterActor *self,
ClutterRotateAxis axis,
ClutterUnit *x,
ClutterUnit *y,
ClutterUnit *z);
ClutterGravity clutter_actor_get_z_rotation_gravity (ClutterActor *self); ClutterGravity clutter_actor_get_z_rotation_gravity (ClutterActor *self);
void clutter_actor_set_opacity (ClutterActor *self, void clutter_actor_set_opacity (ClutterActor *self,
guint8 opacity); guint8 opacity);
guint8 clutter_actor_get_opacity (ClutterActor *self); guint8 clutter_actor_get_opacity (ClutterActor *self);
guint8 clutter_actor_get_paint_opacity (ClutterActor *self); guint8 clutter_actor_get_paint_opacity (ClutterActor *self);
gboolean clutter_actor_get_paint_visibility (ClutterActor *self); gboolean clutter_actor_get_paint_visibility (ClutterActor *self);
@ -441,27 +401,17 @@ G_CONST_RETURN gchar *clutter_actor_get_name (ClutterActor
guint32 clutter_actor_get_gid (ClutterActor *self); guint32 clutter_actor_get_gid (ClutterActor *self);
void clutter_actor_set_clip (ClutterActor *self, void clutter_actor_set_clip (ClutterActor *self,
gint xoff, gfloat xoff,
gint yoff, gfloat yoff,
gint width, gfloat width,
gint height); gfloat height);
void clutter_actor_set_clipu (ClutterActor *self,
ClutterUnit xoff,
ClutterUnit yoff,
ClutterUnit width,
ClutterUnit height);
void clutter_actor_remove_clip (ClutterActor *self); void clutter_actor_remove_clip (ClutterActor *self);
gboolean clutter_actor_has_clip (ClutterActor *self); gboolean clutter_actor_has_clip (ClutterActor *self);
void clutter_actor_get_clip (ClutterActor *self, void clutter_actor_get_clip (ClutterActor *self,
gint *xoff, gfloat *xoff,
gint *yoff, gfloat *yoff,
gint *width, gfloat *width,
gint *height); gfloat *height);
void clutter_actor_get_clipu (ClutterActor *self,
ClutterUnit *xoff,
ClutterUnit *yoff,
ClutterUnit *width,
ClutterUnit *height);
void clutter_actor_set_parent (ClutterActor *self, void clutter_actor_set_parent (ClutterActor *self,
ClutterActor *parent); ClutterActor *parent);
@ -478,11 +428,8 @@ void clutter_actor_lower (ClutterActor
void clutter_actor_raise_top (ClutterActor *self); void clutter_actor_raise_top (ClutterActor *self);
void clutter_actor_lower_bottom (ClutterActor *self); void clutter_actor_lower_bottom (ClutterActor *self);
void clutter_actor_set_depth (ClutterActor *self, void clutter_actor_set_depth (ClutterActor *self,
gint depth); gfloat depth);
gint clutter_actor_get_depth (ClutterActor *self); gfloat clutter_actor_get_depth (ClutterActor *self);
void clutter_actor_set_depthu (ClutterActor *self,
ClutterUnit depth);
ClutterUnit clutter_actor_get_depthu (ClutterActor *self);
void clutter_actor_set_scale (ClutterActor *self, void clutter_actor_set_scale (ClutterActor *self,
gdouble scale_x, gdouble scale_x,
@ -490,13 +437,8 @@ void clutter_actor_set_scale (ClutterActor
void clutter_actor_set_scale_full (ClutterActor *self, void clutter_actor_set_scale_full (ClutterActor *self,
gdouble scale_x, gdouble scale_x,
gdouble scale_y, gdouble scale_y,
int center_x, gfloat center_x,
int center_y); gfloat center_y);
void clutter_actor_set_scale_fullu (ClutterActor *self,
gdouble scale_x,
gdouble scale_y,
ClutterUnit center_x,
ClutterUnit center_y);
void clutter_actor_set_scale_with_gravity (ClutterActor *self, void clutter_actor_set_scale_with_gravity (ClutterActor *self,
gdouble scale_x, gdouble scale_x,
gdouble scale_y, gdouble scale_y,
@ -505,19 +447,13 @@ void clutter_actor_get_scale (ClutterActor
gdouble *scale_x, gdouble *scale_x,
gdouble *scale_y); gdouble *scale_y);
void clutter_actor_get_scale_center (ClutterActor *self, void clutter_actor_get_scale_center (ClutterActor *self,
gint *center_x, gfloat *center_x,
gint *center_y); gfloat *center_y);
void clutter_actor_get_scale_centeru (ClutterActor *self,
ClutterUnit *center_x,
ClutterUnit *center_y);
ClutterGravity clutter_actor_get_scale_gravity (ClutterActor *self); ClutterGravity clutter_actor_get_scale_gravity (ClutterActor *self);
void clutter_actor_move_by (ClutterActor *self, void clutter_actor_move_by (ClutterActor *self,
gint dx, gfloat dx,
gint dy); gfloat dy);
void clutter_actor_move_byu (ClutterActor *self,
ClutterUnit dx,
ClutterUnit dy);
void clutter_actor_set_reactive (ClutterActor *actor, void clutter_actor_set_reactive (ClutterActor *actor,
gboolean reactive); gboolean reactive);
@ -543,34 +479,25 @@ void clutter_actor_set_shader_param_float (ClutterActor
gfloat value); gfloat value);
void clutter_actor_set_anchor_point (ClutterActor *self, void clutter_actor_set_anchor_point (ClutterActor *self,
gint anchor_x, gfloat anchor_x,
gint anchor_y); gfloat anchor_y);
void clutter_actor_move_anchor_point (ClutterActor *self, void clutter_actor_move_anchor_point (ClutterActor *self,
gint anchor_x, gfloat anchor_x,
gint anchor_y); gfloat anchor_y);
void clutter_actor_get_anchor_point (ClutterActor *self, void clutter_actor_get_anchor_point (ClutterActor *self,
gint *anchor_x, gfloat *anchor_x,
gint *anchor_y); gfloat *anchor_y);
ClutterGravity clutter_actor_get_anchor_point_gravity (ClutterActor *self); ClutterGravity clutter_actor_get_anchor_point_gravity (ClutterActor *self);
void clutter_actor_set_anchor_pointu (ClutterActor *self,
ClutterUnit anchor_x,
ClutterUnit anchor_y);
void clutter_actor_move_anchor_pointu (ClutterActor *self,
ClutterUnit anchor_x,
ClutterUnit anchor_y);
void clutter_actor_get_anchor_pointu (ClutterActor *self,
ClutterUnit *anchor_x,
ClutterUnit *anchor_y);
void clutter_actor_set_anchor_point_from_gravity (ClutterActor *self, void clutter_actor_set_anchor_point_from_gravity (ClutterActor *self,
ClutterGravity gravity); ClutterGravity gravity);
void clutter_actor_move_anchor_point_from_gravity (ClutterActor *self, void clutter_actor_move_anchor_point_from_gravity (ClutterActor *self,
ClutterGravity gravity); ClutterGravity gravity);
gboolean clutter_actor_transform_stage_point (ClutterActor *self, gboolean clutter_actor_transform_stage_point (ClutterActor *self,
ClutterUnit x, gfloat x,
ClutterUnit y, gfloat y,
ClutterUnit *x_out, gfloat *x_out,
ClutterUnit *y_out); gfloat *y_out);
gboolean clutter_actor_is_rotated (ClutterActor *self); gboolean clutter_actor_is_rotated (ClutterActor *self);
gboolean clutter_actor_is_scaled (ClutterActor *self); gboolean clutter_actor_is_scaled (ClutterActor *self);
gboolean clutter_actor_should_pick_paint (ClutterActor *self); gboolean clutter_actor_should_pick_paint (ClutterActor *self);

View File

@ -1196,6 +1196,9 @@ clutter_animation_get_timeline (ClutterAnimation *animation)
* the current values of the #ClutterAnimation:mode and * the current values of the #ClutterAnimation:mode and
* #ClutterAnimation:timeline properties. * #ClutterAnimation:timeline properties.
* *
* If @alpha is not %NULL, the #ClutterAnimation will take ownership
* of the #ClutterAlpha instance.
*
* Since: 1.0 * Since: 1.0
*/ */
void void

View File

@ -61,7 +61,8 @@ struct _ClutterBackendPrivate
guint double_click_distance; guint double_click_distance;
gdouble resolution; gdouble resolution;
gdouble units_per_em;
gfloat units_per_em;
cairo_font_options_t *font_options; cairo_font_options_t *font_options;
@ -133,12 +134,12 @@ update_units_per_em (ClutterBackend *backend)
} }
/* 10 points at 96 DPI is 12 pixels */ /* 10 points at 96 DPI is 12 pixels */
priv->units_per_em = 1.2 * font_size priv->units_per_em = 1.2f * font_size
* dpi * dpi
/ 96.0; / 96.0f;
} }
else else
priv->units_per_em = -1.0; priv->units_per_em = -1.0f;
} }
static void static void
@ -359,7 +360,7 @@ _clutter_backend_init_events (ClutterBackend *backend)
klass->init_events (backend); klass->init_events (backend);
} }
ClutterUnit gfloat
_clutter_backend_get_units_per_em (ClutterBackend *backend) _clutter_backend_get_units_per_em (ClutterBackend *backend)
{ {
ClutterBackendPrivate *priv; ClutterBackendPrivate *priv;

View File

@ -559,6 +559,9 @@ notify_cb (GObject *object,
* the #ClutterBehaviour to update one or more properties of the * the #ClutterBehaviour to update one or more properties of the
* actors to which the behaviour applies. * actors to which the behaviour applies.
* *
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
* of the #ClutterAlpha instance.
*
* Since: 0.2 * Since: 0.2
*/ */
void void

View File

@ -319,9 +319,9 @@ clutter_cairo_texture_notify (GObject *object,
static void static void
clutter_cairo_texture_get_preferred_width (ClutterActor *actor, clutter_cairo_texture_get_preferred_width (ClutterActor *actor,
ClutterUnit for_height, gfloat for_height,
ClutterUnit *min_width, gfloat *min_width,
ClutterUnit *natural_width) gfloat *natural_width)
{ {
ClutterCairoTexturePrivate *priv = CLUTTER_CAIRO_TEXTURE (actor)->priv; ClutterCairoTexturePrivate *priv = CLUTTER_CAIRO_TEXTURE (actor)->priv;
@ -329,14 +329,14 @@ clutter_cairo_texture_get_preferred_width (ClutterActor *actor,
*min_width = 0; *min_width = 0;
if (natural_width) if (natural_width)
*natural_width = CLUTTER_UNITS_FROM_DEVICE (priv->width); *natural_width = (gfloat) priv->width;
} }
static void static void
clutter_cairo_texture_get_preferred_height (ClutterActor *actor, clutter_cairo_texture_get_preferred_height (ClutterActor *actor,
ClutterUnit for_width, gfloat for_width,
ClutterUnit *min_height, gfloat *min_height,
ClutterUnit *natural_height) gfloat *natural_height)
{ {
ClutterCairoTexturePrivate *priv = CLUTTER_CAIRO_TEXTURE (actor)->priv; ClutterCairoTexturePrivate *priv = CLUTTER_CAIRO_TEXTURE (actor)->priv;
@ -344,7 +344,7 @@ clutter_cairo_texture_get_preferred_height (ClutterActor *actor,
*min_height = 0; *min_height = 0;
if (natural_height) if (natural_height)
*natural_height = CLUTTER_UNITS_FROM_DEVICE (priv->height); *natural_height = (gfloat) priv->height;
} }
static void static void

View File

@ -69,14 +69,14 @@ static void clutter_clone_set_source_internal (ClutterClone *clone,
ClutterActor *source); ClutterActor *source);
static void static void
clutter_clone_get_preferred_width (ClutterActor *self, clutter_clone_get_preferred_width (ClutterActor *self,
ClutterUnit for_height, gfloat for_height,
ClutterUnit *min_width_p, gfloat *min_width_p,
ClutterUnit *natural_width_p) gfloat *natural_width_p)
{ {
ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv; ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
ClutterActor *clone_source = priv->clone_source; ClutterActor *clone_source = priv->clone_source;
if (G_UNLIKELY (clone_source == NULL)) if (clone_source == NULL)
{ {
if (min_width_p) if (min_width_p)
*min_width_p = 0; *min_width_p = 0;
@ -93,14 +93,14 @@ clutter_clone_get_preferred_width (ClutterActor *self,
static void static void
clutter_clone_get_preferred_height (ClutterActor *self, clutter_clone_get_preferred_height (ClutterActor *self,
ClutterUnit for_width, gfloat for_width,
ClutterUnit *min_height_p, gfloat *min_height_p,
ClutterUnit *natural_height_p) gfloat *natural_height_p)
{ {
ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv; ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
ClutterActor *clone_source = priv->clone_source; ClutterActor *clone_source = priv->clone_source;
if (G_UNLIKELY (clone_source == NULL)) if (clone_source == NULL)
{ {
if (min_height_p) if (min_height_p)
*min_height_p = 0; *min_height_p = 0;

View File

@ -148,4 +148,24 @@
#define clutter_shader_set_uniform_1f clutter_shader_set_uniform_1f_REPLACED_BY_clutter_shader_set_uniform #define clutter_shader_set_uniform_1f clutter_shader_set_uniform_1f_REPLACED_BY_clutter_shader_set_uniform
#define clutter_actor_set_xu clutter_actor_set_xu_DEPRECATED_BY_clutter_actor_set_x
#define clutter_actor_set_yu clutter_actor_set_yu_DEPRECATED_BY_clutter_actor_set_y
#define clutter_actor_set_widthu clutter_actor_set_widthu_DEPRECATED_BY_clutter_actor_set_width
#define clutter_actor_set_heightu clutter_actor_set_heightu_DEPRECATED_BY_clutter_actor_set_height
#define clutter_actor_set_depthu clutter_actor_set_depthu_DEPRECATED_BY_clutter_actor_set_depth
#define clutter_actor_set_positionu clutter_actor_set_positionu_DEPRECATED_BY_clutter_actor_set_position
#define clutter_actor_set_sizeu clutter_actor_set_sizeu_DEPRECATED_BY_clutter_actor_set_size
#define clutter_actor_set_anchor_pointu clutter_actor_set_anchor_pointu_DEPRECATED_BY_clutter_actor_set_anchor_point
#define clutter_actor_get_anchor_pointu clutter_actor_get_anchor_pointu_DEPRECATED_BY_clutter_actor_get_anchor_point
#define clutter_actor_move_byu clutter_actor_move_byu_DEPRECATED_BY_clutter_actor_move_by
#define clutter_actor_get_xu clutter_actor_get_xu_DEPRECATED_BY_clutter_actor_get_x
#define clutter_actor_get_yu clutter_actor_get_yu_DEPRECATED_BY_clutter_actor_get_y
#define clutter_actor_get_widthu clutter_actor_get_widthu_DEPRECATED_BY_clutter_actor_get_width
#define clutter_actor_get_heightu clutter_actor_get_heightu_DEPRECATED_BY_clutter_actor_get_height
#define clutter_actor_get_depthu clutter_actor_get_depthu_DEPRECATED_BY_clutter_actor_get_depth
#define clutter_actor_get_positionu clutter_actor_get_positionu_DEPRECATED_BY_clutter_actor_get_position
#define clutter_actor_get_sizeu clutter_actor_get_sizeu_DEPRECATED_BY_clutter_actor_get_size
#endif /* CLUTTER_DEPRECATED_H */ #endif /* CLUTTER_DEPRECATED_H */

View File

@ -119,10 +119,10 @@ clutter_event_get_state (ClutterEvent *event)
*/ */
void void
clutter_event_get_coords (ClutterEvent *event, clutter_event_get_coords (ClutterEvent *event,
gint *x, gfloat *x,
gint *y) gfloat *y)
{ {
gint event_x, event_y; gfloat event_x, event_y;
g_return_if_fail (event != NULL); g_return_if_fail (event != NULL);
@ -140,15 +140,18 @@ clutter_event_get_coords (ClutterEvent *event,
case CLUTTER_ENTER: case CLUTTER_ENTER:
case CLUTTER_LEAVE: case CLUTTER_LEAVE:
break; break;
case CLUTTER_BUTTON_PRESS: case CLUTTER_BUTTON_PRESS:
case CLUTTER_BUTTON_RELEASE: case CLUTTER_BUTTON_RELEASE:
event_x = event->button.x; event_x = event->button.x;
event_y = event->button.y; event_y = event->button.y;
break; break;
case CLUTTER_MOTION: case CLUTTER_MOTION:
event_x = event->motion.x; event_x = event->motion.x;
event_y = event->motion.y; event_y = event->motion.y;
break; break;
case CLUTTER_SCROLL: case CLUTTER_SCROLL:
event_x = event->scroll.x; event_x = event->scroll.x;
event_y = event->scroll.y; event_y = event->scroll.y;

View File

@ -290,8 +290,8 @@ struct _ClutterButtonEvent
ClutterEventFlags flags; ClutterEventFlags flags;
ClutterStage *stage; ClutterStage *stage;
ClutterActor *source; ClutterActor *source;
gint x; gfloat x;
gint y; gfloat y;
ClutterModifierType modifier_state; ClutterModifierType modifier_state;
guint32 button; guint32 button;
guint click_count; guint click_count;
@ -322,8 +322,8 @@ struct _ClutterCrossingEvent
ClutterEventFlags flags; ClutterEventFlags flags;
ClutterStage *stage; ClutterStage *stage;
ClutterActor *source; ClutterActor *source;
gint x; gfloat x;
gint y; gfloat y;
ClutterInputDevice *device; /* future use */ ClutterInputDevice *device; /* future use */
ClutterActor *related; ClutterActor *related;
}; };
@ -352,8 +352,8 @@ struct _ClutterMotionEvent
ClutterEventFlags flags; ClutterEventFlags flags;
ClutterStage *stage; ClutterStage *stage;
ClutterActor *source; ClutterActor *source;
gint x; gfloat x;
gint y; gfloat y;
ClutterModifierType modifier_state; ClutterModifierType modifier_state;
gdouble *axes; /* Future use */ gdouble *axes; /* Future use */
ClutterInputDevice *device; /* Future use */ ClutterInputDevice *device; /* Future use */
@ -384,8 +384,8 @@ struct _ClutterScrollEvent
ClutterEventFlags flags; ClutterEventFlags flags;
ClutterStage *stage; ClutterStage *stage;
ClutterActor *source; ClutterActor *source;
gint x; gfloat x;
gint y; gfloat y;
ClutterScrollDirection direction; ClutterScrollDirection direction;
ClutterModifierType modifier_state; ClutterModifierType modifier_state;
gdouble *axes; /* future use */ gdouble *axes; /* future use */
@ -451,8 +451,8 @@ ClutterEventType clutter_event_type (ClutterEvent *event);
guint32 clutter_event_get_time (ClutterEvent *event); guint32 clutter_event_get_time (ClutterEvent *event);
ClutterModifierType clutter_event_get_state (ClutterEvent *event); ClutterModifierType clutter_event_get_state (ClutterEvent *event);
void clutter_event_get_coords (ClutterEvent *event, void clutter_event_get_coords (ClutterEvent *event,
gint *x, gfloat *x,
gint *y); gfloat *y);
gint clutter_event_get_device_id (ClutterEvent *event); gint clutter_event_get_device_id (ClutterEvent *event);
ClutterActor* clutter_event_get_source (ClutterEvent *event); ClutterActor* clutter_event_get_source (ClutterEvent *event);

View File

@ -121,12 +121,12 @@ clutter_group_pick (ClutterActor *actor,
static void static void
clutter_fixed_layout_get_preferred_width (GList *children, clutter_fixed_layout_get_preferred_width (GList *children,
ClutterUnit *min_width_p, gfloat *min_width_p,
ClutterUnit *natural_width_p) gfloat *natural_width_p)
{ {
GList *l; GList *l;
ClutterUnit min_left, min_right; gfloat min_left, min_right;
ClutterUnit natural_left, natural_right; gfloat natural_left, natural_right;
min_left = 0; min_left = 0;
min_right = 0; min_right = 0;
@ -136,9 +136,9 @@ clutter_fixed_layout_get_preferred_width (GList *children,
for (l = children; l != NULL; l = l->next) for (l = children; l != NULL; l = l->next)
{ {
ClutterActor *child = l->data; ClutterActor *child = l->data;
ClutterUnit child_x, child_min, child_natural; gfloat child_x, child_min, child_natural;
child_x = clutter_actor_get_xu (child); child_x = clutter_actor_get_x (child);
clutter_actor_get_preferred_size (child, clutter_actor_get_preferred_size (child,
&child_min, NULL, &child_min, NULL,
@ -197,12 +197,12 @@ clutter_fixed_layout_get_preferred_width (GList *children,
static void static void
clutter_fixed_layout_get_preferred_height (GList *children, clutter_fixed_layout_get_preferred_height (GList *children,
ClutterUnit *min_height_p, gfloat *min_height_p,
ClutterUnit *natural_height_p) gfloat *natural_height_p)
{ {
GList *l; GList *l;
ClutterUnit min_top, min_bottom; gfloat min_top, min_bottom;
ClutterUnit natural_top, natural_bottom; gfloat natural_top, natural_bottom;
min_top = 0; min_top = 0;
min_bottom = 0; min_bottom = 0;
@ -212,9 +212,9 @@ clutter_fixed_layout_get_preferred_height (GList *children,
for (l = children; l != NULL; l = l->next) for (l = children; l != NULL; l = l->next)
{ {
ClutterActor *child = l->data; ClutterActor *child = l->data;
ClutterUnit child_y, child_min, child_natural; gfloat child_y, child_min, child_natural;
child_y = clutter_actor_get_yu (child); child_y = clutter_actor_get_y (child);
clutter_actor_get_preferred_size (child, clutter_actor_get_preferred_size (child,
NULL, &child_min, NULL, &child_min,
@ -286,9 +286,9 @@ clutter_fixed_layout_allocate (GList *children,
static void static void
clutter_group_get_preferred_width (ClutterActor *self, clutter_group_get_preferred_width (ClutterActor *self,
ClutterUnit for_height, gfloat for_height,
ClutterUnit *min_width_p, gfloat *min_width_p,
ClutterUnit *natural_width_p) gfloat *natural_width_p)
{ {
ClutterGroupPrivate *priv = CLUTTER_GROUP (self)->priv; ClutterGroupPrivate *priv = CLUTTER_GROUP (self)->priv;
@ -300,9 +300,9 @@ clutter_group_get_preferred_width (ClutterActor *self,
static void static void
clutter_group_get_preferred_height (ClutterActor *self, clutter_group_get_preferred_height (ClutterActor *self,
ClutterUnit for_width, gfloat for_width,
ClutterUnit *min_height_p, gfloat *min_height_p,
ClutterUnit *natural_height_p) gfloat *natural_height_p)
{ {
ClutterGroupPrivate *priv = CLUTTER_GROUP (self)->priv; ClutterGroupPrivate *priv = CLUTTER_GROUP (self)->priv;

View File

@ -119,7 +119,7 @@ clutter_get_show_fps (void)
void void
_clutter_stage_maybe_relayout (ClutterActor *stage) _clutter_stage_maybe_relayout (ClutterActor *stage)
{ {
ClutterUnit natural_width, natural_height; gfloat natural_width, natural_height;
ClutterActorBox box = { 0, }; ClutterActorBox box = { 0, };
/* avoid reentrancy */ /* avoid reentrancy */
@ -140,8 +140,8 @@ _clutter_stage_maybe_relayout (ClutterActor *stage)
box.y2 = natural_height; box.y2 = natural_height;
CLUTTER_NOTE (ACTOR, "Allocating (0, 0 - %d, %d) for the stage", CLUTTER_NOTE (ACTOR, "Allocating (0, 0 - %d, %d) for the stage",
CLUTTER_UNITS_TO_DEVICE (natural_width), (int) natural_width,
CLUTTER_UNITS_TO_DEVICE (natural_height)); (int) natural_height);
clutter_actor_allocate (stage, &box, FALSE); clutter_actor_allocate (stage, &box, FALSE);
@ -155,7 +155,7 @@ _clutter_stage_maybe_setup_viewport (ClutterStage *stage)
if (CLUTTER_PRIVATE_FLAGS (stage) & CLUTTER_ACTOR_SYNC_MATRICES) if (CLUTTER_PRIVATE_FLAGS (stage) & CLUTTER_ACTOR_SYNC_MATRICES)
{ {
ClutterPerspective perspective; ClutterPerspective perspective;
guint width, height; gfloat width, height;
clutter_actor_get_size (CLUTTER_ACTOR (stage), &width, &height); clutter_actor_get_size (CLUTTER_ACTOR (stage), &width, &height);
clutter_stage_get_perspective (stage, &perspective); clutter_stage_get_perspective (stage, &perspective);
@ -1931,8 +1931,8 @@ generate_enter_leave_events (ClutterEvent *event)
{ {
if (motion_current_actor) if (motion_current_actor)
{ {
gint x, y;
ClutterEvent cev; ClutterEvent cev;
gfloat x, y;
cev.crossing.device = device; cev.crossing.device = device;
clutter_event_get_coords (event, &x, &y); clutter_event_get_coords (event, &x, &y);
@ -2153,7 +2153,7 @@ clutter_do_event (ClutterEvent *event)
case CLUTTER_SCROLL: case CLUTTER_SCROLL:
{ {
ClutterActor *actor; ClutterActor *actor;
gint x,y; gfloat x, y;
clutter_event_get_coords (event, &x, &y); clutter_event_get_coords (event, &x, &y);
@ -2170,7 +2170,7 @@ clutter_do_event (ClutterEvent *event)
if (event->type == CLUTTER_BUTTON_RELEASE) if (event->type == CLUTTER_BUTTON_RELEASE)
{ {
CLUTTER_NOTE (EVENT, CLUTTER_NOTE (EVENT,
"Release off stage received at %i, %i", "Release off stage received at %.2f, %.2f",
x, y); x, y);
event->button.source = stage; event->button.source = stage;
@ -2196,12 +2196,14 @@ clutter_do_event (ClutterEvent *event)
/* FIXME: for an optimisation should check if there are /* FIXME: for an optimisation should check if there are
* actually any reactive actors and avoid the pick all togeather * actually any reactive actors and avoid the pick all together
* (signalling just the stage). Should be big help for gles. * (signalling just the stage). Should be big help for gles.
*/ */
CLUTTER_NOTE (EVENT, "Reactive event received at %i, %i - actor: %p", CLUTTER_NOTE (EVENT,
x, y, actor); "Reactive event received at %.2f, %.2f - actor: %p",
x, y,
actor);
/* Create, enter/leave events if needed */ /* Create, enter/leave events if needed */
generate_enter_leave_events (event); generate_enter_leave_events (event);

View File

@ -193,7 +193,7 @@ void _clutter_backend_init_events (ClutterBackend *backend);
ClutterFeatureFlags _clutter_backend_get_features (ClutterBackend *backend); ClutterFeatureFlags _clutter_backend_get_features (ClutterBackend *backend);
ClutterUnit _clutter_backend_get_units_per_em (ClutterBackend *backend); gfloat _clutter_backend_get_units_per_em (ClutterBackend *backend);
void _clutter_feature_init (void); void _clutter_feature_init (void);

View File

@ -127,9 +127,9 @@ static const ClutterColor default_stage_color = { 255, 255, 255, 255 };
static void static void
clutter_stage_get_preferred_width (ClutterActor *self, clutter_stage_get_preferred_width (ClutterActor *self,
ClutterUnit for_height, gfloat for_height,
ClutterUnit *min_width_p, gfloat *min_width_p,
ClutterUnit *natural_width_p) gfloat *natural_width_p)
{ {
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv; ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
@ -143,9 +143,9 @@ clutter_stage_get_preferred_width (ClutterActor *self,
static void static void
clutter_stage_get_preferred_height (ClutterActor *self, clutter_stage_get_preferred_height (ClutterActor *self,
ClutterUnit for_width, gfloat for_width,
ClutterUnit *min_height_p, gfloat *min_height_p,
ClutterUnit *natural_height_p) gfloat *natural_height_p)
{ {
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv; ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
@ -169,13 +169,14 @@ clutter_stage_allocate (ClutterActor *self,
* then we simply ignore any allocation request and override the * then we simply ignore any allocation request and override the
* allocation chain. * allocation chain.
*/ */
if (G_LIKELY (!clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC))) if ((!clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC)))
{ {
ClutterActorClass *klass; ClutterActorClass *klass;
CLUTTER_NOTE (ACTOR, "Following allocation to %dx%d (origin %s)", CLUTTER_NOTE (LAYOUT,
CLUTTER_UNITS_TO_DEVICE (box->x2 - box->x1), "Following allocation to %dx%d (origin %s)",
CLUTTER_UNITS_TO_DEVICE (box->y2 - box->y1), (int) (box->x2 - box->x1),
(int) (box->y2 - box->y1),
origin_changed ? "changed" : "not changed"); origin_changed ? "changed" : "not changed");
klass = CLUTTER_ACTOR_CLASS (clutter_stage_parent_class); klass = CLUTTER_ACTOR_CLASS (clutter_stage_parent_class);
@ -188,7 +189,7 @@ clutter_stage_allocate (ClutterActor *self,
{ {
ClutterActorBox override = { 0, }; ClutterActorBox override = { 0, };
ClutterActorClass *klass; ClutterActorClass *klass;
ClutterUnit natural_width, natural_height; gfloat natural_width, natural_height;
/* propagate the allocation */ /* propagate the allocation */
klass = CLUTTER_ACTOR_GET_CLASS (priv->impl); klass = CLUTTER_ACTOR_GET_CLASS (priv->impl);
@ -204,6 +205,15 @@ clutter_stage_allocate (ClutterActor *self,
override.x2 = natural_width; override.x2 = natural_width;
override.y2 = natural_height; override.y2 = natural_height;
CLUTTER_NOTE (LAYOUT,
"Overrigin original allocation of %dx%d "
"with %dx%d (origin %s)",
(int) (box->x2 - box->x1),
(int) (box->y2 - box->y1),
(int) (override.x2),
(int) (override.y2),
origin_changed ? "changed" : "not changed");
/* and store the overridden allocation */ /* and store the overridden allocation */
klass = CLUTTER_ACTOR_CLASS (clutter_stage_parent_class); klass = CLUTTER_ACTOR_CLASS (clutter_stage_parent_class);
klass->allocate (self, &override, origin_changed); klass->allocate (self, &override, origin_changed);
@ -320,7 +330,7 @@ static void
clutter_stage_real_fullscreen (ClutterStage *stage) clutter_stage_real_fullscreen (ClutterStage *stage)
{ {
ClutterStagePrivate *priv = stage->priv; ClutterStagePrivate *priv = stage->priv;
ClutterUnit natural_width, natural_height; gfloat natural_width, natural_height;
ClutterActorBox box; ClutterActorBox box;
/* we need to force an allocation here because the size /* we need to force an allocation here because the size

View File

@ -87,10 +87,10 @@ struct _LayoutCache
PangoLayout *layout; PangoLayout *layout;
/* The width that was used to generate this layout */ /* The width that was used to generate this layout */
ClutterUnit width; gfloat width;
/* The height that was used to generate this layout */ /* The height that was used to generate this layout */
ClutterUnit height; gfloat height;
/* A number representing the age of this cache (so that when a /* A number representing the age of this cache (so that when a
* new layout is needed the last used cache is replaced) * new layout is needed the last used cache is replaced)
@ -240,8 +240,8 @@ clutter_text_clear_selection (ClutterText *self)
static PangoLayout * static PangoLayout *
clutter_text_create_layout_no_cache (ClutterText *text, clutter_text_create_layout_no_cache (ClutterText *text,
ClutterUnit allocation_width, gfloat allocation_width,
ClutterUnit allocation_height) gfloat allocation_height)
{ {
ClutterTextPrivate *priv = text->priv; ClutterTextPrivate *priv = text->priv;
PangoLayout *layout; PangoLayout *layout;
@ -386,8 +386,8 @@ clutter_text_font_changed_cb (ClutterText *text)
*/ */
static PangoLayout * static PangoLayout *
clutter_text_create_layout (ClutterText *text, clutter_text_create_layout (ClutterText *text,
ClutterUnit allocation_width, gfloat allocation_width,
ClutterUnit allocation_height) gfloat allocation_height)
{ {
ClutterTextPrivate *priv = text->priv; ClutterTextPrivate *priv = text->priv;
LayoutCache *oldest_cache = priv->cached_layouts; LayoutCache *oldest_cache = priv->cached_layouts;
@ -484,9 +484,9 @@ clutter_text_coords_to_position (ClutterText *text,
static gboolean static gboolean
clutter_text_position_to_coords (ClutterText *self, clutter_text_position_to_coords (ClutterText *self,
gint position, gint position,
ClutterUnit *x, gfloat *x,
ClutterUnit *y, gfloat *y,
ClutterUnit *line_height) gfloat *line_height)
{ {
ClutterTextPrivate *priv = self->priv; ClutterTextPrivate *priv = self->priv;
PangoRectangle rect; PangoRectangle rect;
@ -535,7 +535,7 @@ static inline void
clutter_text_ensure_cursor_position (ClutterText *self) clutter_text_ensure_cursor_position (ClutterText *self)
{ {
ClutterTextPrivate *priv = self->priv; ClutterTextPrivate *priv = self->priv;
ClutterUnit x, y, cursor_height; gfloat x, y, cursor_height;
ClutterGeometry cursor_pos = { 0, }; ClutterGeometry cursor_pos = { 0, };
gboolean x_changed, y_changed; gboolean x_changed, y_changed;
gboolean width_changed, height_changed; gboolean width_changed, height_changed;
@ -922,7 +922,7 @@ cursor_paint (ClutterText *self)
gint i; gint i;
gint index_; gint index_;
gint maxindex; gint maxindex;
ClutterUnit y, height; gfloat y, height;
line = pango_layout_get_line_readonly (layout, line_no); line = pango_layout_get_line_readonly (layout, line_no);
pango_layout_line_x_to_index (line, G_MAXINT, &maxindex, NULL); pango_layout_line_x_to_index (line, G_MAXINT, &maxindex, NULL);
@ -1119,7 +1119,7 @@ clutter_text_button_press (ClutterActor *actor,
ClutterText *self = CLUTTER_TEXT (actor); ClutterText *self = CLUTTER_TEXT (actor);
ClutterTextPrivate *priv = self->priv; ClutterTextPrivate *priv = self->priv;
gboolean res = FALSE; gboolean res = FALSE;
ClutterUnit x, y; gfloat x, y;
gint index_; gint index_;
/* we'll steal keyfocus if we do not have it */ /* we'll steal keyfocus if we do not have it */
@ -1186,7 +1186,7 @@ clutter_text_motion (ClutterActor *actor,
{ {
ClutterText *ttext = CLUTTER_TEXT (actor); ClutterText *ttext = CLUTTER_TEXT (actor);
ClutterTextPrivate *priv = ttext->priv; ClutterTextPrivate *priv = ttext->priv;
ClutterUnit x, y; gfloat x, y;
gint index_; gint index_;
const gchar *text; const gchar *text;
@ -1401,16 +1401,16 @@ clutter_text_paint (ClutterActor *self)
static void static void
clutter_text_get_preferred_width (ClutterActor *self, clutter_text_get_preferred_width (ClutterActor *self,
ClutterUnit for_height, gfloat for_height,
ClutterUnit *min_width_p, gfloat *min_width_p,
ClutterUnit *natural_width_p) gfloat *natural_width_p)
{ {
ClutterText *text = CLUTTER_TEXT (self); ClutterText *text = CLUTTER_TEXT (self);
ClutterTextPrivate *priv = text->priv; ClutterTextPrivate *priv = text->priv;
PangoRectangle logical_rect = { 0, }; PangoRectangle logical_rect = { 0, };
PangoLayout *layout; PangoLayout *layout;
gint logical_width; gint logical_width;
ClutterUnit layout_width; gfloat layout_width;
layout = clutter_text_create_layout (text, -1, -1); layout = clutter_text_create_layout (text, -1, -1);
@ -1440,9 +1440,9 @@ clutter_text_get_preferred_width (ClutterActor *self,
static void static void
clutter_text_get_preferred_height (ClutterActor *self, clutter_text_get_preferred_height (ClutterActor *self,
ClutterUnit for_width, gfloat for_width,
ClutterUnit *min_height_p, gfloat *min_height_p,
ClutterUnit *natural_height_p) gfloat *natural_height_p)
{ {
ClutterText *text = CLUTTER_TEXT (self); ClutterText *text = CLUTTER_TEXT (self);
@ -1459,7 +1459,7 @@ clutter_text_get_preferred_height (ClutterActor *self,
PangoLayout *layout; PangoLayout *layout;
PangoRectangle logical_rect = { 0, }; PangoRectangle logical_rect = { 0, };
gint logical_height; gint logical_height;
ClutterUnit layout_height; gfloat layout_height;
layout = clutter_text_create_layout (text, for_width, -1); layout = clutter_text_create_layout (text, for_width, -1);
@ -3284,11 +3284,11 @@ clutter_text_set_markup (ClutterText *self,
PangoLayout * PangoLayout *
clutter_text_get_layout (ClutterText *self) clutter_text_get_layout (ClutterText *self)
{ {
ClutterUnit width, height; gfloat width, height;
g_return_val_if_fail (CLUTTER_IS_TEXT (self), NULL); g_return_val_if_fail (CLUTTER_IS_TEXT (self), NULL);
clutter_actor_get_sizeu (CLUTTER_ACTOR (self), &width, &height); clutter_actor_get_size (CLUTTER_ACTOR (self), &width, &height);
return clutter_text_create_layout (self, width, height); return clutter_text_create_layout (self, width, height);
} }

View File

@ -77,8 +77,8 @@ typedef struct _ClutterTextureAsyncData ClutterTextureAsyncData;
struct _ClutterTexturePrivate struct _ClutterTexturePrivate
{ {
gint width; gfloat width;
gint height; gfloat height;
gint max_tile_waste; gint max_tile_waste;
ClutterTextureQuality filter_quality; ClutterTextureQuality filter_quality;
CoglHandle material; CoglHandle material;
@ -351,9 +351,9 @@ clutter_texture_realize (ClutterActor *actor)
static void static void
clutter_texture_get_preferred_width (ClutterActor *self, clutter_texture_get_preferred_width (ClutterActor *self,
ClutterUnit for_height, gfloat for_height,
ClutterUnit *min_width_p, gfloat *min_width_p,
ClutterUnit *natural_width_p) gfloat *natural_width_p)
{ {
ClutterTexture *texture = CLUTTER_TEXTURE (self); ClutterTexture *texture = CLUTTER_TEXTURE (self);
ClutterTexturePrivate *priv = texture->priv; ClutterTexturePrivate *priv = texture->priv;
@ -370,19 +370,14 @@ clutter_texture_get_preferred_width (ClutterActor *self,
for_height < 0 || for_height < 0 ||
priv->height <= 0) priv->height <= 0)
{ {
*natural_width_p = CLUTTER_UNITS_FROM_DEVICE (priv->width); *natural_width_p = priv->width;
} }
else else
{ {
/* Set the natural width so as to preserve the aspect ratio */ /* Set the natural width so as to preserve the aspect ratio */
gfloat ratio, height; gfloat ratio = priv->width / priv->height;
ratio = (float)(priv->width) / (float)(priv->height); *natural_width_p = ratio * for_height;
height = CLUTTER_UNITS_TO_FLOAT (for_height);
*natural_width_p =
CLUTTER_UNITS_FROM_FLOAT (ratio * height);
} }
} }
} }
@ -395,9 +390,9 @@ clutter_texture_get_preferred_width (ClutterActor *self,
static void static void
clutter_texture_get_preferred_height (ClutterActor *self, clutter_texture_get_preferred_height (ClutterActor *self,
ClutterUnit for_width, gfloat for_width,
ClutterUnit *min_height_p, gfloat *min_height_p,
ClutterUnit *natural_height_p) gfloat *natural_height_p)
{ {
ClutterTexture *texture = CLUTTER_TEXTURE (self); ClutterTexture *texture = CLUTTER_TEXTURE (self);
ClutterTexturePrivate *priv = texture->priv; ClutterTexturePrivate *priv = texture->priv;
@ -414,19 +409,14 @@ clutter_texture_get_preferred_height (ClutterActor *self,
for_width < 0 || for_width < 0 ||
priv->width <= 0) priv->width <= 0)
{ {
*natural_height_p = CLUTTER_UNITS_FROM_DEVICE (priv->height); *natural_height_p = priv->height;
} }
else else
{ {
/* Set the natural height so as to preserve the aspect ratio */ /* Set the natural height so as to preserve the aspect ratio */
gfloat ratio, width; gfloat ratio = priv->height / priv->width;
ratio = (float)(priv->height) / (float)(priv->width); *natural_height_p = ratio * for_width;
width = CLUTTER_UNITS_TO_FLOAT (for_width);
*natural_height_p =
CLUTTER_UNITS_FROM_FLOAT (ratio * width);
} }
} }
} }
@ -460,7 +450,7 @@ clutter_texture_set_fbo_projection (ClutterActor *self)
ClutterTexturePrivate *priv = CLUTTER_TEXTURE (self)->priv; ClutterTexturePrivate *priv = CLUTTER_TEXTURE (self)->priv;
ClutterVertex verts[4]; ClutterVertex verts[4];
gfloat viewport[4]; gfloat viewport[4];
ClutterUnit x_min, x_max, y_min, y_max; gfloat x_min, x_max, y_min, y_max;
gfloat tx_min, tx_max, ty_min, ty_max; gfloat tx_min, tx_max, ty_min, ty_max;
gfloat tan_angle, near_size; gfloat tan_angle, near_size;
ClutterPerspective perspective; ClutterPerspective perspective;
@ -495,13 +485,13 @@ clutter_texture_set_fbo_projection (ClutterActor *self)
/* Convert the coordinates back to [-1,1] range */ /* Convert the coordinates back to [-1,1] range */
cogl_get_viewport (viewport); cogl_get_viewport (viewport);
tx_min = (CLUTTER_UNITS_TO_FLOAT (x_min) / viewport[2]) tx_min = (x_min / viewport[2])
* 2 - 1.0; * 2 - 1.0;
tx_max = (CLUTTER_UNITS_TO_FLOAT (x_max) / viewport[2]) tx_max = (x_max / viewport[2])
* 2 - 1.0; * 2 - 1.0;
ty_min = (CLUTTER_UNITS_TO_FLOAT (y_min) / viewport[3]) ty_min = (y_min / viewport[3])
* 2 - 1.0; * 2 - 1.0;
ty_max = (CLUTTER_UNITS_TO_FLOAT (y_max) / viewport[3]) ty_max = (y_max / viewport[3])
* 2 - 1.0; * 2 - 1.0;
/* Set up a projection matrix so that the actor will be projected as /* Set up a projection matrix so that the actor will be projected as
@ -558,7 +548,7 @@ clutter_texture_paint (ClutterActor *self)
if ((stage = clutter_actor_get_stage (self))) if ((stage = clutter_actor_get_stage (self)))
{ {
guint stage_width, stage_height; gfloat stage_width, stage_height;
ClutterActor *source_parent; ClutterActor *source_parent;
clutter_stage_get_perspective (CLUTTER_STAGE (stage), &perspective); clutter_stage_get_perspective (CLUTTER_STAGE (stage), &perspective);
@ -571,6 +561,7 @@ clutter_texture_paint (ClutterActor *self)
perspective.aspect, perspective.aspect,
perspective.z_near, perspective.z_near,
perspective.z_far); perspective.z_far);
/* Use a projection matrix that makes the actor appear as it /* Use a projection matrix that makes the actor appear as it
would if it was rendered at its normal screen location */ would if it was rendered at its normal screen location */
clutter_texture_set_fbo_projection (self); clutter_texture_set_fbo_projection (self);
@ -1445,7 +1436,7 @@ clutter_texture_set_cogl_texture (ClutterTexture *texture,
priv->width = width; priv->width = width;
priv->height = height; priv->height = height;
CLUTTER_NOTE (TEXTURE, "set size %ix%i\n", CLUTTER_NOTE (TEXTURE, "set size %.2fx%.2f\n",
priv->width, priv->width,
priv->height); priv->height);
@ -2310,7 +2301,7 @@ on_fbo_source_size_change (GObject *object,
ClutterTexture *texture) ClutterTexture *texture)
{ {
ClutterTexturePrivate *priv = texture->priv; ClutterTexturePrivate *priv = texture->priv;
guint w, h; gfloat w, h;
clutter_actor_get_transformed_size (priv->fbo_source, &w, &h); clutter_actor_get_transformed_size (priv->fbo_source, &w, &h);
@ -2453,7 +2444,7 @@ clutter_texture_new_from_actor (ClutterActor *actor)
{ {
ClutterTexture *texture; ClutterTexture *texture;
ClutterTexturePrivate *priv; ClutterTexturePrivate *priv;
guint w, h; gfloat w, h;
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), NULL); g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), NULL);

View File

@ -106,15 +106,15 @@ GType clutter_geometry_get_type (void) G_GNUC_CONST;
* @y: Y coordinate of the vertex * @y: Y coordinate of the vertex
* @z: Z coordinate of the vertex * @z: Z coordinate of the vertex
* *
* Vertex of an actor in 3D space, expressed in device independent units. * Vertex of an actor in 3D space, expressed in pixels
* *
* Since: 0.4 * Since: 0.4
*/ */
struct _ClutterVertex struct _ClutterVertex
{ {
ClutterUnit x; gfloat x;
ClutterUnit y; gfloat y;
ClutterUnit z; gfloat z;
}; };
GType clutter_vertex_get_type (void) G_GNUC_CONST; GType clutter_vertex_get_type (void) G_GNUC_CONST;

View File

@ -221,9 +221,9 @@ clutter_stage_egl_realize (ClutterActor *actor)
static void static void
clutter_stage_egl_get_preferred_width (ClutterActor *self, clutter_stage_egl_get_preferred_width (ClutterActor *self,
ClutterUnit for_height, gfloat for_height,
ClutterUnit *min_width_p, gfloat *min_width_p,
ClutterUnit *natural_width_p) gfloat *natural_width_p)
{ {
ClutterStageEGL *stage_egl = CLUTTER_STAGE_EGL (self); ClutterStageEGL *stage_egl = CLUTTER_STAGE_EGL (self);
@ -236,9 +236,9 @@ clutter_stage_egl_get_preferred_width (ClutterActor *self,
static void static void
clutter_stage_egl_get_preferred_height (ClutterActor *self, clutter_stage_egl_get_preferred_height (ClutterActor *self,
ClutterUnit for_width, gfloat for_width,
ClutterUnit *min_height_p, gfloat *min_height_p,
ClutterUnit *natural_height_p) gfloat *natural_height_p)
{ {
ClutterStageEGL *stage_egl = CLUTTER_STAGE_EGL (self); ClutterStageEGL *stage_egl = CLUTTER_STAGE_EGL (self);

View File

@ -190,9 +190,9 @@ clutter_stage_egl_realize (ClutterActor *actor)
static void static void
clutter_stage_egl_get_preferred_width (ClutterActor *self, clutter_stage_egl_get_preferred_width (ClutterActor *self,
ClutterUnit for_height, gfloat for_height,
ClutterUnit *min_width_p, gfloat *min_width_p,
ClutterUnit *natural_width_p) gfloat *natural_width_p)
{ {
ClutterStageEGL *stage_egl = CLUTTER_STAGE_EGL (self); ClutterStageEGL *stage_egl = CLUTTER_STAGE_EGL (self);
@ -205,9 +205,9 @@ clutter_stage_egl_get_preferred_width (ClutterActor *self,
static void static void
clutter_stage_egl_get_preferred_height (ClutterActor *self, clutter_stage_egl_get_preferred_height (ClutterActor *self,
ClutterUnit for_width, gfloat for_width,
ClutterUnit *min_height_p, gfloat *min_height_p,
ClutterUnit *natural_height_p) gfloat *natural_height_p)
{ {
ClutterStageEGL *stage_egl = CLUTTER_STAGE_EGL (self); ClutterStageEGL *stage_egl = CLUTTER_STAGE_EGL (self);

View File

@ -367,9 +367,9 @@ clutter_stage_osx_hide (ClutterActor *actor)
static void static void
clutter_stage_osx_get_preferred_width (ClutterActor *actor, clutter_stage_osx_get_preferred_width (ClutterActor *actor,
ClutterUnit for_height, gfloat for_height,
ClutterUnit *min_width_p, gfloat *min_width_p,
ClutterUnit *natural_width_p) gfloat *natural_width_p)
{ {
ClutterStageOSX *self = CLUTTER_STAGE_OSX (actor); ClutterStageOSX *self = CLUTTER_STAGE_OSX (actor);
gboolean is_resizable; gboolean is_resizable;
@ -394,9 +394,9 @@ clutter_stage_osx_get_preferred_width (ClutterActor *actor,
static void static void
clutter_stage_osx_get_preferred_height (ClutterActor *actor, clutter_stage_osx_get_preferred_height (ClutterActor *actor,
ClutterUnit for_width, gfloat for_width,
ClutterUnit *min_height_p, gfloat *min_height_p,
ClutterUnit *natural_height_p) gfloat *natural_height_p)
{ {
ClutterStageOSX *self = CLUTTER_STAGE_OSX (actor); ClutterStageOSX *self = CLUTTER_STAGE_OSX (actor);
gboolean is_resizable; gboolean is_resizable;

View File

@ -103,9 +103,9 @@ clutter_stage_sdl_realize (ClutterActor *actor)
static void static void
clutter_stage_sdl_get_preferred_width (ClutterActor *self, clutter_stage_sdl_get_preferred_width (ClutterActor *self,
ClutterUnit for_height, gfloat for_height,
ClutterUnit *min_width_p, gfloat *min_width_p,
ClutterUnit *natural_width_p) gfloat *natural_width_p)
{ {
ClutterStageSDL *stage_sdl = CLUTTER_STAGE_SDL (self); ClutterStageSDL *stage_sdl = CLUTTER_STAGE_SDL (self);
@ -118,9 +118,9 @@ clutter_stage_sdl_get_preferred_width (ClutterActor *self,
static void static void
clutter_stage_sdl_get_preferred_height (ClutterActor *self, clutter_stage_sdl_get_preferred_height (ClutterActor *self,
ClutterUnit for_width, gfloat for_width,
ClutterUnit *min_height_p, gfloat *min_height_p,
ClutterUnit *natural_height_p) gfloat *natural_height_p)
{ {
ClutterStageSDL *stage_sdl = CLUTTER_STAGE_SDL (self); ClutterStageSDL *stage_sdl = CLUTTER_STAGE_SDL (self);

View File

@ -81,9 +81,9 @@ clutter_stage_win32_hide (ClutterActor *actor)
static void static void
clutter_stage_win32_get_preferred_width (ClutterActor *self, clutter_stage_win32_get_preferred_width (ClutterActor *self,
ClutterUnit for_height, gfloat for_height,
ClutterUnit *min_width_p, gfloat *min_width_p,
ClutterUnit *natural_width_p) gfloat *natural_width_p)
{ {
ClutterStageWin32 *stage_win32 = CLUTTER_STAGE_WIN32 (self); ClutterStageWin32 *stage_win32 = CLUTTER_STAGE_WIN32 (self);
int width; int width;
@ -105,9 +105,9 @@ clutter_stage_win32_get_preferred_width (ClutterActor *self,
static void static void
clutter_stage_win32_get_preferred_height (ClutterActor *self, clutter_stage_win32_get_preferred_height (ClutterActor *self,
ClutterUnit for_width, gfloat for_width,
ClutterUnit *min_height_p, gfloat *min_height_p,
ClutterUnit *natural_height_p) gfloat *natural_height_p)
{ {
ClutterStageWin32 *stage_win32 = CLUTTER_STAGE_WIN32 (self); ClutterStageWin32 *stage_win32 = CLUTTER_STAGE_WIN32 (self);
int height; int height;

View File

@ -94,7 +94,7 @@ clutter_stage_x11_fix_window_size (ClutterStageX11 *stage_x11)
if (stage_x11->xwin != None && stage_x11->is_foreign_xwin == FALSE) if (stage_x11->xwin != None && stage_x11->is_foreign_xwin == FALSE)
{ {
XSizeHints *size_hints; XSizeHints *size_hints;
ClutterUnit min_width, min_height; gfloat min_width, min_height;
size_hints = XAllocSizeHints(); size_hints = XAllocSizeHints();
@ -172,9 +172,9 @@ clutter_stage_x11_set_wm_protocols (ClutterStageX11 *stage_x11)
static void static void
clutter_stage_x11_get_preferred_width (ClutterActor *self, clutter_stage_x11_get_preferred_width (ClutterActor *self,
ClutterUnit for_height, gfloat for_height,
ClutterUnit *min_width_p, gfloat *min_width_p,
ClutterUnit *natural_width_p) gfloat *natural_width_p)
{ {
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (self); ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (self);
gboolean resize; gboolean resize;
@ -211,9 +211,9 @@ clutter_stage_x11_get_preferred_width (ClutterActor *self,
static void static void
clutter_stage_x11_get_preferred_height (ClutterActor *self, clutter_stage_x11_get_preferred_height (ClutterActor *self,
ClutterUnit for_width, gfloat for_width,
ClutterUnit *min_height_p, gfloat *min_height_p,
ClutterUnit *natural_height_p) gfloat *natural_height_p)
{ {
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (self); ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (self);
gboolean resize; gboolean resize;

View File

@ -417,8 +417,8 @@ test_rotate_center (TestState *state)
gdouble angle_x, angle_y, angle_z; gdouble angle_x, angle_y, angle_z;
ClutterVertex *center_x, *center_y, *center_z; ClutterVertex *center_x, *center_y, *center_z;
ClutterGravity z_center_gravity; ClutterGravity z_center_gravity;
guint stage_width, stage_height; gfloat stage_width, stage_height;
gint rect_x, rect_y; gfloat rect_x, rect_y;
int i; int i;
/* Position the rectangle at the center of the stage so that /* Position the rectangle at the center of the stage so that
@ -426,16 +426,17 @@ test_rotate_center (TestState *state)
appear as a flat line. This makes verifying the transformations appear as a flat line. This makes verifying the transformations
easier */ easier */
clutter_actor_get_size (clutter_actor_get_stage (rect), clutter_actor_get_size (clutter_actor_get_stage (rect),
&stage_width, &stage_height); &stage_width,
&stage_height);
rect_x = stage_width / 2; rect_x = stage_width / 2;
rect_y = stage_height / 2; rect_y = stage_height / 2;
clutter_actor_set_position (rect, rect_x, rect_y); clutter_actor_set_position (rect, rect_x, rect_y);
/* Assert the default settings */ /* Assert the default settings */
g_assert (clutter_actor_get_x (rect) == rect_x); g_assert_cmpfloat (clutter_actor_get_x (rect), ==, rect_x);
g_assert (clutter_actor_get_y (rect) == rect_y); g_assert_cmpfloat (clutter_actor_get_y (rect), ==, rect_y);
g_assert (clutter_actor_get_width (rect) == RECT_WIDTH); g_assert_cmpfloat (clutter_actor_get_width (rect), ==, RECT_WIDTH);
g_assert (clutter_actor_get_height (rect) == RECT_HEIGHT); g_assert_cmpfloat (clutter_actor_get_height (rect), ==, RECT_HEIGHT);
g_object_get (rect, g_object_get (rect,
"rotation-angle-x", &angle_x, "rotation-angle-x", &angle_x,
"rotation-angle-y", &angle_y, "rotation-angle-y", &angle_y,

View File

@ -76,7 +76,6 @@ frame_tick (gpointer data)
{ {
TestState *state = data; TestState *state = data;
GTimeVal cur_tick = { 0, }; GTimeVal cur_tick = { 0, };
GSList *l;
gulong msecs; gulong msecs;
g_get_current_time (&cur_tick); g_get_current_time (&cur_tick);

View File

@ -139,7 +139,6 @@ frame_tick (gpointer data)
{ {
TestState *state = data; TestState *state = data;
GTimeVal cur_tick = { 0, }; GTimeVal cur_tick = { 0, };
GSList *l;
gulong msecs; gulong msecs;
g_get_current_time (&cur_tick); g_get_current_time (&cur_tick);

View File

@ -75,7 +75,6 @@ frame_tick (gpointer data)
{ {
TestState *state = data; TestState *state = data;
GTimeVal cur_tick = { 0, }; GTimeVal cur_tick = { 0, };
GSList *l;
gulong msecs; gulong msecs;
g_get_current_time (&cur_tick); g_get_current_time (&cur_tick);

View File

@ -89,7 +89,6 @@ frame_tick (gpointer data)
{ {
TestState *state = data; TestState *state = data;
GTimeVal cur_tick = { 0, }; GTimeVal cur_tick = { 0, };
GSList *l;
gulong msecs; gulong msecs;
g_get_current_time (&cur_tick); g_get_current_time (&cur_tick);

View File

@ -48,12 +48,12 @@ input_cb (ClutterActor *stage,
{ {
ClutterButtonEvent *button_event; ClutterButtonEvent *button_event;
ClutterActor *e; ClutterActor *e;
gint x, y; gfloat x, y;
clutter_event_get_coords (event, &x, &y); clutter_event_get_coords (event, &x, &y);
button_event = (ClutterButtonEvent *) event; button_event = (ClutterButtonEvent *) event;
g_print ("*** button press event (button:%d) at %d, %d ***\n", g_print ("*** button press event (button:%d) at %.2f, %.2f ***\n",
button_event->button, button_event->button,
x, y); x, y);

View File

@ -48,12 +48,12 @@ input_cb (ClutterActor *stage,
{ {
ClutterButtonEvent *button_event; ClutterButtonEvent *button_event;
ClutterActor *e; ClutterActor *e;
gint x, y; gfloat x, y;
clutter_event_get_coords (event, &x, &y); clutter_event_get_coords (event, &x, &y);
button_event = (ClutterButtonEvent *) event; button_event = (ClutterButtonEvent *) event;
g_print ("*** button press event (button:%d) at %d, %d ***\n", g_print ("*** button press event (button:%d) at %.2f, %.2f ***\n",
button_event->button, button_event->button,
x, y); x, y);

View File

@ -21,8 +21,8 @@ on_button_press (ClutterActor *actor,
gpointer dummy) gpointer dummy)
{ {
ClutterAnimation *animation; ClutterAnimation *animation;
gint old_x, old_y, new_x, new_y; gfloat old_x, old_y, new_x, new_y;
guint old_width, old_height, new_width, new_height; gfloat old_width, old_height, new_width, new_height;
gdouble new_angle; gdouble new_angle;
ClutterVertex vertex = { 0, }; ClutterVertex vertex = { 0, };
ClutterColor new_color = { 0, }; ClutterColor new_color = { 0, };
@ -65,10 +65,10 @@ on_button_press (ClutterActor *actor,
animation = animation =
clutter_actor_animate (actor, CLUTTER_EASE_IN_EXPO, 2000, clutter_actor_animate (actor, CLUTTER_EASE_IN_EXPO, 2000,
"x", new_x, "x", (int) new_x,
"y", new_y, "y", (int) new_y,
"width", new_width, "width", (int) new_width,
"height", new_height, "height", (int) new_height,
"color", &new_color, "color", &new_color,
"rotation-angle-z", new_angle, "rotation-angle-z", new_angle,
"fixed::rotation-center-z", &vertex, "fixed::rotation-center-z", &vertex,

View File

@ -186,9 +186,9 @@ test_clutter_cairo_flowers_main (int argc, char **argv)
{ {
flowers[i] = g_new0(Flower, 1); flowers[i] = g_new0(Flower, 1);
flowers[i]->ctex = make_flower_actor(); flowers[i]->ctex = make_flower_actor();
flowers[i]->x = rand() % clutter_actor_get_width(stage) flowers[i]->x = rand() % (int) clutter_actor_get_width (stage)
- (PETAL_MIN+PETAL_VAR)*2; - (PETAL_MIN + PETAL_VAR) * 2;
flowers[i]->y = rand() % clutter_actor_get_height(stage); flowers[i]->y = rand() % (int) clutter_actor_get_height (stage);
flowers[i]->rv = rand() % 5 + 1; flowers[i]->rv = rand() % 5 + 1;
flowers[i]->v = rand() % 10 + 2; flowers[i]->v = rand() % 10 + 2;

View File

@ -26,7 +26,7 @@ raise_top (gpointer ignored)
static ClutterActor * static ClutterActor *
clone_box (ClutterActor *original) clone_box (ClutterActor *original)
{ {
guint width, height; gfloat width, height;
ClutterActor *group; ClutterActor *group;
ClutterActor *clone; ClutterActor *clone;
@ -35,38 +35,39 @@ clone_box (ClutterActor *original)
group = clutter_group_new (); group = clutter_group_new ();
clone = clutter_clone_new (original); clone = clutter_clone_new (original);
clutter_container_add_actor (CLUTTER_CONTAINER (group), clone); clutter_container_add_actor (CLUTTER_CONTAINER (group), clone);
clutter_actor_set_depth (clone, width/2); clutter_actor_set_depth (clone, width / 2);
clone = clutter_clone_new (original); clone = clutter_clone_new (original);
clutter_container_add_actor (CLUTTER_CONTAINER (group), clone); clutter_container_add_actor (CLUTTER_CONTAINER (group), clone);
clutter_actor_set_rotation (clone, CLUTTER_Y_AXIS, 180, width/2, 0, 0); clutter_actor_set_rotation (clone, CLUTTER_Y_AXIS, 180, width / 2, 0, 0);
clutter_actor_set_depth (clone, -(gint)width/2); clutter_actor_set_depth (clone, -width / 2);
clone = clutter_clone_new (original); clone = clutter_clone_new (original);
clutter_container_add_actor (CLUTTER_CONTAINER (group), clone); clutter_container_add_actor (CLUTTER_CONTAINER (group), clone);
clutter_actor_set_rotation (clone, CLUTTER_Y_AXIS, 90, 0, 0, 0); clutter_actor_set_rotation (clone, CLUTTER_Y_AXIS, 90, 0, 0, 0);
clutter_actor_set_depth (clone, width/2); clutter_actor_set_depth (clone, width / 2);
clutter_actor_set_position (clone, 0, 0); clutter_actor_set_position (clone, 0, 0);
clone = clutter_clone_new (original); clone = clutter_clone_new (original);
clutter_container_add_actor (CLUTTER_CONTAINER (group), clone); clutter_container_add_actor (CLUTTER_CONTAINER (group), clone);
clutter_actor_set_rotation (clone, CLUTTER_Y_AXIS, 90, 0, 0, 0); clutter_actor_set_rotation (clone, CLUTTER_Y_AXIS, 90, 0, 0, 0);
clutter_actor_set_depth (clone, width/2); clutter_actor_set_depth (clone, width / 2);
clutter_actor_set_position (clone, width, 0); clutter_actor_set_position (clone, width, 0);
clone = clutter_clone_new (original); clone = clutter_clone_new (original);
clutter_container_add_actor (CLUTTER_CONTAINER (group), clone); clutter_container_add_actor (CLUTTER_CONTAINER (group), clone);
clutter_actor_set_rotation (clone, CLUTTER_X_AXIS, 90, 0, 0, 0); clutter_actor_set_rotation (clone, CLUTTER_X_AXIS, 90, 0, 0, 0);
clutter_actor_set_depth (clone, -(gint)width/2); clutter_actor_set_depth (clone, -width / 2);
clutter_actor_set_position (clone, 0, height); clutter_actor_set_position (clone, 0, height);
clone = clutter_clone_new (original); clone = clutter_clone_new (original);
clutter_container_add_actor (CLUTTER_CONTAINER (group), clone); clutter_container_add_actor (CLUTTER_CONTAINER (group), clone);
clutter_actor_set_rotation (clone, CLUTTER_X_AXIS, 90, 0, 0, 0); clutter_actor_set_rotation (clone, CLUTTER_X_AXIS, 90, 0, 0, 0);
clutter_actor_set_depth (clone, -(gint)width/2); clutter_actor_set_depth (clone, -width / 2);
clutter_actor_set_position (clone, 0, 0); clutter_actor_set_position (clone, 0, 0);
clutter_actor_show_all (group); clutter_actor_show_all (group);
return group; return group;
} }
@ -78,8 +79,8 @@ janus_group (const gchar *front_text,
ClutterColor red = {0xff, 0x00, 0x00, 0xff}; ClutterColor red = {0xff, 0x00, 0x00, 0xff};
ClutterColor green = {0x00, 0xff, 0x00, 0xff}; ClutterColor green = {0x00, 0xff, 0x00, 0xff};
ClutterActor *group, *rectangle, *front, *back; ClutterActor *group, *rectangle, *front, *back;
guint width, height; gfloat width, height;
guint width2, height2; gfloat width2, height2;
group = clutter_group_new (); group = clutter_group_new ();
rectangle = clutter_rectangle_new_with_color (&slide_color); rectangle = clutter_rectangle_new_with_color (&slide_color);
@ -93,11 +94,12 @@ janus_group (const gchar *front_text,
if (width2 > width) if (width2 > width)
width = width2; width = width2;
if (height2 > height) if (height2 > height)
height = height2; height = height2;
clutter_actor_set_size (rectangle, width, height); clutter_actor_set_size (rectangle, width, height);
clutter_actor_set_rotation (back, CLUTTER_Y_AXIS, 180, width/2, 0, 0); clutter_actor_set_rotation (back, CLUTTER_Y_AXIS, 180, width / 2, 0, 0);
clutter_container_add (CLUTTER_CONTAINER (group), clutter_container_add (CLUTTER_CONTAINER (group),
back, rectangle, front, NULL); back, rectangle, front, NULL);

View File

@ -53,8 +53,8 @@ on_button_press (ClutterActor *actor,
if (event->button == 3) if (event->button == 3)
{ {
gchar *text; gchar *text;
guint stage_width, stage_height; gfloat stage_width, stage_height;
guint label_width, label_height; gfloat label_width, label_height;
current_mode = (current_mode + 1 < n_easing_modes) ? current_mode + 1 current_mode = (current_mode + 1 < n_easing_modes) ? current_mode + 1
: 0; : 0;
@ -94,8 +94,8 @@ on_button_press (ClutterActor *actor,
animation = animation =
clutter_actor_animate (rectangle, cur_mode, 2000, clutter_actor_animate (rectangle, cur_mode, 2000,
"x", event->x, "x", (int) event->x,
"y", event->y, "y", (int) event->y,
"color", &color, "color", &color,
NULL); NULL);
} }
@ -110,8 +110,8 @@ test_easing_main (int argc, char *argv[])
ClutterColor stage_color = { 0x66, 0x66, 0xdd, 0xff }; ClutterColor stage_color = { 0x66, 0x66, 0xdd, 0xff };
ClutterColor rect_color = { 0x44, 0xdd, 0x44, 0xff }; ClutterColor rect_color = { 0x44, 0xdd, 0x44, 0xff };
gchar *text; gchar *text;
guint stage_width, stage_height; gfloat stage_width, stage_height;
guint label_width, label_height; gfloat label_width, label_height;
clutter_init (&argc, &argv); clutter_init (&argc, &argv);

View File

@ -15,7 +15,7 @@ static int state = START;
static void static void
on_fullscreen (ClutterStage *stage) on_fullscreen (ClutterStage *stage)
{ {
g_debug ("fullscreen set, size: %dx%d, mapped: %s", g_debug ("fullscreen set, size: %.2fx%.2f, mapped: %s",
clutter_actor_get_width (CLUTTER_ACTOR (stage)), clutter_actor_get_width (CLUTTER_ACTOR (stage)),
clutter_actor_get_height (CLUTTER_ACTOR (stage)), clutter_actor_get_height (CLUTTER_ACTOR (stage)),
CLUTTER_ACTOR_IS_MAPPED (stage) ? "true" : "false"); CLUTTER_ACTOR_IS_MAPPED (stage) ? "true" : "false");
@ -24,7 +24,7 @@ on_fullscreen (ClutterStage *stage)
static void static void
on_unfullscreen (ClutterStage *stage) on_unfullscreen (ClutterStage *stage)
{ {
g_debug ("fullscreen unset, size: %dx%d, mapped: %s", g_debug ("fullscreen unset, size: %.2fx%.2f, mapped: %s",
clutter_actor_get_width (CLUTTER_ACTOR (stage)), clutter_actor_get_width (CLUTTER_ACTOR (stage)),
clutter_actor_get_height (CLUTTER_ACTOR (stage)), clutter_actor_get_height (CLUTTER_ACTOR (stage)),
CLUTTER_ACTOR_IS_MAPPED (stage) ? "true" : "false"); CLUTTER_ACTOR_IS_MAPPED (stage) ? "true" : "false");
@ -85,7 +85,7 @@ test_fullscreen_main (int argc, char *argv[])
clutter_stage_fullscreen (CLUTTER_STAGE (stage)); clutter_stage_fullscreen (CLUTTER_STAGE (stage));
clutter_actor_show (stage); clutter_actor_show (stage);
g_debug ("stage size: %dx%d, mapped: %s", g_debug ("stage size: %.2fx%.2f, mapped: %s",
clutter_actor_get_width (stage), clutter_actor_get_width (stage),
clutter_actor_get_height (stage), clutter_actor_get_height (stage),
CLUTTER_ACTOR_IS_MAPPED (stage) ? "true" : "false"); CLUTTER_ACTOR_IS_MAPPED (stage) ? "true" : "false");

View File

@ -237,7 +237,7 @@ my_thing_get_preferred_width (ClutterActor *self,
child = l->data; child = l->data;
child_x = clutter_actor_get_xu (child); child_x = clutter_actor_get_x (child);
clutter_actor_get_preferred_size (child, clutter_actor_get_preferred_size (child,
&child_min, NULL, &child_min, NULL,
@ -315,7 +315,7 @@ my_thing_get_preferred_height (ClutterActor *self,
child = l->data; child = l->data;
child_y = clutter_actor_get_yu (child); child_y = clutter_actor_get_y (child);
clutter_actor_get_preferred_size (child, clutter_actor_get_preferred_size (child,
NULL, &child_min, NULL, &child_min,
@ -490,7 +490,6 @@ my_thing_paint (ClutterActor *actor)
g_assert (child != NULL); g_assert (child != NULL);
if (CLUTTER_ACTOR_IS_VISIBLE (child))
clutter_actor_paint (child); clutter_actor_paint (child);
} }
@ -748,7 +747,7 @@ test_layout_main (int argc, char *argv[])
{ {
ClutterActor *stage, *instructions; ClutterActor *stage, *instructions;
ClutterAlpha *alpha; ClutterAlpha *alpha;
gint i; gint i, size;
GError *error = NULL; GError *error = NULL;
clutter_init (&argc, &argv); clutter_init (&argc, &argv);
@ -776,7 +775,12 @@ test_layout_main (int argc, char *argv[])
if (error) if (error)
g_error ("Unable to load 'redhand.png': %s", error->message); g_error ("Unable to load 'redhand.png': %s", error->message);
for (i = 0; i < 33; i++) size = g_random_int_range (MIN_SIZE, MAX_SIZE);
clutter_actor_set_size (icon, size, size);
clutter_behaviour_apply (behaviour, icon);
clutter_container_add_actor (CLUTTER_CONTAINER (box), icon);
for (i = 1; i < 33; i++)
{ {
ClutterActor *clone = create_item (); ClutterActor *clone = create_item ();

View File

@ -51,7 +51,7 @@ input_cb (ClutterStage *stage,
{ {
ClutterButtonEvent *button_event; ClutterButtonEvent *button_event;
ClutterActor *e; ClutterActor *e;
gint x, y; gfloat x, y;
clutter_event_get_coords (event, &x, &y); clutter_event_get_coords (event, &x, &y);
@ -125,7 +125,7 @@ hand_pre_paint (ClutterActor *actor,
gpointer user_data) gpointer user_data)
{ {
SuperOH *oh = (SuperOH *) user_data; SuperOH *oh = (SuperOH *) user_data;
guint w, h; gfloat w, h;
int actor_num; int actor_num;
for (actor_num = 0; oh->hand[actor_num] != actor; actor_num++); for (actor_num = 0; oh->hand[actor_num] != actor; actor_num++);
@ -145,7 +145,7 @@ hand_post_paint (ClutterActor *actor,
gpointer user_data) gpointer user_data)
{ {
SuperOH *oh = (SuperOH *) user_data; SuperOH *oh = (SuperOH *) user_data;
guint w, h; gfloat w, h;
int actor_num; int actor_num;
for (actor_num = 0; oh->hand[actor_num] != actor; actor_num++); for (actor_num = 0; oh->hand[actor_num] != actor; actor_num++);

View File

@ -21,19 +21,17 @@ init_handles ()
clutter_actor_set_position (p[i], 0, 0); clutter_actor_set_position (p[i], 0, 0);
clutter_group_add (CLUTTER_GROUP (main_stage), p[i]); clutter_group_add (CLUTTER_GROUP (main_stage), p[i]);
clutter_actor_set_positionu (p[i], clutter_actor_set_position (p[i],
v[i].x - v[i].x - clutter_actor_get_width (p[i]) / 2,
clutter_actor_get_widthu (p[i])/2, v[i].y - clutter_actor_get_height (p[i]) / 2);
v[i].y -
clutter_actor_get_heightu (p[i])/2);
clutter_actor_raise_top (p[i]); clutter_actor_raise_top (p[i]);
clutter_actor_show (p[i]); clutter_actor_show (p[i]);
} }
v1.x = clutter_actor_get_widthu (rect) / 2; v1.x = clutter_actor_get_width (rect) / 2;
v1.y = clutter_actor_get_heightu (rect) / 2; v1.y = clutter_actor_get_height (rect) / 2;
v1.z = 0; v1.z = 0;
clutter_actor_apply_transform_to_point (rect, &v1, &v2); clutter_actor_apply_transform_to_point (rect, &v1, &v2);
@ -41,11 +39,9 @@ init_handles ()
clutter_actor_set_size (p[4], 5, 5); clutter_actor_set_size (p[4], 5, 5);
clutter_actor_set_position (p[4], 0, 0); clutter_actor_set_position (p[4], 0, 0);
clutter_group_add (CLUTTER_GROUP (main_stage), p[4]); clutter_group_add (CLUTTER_GROUP (main_stage), p[4]);
clutter_actor_set_positionu (p[4], clutter_actor_set_position (p[4],
v2.x - v2.x - clutter_actor_get_width (p[4]) / 2,
clutter_actor_get_widthu (p[4])/2, v2.y - clutter_actor_get_height (p[4]) / 2);
v2.y -
clutter_actor_get_heightu (p[4])/2);
clutter_actor_raise_top (p[4]); clutter_actor_raise_top (p[4]);
@ -62,21 +58,19 @@ place_handles ()
clutter_actor_get_abs_allocation_vertices (rect, v); clutter_actor_get_abs_allocation_vertices (rect, v);
for (i = 0; i < 4; ++i) for (i = 0; i < 4; ++i)
{ {
clutter_actor_set_positionu (p[i], clutter_actor_set_position (p[i],
v[i].x - v[i].x - clutter_actor_get_width (p[i])/2,
clutter_actor_get_widthu (p[i])/2, v[i].y - clutter_actor_get_height (p[i])/2);
v[i].y -
clutter_actor_get_heightu (p[i])/2);
} }
v1.x = clutter_actor_get_widthu (rect)/2; v1.x = clutter_actor_get_width (rect) / 2;
v1.y = clutter_actor_get_heightu (rect)/2; v1.y = clutter_actor_get_height (rect) / 2;
v1.z = 0; v1.z = 0;
clutter_actor_apply_transform_to_point (rect, &v1, &v2); clutter_actor_apply_transform_to_point (rect, &v1, &v2);
clutter_actor_set_positionu (p[4], clutter_actor_set_position (p[4],
v2.x - clutter_actor_get_widthu (p[4])/2, v2.x - clutter_actor_get_width (p[4])/2,
v2.y - clutter_actor_get_heightu (p[4])/2); v2.y - clutter_actor_get_height (p[4])/2);
} }
#define M(m,row,col) (m)[col*4+row] #define M(m,row,col) (m)[col*4+row]
@ -103,8 +97,8 @@ on_event (ClutterStage *stage,
{ {
case CLUTTER_BUTTON_PRESS: case CLUTTER_BUTTON_PRESS:
{ {
gint x, y; ClutterActor *actor;
ClutterActor * actor; gfloat x, y;
clutter_event_get_coords (event, &x, &y); clutter_event_get_coords (event, &x, &y);
@ -124,7 +118,7 @@ on_event (ClutterStage *stage,
{ {
if (dragging) if (dragging)
{ {
gint x, y; gfloat x, y;
gint i; gint i;
ClutterActorBox box1, box2; ClutterActorBox box1, box2;
ClutterUnit xp, yp; ClutterUnit xp, yp;
@ -148,7 +142,7 @@ on_event (ClutterStage *stage,
CLUTTER_UNITS_TO_FLOAT (xp), CLUTTER_UNITS_TO_FLOAT (xp),
CLUTTER_UNITS_TO_FLOAT (yp)); CLUTTER_UNITS_TO_FLOAT (yp));
clutter_actor_move_byu (rect, xp, yp); clutter_actor_move_by (rect, xp, yp);
} }
else else
{ {

View File

@ -65,17 +65,18 @@ on_motion_idle (gpointer user_data)
{ {
CallbackData *data = (CallbackData *) user_data; CallbackData *data = (CallbackData *) user_data;
guchar *pixels, *p; guchar *pixels, *p;
guint stage_width, stage_height; gfloat stage_width, stage_height;
gint x, y; gint x, y;
data->idle_source = 0; data->idle_source = 0;
clutter_actor_get_size (data->stage, &stage_width, &stage_height); clutter_actor_get_size (data->stage, &stage_width, &stage_height);
x = CLAMP (data->event.x - TEX_SIZE / 2, 0, (int) stage_width - TEX_SIZE); x = CLAMP (data->event.x - TEX_SIZE / 2, 0, stage_width - TEX_SIZE);
y = CLAMP (data->event.y - TEX_SIZE / 2, 0, (int) stage_height - TEX_SIZE); y = CLAMP (data->event.y - TEX_SIZE / 2, 0, stage_height - TEX_SIZE);
clutter_actor_set_position (data->box, x + TEX_SIZE / 2 - 1, clutter_actor_set_position (data->box,
x + TEX_SIZE / 2 - 1,
y + TEX_SIZE / 2 - 1); y + TEX_SIZE / 2 - 1);
clutter_actor_show (data->box); clutter_actor_show (data->box);
/* Redraw so that the layouting will be done and the box will be /* Redraw so that the layouting will be done and the box will be
@ -83,7 +84,8 @@ on_motion_idle (gpointer user_data)
clutter_redraw (CLUTTER_STAGE (data->stage)); clutter_redraw (CLUTTER_STAGE (data->stage));
pixels = clutter_stage_read_pixels (CLUTTER_STAGE (data->stage), pixels = clutter_stage_read_pixels (CLUTTER_STAGE (data->stage),
x, y, TEX_SIZE, TEX_SIZE); x, y,
TEX_SIZE, TEX_SIZE);
/* Make a red dot in the center */ /* Make a red dot in the center */
p = pixels + (TEX_SIZE / 2 - DOT_SIZE / 2) * TEX_SIZE * 4 p = pixels + (TEX_SIZE / 2 - DOT_SIZE / 2) * TEX_SIZE * 4

View File

@ -23,9 +23,9 @@ on_event (ClutterStage *stage,
{ {
case CLUTTER_BUTTON_PRESS: case CLUTTER_BUTTON_PRESS:
{ {
gint x, y; ClutterActor *actor;
ClutterActor * actor; gfloat xu2, yu2;
ClutterUnit xu2, yu2; gfloat x, y;
clutter_event_get_coords (event, &x, &y); clutter_event_get_coords (event, &x, &y);
@ -33,10 +33,7 @@ on_event (ClutterStage *stage,
CLUTTER_PICK_ALL, CLUTTER_PICK_ALL,
x, y); x, y);
if (clutter_actor_transform_stage_point (actor, if (clutter_actor_transform_stage_point (actor, x, y, &xu2, &yu2))
CLUTTER_UNITS_FROM_DEVICE (x),
CLUTTER_UNITS_FROM_DEVICE (y),
&xu2, &yu2))
{ {
gchar *txt; gchar *txt;
@ -44,16 +41,14 @@ on_event (ClutterStage *stage,
txt = g_strdup_printf ("Click on rectangle\n" txt = g_strdup_printf ("Click on rectangle\n"
"Screen coords: [%d, %d]\n" "Screen coords: [%d, %d]\n"
"Local coords : [%d, %d]", "Local coords : [%d, %d]",
x, y, (int) x, (int) y,
CLUTTER_UNITS_TO_DEVICE (xu2), (int) xu2, (int) yu2);
CLUTTER_UNITS_TO_DEVICE (yu2));
else else
txt = g_strdup_printf ("Click on stage\n" txt = g_strdup_printf ("Click on stage\n"
"Screen coords: [%d, %d]\n" "Screen coords: [%d, %d]\n"
"Local coords : [%d, %d]", "Local coords : [%d, %d]",
x, y, (int) x, (int) y,
CLUTTER_UNITS_TO_DEVICE (xu2), (int) xu2, (int) yu2);
CLUTTER_UNITS_TO_DEVICE (yu2));
clutter_text_set_text (CLUTTER_TEXT (label), txt); clutter_text_set_text (CLUTTER_TEXT (label), txt);
g_free (txt); g_free (txt);