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:
parent
c2abdd5e82
commit
d6d208da7d
File diff suppressed because it is too large
Load Diff
@ -129,15 +129,15 @@ typedef enum
|
||||
*
|
||||
* 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
|
||||
* #ClutterUnit<!-- -->s, that is are device-independent. If you want to obtain
|
||||
* the box dimensions in pixels, use clutter_actor_get_geometry().
|
||||
* pixels with sub-pixel precision
|
||||
*/
|
||||
struct _ClutterActorBox
|
||||
{
|
||||
ClutterUnit x1;
|
||||
ClutterUnit y1;
|
||||
ClutterUnit x2;
|
||||
ClutterUnit y2;
|
||||
gfloat x1;
|
||||
gfloat y1;
|
||||
|
||||
gfloat x2;
|
||||
gfloat y2;
|
||||
};
|
||||
|
||||
GType clutter_actor_box_get_type (void) G_GNUC_CONST;
|
||||
@ -238,13 +238,13 @@ struct _ClutterActorClass
|
||||
|
||||
/* size negotiation */
|
||||
void (* get_preferred_width) (ClutterActor *actor,
|
||||
ClutterUnit for_height,
|
||||
ClutterUnit *min_width_p,
|
||||
ClutterUnit *natural_width_p);
|
||||
gfloat for_height,
|
||||
gfloat *min_width_p,
|
||||
gfloat *natural_width_p);
|
||||
void (* get_preferred_height) (ClutterActor *actor,
|
||||
ClutterUnit for_width,
|
||||
ClutterUnit *min_height_p,
|
||||
ClutterUnit *natural_height_p);
|
||||
gfloat for_width,
|
||||
gfloat *min_height_p,
|
||||
gfloat *natural_height_p);
|
||||
void (* allocate) (ClutterActor *actor,
|
||||
const ClutterActorBox *box,
|
||||
gboolean absolute_origin_changed);
|
||||
@ -302,18 +302,18 @@ void clutter_actor_destroy (ClutterActor
|
||||
|
||||
/* size negotiation */
|
||||
void clutter_actor_get_preferred_width (ClutterActor *self,
|
||||
ClutterUnit for_height,
|
||||
ClutterUnit *min_width_p,
|
||||
ClutterUnit *natural_width_p);
|
||||
gfloat for_height,
|
||||
gfloat *min_width_p,
|
||||
gfloat *natural_width_p);
|
||||
void clutter_actor_get_preferred_height (ClutterActor *self,
|
||||
ClutterUnit for_width,
|
||||
ClutterUnit *min_height_p,
|
||||
ClutterUnit *natural_height_p);
|
||||
gfloat for_width,
|
||||
gfloat *min_height_p,
|
||||
gfloat *natural_height_p);
|
||||
void clutter_actor_get_preferred_size (ClutterActor *self,
|
||||
ClutterUnit *min_width_p,
|
||||
ClutterUnit *min_height_p,
|
||||
ClutterUnit *natural_width_p,
|
||||
ClutterUnit *natural_height_p);
|
||||
gfloat *min_width_p,
|
||||
gfloat *min_height_p,
|
||||
gfloat *natural_width_p,
|
||||
gfloat *natural_height_p);
|
||||
void clutter_actor_allocate (ClutterActor *self,
|
||||
const ClutterActorBox *box,
|
||||
gboolean absolute_origin_changed);
|
||||
@ -337,100 +337,60 @@ void clutter_actor_set_geometry (ClutterActor
|
||||
void clutter_actor_get_geometry (ClutterActor *self,
|
||||
ClutterGeometry *geometry);
|
||||
void clutter_actor_set_size (ClutterActor *self,
|
||||
gint width,
|
||||
gint height);
|
||||
void clutter_actor_set_sizeu (ClutterActor *self,
|
||||
ClutterUnit width,
|
||||
ClutterUnit height);
|
||||
gfloat width,
|
||||
gfloat height);
|
||||
void clutter_actor_get_size (ClutterActor *self,
|
||||
guint *width,
|
||||
guint *height);
|
||||
void clutter_actor_get_sizeu (ClutterActor *self,
|
||||
ClutterUnit *width,
|
||||
ClutterUnit *height);
|
||||
gfloat *width,
|
||||
gfloat *height);
|
||||
void clutter_actor_get_transformed_size (ClutterActor *self,
|
||||
guint *width,
|
||||
guint *height);
|
||||
void clutter_actor_get_transformed_sizeu (ClutterActor *self,
|
||||
ClutterUnit *width,
|
||||
ClutterUnit *height);
|
||||
gfloat *width,
|
||||
gfloat *height);
|
||||
void clutter_actor_set_position (ClutterActor *self,
|
||||
gint x,
|
||||
gint y);
|
||||
void clutter_actor_set_positionu (ClutterActor *self,
|
||||
ClutterUnit x,
|
||||
ClutterUnit y);
|
||||
gfloat x,
|
||||
gfloat y);
|
||||
void clutter_actor_get_position (ClutterActor *self,
|
||||
gint *x,
|
||||
gint *y);
|
||||
void clutter_actor_get_positionu (ClutterActor *self,
|
||||
ClutterUnit *x,
|
||||
ClutterUnit *y);
|
||||
gfloat *x,
|
||||
gfloat *y);
|
||||
void clutter_actor_get_transformed_position (ClutterActor *self,
|
||||
gint *x,
|
||||
gint *y);
|
||||
void clutter_actor_get_transformed_positionu (ClutterActor *self,
|
||||
ClutterUnit *x,
|
||||
ClutterUnit *y);
|
||||
gfloat *x,
|
||||
gfloat *y);
|
||||
|
||||
gboolean clutter_actor_get_fixed_position_set (ClutterActor *self);
|
||||
void clutter_actor_set_fixed_position_set (ClutterActor *self,
|
||||
gboolean is_set);
|
||||
|
||||
guint clutter_actor_get_width (ClutterActor *self);
|
||||
ClutterUnit clutter_actor_get_widthu (ClutterActor *self);
|
||||
guint clutter_actor_get_height (ClutterActor *self);
|
||||
ClutterUnit clutter_actor_get_heightu (ClutterActor *self);
|
||||
gfloat clutter_actor_get_width (ClutterActor *self);
|
||||
gfloat clutter_actor_get_height (ClutterActor *self);
|
||||
void clutter_actor_set_width (ClutterActor *self,
|
||||
guint width);
|
||||
void clutter_actor_set_widthu (ClutterActor *self,
|
||||
ClutterUnit width);
|
||||
gfloat width);
|
||||
void clutter_actor_set_height (ClutterActor *self,
|
||||
guint height);
|
||||
void clutter_actor_set_heightu (ClutterActor *self,
|
||||
ClutterUnit height);
|
||||
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);
|
||||
gfloat height);
|
||||
gfloat clutter_actor_get_x (ClutterActor *self);
|
||||
gfloat clutter_actor_get_y (ClutterActor *self);
|
||||
void clutter_actor_set_x (ClutterActor *self,
|
||||
gint x);
|
||||
void clutter_actor_set_xu (ClutterActor *self,
|
||||
ClutterUnit x);
|
||||
gfloat x);
|
||||
void clutter_actor_set_y (ClutterActor *self,
|
||||
gint y);
|
||||
void clutter_actor_set_yu (ClutterActor *self,
|
||||
ClutterUnit y);
|
||||
gfloat y);
|
||||
void clutter_actor_set_rotation (ClutterActor *self,
|
||||
ClutterRotateAxis axis,
|
||||
gdouble angle,
|
||||
gint x,
|
||||
gint y,
|
||||
gint z);
|
||||
void clutter_actor_set_rotationu (ClutterActor *self,
|
||||
ClutterRotateAxis axis,
|
||||
gdouble angle,
|
||||
ClutterUnit x,
|
||||
ClutterUnit y,
|
||||
ClutterUnit z);
|
||||
gfloat x,
|
||||
gfloat y,
|
||||
gfloat z);
|
||||
void clutter_actor_set_z_rotation_from_gravity (ClutterActor *self,
|
||||
gdouble angle,
|
||||
ClutterGravity gravity);
|
||||
gdouble clutter_actor_get_rotation (ClutterActor *self,
|
||||
ClutterRotateAxis axis,
|
||||
gint *x,
|
||||
gint *y,
|
||||
gint *z);
|
||||
gdouble clutter_actor_get_rotationu (ClutterActor *self,
|
||||
ClutterRotateAxis axis,
|
||||
ClutterUnit *x,
|
||||
ClutterUnit *y,
|
||||
ClutterUnit *z);
|
||||
gfloat *x,
|
||||
gfloat *y,
|
||||
gfloat *z);
|
||||
ClutterGravity clutter_actor_get_z_rotation_gravity (ClutterActor *self);
|
||||
|
||||
void clutter_actor_set_opacity (ClutterActor *self,
|
||||
guint8 opacity);
|
||||
guint8 clutter_actor_get_opacity (ClutterActor *self);
|
||||
|
||||
guint8 clutter_actor_get_paint_opacity (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);
|
||||
void clutter_actor_set_clip (ClutterActor *self,
|
||||
gint xoff,
|
||||
gint yoff,
|
||||
gint width,
|
||||
gint height);
|
||||
void clutter_actor_set_clipu (ClutterActor *self,
|
||||
ClutterUnit xoff,
|
||||
ClutterUnit yoff,
|
||||
ClutterUnit width,
|
||||
ClutterUnit height);
|
||||
gfloat xoff,
|
||||
gfloat yoff,
|
||||
gfloat width,
|
||||
gfloat height);
|
||||
void clutter_actor_remove_clip (ClutterActor *self);
|
||||
gboolean clutter_actor_has_clip (ClutterActor *self);
|
||||
void clutter_actor_get_clip (ClutterActor *self,
|
||||
gint *xoff,
|
||||
gint *yoff,
|
||||
gint *width,
|
||||
gint *height);
|
||||
void clutter_actor_get_clipu (ClutterActor *self,
|
||||
ClutterUnit *xoff,
|
||||
ClutterUnit *yoff,
|
||||
ClutterUnit *width,
|
||||
ClutterUnit *height);
|
||||
gfloat *xoff,
|
||||
gfloat *yoff,
|
||||
gfloat *width,
|
||||
gfloat *height);
|
||||
|
||||
void clutter_actor_set_parent (ClutterActor *self,
|
||||
ClutterActor *parent);
|
||||
@ -478,11 +428,8 @@ void clutter_actor_lower (ClutterActor
|
||||
void clutter_actor_raise_top (ClutterActor *self);
|
||||
void clutter_actor_lower_bottom (ClutterActor *self);
|
||||
void clutter_actor_set_depth (ClutterActor *self,
|
||||
gint depth);
|
||||
gint clutter_actor_get_depth (ClutterActor *self);
|
||||
void clutter_actor_set_depthu (ClutterActor *self,
|
||||
ClutterUnit depth);
|
||||
ClutterUnit clutter_actor_get_depthu (ClutterActor *self);
|
||||
gfloat depth);
|
||||
gfloat clutter_actor_get_depth (ClutterActor *self);
|
||||
|
||||
void clutter_actor_set_scale (ClutterActor *self,
|
||||
gdouble scale_x,
|
||||
@ -490,13 +437,8 @@ void clutter_actor_set_scale (ClutterActor
|
||||
void clutter_actor_set_scale_full (ClutterActor *self,
|
||||
gdouble scale_x,
|
||||
gdouble scale_y,
|
||||
int center_x,
|
||||
int center_y);
|
||||
void clutter_actor_set_scale_fullu (ClutterActor *self,
|
||||
gdouble scale_x,
|
||||
gdouble scale_y,
|
||||
ClutterUnit center_x,
|
||||
ClutterUnit center_y);
|
||||
gfloat center_x,
|
||||
gfloat center_y);
|
||||
void clutter_actor_set_scale_with_gravity (ClutterActor *self,
|
||||
gdouble scale_x,
|
||||
gdouble scale_y,
|
||||
@ -505,19 +447,13 @@ void clutter_actor_get_scale (ClutterActor
|
||||
gdouble *scale_x,
|
||||
gdouble *scale_y);
|
||||
void clutter_actor_get_scale_center (ClutterActor *self,
|
||||
gint *center_x,
|
||||
gint *center_y);
|
||||
void clutter_actor_get_scale_centeru (ClutterActor *self,
|
||||
ClutterUnit *center_x,
|
||||
ClutterUnit *center_y);
|
||||
gfloat *center_x,
|
||||
gfloat *center_y);
|
||||
ClutterGravity clutter_actor_get_scale_gravity (ClutterActor *self);
|
||||
|
||||
void clutter_actor_move_by (ClutterActor *self,
|
||||
gint dx,
|
||||
gint dy);
|
||||
void clutter_actor_move_byu (ClutterActor *self,
|
||||
ClutterUnit dx,
|
||||
ClutterUnit dy);
|
||||
gfloat dx,
|
||||
gfloat dy);
|
||||
|
||||
void clutter_actor_set_reactive (ClutterActor *actor,
|
||||
gboolean reactive);
|
||||
@ -543,34 +479,25 @@ void clutter_actor_set_shader_param_float (ClutterActor
|
||||
gfloat value);
|
||||
|
||||
void clutter_actor_set_anchor_point (ClutterActor *self,
|
||||
gint anchor_x,
|
||||
gint anchor_y);
|
||||
gfloat anchor_x,
|
||||
gfloat anchor_y);
|
||||
void clutter_actor_move_anchor_point (ClutterActor *self,
|
||||
gint anchor_x,
|
||||
gint anchor_y);
|
||||
gfloat anchor_x,
|
||||
gfloat anchor_y);
|
||||
void clutter_actor_get_anchor_point (ClutterActor *self,
|
||||
gint *anchor_x,
|
||||
gint *anchor_y);
|
||||
gfloat *anchor_x,
|
||||
gfloat *anchor_y);
|
||||
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,
|
||||
ClutterGravity gravity);
|
||||
void clutter_actor_move_anchor_point_from_gravity (ClutterActor *self,
|
||||
ClutterGravity gravity);
|
||||
|
||||
gboolean clutter_actor_transform_stage_point (ClutterActor *self,
|
||||
ClutterUnit x,
|
||||
ClutterUnit y,
|
||||
ClutterUnit *x_out,
|
||||
ClutterUnit *y_out);
|
||||
gfloat x,
|
||||
gfloat y,
|
||||
gfloat *x_out,
|
||||
gfloat *y_out);
|
||||
gboolean clutter_actor_is_rotated (ClutterActor *self);
|
||||
gboolean clutter_actor_is_scaled (ClutterActor *self);
|
||||
gboolean clutter_actor_should_pick_paint (ClutterActor *self);
|
||||
|
@ -1196,6 +1196,9 @@ clutter_animation_get_timeline (ClutterAnimation *animation)
|
||||
* the current values of the #ClutterAnimation:mode and
|
||||
* #ClutterAnimation:timeline properties.
|
||||
*
|
||||
* If @alpha is not %NULL, the #ClutterAnimation will take ownership
|
||||
* of the #ClutterAlpha instance.
|
||||
*
|
||||
* Since: 1.0
|
||||
*/
|
||||
void
|
||||
|
@ -61,7 +61,8 @@ struct _ClutterBackendPrivate
|
||||
guint double_click_distance;
|
||||
|
||||
gdouble resolution;
|
||||
gdouble units_per_em;
|
||||
|
||||
gfloat units_per_em;
|
||||
|
||||
cairo_font_options_t *font_options;
|
||||
|
||||
@ -133,12 +134,12 @@ update_units_per_em (ClutterBackend *backend)
|
||||
}
|
||||
|
||||
/* 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
|
||||
/ 96.0;
|
||||
/ 96.0f;
|
||||
}
|
||||
else
|
||||
priv->units_per_em = -1.0;
|
||||
priv->units_per_em = -1.0f;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -359,7 +360,7 @@ _clutter_backend_init_events (ClutterBackend *backend)
|
||||
klass->init_events (backend);
|
||||
}
|
||||
|
||||
ClutterUnit
|
||||
gfloat
|
||||
_clutter_backend_get_units_per_em (ClutterBackend *backend)
|
||||
{
|
||||
ClutterBackendPrivate *priv;
|
||||
|
@ -552,13 +552,16 @@ notify_cb (GObject *object,
|
||||
* @behave: a #ClutterBehaviour
|
||||
* @alpha: a #ClutterAlpha or %NULL to unset a previously set alpha
|
||||
*
|
||||
* Binds @alpha to a #ClutterBehaviour. The #ClutterAlpha object
|
||||
* Binds @alpha to a #ClutterBehaviour. The #ClutterAlpha object
|
||||
* is what makes a behaviour work: for each tick of the timeline
|
||||
* used by #ClutterAlpha a new value of the alpha parameter is
|
||||
* computed by the alpha function; the value should be used by
|
||||
* the #ClutterBehaviour to update one or more properties of the
|
||||
* actors to which the behaviour applies.
|
||||
*
|
||||
* If @alpha is not %NULL, the #ClutterBehaviour will take ownership
|
||||
* of the #ClutterAlpha instance.
|
||||
*
|
||||
* Since: 0.2
|
||||
*/
|
||||
void
|
||||
|
@ -319,9 +319,9 @@ clutter_cairo_texture_notify (GObject *object,
|
||||
|
||||
static void
|
||||
clutter_cairo_texture_get_preferred_width (ClutterActor *actor,
|
||||
ClutterUnit for_height,
|
||||
ClutterUnit *min_width,
|
||||
ClutterUnit *natural_width)
|
||||
gfloat for_height,
|
||||
gfloat *min_width,
|
||||
gfloat *natural_width)
|
||||
{
|
||||
ClutterCairoTexturePrivate *priv = CLUTTER_CAIRO_TEXTURE (actor)->priv;
|
||||
|
||||
@ -329,14 +329,14 @@ clutter_cairo_texture_get_preferred_width (ClutterActor *actor,
|
||||
*min_width = 0;
|
||||
|
||||
if (natural_width)
|
||||
*natural_width = CLUTTER_UNITS_FROM_DEVICE (priv->width);
|
||||
*natural_width = (gfloat) priv->width;
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_cairo_texture_get_preferred_height (ClutterActor *actor,
|
||||
ClutterUnit for_width,
|
||||
ClutterUnit *min_height,
|
||||
ClutterUnit *natural_height)
|
||||
gfloat for_width,
|
||||
gfloat *min_height,
|
||||
gfloat *natural_height)
|
||||
{
|
||||
ClutterCairoTexturePrivate *priv = CLUTTER_CAIRO_TEXTURE (actor)->priv;
|
||||
|
||||
@ -344,7 +344,7 @@ clutter_cairo_texture_get_preferred_height (ClutterActor *actor,
|
||||
*min_height = 0;
|
||||
|
||||
if (natural_height)
|
||||
*natural_height = CLUTTER_UNITS_FROM_DEVICE (priv->height);
|
||||
*natural_height = (gfloat) priv->height;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -69,14 +69,14 @@ static void clutter_clone_set_source_internal (ClutterClone *clone,
|
||||
ClutterActor *source);
|
||||
static void
|
||||
clutter_clone_get_preferred_width (ClutterActor *self,
|
||||
ClutterUnit for_height,
|
||||
ClutterUnit *min_width_p,
|
||||
ClutterUnit *natural_width_p)
|
||||
gfloat for_height,
|
||||
gfloat *min_width_p,
|
||||
gfloat *natural_width_p)
|
||||
{
|
||||
ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
|
||||
ClutterActor *clone_source = priv->clone_source;
|
||||
|
||||
if (G_UNLIKELY (clone_source == NULL))
|
||||
if (clone_source == NULL)
|
||||
{
|
||||
if (min_width_p)
|
||||
*min_width_p = 0;
|
||||
@ -93,14 +93,14 @@ clutter_clone_get_preferred_width (ClutterActor *self,
|
||||
|
||||
static void
|
||||
clutter_clone_get_preferred_height (ClutterActor *self,
|
||||
ClutterUnit for_width,
|
||||
ClutterUnit *min_height_p,
|
||||
ClutterUnit *natural_height_p)
|
||||
gfloat for_width,
|
||||
gfloat *min_height_p,
|
||||
gfloat *natural_height_p)
|
||||
{
|
||||
ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
|
||||
ClutterActor *clone_source = priv->clone_source;
|
||||
|
||||
if (G_UNLIKELY (clone_source == NULL))
|
||||
if (clone_source == NULL)
|
||||
{
|
||||
if (min_height_p)
|
||||
*min_height_p = 0;
|
||||
|
@ -148,4 +148,24 @@
|
||||
|
||||
#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 */
|
||||
|
@ -119,10 +119,10 @@ clutter_event_get_state (ClutterEvent *event)
|
||||
*/
|
||||
void
|
||||
clutter_event_get_coords (ClutterEvent *event,
|
||||
gint *x,
|
||||
gint *y)
|
||||
gfloat *x,
|
||||
gfloat *y)
|
||||
{
|
||||
gint event_x, event_y;
|
||||
gfloat event_x, event_y;
|
||||
|
||||
g_return_if_fail (event != NULL);
|
||||
|
||||
@ -140,15 +140,18 @@ clutter_event_get_coords (ClutterEvent *event,
|
||||
case CLUTTER_ENTER:
|
||||
case CLUTTER_LEAVE:
|
||||
break;
|
||||
|
||||
case CLUTTER_BUTTON_PRESS:
|
||||
case CLUTTER_BUTTON_RELEASE:
|
||||
event_x = event->button.x;
|
||||
event_y = event->button.y;
|
||||
break;
|
||||
|
||||
case CLUTTER_MOTION:
|
||||
event_x = event->motion.x;
|
||||
event_y = event->motion.y;
|
||||
break;
|
||||
|
||||
case CLUTTER_SCROLL:
|
||||
event_x = event->scroll.x;
|
||||
event_y = event->scroll.y;
|
||||
|
@ -221,8 +221,8 @@ typedef struct _ClutterInputDevice ClutterInputDevice;
|
||||
*/
|
||||
struct _ClutterAnyEvent
|
||||
{
|
||||
ClutterEventType type;
|
||||
guint32 time;
|
||||
ClutterEventType type;
|
||||
guint32 time;
|
||||
ClutterEventFlags flags;
|
||||
ClutterStage *stage;
|
||||
ClutterActor *source;
|
||||
@ -290,8 +290,8 @@ struct _ClutterButtonEvent
|
||||
ClutterEventFlags flags;
|
||||
ClutterStage *stage;
|
||||
ClutterActor *source;
|
||||
gint x;
|
||||
gint y;
|
||||
gfloat x;
|
||||
gfloat y;
|
||||
ClutterModifierType modifier_state;
|
||||
guint32 button;
|
||||
guint click_count;
|
||||
@ -322,8 +322,8 @@ struct _ClutterCrossingEvent
|
||||
ClutterEventFlags flags;
|
||||
ClutterStage *stage;
|
||||
ClutterActor *source;
|
||||
gint x;
|
||||
gint y;
|
||||
gfloat x;
|
||||
gfloat y;
|
||||
ClutterInputDevice *device; /* future use */
|
||||
ClutterActor *related;
|
||||
};
|
||||
@ -352,8 +352,8 @@ struct _ClutterMotionEvent
|
||||
ClutterEventFlags flags;
|
||||
ClutterStage *stage;
|
||||
ClutterActor *source;
|
||||
gint x;
|
||||
gint y;
|
||||
gfloat x;
|
||||
gfloat y;
|
||||
ClutterModifierType modifier_state;
|
||||
gdouble *axes; /* Future use */
|
||||
ClutterInputDevice *device; /* Future use */
|
||||
@ -384,8 +384,8 @@ struct _ClutterScrollEvent
|
||||
ClutterEventFlags flags;
|
||||
ClutterStage *stage;
|
||||
ClutterActor *source;
|
||||
gint x;
|
||||
gint y;
|
||||
gfloat x;
|
||||
gfloat y;
|
||||
ClutterScrollDirection direction;
|
||||
ClutterModifierType modifier_state;
|
||||
gdouble *axes; /* future use */
|
||||
@ -451,8 +451,8 @@ ClutterEventType clutter_event_type (ClutterEvent *event);
|
||||
guint32 clutter_event_get_time (ClutterEvent *event);
|
||||
ClutterModifierType clutter_event_get_state (ClutterEvent *event);
|
||||
void clutter_event_get_coords (ClutterEvent *event,
|
||||
gint *x,
|
||||
gint *y);
|
||||
gfloat *x,
|
||||
gfloat *y);
|
||||
gint clutter_event_get_device_id (ClutterEvent *event);
|
||||
ClutterActor* clutter_event_get_source (ClutterEvent *event);
|
||||
|
||||
|
@ -120,13 +120,13 @@ clutter_group_pick (ClutterActor *actor,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_fixed_layout_get_preferred_width (GList *children,
|
||||
ClutterUnit *min_width_p,
|
||||
ClutterUnit *natural_width_p)
|
||||
clutter_fixed_layout_get_preferred_width (GList *children,
|
||||
gfloat *min_width_p,
|
||||
gfloat *natural_width_p)
|
||||
{
|
||||
GList *l;
|
||||
ClutterUnit min_left, min_right;
|
||||
ClutterUnit natural_left, natural_right;
|
||||
gfloat min_left, min_right;
|
||||
gfloat natural_left, natural_right;
|
||||
|
||||
min_left = 0;
|
||||
min_right = 0;
|
||||
@ -136,9 +136,9 @@ clutter_fixed_layout_get_preferred_width (GList *children,
|
||||
for (l = children; l != NULL; l = l->next)
|
||||
{
|
||||
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,
|
||||
&child_min, NULL,
|
||||
@ -196,13 +196,13 @@ clutter_fixed_layout_get_preferred_width (GList *children,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_fixed_layout_get_preferred_height (GList *children,
|
||||
ClutterUnit *min_height_p,
|
||||
ClutterUnit *natural_height_p)
|
||||
clutter_fixed_layout_get_preferred_height (GList *children,
|
||||
gfloat *min_height_p,
|
||||
gfloat *natural_height_p)
|
||||
{
|
||||
GList *l;
|
||||
ClutterUnit min_top, min_bottom;
|
||||
ClutterUnit natural_top, natural_bottom;
|
||||
gfloat min_top, min_bottom;
|
||||
gfloat natural_top, natural_bottom;
|
||||
|
||||
min_top = 0;
|
||||
min_bottom = 0;
|
||||
@ -212,9 +212,9 @@ clutter_fixed_layout_get_preferred_height (GList *children,
|
||||
for (l = children; l != NULL; l = l->next)
|
||||
{
|
||||
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,
|
||||
NULL, &child_min,
|
||||
@ -286,9 +286,9 @@ clutter_fixed_layout_allocate (GList *children,
|
||||
|
||||
static void
|
||||
clutter_group_get_preferred_width (ClutterActor *self,
|
||||
ClutterUnit for_height,
|
||||
ClutterUnit *min_width_p,
|
||||
ClutterUnit *natural_width_p)
|
||||
gfloat for_height,
|
||||
gfloat *min_width_p,
|
||||
gfloat *natural_width_p)
|
||||
{
|
||||
ClutterGroupPrivate *priv = CLUTTER_GROUP (self)->priv;
|
||||
|
||||
@ -300,9 +300,9 @@ clutter_group_get_preferred_width (ClutterActor *self,
|
||||
|
||||
static void
|
||||
clutter_group_get_preferred_height (ClutterActor *self,
|
||||
ClutterUnit for_width,
|
||||
ClutterUnit *min_height_p,
|
||||
ClutterUnit *natural_height_p)
|
||||
gfloat for_width,
|
||||
gfloat *min_height_p,
|
||||
gfloat *natural_height_p)
|
||||
{
|
||||
ClutterGroupPrivate *priv = CLUTTER_GROUP (self)->priv;
|
||||
|
||||
|
@ -119,7 +119,7 @@ clutter_get_show_fps (void)
|
||||
void
|
||||
_clutter_stage_maybe_relayout (ClutterActor *stage)
|
||||
{
|
||||
ClutterUnit natural_width, natural_height;
|
||||
gfloat natural_width, natural_height;
|
||||
ClutterActorBox box = { 0, };
|
||||
|
||||
/* avoid reentrancy */
|
||||
@ -140,8 +140,8 @@ _clutter_stage_maybe_relayout (ClutterActor *stage)
|
||||
box.y2 = natural_height;
|
||||
|
||||
CLUTTER_NOTE (ACTOR, "Allocating (0, 0 - %d, %d) for the stage",
|
||||
CLUTTER_UNITS_TO_DEVICE (natural_width),
|
||||
CLUTTER_UNITS_TO_DEVICE (natural_height));
|
||||
(int) natural_width,
|
||||
(int) natural_height);
|
||||
|
||||
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)
|
||||
{
|
||||
ClutterPerspective perspective;
|
||||
guint width, height;
|
||||
gfloat width, height;
|
||||
|
||||
clutter_actor_get_size (CLUTTER_ACTOR (stage), &width, &height);
|
||||
clutter_stage_get_perspective (stage, &perspective);
|
||||
@ -1931,8 +1931,8 @@ generate_enter_leave_events (ClutterEvent *event)
|
||||
{
|
||||
if (motion_current_actor)
|
||||
{
|
||||
gint x, y;
|
||||
ClutterEvent cev;
|
||||
gfloat x, y;
|
||||
|
||||
cev.crossing.device = device;
|
||||
clutter_event_get_coords (event, &x, &y);
|
||||
@ -2153,7 +2153,7 @@ clutter_do_event (ClutterEvent *event)
|
||||
case CLUTTER_SCROLL:
|
||||
{
|
||||
ClutterActor *actor;
|
||||
gint x,y;
|
||||
gfloat x, y;
|
||||
|
||||
clutter_event_get_coords (event, &x, &y);
|
||||
|
||||
@ -2170,7 +2170,7 @@ clutter_do_event (ClutterEvent *event)
|
||||
if (event->type == CLUTTER_BUTTON_RELEASE)
|
||||
{
|
||||
CLUTTER_NOTE (EVENT,
|
||||
"Release off stage received at %i, %i",
|
||||
"Release off stage received at %.2f, %.2f",
|
||||
x, y);
|
||||
|
||||
event->button.source = stage;
|
||||
@ -2196,12 +2196,14 @@ clutter_do_event (ClutterEvent *event)
|
||||
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
CLUTTER_NOTE (EVENT, "Reactive event received at %i, %i - actor: %p",
|
||||
x, y, actor);
|
||||
CLUTTER_NOTE (EVENT,
|
||||
"Reactive event received at %.2f, %.2f - actor: %p",
|
||||
x, y,
|
||||
actor);
|
||||
|
||||
/* Create, enter/leave events if needed */
|
||||
generate_enter_leave_events (event);
|
||||
|
@ -193,15 +193,15 @@ void _clutter_backend_init_events (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);
|
||||
|
||||
/* Picking code */
|
||||
ClutterActor *_clutter_do_pick (ClutterStage *stage,
|
||||
gint x,
|
||||
gint y,
|
||||
ClutterPickMode mode);
|
||||
ClutterActor *_clutter_do_pick (ClutterStage *stage,
|
||||
gint x,
|
||||
gint y,
|
||||
ClutterPickMode mode);
|
||||
|
||||
guint _clutter_pixel_to_id (guchar pixel[4]);
|
||||
|
||||
|
@ -127,9 +127,9 @@ static const ClutterColor default_stage_color = { 255, 255, 255, 255 };
|
||||
|
||||
static void
|
||||
clutter_stage_get_preferred_width (ClutterActor *self,
|
||||
ClutterUnit for_height,
|
||||
ClutterUnit *min_width_p,
|
||||
ClutterUnit *natural_width_p)
|
||||
gfloat for_height,
|
||||
gfloat *min_width_p,
|
||||
gfloat *natural_width_p)
|
||||
{
|
||||
ClutterStagePrivate *priv = CLUTTER_STAGE (self)->priv;
|
||||
|
||||
@ -143,9 +143,9 @@ clutter_stage_get_preferred_width (ClutterActor *self,
|
||||
|
||||
static void
|
||||
clutter_stage_get_preferred_height (ClutterActor *self,
|
||||
ClutterUnit for_width,
|
||||
ClutterUnit *min_height_p,
|
||||
ClutterUnit *natural_height_p)
|
||||
gfloat for_width,
|
||||
gfloat *min_height_p,
|
||||
gfloat *natural_height_p)
|
||||
{
|
||||
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
|
||||
* allocation chain.
|
||||
*/
|
||||
if (G_LIKELY (!clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC)))
|
||||
if ((!clutter_feature_available (CLUTTER_FEATURE_STAGE_STATIC)))
|
||||
{
|
||||
ClutterActorClass *klass;
|
||||
|
||||
CLUTTER_NOTE (ACTOR, "Following allocation to %dx%d (origin %s)",
|
||||
CLUTTER_UNITS_TO_DEVICE (box->x2 - box->x1),
|
||||
CLUTTER_UNITS_TO_DEVICE (box->y2 - box->y1),
|
||||
CLUTTER_NOTE (LAYOUT,
|
||||
"Following allocation to %dx%d (origin %s)",
|
||||
(int) (box->x2 - box->x1),
|
||||
(int) (box->y2 - box->y1),
|
||||
origin_changed ? "changed" : "not changed");
|
||||
|
||||
klass = CLUTTER_ACTOR_CLASS (clutter_stage_parent_class);
|
||||
@ -188,7 +189,7 @@ clutter_stage_allocate (ClutterActor *self,
|
||||
{
|
||||
ClutterActorBox override = { 0, };
|
||||
ClutterActorClass *klass;
|
||||
ClutterUnit natural_width, natural_height;
|
||||
gfloat natural_width, natural_height;
|
||||
|
||||
/* propagate the allocation */
|
||||
klass = CLUTTER_ACTOR_GET_CLASS (priv->impl);
|
||||
@ -204,6 +205,15 @@ clutter_stage_allocate (ClutterActor *self,
|
||||
override.x2 = natural_width;
|
||||
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 */
|
||||
klass = CLUTTER_ACTOR_CLASS (clutter_stage_parent_class);
|
||||
klass->allocate (self, &override, origin_changed);
|
||||
@ -320,7 +330,7 @@ static void
|
||||
clutter_stage_real_fullscreen (ClutterStage *stage)
|
||||
{
|
||||
ClutterStagePrivate *priv = stage->priv;
|
||||
ClutterUnit natural_width, natural_height;
|
||||
gfloat natural_width, natural_height;
|
||||
ClutterActorBox box;
|
||||
|
||||
/* we need to force an allocation here because the size
|
||||
|
@ -87,10 +87,10 @@ struct _LayoutCache
|
||||
PangoLayout *layout;
|
||||
|
||||
/* The width that was used to generate this layout */
|
||||
ClutterUnit width;
|
||||
gfloat width;
|
||||
|
||||
/* 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
|
||||
* new layout is needed the last used cache is replaced)
|
||||
@ -240,8 +240,8 @@ clutter_text_clear_selection (ClutterText *self)
|
||||
|
||||
static PangoLayout *
|
||||
clutter_text_create_layout_no_cache (ClutterText *text,
|
||||
ClutterUnit allocation_width,
|
||||
ClutterUnit allocation_height)
|
||||
gfloat allocation_width,
|
||||
gfloat allocation_height)
|
||||
{
|
||||
ClutterTextPrivate *priv = text->priv;
|
||||
PangoLayout *layout;
|
||||
@ -386,8 +386,8 @@ clutter_text_font_changed_cb (ClutterText *text)
|
||||
*/
|
||||
static PangoLayout *
|
||||
clutter_text_create_layout (ClutterText *text,
|
||||
ClutterUnit allocation_width,
|
||||
ClutterUnit allocation_height)
|
||||
gfloat allocation_width,
|
||||
gfloat allocation_height)
|
||||
{
|
||||
ClutterTextPrivate *priv = text->priv;
|
||||
LayoutCache *oldest_cache = priv->cached_layouts;
|
||||
@ -484,9 +484,9 @@ clutter_text_coords_to_position (ClutterText *text,
|
||||
static gboolean
|
||||
clutter_text_position_to_coords (ClutterText *self,
|
||||
gint position,
|
||||
ClutterUnit *x,
|
||||
ClutterUnit *y,
|
||||
ClutterUnit *line_height)
|
||||
gfloat *x,
|
||||
gfloat *y,
|
||||
gfloat *line_height)
|
||||
{
|
||||
ClutterTextPrivate *priv = self->priv;
|
||||
PangoRectangle rect;
|
||||
@ -535,7 +535,7 @@ static inline void
|
||||
clutter_text_ensure_cursor_position (ClutterText *self)
|
||||
{
|
||||
ClutterTextPrivate *priv = self->priv;
|
||||
ClutterUnit x, y, cursor_height;
|
||||
gfloat x, y, cursor_height;
|
||||
ClutterGeometry cursor_pos = { 0, };
|
||||
gboolean x_changed, y_changed;
|
||||
gboolean width_changed, height_changed;
|
||||
@ -922,7 +922,7 @@ cursor_paint (ClutterText *self)
|
||||
gint i;
|
||||
gint index_;
|
||||
gint maxindex;
|
||||
ClutterUnit y, height;
|
||||
gfloat y, height;
|
||||
|
||||
line = pango_layout_get_line_readonly (layout, line_no);
|
||||
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);
|
||||
ClutterTextPrivate *priv = self->priv;
|
||||
gboolean res = FALSE;
|
||||
ClutterUnit x, y;
|
||||
gfloat x, y;
|
||||
gint index_;
|
||||
|
||||
/* we'll steal keyfocus if we do not have it */
|
||||
@ -1186,9 +1186,9 @@ clutter_text_motion (ClutterActor *actor,
|
||||
{
|
||||
ClutterText *ttext = CLUTTER_TEXT (actor);
|
||||
ClutterTextPrivate *priv = ttext->priv;
|
||||
ClutterUnit x, y;
|
||||
gint index_;
|
||||
const gchar *text;
|
||||
gfloat x, y;
|
||||
gint index_;
|
||||
const gchar *text;
|
||||
|
||||
if (!priv->in_select_drag)
|
||||
return FALSE;
|
||||
@ -1401,16 +1401,16 @@ clutter_text_paint (ClutterActor *self)
|
||||
|
||||
static void
|
||||
clutter_text_get_preferred_width (ClutterActor *self,
|
||||
ClutterUnit for_height,
|
||||
ClutterUnit *min_width_p,
|
||||
ClutterUnit *natural_width_p)
|
||||
gfloat for_height,
|
||||
gfloat *min_width_p,
|
||||
gfloat *natural_width_p)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (self);
|
||||
ClutterTextPrivate *priv = text->priv;
|
||||
PangoRectangle logical_rect = { 0, };
|
||||
PangoLayout *layout;
|
||||
gint logical_width;
|
||||
ClutterUnit layout_width;
|
||||
gfloat layout_width;
|
||||
|
||||
layout = clutter_text_create_layout (text, -1, -1);
|
||||
|
||||
@ -1440,9 +1440,9 @@ clutter_text_get_preferred_width (ClutterActor *self,
|
||||
|
||||
static void
|
||||
clutter_text_get_preferred_height (ClutterActor *self,
|
||||
ClutterUnit for_width,
|
||||
ClutterUnit *min_height_p,
|
||||
ClutterUnit *natural_height_p)
|
||||
gfloat for_width,
|
||||
gfloat *min_height_p,
|
||||
gfloat *natural_height_p)
|
||||
{
|
||||
ClutterText *text = CLUTTER_TEXT (self);
|
||||
|
||||
@ -1459,7 +1459,7 @@ clutter_text_get_preferred_height (ClutterActor *self,
|
||||
PangoLayout *layout;
|
||||
PangoRectangle logical_rect = { 0, };
|
||||
gint logical_height;
|
||||
ClutterUnit layout_height;
|
||||
gfloat layout_height;
|
||||
|
||||
layout = clutter_text_create_layout (text, for_width, -1);
|
||||
|
||||
@ -3284,11 +3284,11 @@ clutter_text_set_markup (ClutterText *self,
|
||||
PangoLayout *
|
||||
clutter_text_get_layout (ClutterText *self)
|
||||
{
|
||||
ClutterUnit width, height;
|
||||
gfloat width, height;
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -77,8 +77,8 @@ typedef struct _ClutterTextureAsyncData ClutterTextureAsyncData;
|
||||
|
||||
struct _ClutterTexturePrivate
|
||||
{
|
||||
gint width;
|
||||
gint height;
|
||||
gfloat width;
|
||||
gfloat height;
|
||||
gint max_tile_waste;
|
||||
ClutterTextureQuality filter_quality;
|
||||
CoglHandle material;
|
||||
@ -351,9 +351,9 @@ clutter_texture_realize (ClutterActor *actor)
|
||||
|
||||
static void
|
||||
clutter_texture_get_preferred_width (ClutterActor *self,
|
||||
ClutterUnit for_height,
|
||||
ClutterUnit *min_width_p,
|
||||
ClutterUnit *natural_width_p)
|
||||
gfloat for_height,
|
||||
gfloat *min_width_p,
|
||||
gfloat *natural_width_p)
|
||||
{
|
||||
ClutterTexture *texture = CLUTTER_TEXTURE (self);
|
||||
ClutterTexturePrivate *priv = texture->priv;
|
||||
@ -370,19 +370,14 @@ clutter_texture_get_preferred_width (ClutterActor *self,
|
||||
for_height < 0 ||
|
||||
priv->height <= 0)
|
||||
{
|
||||
*natural_width_p = CLUTTER_UNITS_FROM_DEVICE (priv->width);
|
||||
*natural_width_p = priv->width;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 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);
|
||||
|
||||
height = CLUTTER_UNITS_TO_FLOAT (for_height);
|
||||
|
||||
*natural_width_p =
|
||||
CLUTTER_UNITS_FROM_FLOAT (ratio * height);
|
||||
*natural_width_p = ratio * for_height;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -395,9 +390,9 @@ clutter_texture_get_preferred_width (ClutterActor *self,
|
||||
|
||||
static void
|
||||
clutter_texture_get_preferred_height (ClutterActor *self,
|
||||
ClutterUnit for_width,
|
||||
ClutterUnit *min_height_p,
|
||||
ClutterUnit *natural_height_p)
|
||||
gfloat for_width,
|
||||
gfloat *min_height_p,
|
||||
gfloat *natural_height_p)
|
||||
{
|
||||
ClutterTexture *texture = CLUTTER_TEXTURE (self);
|
||||
ClutterTexturePrivate *priv = texture->priv;
|
||||
@ -414,19 +409,14 @@ clutter_texture_get_preferred_height (ClutterActor *self,
|
||||
for_width < 0 ||
|
||||
priv->width <= 0)
|
||||
{
|
||||
*natural_height_p = CLUTTER_UNITS_FROM_DEVICE (priv->height);
|
||||
*natural_height_p = priv->height;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 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);
|
||||
|
||||
width = CLUTTER_UNITS_TO_FLOAT (for_width);
|
||||
|
||||
*natural_height_p =
|
||||
CLUTTER_UNITS_FROM_FLOAT (ratio * width);
|
||||
*natural_height_p = ratio * for_width;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -460,7 +450,7 @@ clutter_texture_set_fbo_projection (ClutterActor *self)
|
||||
ClutterTexturePrivate *priv = CLUTTER_TEXTURE (self)->priv;
|
||||
ClutterVertex verts[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 tan_angle, near_size;
|
||||
ClutterPerspective perspective;
|
||||
@ -495,13 +485,13 @@ clutter_texture_set_fbo_projection (ClutterActor *self)
|
||||
/* Convert the coordinates back to [-1,1] range */
|
||||
cogl_get_viewport (viewport);
|
||||
|
||||
tx_min = (CLUTTER_UNITS_TO_FLOAT (x_min) / viewport[2])
|
||||
tx_min = (x_min / viewport[2])
|
||||
* 2 - 1.0;
|
||||
tx_max = (CLUTTER_UNITS_TO_FLOAT (x_max) / viewport[2])
|
||||
tx_max = (x_max / viewport[2])
|
||||
* 2 - 1.0;
|
||||
ty_min = (CLUTTER_UNITS_TO_FLOAT (y_min) / viewport[3])
|
||||
ty_min = (y_min / viewport[3])
|
||||
* 2 - 1.0;
|
||||
ty_max = (CLUTTER_UNITS_TO_FLOAT (y_max) / viewport[3])
|
||||
ty_max = (y_max / viewport[3])
|
||||
* 2 - 1.0;
|
||||
|
||||
/* Set up a projection matrix so that the actor will be projected as
|
||||
@ -558,8 +548,8 @@ clutter_texture_paint (ClutterActor *self)
|
||||
|
||||
if ((stage = clutter_actor_get_stage (self)))
|
||||
{
|
||||
guint stage_width, stage_height;
|
||||
ClutterActor *source_parent;
|
||||
gfloat stage_width, stage_height;
|
||||
ClutterActor *source_parent;
|
||||
|
||||
clutter_stage_get_perspective (CLUTTER_STAGE (stage), &perspective);
|
||||
clutter_actor_get_size (stage, &stage_width, &stage_height);
|
||||
@ -571,6 +561,7 @@ clutter_texture_paint (ClutterActor *self)
|
||||
perspective.aspect,
|
||||
perspective.z_near,
|
||||
perspective.z_far);
|
||||
|
||||
/* Use a projection matrix that makes the actor appear as it
|
||||
would if it was rendered at its normal screen location */
|
||||
clutter_texture_set_fbo_projection (self);
|
||||
@ -1445,7 +1436,7 @@ clutter_texture_set_cogl_texture (ClutterTexture *texture,
|
||||
priv->width = width;
|
||||
priv->height = height;
|
||||
|
||||
CLUTTER_NOTE (TEXTURE, "set size %ix%i\n",
|
||||
CLUTTER_NOTE (TEXTURE, "set size %.2fx%.2f\n",
|
||||
priv->width,
|
||||
priv->height);
|
||||
|
||||
@ -2310,7 +2301,7 @@ on_fbo_source_size_change (GObject *object,
|
||||
ClutterTexture *texture)
|
||||
{
|
||||
ClutterTexturePrivate *priv = texture->priv;
|
||||
guint w, h;
|
||||
gfloat 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;
|
||||
ClutterTexturePrivate *priv;
|
||||
guint w, h;
|
||||
gfloat w, h;
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (actor), NULL);
|
||||
|
||||
@ -2523,8 +2514,8 @@ clutter_texture_new_from_actor (ClutterActor *actor)
|
||||
G_CALLBACK(on_fbo_parent_change),
|
||||
texture);
|
||||
|
||||
priv->width = w;
|
||||
priv->height = h;
|
||||
priv->width = w;
|
||||
priv->height = h;
|
||||
|
||||
clutter_actor_set_size (CLUTTER_ACTOR (texture), priv->width, priv->height);
|
||||
|
||||
|
@ -106,15 +106,15 @@ GType clutter_geometry_get_type (void) G_GNUC_CONST;
|
||||
* @y: Y 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
|
||||
*/
|
||||
struct _ClutterVertex
|
||||
{
|
||||
ClutterUnit x;
|
||||
ClutterUnit y;
|
||||
ClutterUnit z;
|
||||
gfloat x;
|
||||
gfloat y;
|
||||
gfloat z;
|
||||
};
|
||||
|
||||
GType clutter_vertex_get_type (void) G_GNUC_CONST;
|
||||
|
@ -221,9 +221,9 @@ clutter_stage_egl_realize (ClutterActor *actor)
|
||||
|
||||
static void
|
||||
clutter_stage_egl_get_preferred_width (ClutterActor *self,
|
||||
ClutterUnit for_height,
|
||||
ClutterUnit *min_width_p,
|
||||
ClutterUnit *natural_width_p)
|
||||
gfloat for_height,
|
||||
gfloat *min_width_p,
|
||||
gfloat *natural_width_p)
|
||||
{
|
||||
ClutterStageEGL *stage_egl = CLUTTER_STAGE_EGL (self);
|
||||
|
||||
@ -236,9 +236,9 @@ clutter_stage_egl_get_preferred_width (ClutterActor *self,
|
||||
|
||||
static void
|
||||
clutter_stage_egl_get_preferred_height (ClutterActor *self,
|
||||
ClutterUnit for_width,
|
||||
ClutterUnit *min_height_p,
|
||||
ClutterUnit *natural_height_p)
|
||||
gfloat for_width,
|
||||
gfloat *min_height_p,
|
||||
gfloat *natural_height_p)
|
||||
{
|
||||
ClutterStageEGL *stage_egl = CLUTTER_STAGE_EGL (self);
|
||||
|
||||
|
@ -190,9 +190,9 @@ clutter_stage_egl_realize (ClutterActor *actor)
|
||||
|
||||
static void
|
||||
clutter_stage_egl_get_preferred_width (ClutterActor *self,
|
||||
ClutterUnit for_height,
|
||||
ClutterUnit *min_width_p,
|
||||
ClutterUnit *natural_width_p)
|
||||
gfloat for_height,
|
||||
gfloat *min_width_p,
|
||||
gfloat *natural_width_p)
|
||||
{
|
||||
ClutterStageEGL *stage_egl = CLUTTER_STAGE_EGL (self);
|
||||
|
||||
@ -205,9 +205,9 @@ clutter_stage_egl_get_preferred_width (ClutterActor *self,
|
||||
|
||||
static void
|
||||
clutter_stage_egl_get_preferred_height (ClutterActor *self,
|
||||
ClutterUnit for_width,
|
||||
ClutterUnit *min_height_p,
|
||||
ClutterUnit *natural_height_p)
|
||||
gfloat for_width,
|
||||
gfloat *min_height_p,
|
||||
gfloat *natural_height_p)
|
||||
{
|
||||
ClutterStageEGL *stage_egl = CLUTTER_STAGE_EGL (self);
|
||||
|
||||
|
@ -367,9 +367,9 @@ clutter_stage_osx_hide (ClutterActor *actor)
|
||||
|
||||
static void
|
||||
clutter_stage_osx_get_preferred_width (ClutterActor *actor,
|
||||
ClutterUnit for_height,
|
||||
ClutterUnit *min_width_p,
|
||||
ClutterUnit *natural_width_p)
|
||||
gfloat for_height,
|
||||
gfloat *min_width_p,
|
||||
gfloat *natural_width_p)
|
||||
{
|
||||
ClutterStageOSX *self = CLUTTER_STAGE_OSX (actor);
|
||||
gboolean is_resizable;
|
||||
@ -394,9 +394,9 @@ clutter_stage_osx_get_preferred_width (ClutterActor *actor,
|
||||
|
||||
static void
|
||||
clutter_stage_osx_get_preferred_height (ClutterActor *actor,
|
||||
ClutterUnit for_width,
|
||||
ClutterUnit *min_height_p,
|
||||
ClutterUnit *natural_height_p)
|
||||
gfloat for_width,
|
||||
gfloat *min_height_p,
|
||||
gfloat *natural_height_p)
|
||||
{
|
||||
ClutterStageOSX *self = CLUTTER_STAGE_OSX (actor);
|
||||
gboolean is_resizable;
|
||||
|
@ -103,9 +103,9 @@ clutter_stage_sdl_realize (ClutterActor *actor)
|
||||
|
||||
static void
|
||||
clutter_stage_sdl_get_preferred_width (ClutterActor *self,
|
||||
ClutterUnit for_height,
|
||||
ClutterUnit *min_width_p,
|
||||
ClutterUnit *natural_width_p)
|
||||
gfloat for_height,
|
||||
gfloat *min_width_p,
|
||||
gfloat *natural_width_p)
|
||||
{
|
||||
ClutterStageSDL *stage_sdl = CLUTTER_STAGE_SDL (self);
|
||||
|
||||
@ -118,9 +118,9 @@ clutter_stage_sdl_get_preferred_width (ClutterActor *self,
|
||||
|
||||
static void
|
||||
clutter_stage_sdl_get_preferred_height (ClutterActor *self,
|
||||
ClutterUnit for_width,
|
||||
ClutterUnit *min_height_p,
|
||||
ClutterUnit *natural_height_p)
|
||||
gfloat for_width,
|
||||
gfloat *min_height_p,
|
||||
gfloat *natural_height_p)
|
||||
{
|
||||
ClutterStageSDL *stage_sdl = CLUTTER_STAGE_SDL (self);
|
||||
|
||||
|
@ -81,9 +81,9 @@ clutter_stage_win32_hide (ClutterActor *actor)
|
||||
|
||||
static void
|
||||
clutter_stage_win32_get_preferred_width (ClutterActor *self,
|
||||
ClutterUnit for_height,
|
||||
ClutterUnit *min_width_p,
|
||||
ClutterUnit *natural_width_p)
|
||||
gfloat for_height,
|
||||
gfloat *min_width_p,
|
||||
gfloat *natural_width_p)
|
||||
{
|
||||
ClutterStageWin32 *stage_win32 = CLUTTER_STAGE_WIN32 (self);
|
||||
int width;
|
||||
@ -105,9 +105,9 @@ clutter_stage_win32_get_preferred_width (ClutterActor *self,
|
||||
|
||||
static void
|
||||
clutter_stage_win32_get_preferred_height (ClutterActor *self,
|
||||
ClutterUnit for_width,
|
||||
ClutterUnit *min_height_p,
|
||||
ClutterUnit *natural_height_p)
|
||||
gfloat for_width,
|
||||
gfloat *min_height_p,
|
||||
gfloat *natural_height_p)
|
||||
{
|
||||
ClutterStageWin32 *stage_win32 = CLUTTER_STAGE_WIN32 (self);
|
||||
int height;
|
||||
|
@ -94,7 +94,7 @@ clutter_stage_x11_fix_window_size (ClutterStageX11 *stage_x11)
|
||||
if (stage_x11->xwin != None && stage_x11->is_foreign_xwin == FALSE)
|
||||
{
|
||||
XSizeHints *size_hints;
|
||||
ClutterUnit min_width, min_height;
|
||||
gfloat min_width, min_height;
|
||||
|
||||
size_hints = XAllocSizeHints();
|
||||
|
||||
@ -172,9 +172,9 @@ clutter_stage_x11_set_wm_protocols (ClutterStageX11 *stage_x11)
|
||||
|
||||
static void
|
||||
clutter_stage_x11_get_preferred_width (ClutterActor *self,
|
||||
ClutterUnit for_height,
|
||||
ClutterUnit *min_width_p,
|
||||
ClutterUnit *natural_width_p)
|
||||
gfloat for_height,
|
||||
gfloat *min_width_p,
|
||||
gfloat *natural_width_p)
|
||||
{
|
||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (self);
|
||||
gboolean resize;
|
||||
@ -211,9 +211,9 @@ clutter_stage_x11_get_preferred_width (ClutterActor *self,
|
||||
|
||||
static void
|
||||
clutter_stage_x11_get_preferred_height (ClutterActor *self,
|
||||
ClutterUnit for_width,
|
||||
ClutterUnit *min_height_p,
|
||||
ClutterUnit *natural_height_p)
|
||||
gfloat for_width,
|
||||
gfloat *min_height_p,
|
||||
gfloat *natural_height_p)
|
||||
{
|
||||
ClutterStageX11 *stage_x11 = CLUTTER_STAGE_X11 (self);
|
||||
gboolean resize;
|
||||
|
@ -417,8 +417,8 @@ test_rotate_center (TestState *state)
|
||||
gdouble angle_x, angle_y, angle_z;
|
||||
ClutterVertex *center_x, *center_y, *center_z;
|
||||
ClutterGravity z_center_gravity;
|
||||
guint stage_width, stage_height;
|
||||
gint rect_x, rect_y;
|
||||
gfloat stage_width, stage_height;
|
||||
gfloat rect_x, rect_y;
|
||||
int i;
|
||||
|
||||
/* 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
|
||||
easier */
|
||||
clutter_actor_get_size (clutter_actor_get_stage (rect),
|
||||
&stage_width, &stage_height);
|
||||
&stage_width,
|
||||
&stage_height);
|
||||
rect_x = stage_width / 2;
|
||||
rect_y = stage_height / 2;
|
||||
clutter_actor_set_position (rect, rect_x, rect_y);
|
||||
|
||||
/* Assert the default settings */
|
||||
g_assert (clutter_actor_get_x (rect) == rect_x);
|
||||
g_assert (clutter_actor_get_y (rect) == rect_y);
|
||||
g_assert (clutter_actor_get_width (rect) == RECT_WIDTH);
|
||||
g_assert (clutter_actor_get_height (rect) == RECT_HEIGHT);
|
||||
g_assert_cmpfloat (clutter_actor_get_x (rect), ==, rect_x);
|
||||
g_assert_cmpfloat (clutter_actor_get_y (rect), ==, rect_y);
|
||||
g_assert_cmpfloat (clutter_actor_get_width (rect), ==, RECT_WIDTH);
|
||||
g_assert_cmpfloat (clutter_actor_get_height (rect), ==, RECT_HEIGHT);
|
||||
g_object_get (rect,
|
||||
"rotation-angle-x", &angle_x,
|
||||
"rotation-angle-y", &angle_y,
|
||||
|
@ -76,7 +76,6 @@ frame_tick (gpointer data)
|
||||
{
|
||||
TestState *state = data;
|
||||
GTimeVal cur_tick = { 0, };
|
||||
GSList *l;
|
||||
gulong msecs;
|
||||
|
||||
g_get_current_time (&cur_tick);
|
||||
|
@ -139,7 +139,6 @@ frame_tick (gpointer data)
|
||||
{
|
||||
TestState *state = data;
|
||||
GTimeVal cur_tick = { 0, };
|
||||
GSList *l;
|
||||
gulong msecs;
|
||||
|
||||
g_get_current_time (&cur_tick);
|
||||
|
@ -75,7 +75,6 @@ frame_tick (gpointer data)
|
||||
{
|
||||
TestState *state = data;
|
||||
GTimeVal cur_tick = { 0, };
|
||||
GSList *l;
|
||||
gulong msecs;
|
||||
|
||||
g_get_current_time (&cur_tick);
|
||||
|
@ -89,7 +89,6 @@ frame_tick (gpointer data)
|
||||
{
|
||||
TestState *state = data;
|
||||
GTimeVal cur_tick = { 0, };
|
||||
GSList *l;
|
||||
gulong msecs;
|
||||
|
||||
g_get_current_time (&cur_tick);
|
||||
|
@ -48,12 +48,12 @@ input_cb (ClutterActor *stage,
|
||||
{
|
||||
ClutterButtonEvent *button_event;
|
||||
ClutterActor *e;
|
||||
gint x, y;
|
||||
gfloat x, y;
|
||||
|
||||
clutter_event_get_coords (event, &x, &y);
|
||||
|
||||
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,
|
||||
x, y);
|
||||
|
||||
|
@ -48,12 +48,12 @@ input_cb (ClutterActor *stage,
|
||||
{
|
||||
ClutterButtonEvent *button_event;
|
||||
ClutterActor *e;
|
||||
gint x, y;
|
||||
gfloat x, y;
|
||||
|
||||
clutter_event_get_coords (event, &x, &y);
|
||||
|
||||
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,
|
||||
x, y);
|
||||
|
||||
|
@ -21,8 +21,8 @@ on_button_press (ClutterActor *actor,
|
||||
gpointer dummy)
|
||||
{
|
||||
ClutterAnimation *animation;
|
||||
gint old_x, old_y, new_x, new_y;
|
||||
guint old_width, old_height, new_width, new_height;
|
||||
gfloat old_x, old_y, new_x, new_y;
|
||||
gfloat old_width, old_height, new_width, new_height;
|
||||
gdouble new_angle;
|
||||
ClutterVertex vertex = { 0, };
|
||||
ClutterColor new_color = { 0, };
|
||||
@ -65,10 +65,10 @@ on_button_press (ClutterActor *actor,
|
||||
|
||||
animation =
|
||||
clutter_actor_animate (actor, CLUTTER_EASE_IN_EXPO, 2000,
|
||||
"x", new_x,
|
||||
"y", new_y,
|
||||
"width", new_width,
|
||||
"height", new_height,
|
||||
"x", (int) new_x,
|
||||
"y", (int) new_y,
|
||||
"width", (int) new_width,
|
||||
"height", (int) new_height,
|
||||
"color", &new_color,
|
||||
"rotation-angle-z", new_angle,
|
||||
"fixed::rotation-center-z", &vertex,
|
||||
|
@ -186,11 +186,11 @@ test_clutter_cairo_flowers_main (int argc, char **argv)
|
||||
{
|
||||
flowers[i] = g_new0(Flower, 1);
|
||||
flowers[i]->ctex = make_flower_actor();
|
||||
flowers[i]->x = rand() % clutter_actor_get_width(stage)
|
||||
- (PETAL_MIN+PETAL_VAR)*2;
|
||||
flowers[i]->y = rand() % clutter_actor_get_height(stage);
|
||||
flowers[i]->rv = rand() % 5 + 1;
|
||||
flowers[i]->v = rand() % 10 + 2;
|
||||
flowers[i]->x = rand() % (int) clutter_actor_get_width (stage)
|
||||
- (PETAL_MIN + PETAL_VAR) * 2;
|
||||
flowers[i]->y = rand() % (int) clutter_actor_get_height (stage);
|
||||
flowers[i]->rv = rand() % 5 + 1;
|
||||
flowers[i]->v = rand() % 10 + 2;
|
||||
|
||||
clutter_group_add (CLUTTER_GROUP(stage), flowers[i]->ctex);
|
||||
clutter_actor_set_position (flowers[i]->ctex,
|
||||
|
@ -26,7 +26,7 @@ raise_top (gpointer ignored)
|
||||
static ClutterActor *
|
||||
clone_box (ClutterActor *original)
|
||||
{
|
||||
guint width, height;
|
||||
gfloat width, height;
|
||||
ClutterActor *group;
|
||||
ClutterActor *clone;
|
||||
|
||||
@ -35,38 +35,39 @@ clone_box (ClutterActor *original)
|
||||
group = clutter_group_new ();
|
||||
clone = clutter_clone_new (original);
|
||||
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);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (group), clone);
|
||||
clutter_actor_set_rotation (clone, CLUTTER_Y_AXIS, 180, width/2, 0, 0);
|
||||
clutter_actor_set_depth (clone, -(gint)width/2);
|
||||
clutter_actor_set_rotation (clone, CLUTTER_Y_AXIS, 180, width / 2, 0, 0);
|
||||
clutter_actor_set_depth (clone, -width / 2);
|
||||
|
||||
clone = clutter_clone_new (original);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (group), clone);
|
||||
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);
|
||||
|
||||
clone = clutter_clone_new (original);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (group), clone);
|
||||
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);
|
||||
|
||||
clone = clutter_clone_new (original);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (group), clone);
|
||||
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);
|
||||
|
||||
clone = clutter_clone_new (original);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (group), clone);
|
||||
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_show_all (group);
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
@ -78,8 +79,8 @@ janus_group (const gchar *front_text,
|
||||
ClutterColor red = {0xff, 0x00, 0x00, 0xff};
|
||||
ClutterColor green = {0x00, 0xff, 0x00, 0xff};
|
||||
ClutterActor *group, *rectangle, *front, *back;
|
||||
guint width, height;
|
||||
guint width2, height2;
|
||||
gfloat width, height;
|
||||
gfloat width2, height2;
|
||||
|
||||
group = clutter_group_new ();
|
||||
rectangle = clutter_rectangle_new_with_color (&slide_color);
|
||||
@ -93,11 +94,12 @@ janus_group (const gchar *front_text,
|
||||
|
||||
if (width2 > width)
|
||||
width = width2;
|
||||
|
||||
if (height2 > height)
|
||||
height = height2;
|
||||
|
||||
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),
|
||||
back, rectangle, front, NULL);
|
||||
|
@ -53,8 +53,8 @@ on_button_press (ClutterActor *actor,
|
||||
if (event->button == 3)
|
||||
{
|
||||
gchar *text;
|
||||
guint stage_width, stage_height;
|
||||
guint label_width, label_height;
|
||||
gfloat stage_width, stage_height;
|
||||
gfloat label_width, label_height;
|
||||
|
||||
current_mode = (current_mode + 1 < n_easing_modes) ? current_mode + 1
|
||||
: 0;
|
||||
@ -94,8 +94,8 @@ on_button_press (ClutterActor *actor,
|
||||
|
||||
animation =
|
||||
clutter_actor_animate (rectangle, cur_mode, 2000,
|
||||
"x", event->x,
|
||||
"y", event->y,
|
||||
"x", (int) event->x,
|
||||
"y", (int) event->y,
|
||||
"color", &color,
|
||||
NULL);
|
||||
}
|
||||
@ -110,8 +110,8 @@ test_easing_main (int argc, char *argv[])
|
||||
ClutterColor stage_color = { 0x66, 0x66, 0xdd, 0xff };
|
||||
ClutterColor rect_color = { 0x44, 0xdd, 0x44, 0xff };
|
||||
gchar *text;
|
||||
guint stage_width, stage_height;
|
||||
guint label_width, label_height;
|
||||
gfloat stage_width, stage_height;
|
||||
gfloat label_width, label_height;
|
||||
|
||||
clutter_init (&argc, &argv);
|
||||
|
||||
|
@ -15,7 +15,7 @@ static int state = START;
|
||||
static void
|
||||
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_height (CLUTTER_ACTOR (stage)),
|
||||
CLUTTER_ACTOR_IS_MAPPED (stage) ? "true" : "false");
|
||||
@ -24,7 +24,7 @@ on_fullscreen (ClutterStage *stage)
|
||||
static void
|
||||
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_height (CLUTTER_ACTOR (stage)),
|
||||
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_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_height (stage),
|
||||
CLUTTER_ACTOR_IS_MAPPED (stage) ? "true" : "false");
|
||||
|
@ -237,7 +237,7 @@ my_thing_get_preferred_width (ClutterActor *self,
|
||||
|
||||
child = l->data;
|
||||
|
||||
child_x = clutter_actor_get_xu (child);
|
||||
child_x = clutter_actor_get_x (child);
|
||||
|
||||
clutter_actor_get_preferred_size (child,
|
||||
&child_min, NULL,
|
||||
@ -315,7 +315,7 @@ my_thing_get_preferred_height (ClutterActor *self,
|
||||
|
||||
child = l->data;
|
||||
|
||||
child_y = clutter_actor_get_yu (child);
|
||||
child_y = clutter_actor_get_y (child);
|
||||
|
||||
clutter_actor_get_preferred_size (child,
|
||||
NULL, &child_min,
|
||||
@ -490,8 +490,7 @@ my_thing_paint (ClutterActor *actor)
|
||||
|
||||
g_assert (child != NULL);
|
||||
|
||||
if (CLUTTER_ACTOR_IS_VISIBLE (child))
|
||||
clutter_actor_paint (child);
|
||||
clutter_actor_paint (child);
|
||||
}
|
||||
|
||||
cogl_pop_matrix();
|
||||
@ -748,7 +747,7 @@ test_layout_main (int argc, char *argv[])
|
||||
{
|
||||
ClutterActor *stage, *instructions;
|
||||
ClutterAlpha *alpha;
|
||||
gint i;
|
||||
gint i, size;
|
||||
GError *error = NULL;
|
||||
|
||||
clutter_init (&argc, &argv);
|
||||
@ -776,7 +775,12 @@ test_layout_main (int argc, char *argv[])
|
||||
if (error)
|
||||
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 ();
|
||||
|
||||
|
@ -51,7 +51,7 @@ input_cb (ClutterStage *stage,
|
||||
{
|
||||
ClutterButtonEvent *button_event;
|
||||
ClutterActor *e;
|
||||
gint x, y;
|
||||
gfloat x, y;
|
||||
|
||||
clutter_event_get_coords (event, &x, &y);
|
||||
|
||||
@ -125,7 +125,7 @@ hand_pre_paint (ClutterActor *actor,
|
||||
gpointer user_data)
|
||||
{
|
||||
SuperOH *oh = (SuperOH *) user_data;
|
||||
guint w, h;
|
||||
gfloat w, h;
|
||||
int 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)
|
||||
{
|
||||
SuperOH *oh = (SuperOH *) user_data;
|
||||
guint w, h;
|
||||
gfloat w, h;
|
||||
int actor_num;
|
||||
|
||||
for (actor_num = 0; oh->hand[actor_num] != actor; actor_num++);
|
||||
|
@ -21,19 +21,17 @@ init_handles ()
|
||||
clutter_actor_set_position (p[i], 0, 0);
|
||||
clutter_group_add (CLUTTER_GROUP (main_stage), p[i]);
|
||||
|
||||
clutter_actor_set_positionu (p[i],
|
||||
v[i].x -
|
||||
clutter_actor_get_widthu (p[i])/2,
|
||||
v[i].y -
|
||||
clutter_actor_get_heightu (p[i])/2);
|
||||
clutter_actor_set_position (p[i],
|
||||
v[i].x - clutter_actor_get_width (p[i]) / 2,
|
||||
v[i].y - clutter_actor_get_height (p[i]) / 2);
|
||||
|
||||
clutter_actor_raise_top (p[i]);
|
||||
|
||||
clutter_actor_show (p[i]);
|
||||
}
|
||||
|
||||
v1.x = clutter_actor_get_widthu (rect) / 2;
|
||||
v1.y = clutter_actor_get_heightu (rect) / 2;
|
||||
v1.x = clutter_actor_get_width (rect) / 2;
|
||||
v1.y = clutter_actor_get_height (rect) / 2;
|
||||
v1.z = 0;
|
||||
|
||||
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_position (p[4], 0, 0);
|
||||
clutter_group_add (CLUTTER_GROUP (main_stage), p[4]);
|
||||
clutter_actor_set_positionu (p[4],
|
||||
v2.x -
|
||||
clutter_actor_get_widthu (p[4])/2,
|
||||
v2.y -
|
||||
clutter_actor_get_heightu (p[4])/2);
|
||||
clutter_actor_set_position (p[4],
|
||||
v2.x - clutter_actor_get_width (p[4]) / 2,
|
||||
v2.y - clutter_actor_get_height (p[4]) / 2);
|
||||
|
||||
clutter_actor_raise_top (p[4]);
|
||||
|
||||
@ -62,21 +58,19 @@ place_handles ()
|
||||
clutter_actor_get_abs_allocation_vertices (rect, v);
|
||||
for (i = 0; i < 4; ++i)
|
||||
{
|
||||
clutter_actor_set_positionu (p[i],
|
||||
v[i].x -
|
||||
clutter_actor_get_widthu (p[i])/2,
|
||||
v[i].y -
|
||||
clutter_actor_get_heightu (p[i])/2);
|
||||
clutter_actor_set_position (p[i],
|
||||
v[i].x - clutter_actor_get_width (p[i])/2,
|
||||
v[i].y - clutter_actor_get_height (p[i])/2);
|
||||
}
|
||||
|
||||
v1.x = clutter_actor_get_widthu (rect)/2;
|
||||
v1.y = clutter_actor_get_heightu (rect)/2;
|
||||
v1.x = clutter_actor_get_width (rect) / 2;
|
||||
v1.y = clutter_actor_get_height (rect) / 2;
|
||||
v1.z = 0;
|
||||
|
||||
clutter_actor_apply_transform_to_point (rect, &v1, &v2);
|
||||
clutter_actor_set_positionu (p[4],
|
||||
v2.x - clutter_actor_get_widthu (p[4])/2,
|
||||
v2.y - clutter_actor_get_heightu (p[4])/2);
|
||||
clutter_actor_set_position (p[4],
|
||||
v2.x - clutter_actor_get_width (p[4])/2,
|
||||
v2.y - clutter_actor_get_height (p[4])/2);
|
||||
}
|
||||
|
||||
#define M(m,row,col) (m)[col*4+row]
|
||||
@ -103,8 +97,8 @@ on_event (ClutterStage *stage,
|
||||
{
|
||||
case CLUTTER_BUTTON_PRESS:
|
||||
{
|
||||
gint x, y;
|
||||
ClutterActor * actor;
|
||||
ClutterActor *actor;
|
||||
gfloat x, y;
|
||||
|
||||
clutter_event_get_coords (event, &x, &y);
|
||||
|
||||
@ -124,7 +118,7 @@ on_event (ClutterStage *stage,
|
||||
{
|
||||
if (dragging)
|
||||
{
|
||||
gint x, y;
|
||||
gfloat x, y;
|
||||
gint i;
|
||||
ClutterActorBox box1, box2;
|
||||
ClutterUnit xp, yp;
|
||||
@ -148,7 +142,7 @@ on_event (ClutterStage *stage,
|
||||
CLUTTER_UNITS_TO_FLOAT (xp),
|
||||
CLUTTER_UNITS_TO_FLOAT (yp));
|
||||
|
||||
clutter_actor_move_byu (rect, xp, yp);
|
||||
clutter_actor_move_by (rect, xp, yp);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -65,17 +65,18 @@ on_motion_idle (gpointer user_data)
|
||||
{
|
||||
CallbackData *data = (CallbackData *) user_data;
|
||||
guchar *pixels, *p;
|
||||
guint stage_width, stage_height;
|
||||
gfloat stage_width, stage_height;
|
||||
gint x, y;
|
||||
|
||||
data->idle_source = 0;
|
||||
|
||||
clutter_actor_get_size (data->stage, &stage_width, &stage_height);
|
||||
|
||||
x = CLAMP (data->event.x - TEX_SIZE / 2, 0, (int) stage_width - TEX_SIZE);
|
||||
y = CLAMP (data->event.y - TEX_SIZE / 2, 0, (int) stage_height - TEX_SIZE);
|
||||
x = CLAMP (data->event.x - TEX_SIZE / 2, 0, stage_width - 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);
|
||||
clutter_actor_show (data->box);
|
||||
/* 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));
|
||||
|
||||
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 */
|
||||
p = pixels + (TEX_SIZE / 2 - DOT_SIZE / 2) * TEX_SIZE * 4
|
||||
|
@ -23,9 +23,9 @@ on_event (ClutterStage *stage,
|
||||
{
|
||||
case CLUTTER_BUTTON_PRESS:
|
||||
{
|
||||
gint x, y;
|
||||
ClutterActor * actor;
|
||||
ClutterUnit xu2, yu2;
|
||||
ClutterActor *actor;
|
||||
gfloat xu2, yu2;
|
||||
gfloat x, y;
|
||||
|
||||
clutter_event_get_coords (event, &x, &y);
|
||||
|
||||
@ -33,10 +33,7 @@ on_event (ClutterStage *stage,
|
||||
CLUTTER_PICK_ALL,
|
||||
x, y);
|
||||
|
||||
if (clutter_actor_transform_stage_point (actor,
|
||||
CLUTTER_UNITS_FROM_DEVICE (x),
|
||||
CLUTTER_UNITS_FROM_DEVICE (y),
|
||||
&xu2, &yu2))
|
||||
if (clutter_actor_transform_stage_point (actor, x, y, &xu2, &yu2))
|
||||
{
|
||||
gchar *txt;
|
||||
|
||||
@ -44,16 +41,14 @@ on_event (ClutterStage *stage,
|
||||
txt = g_strdup_printf ("Click on rectangle\n"
|
||||
"Screen coords: [%d, %d]\n"
|
||||
"Local coords : [%d, %d]",
|
||||
x, y,
|
||||
CLUTTER_UNITS_TO_DEVICE (xu2),
|
||||
CLUTTER_UNITS_TO_DEVICE (yu2));
|
||||
(int) x, (int) y,
|
||||
(int) xu2, (int) yu2);
|
||||
else
|
||||
txt = g_strdup_printf ("Click on stage\n"
|
||||
"Screen coords: [%d, %d]\n"
|
||||
"Local coords : [%d, %d]",
|
||||
x, y,
|
||||
CLUTTER_UNITS_TO_DEVICE (xu2),
|
||||
CLUTTER_UNITS_TO_DEVICE (yu2));
|
||||
(int) x, (int) y,
|
||||
(int) xu2, (int) yu2);
|
||||
|
||||
clutter_text_set_text (CLUTTER_TEXT (label), txt);
|
||||
g_free (txt);
|
||||
|
Loading…
Reference in New Issue
Block a user