Currently only the Z axis rotation center can be set using a gravity
but the other rotations also store their center as an AnchorCoord for
consistency. Specifying the center as a gravity makes less sense for
the other axes because the actors have no size along the Z axis.
The rotation angles are now stored as gdoubles and the fixed point *x
entry points have been removed.
The Z rotation can now be set with a gravity center using the
following new function:
void clutter_actor_set_z_rotation_from_gravity (ClutterActor *self,
gdouble angle,
ClutterGravity gravity);
This sets the center point from which the scaling will occur. This can
be used insetad of the anchor point to avoid moving the actor. Like
the anchor point, it can be specified as either a coordinate in units
or a gravity enum.
To set the center you can use two new variants of set_scale:
clutter_actor_set_scale_full (ClutterActor *self,
gdouble scale_x,
gdouble scale_y,
int center_x,
int center_y);
or
clutter_actor_set_scale_with_gravity (ClutterActor *self,
gdouble scale_x,
gdouble scale_y,
ClutterGravity gravity);
The ClutterFixed variants of the set_scale functions have been removed
and the scale value is now always stored as a double.
This makes it so when the anchor point is set using a gravity enum
then the anchor point moves when the actor changes size. A new
property is added for the anchor point gravity. If the anchor point is
set from gravity then the position in units can also be retreived with
the regular API.
A new union type is used to store the anchor point with helper
accessor functions. The hope is these can be reused for the scale and
rotation center points.
If you try to use the CLUTTER_ACTOR_IS_* macros defined in ClutterActor
like this:
typedef struct { unsigned int reactive : 1; } foo_t;
foo_t f; f.reactive = CLUTTER_ACTOR_IS_REACTIVE (actor);
It will blow up because while the macros evaluate to 0 they can also
evaluate to non-zero values. Since most of the boolean flags in
Clutter and Clutter-based code are going to be stored like in the
example above, we should change the macros and let them evaluate
stricly either to 0 or to 1.
Sometimes an actor needs to set specific font rendering options on
the PangoContext without changing settings for every other text-rendering
actor.
In order to do this, we need a new public method to create a Pango
context object -- preset with all the default settings -- owned by the
developer and not shared with the rest of Clutter.
This new method is called clutter_actor_create_pango_context(); while
it does not strictly depend on a ClutterActor, it is a good idea to
have it inside the ClutterActor API to map the current get_pango_context()
method and in case we start storing screen-specific data to the Actor
itself during the 1.x API cycle.
Rendering text inside an actor is pretty much impossible without
using internal API to create the various pieces like the PangoContext
and the font map.
Each actor should have the ability to create a PangoContext, which
is the only object needed to generate layouts and change the various
Pango settings.
This commit adds a clutter_actor_get_pango_context() function that
creates a PangoContext inside the ClutterActor private data and allows
the creation of PangoLayouts when needed. If the actor already
has a PangoContext, the same instance is returned.
The PangoContext is created only on demand.
Bug 1003 - Add clutter_actor_take_key_focus()
The grab_key_focus() method is just a simple wrapper around
clutter_stage_take_key_focus() that removes the need to get
the ClutterStage of an actor in order to set the key focus.
Based on a patch by Xan López.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Signed-off-by: Øyvind Kolås <pippin@linux.intel.com>
When the apply_transform_to_point() and its relative variant
landed in Clutter 0.3, the initial approach was to modify the
passed vertex as an in-out parameter. This was later dropped
in favour of a more consistent out parameter.
Unfortunately, the implementation never changed: both methods
where modifying the passed vertex with the partial results of
the computations.
This commit copies the contents of the "point" ClutterVertex
argument inside a stack variable and, for good measure, constifies
the argument.
Thanks to Thomas Steinacher for catching this in Python.
Bug 1049 - Clutter doesn't support most GLSL uniforms (patch
by Chris Lord and Neil Roberts)
* README: Update release notes.
* clutter/Makefile.am:
* clutter/clutter-shader-types.[ch]: Add GValue types for
shader values.
* clutter/clutter-actor.[ch]: Update the shader API to use
the newly added GValue support for GLSL shader uniform
setters.
* clutter/clutter-shader.[ch]: Add float and integer convenience
API for single value GLSL uniform setters.
* clutter/cogl/cogl-shader.h: Add new uniform setters.
* clutter/cogl/gl/cogl-context.c:
* clutter/cogl/gl/cogl-context.h:
* clutter/cogl/gl/cogl-defines.h.in:
* clutter/cogl/gl/cogl-program.c:
* clutter/cogl/gl/cogl.c: Update the GL implementation of COGL
to handle the GLSL uniform setters.
* clutter/cogl/gles/cogl-gles2-wrapper.c:
* clutter/cogl/gles/cogl-gles2-wrapper.h:
* clutter/cogl/gles/cogl-internal.h:
* clutter/cogl/gles/cogl-program.c: Update the GLES 2.0 implementation
of COGL to handle the GLSL uniform setters.
* doc/reference/clutter/clutter-sections.txt:
* doc/reference/cogl/cogl-sections.txt: Update the documentation.
* tests/interactive/test-fbo.c:
* tests/interactive/test-shader.c: Update the shader tests.
* clutter/clutter-actor.c:
* clutter/clutter-actor.h:
* clutter/clutter-clone-texture.c:
* clutter/clutter-private.h:
* clutter/clutter-texture.c:
* clutter/x11/clutter-x11-texture-pixmap.c:
Attempt to lower overhead of updating TFP's (particularly mipmaped).
Compresses mipmap updates only for visible TFPs.
Avoiding updates for non visible TFP's whilst keeping visible
clones working ok.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c:
(clutter_actor_allocate_preferred_size): Add more documentation
and notes on where it's appropriate to call this function.
* clutter/clutter-actor.c:
* clutter/clutter-actor.h:
Clean up of parenting code (see #972)
Doc updates to section intro.
Add clutter_actor_allocate_preferred_size () utility call
* clutter/clutter-group.c: (clutter_fixed_layout_allocate):
Use clutter_actor_allocate_preferred_size ()
* doc/clutter-actor-invariants.txt:
Add some more notes
Bug #815 - Split up request, allocation, and paint box
* clutter/clutter-actor.[ch]: Rework the size allocation,
request and paint area. Now ::request_coords() is called
::allocate(), and ::query_coords() has been split into
::get_preferred_width() and ::get_preferred_height(). See
the documentation and the layout test on how to implement
a container and layout manager with the new API. (#915,
based on a patch by Havoc Pennington, Lucas Rocha and Johan
Bilien)
* clutter/clutter-clone-texture.c: Port CloneTexture to
the new size negotiation API; it just means forwarding
the requests to the parent texture.
* clutter/clutter-deprecated.h: Add deprecated and replaced
API.
* clutter/clutter-entry.c: Port Entry to the new size
negotiation API.
* clutter/clutter-group.c: Port Group to the new size
negotiation API; the semantics of the Group actor do not
change.
* clutter/clutter-label.c: Port Label to the new size
negotiation API, and vastly simplify the code.
* clutter/clutter-main.[ch]: Add API for executing a
relayout when needed.
* clutter/clutter-private.h: Add new Stage private API.
* clutter/clutter-rectangle.c: Update the get_abs_opacity()
call to get_paint_opacity().
* clutter/clutter-stage.c:
(clutter_stage_get_preferred_width),
(clutter_stage_get_preferred_height),
(clutter_stage_allocate),
(clutter_stage_class_init): Port Stage to the new size
negotiation API.
* clutter/clutter-texture.c: Port Texture to the new size
negotiation API.
* clutter/clutter-types.h: Add ClutterRequestMode enumeration.
* clutter/x11/clutter-stage-x11.c: Port the X11 stage
implementation to the new size negotiation API.
* tests/Makefile.am: Add the layout manager test case.
* tests/test-opacity.c: Update.
* tests/test-project.c: Update.
* tests/test-layout.c: Test case for a layout manager implemented
using the new size negotiation API; the layout manager handles
both transformed and untransformed children.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c:
(clutter_actor_get_abs_opacity): Add function that does what
get_opacity() does now...
(clutter_actor_get_opacity): ... and make get_opacity() do what
it's supposed to be doing. The original get_opacity() returned
a composited value, and there's no way to actually extract the
real opacity value set with set_opacity().
* clutter/clutter-clone-texture.c:
* clutter/clutter-rectangle.c:
* clutter/clutter-texture.c: Update to use get_abs_opacity().
* clutter/clutter-entry.c:
* clutter/clutter-label.c: Ditto. Also, never change the stored
alpha value. (#804)
* tests/Makefile.am:
* tests/test-opacity.c: Test suite for the get_opacity() and
get_abs_opacity() API, and correct opacity handling.
* README: Add note about the change in get_opacity().
* clutter/clutter-actor.[ch]:
* clutter/clutter-types.h:
* doc/reference/clutter-docs.sgml: Fix a lot of documentation.
2008-02-15 Matthew Allum <mallum@openedhand.com>
* clutter/clutter-actor.c:
* clutter/clutter-actor.h:
(clutter_group_query_coords):
Added function to translate vertex array to a bounding box.
(clutter_actor_is_scaled):
(clutter_actor_is_rotated):
Fixed documentation.
* clutter/clutter-actor.c:
* clutter/clutter-actor.h:
(clutter_actor_is_scaled):
(clutter_actor_is_rotated):
Convenience functions to test whether actor is scaled or rotated.
(clutter_actor_apply_relative_transform_to_point):
Removed unused variable.
* clutter/clutter-group.c:
(clutter_group_query_coords):
Use clutter_actor_get_relative_vertices() to calculate bounding
boxes of children that are scaled or rotated.
* clutter/clutter-actor.c:
* clutter/clutter-actor.h:
(clutter_actor_get_relative_vertices):
(clutter_actor_apply_relative_transform_to_point):
Functions to calculate actor vertices in the plane of a given
ancestor.
renamed clutter_actor_apply_shader to be clutter_actor_set_shader.
Reindented/aligned header.
* clutter/clutter-texture.c: (clutter_texture_paint): temporarily
disable the shader on top of the clutter context's shader stack while
rendering into the FBO.
* tests/test-fbo.c: (main): s/apply_shader/set_shader/
* tests/test-shader.c: (button_release_cb), (main):
s/apply_shader/set_shader/
* clutter.symbols: Add clutter_actor_move_byu()
* clutter/clutter-actor.h:
* clutter/clutter-actor.c:
(clutter_actor_move_by),
(clutter_actor_move_byu): Add a units-based variant of the
clutter_actor_move_by() function
* clutter.symbols: Add clutter_actor_set_clipu() and
clutter_actor_get_clipu()
* clutter/clutter-actor.h:
* clutter/clutter-actor.c:
(clutter_actor_set_clipu), (clutter_actor_get_clipu): Add the
new units-based versions of the clip accessors
(clutter_actor_set_clip), (clutter_actor_get_clip): Reimplement
the pixels-based clip accessors as proxies for the units-based
ones
* clutter/clutter-actor.c: (clutter_actor_paint),
(clutter_actor_apply_shader): queue a redraw of actor when shader is
set.
* clutter/clutter-actor.h: indentation.
* clutter/clutter-shader.[ch]: made the fragment and vertex shader
sources properties. Report error through GError when binding shaders.
* tests/test-shader.c: modified to use newer API.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c:
(clutter_actor_get_sizeu),
(clutter_actor_get_positionu): Add unit-based accessors to
the size and position.
* clutter/clutter-actor.c:
* clutter/clutter-actor.h:
* tests/Makefile.am:
* tests/test-unproject:
(clutter_actor_transform_stage_point):
Added new function for translating stage coordinates into local
actor coordinates.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c:
Converted depth and rotation offsets to ClutterUnit.
(clutter_actor_set_depthu):
(clutter_actor_get_depthu):
Additional ClutterUnit API.
(_clutter_actor_apply_modelview_transform):
Use cogl_translatex() in place of cogl_translate().
* clutter/NEWS:
Started 0.6.0 section with comment on actor anchor point.
* clutter/clutter/clutter-actor.c:
* clutter/clutter/clutter-actor.h:
* clutter/clutter/clutter-behaviour-scale.c:
* clutter/clutter/clutter-deprecated.h:
(clutter_actor_set_anchor_point):
(clutter_actor_set_anchor_pointu):
(clutter_actor_get_anchor_point):
(clutter_actor_get_anchor_pointu):
(clutter_actor_set_anchor_point_from_gravity):
New anchor point API deprecating old gravity scaling, added
comments on modelview matrix construction to ClutterActor
documentation.
(clutter_actor_set_scale_with_gravity):
(clutter_actor_set_scale_with_gravityx):
Deprecated; use clutter_actor_set_anchor_point_from_gravity() instead.
* clutter.symbols: Update
* clutter/clutter-actor.h: Rename the angle argument for
set_rotationx() to avoid gtk-doc complaining
* clutter/clutter-main.h:
* clutter/clutter-main.c:
(clutter_set_motion_events_enabled): Rename for consistency
(clutter_get_motion_events_frequency),
(clutter_set_motion_events_frequency): Add accessors for the default
motion events deliver frequency.
(clutter_do_event): Throttle down motion events delivery using the
motion events frequency setting, to avoid excessive redraws. (#608)
(clutter_context_get_default): Enable per-actor motion events, at
least for now.
* tests/test-events.c (red_button_cb):
* tests/test-grab.c (green_press_cb): Update.
(clutter_actor_set_rotation): swapped axis and angle around,
the new argument order is: (axis, angle, x, y, z). Also removed
deprecated rotation functions from header.
Updated use of clutter_actor_set_rotation? in the following files:
* clutter/clutter-behaviour-rotate.c:
* clutter/clutter-effect.c:
* tests/test-actors.c:
* tests/test-project.c:
* clutter/clutter-actor.c:
* clutter/clutter-actor.h:
* clutter/clutter-group.c:
* clutter/clutter-main.c:
* clutter/clutter-stage.c:
* tests/test-events.c:
Parent Actors no longer need to be set reactive for reactive
children to get events. Also makes groups now pickable.
(#597, #423)
* clutter/clutter-texture.c:
Handle case when 1x1 tiled texture is created,
falling 'back' to being non tiled. (#596)
* clutter/eglx/clutter-backend-egl.c:
Call EglTerminate on backend shutdown.
* clutter.symbols: Update exported symbols.
* clutter/clutter-actor.[ch]: Remove clutter_actor_rotate_*
and clutter_actor_get_rx* and provide a simpler rotation API:
clutter_actor_set_rotation() and clutter_actor_get_rotation().
* clutter/clutter-deprecated.h: Deprecate the old rotation API.
* clutter/clutter-behaviour-bspline.c:
* clutter/clutter-behaviour-rotate.c:
* clutter/clutter-effect.c: Update internal usage of the
rotation API.
* tests/test-project.c: Ditto as above.
* clutter/clutter-actor.[ch]: Massive API clean-ups. Initial
fixes for bugs #614 and #628.
* clutter/clutter-main.c:
* clutter/clutter-stage.c: Update internal usage of the actor
API.
* tests/test-events.c: Update test suite.
* clutter/clutter-actor.[ch]: Rename clutter_actor_get_id() to
clutter_actor_get_gid().
(clutter_actor_set_parent): Use GUINT_TO_POINTER().
* clutter/clutter-deprecated.h: Add a replacement warning for
clutter_actor_get_id().
* clutter/clutter-texture.c (texture_upload_data): Use
clutter_actor_get_gid(), and don't leak the filename string.
* clutter/clutter-actor.[ch]: Fix the declaration of the
class handlers for the ::captured-event, ::enter-event and
::leave-event signals; the function signatures were missing
the return value the signals marshallers were expecting, and
their names weren't respecting the convention for event-related
signals.
* clutter/clutter-actor.c: Implement part of the ClutterScriptable
interface, using the ClutterActor API to set and get the name
of an actor.
(clutter_geometry_copy), (clutter_geometry_free): Use
the slice allocator to avoid fragmentation when setting
properties and emitting signals (that is: when packing
boxed types into GValues).
(clutter_actor_box_copy), (clutter_actor_box_free),
(clutter_vertex_copy), (clutter_vertex_free): Ditto.
* clutter/clutter-actor.h:
* clutter/clutter-actor.c:
(clutter_actor_push_transform_child),
(clutter_actor_pop_transfomr_child): Simple wrappers around
COGL API, which avoid including clutter/cogl.h when writing
container actors outside Clutter.