Emmanuele Bassi [Tue, 20 Jan 2009 17:57:30 +0000 (17:57 +0000)]
[animation] Implement new easing functions
Instead of using our own homegrown alpha functions, we should
use the easing functions also shared by other animation frameworks,
like jQuery and Tween, in the interests of code portability.
The easing functions have been defined by Robert Penner and
are divided into three categories:
In Out InOut
Each category has a particular curve:
Quadratic
Cubic
Quartic
Quintic
Sinusoidal
Exponential
Circular
In addition, there are "physical" curves:
Elastic
Back (overshooting cubic)
Bounce (exponentially decaying parabolic)
Finally, the Linear curve is also provided as a reference.
The functions are private, and are meant to be used only
through their logical id as provided by the AnimationMode
enumeration.
The tests should be updated as well to match the new
easing functions.
Emmanuele Bassi [Tue, 20 Jan 2009 16:42:49 +0000 (16:42 +0000)]
[animation] Move the alpha value to floating point
The current Alpha value is an unsigned integer that can be used
implicitly as a fixed point value. This makes writing an alpha
function overshooting below and above the current range basically
impossible without complicating an already complex code, and
creating weird corner cases.
For this reason, the Alpha value should be defined as a floating
point normalized value, spanning a range between 0.0 and 1.0; in
order to allow overshooting, the valid range is extended one unit
below and one unit above, thus making it -1.0 .. 2.0.
This commit updates the various users of the ClutterAlpha API
and the tests cases.
This commit also removes all the current alpha functions exposed
in the public API.
Owen W. Taylor [Sun, 11 Jan 2009 00:25:27 +0000 (19:25 -0500)]
Change default tile-waste from 64 to 63
It's more sensible to use 2^n-1 for a max tile-waste value rather
than 2^n, so change the value default from 64 to 63. Example:
191 and 192 will both be sliced to 128+64 rather than having
191=>128+64, 192=>256.
http://bugzilla.openedhand.com/show_bug.cgi?id=1402
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Owen W. Taylor [Fri, 16 Jan 2009 23:01:04 +0000 (18:01 -0500)]
Fix properties that have X11 types to be 'long'
While X11 Pixmap and Window types only have 32-bits of data, they
are actually 'unsigned long'. Change the "window" and "pixmap"
property of ClutterX11TexturePixmaps to be ulong.
This fixes 64-bit bugs where ClutterGLXTexturePixmap passed a
reference to Pixmap to g_object_get("pixmap", &pixmap, ...);
http://bugzilla.openedhand.com/show_bug.cgi?id=1405
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Emmanuele Bassi [Fri, 16 Jan 2009 22:13:44 +0000 (22:13 +0000)]
[eglnative] Set the SYNC_MATRICES on stage realization
Since the stage in the EGL native backend only has one size, and it
is determined at realization, we can simply set the SYNC_MATRICES
private flag and let _clutter_stage_maybe_setup_viewport() set up
the GL viewport at the first redraw.
Emmanuele Bassi [Fri, 16 Jan 2009 14:53:42 +0000 (14:53 +0000)]
[docs] Clarify what API registers a global alpha function
Both clutter_alpha_new_with_func() and clutter_alpha_set_func()
will not register a global alpha function, so we need to update
the documentation to explicitly say so.
Emmanuele Bassi [Fri, 16 Jan 2009 14:16:02 +0000 (14:16 +0000)]
[doc] Clarify the animation mode meaning
The animation mode parameters and properties are now slightly
anonymous unsigned longs, so we need to clarify in the documentation
that the user should either pass a ClutterAnimationMode value or
the result of registering an alpha function.
Emmanuele Bassi [Fri, 16 Jan 2009 14:01:46 +0000 (14:01 +0000)]
Remove AnimationMode from the Animation API
The animation mode symbolic id might come from the AnimationMode
enumeration or from the clutter_alpha_register_*() family of
functions. For this reason, we should use a gulong instead of
ClutterAnimationMode whenever we have an "animation mode" parameter
or property.
Emmanuele Bassi [Fri, 16 Jan 2009 13:42:06 +0000 (13:42 +0000)]
[alpha] Allow registering alpha functions
In order to unify alpha functions and animation modes in ClutterAlpha
we should be able to register alpha functions and get a logical id
for them; the logical id will then be available to be used by
clutter_alpha_set_mode().
The registration requires API changes in ClutterAlpha constructors
and methods. It also provides the chance to shift ClutterAlpha
towards the use of animations modes only, and to alpha functions
as a convenience API for language bindings alone.
Neil Roberts [Thu, 15 Jan 2009 18:09:54 +0000 (18:09 +0000)]
Fix GLES backends after merging the async-textures branch
The changes from the GL version of cogl-texture.c have been mirrored
in the GLES version. This adds the cogl_texture_new_from_bitmap
function and fixes the build errors.
Robert Bragg [Thu, 15 Jan 2009 13:58:31 +0000 (13:58 +0000)]
[test-text] queue redraws instead of calling clutter_actor_paint directly
Directly calling clutter_actor_paint skips out quite a bit code such as the
backend swap buffer call.
Since we are interested in the highest fps possible, and it now goes through
to the backend swap buffer call we now do a setenv (CLUTTER_VBLANK, none, 0)
before calling clutter_init.
Emmanuele Bassi [Wed, 14 Jan 2009 18:14:46 +0000 (18:14 +0000)]
Bug 1380 - Return booleans from CLUTTER_ACTOR_IS_* macros
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.
Emmanuele Bassi [Wed, 7 Jan 2009 18:30:46 +0000 (18:30 +0000)]
Remove the Effects API
The Effects API and all related symbols have been superceded by
the newly added Animation API and clutter_actor_animate().
This commit removes the Effects implementation, the documentation
and the interactive test/example code.
Emmanuele Bassi [Wed, 14 Jan 2009 15:30:10 +0000 (15:30 +0000)]
Emit ::load-finished for every texture load
The ::load-finished signal is emitted only when loading a texture
using clutter_texture_set_from_file(). Since this breaks user
expectations and consistency, we should also emit ::load-finished
when loading a texture from image data.
Robert Bragg [Wed, 14 Jan 2009 15:18:05 +0000 (15:18 +0000)]
[test-depth] cast width to gint when calculating -width/2
It was a fluke that this worked out due to how clutter_actor_set_depth
internally converts the incorrect integer result to fixed point.
Robert Bragg [Thu, 8 Jan 2009 18:54:48 +0000 (18:54 +0000)]
[tests] Adds a flowery clutter_cairo_texture unit test
This is simply a copy of flowers.c from the old clutter-cairo repo
Emmanuele Bassi [Wed, 14 Jan 2009 15:16:41 +0000 (15:16 +0000)]
Merge branch 'async-textures'
* async-textures:
Whitespace fixes in ClutterTexture
[async-loading] Do not force the texture size on async load
[async-loading] Update asynchronous image loading
Add API for extracting image size from a file
Update/clean and apply the async-texture patch from bug #1144
Neil Roberts [Wed, 14 Jan 2009 13:37:31 +0000 (13:37 +0000)]
[ClutterStageX11] Remove the handling_configure flag
Since Clutter changed to using a layout scheme the handling_configure
flag no longer works because the allocate method is not invoked
immediately during the call to set_size from the ConfigureNotify
handler. However it is also no longer neccessary because the resizes
are effectively batched up until a relayout is run so it won't cause
an infinite loop of resize and notify events anyway.
Emmanuele Bassi [Wed, 14 Jan 2009 15:05:03 +0000 (15:05 +0000)]
Add unused symbols
Append the newly added ClutterBindingPool symbols and
clutter_stage_ensure_viewport() to the API reference.
Emmanuele Bassi [Wed, 14 Jan 2009 15:04:28 +0000 (15:04 +0000)]
Fix compile warning for a possible uninitialized variable
Emmanuele Bassi [Wed, 14 Jan 2009 15:03:30 +0000 (15:03 +0000)]
Add declaration of clutter_binding_pool_get_type()
The function is automagically created by G_DEFINE_TYPE(), but
it should also be declared in the header.
Emmanuele Bassi [Wed, 14 Jan 2009 15:00:44 +0000 (15:00 +0000)]
Merge branch 'animation-improvements'
* animation-improvements:
[docs] Add ClutterAnimatable to the API reference
Add license notice to ClutterAnimation files
[docs] Update the ClutterAnimation section
[animation] Extend ClutterAnimation support to all objects
[animation] Use ClutterAnimatable inside Animation
[animation] Add ClutterAnimatable
[animation] Allow registering custom progress function
[animation] Interval::compute_value should return a boolean
Animate ClutterColor properties
Emmanuele Bassi [Wed, 14 Jan 2009 14:34:35 +0000 (14:34 +0000)]
Fix compilation warning
Declare the width and height variables as unsigned ints, in order
to match the required arguments for clutter_actor_get_size().
Neil Roberts [Wed, 14 Jan 2009 11:12:02 +0000 (11:12 +0000)]
[clutter-text] Fix x-position of cursor when moving up or down
ClutterText already has code to try to preserve the x position when
moving up or down. A target x-position is stored and the cursor is
positioned at the nearest point to that in the appropriate line when
up or down is pressed. However the target position was never cleared
so it would always target the x-position of the cursor from the first
time you pressed up or down.
To fix this the patch clears the target position in set_position and
then sets it after the call in real_move_up/down. That way pressing
up or down sets the target position and any other movement will clear
it.
To get an index for the pixel position in the line
pango_layout_line_x_to_index is used. However when x is greater than
the length of the line then the index before the last grapheme is
returned which was causing it to jump to the penultimate
character. The patch makes it add on the trailing value so that it
will jump to the last character.
Neil Roberts [Tue, 13 Jan 2009 18:42:50 +0000 (18:42 +0000)]
[clutter-text] Fix offset_to_bytes to work when pos == 0
The old function ended up returning the length of the string when pos
was zero. This caused it to insert characters at the end when the
cursor was at the beginning of the string.
Neil Roberts [Tue, 13 Jan 2009 17:52:38 +0000 (17:52 +0000)]
[clutter-text] Don't allow control characters to be inserted
If an unbound control key is pressed (such as Ctrl+R) it would insert
a rectangle into the text.
Also zero is considered a valid unicode character by
g_unichar_validate so pressing a key such as shift would cause the
current selection to be deleted. The character isn't actually inserted
because insert_unichar disallows zeroes.
Neil Roberts [Thu, 27 Nov 2008 16:44:39 +0000 (16:44 +0000)]
Fix GLES 2 after the multiple-texture-rectangle branch merge
The GLES 2 wrapper needs to set up some state before each
draw. Previously this was acheived by wrapping glDrawArrays. Since the
multiple-texture-rectangle branch merge, glDrawElements is used
instead so we also need a wrapper for that.
It was also directly calling glBindTexture. GLES 2 uses a wrapper for
this function so that it can cope with GL_ALPHA format textures. The
format of the current texture needs to be stored as well as the target
and object number for this to work.
Neil Roberts [Mon, 12 Jan 2009 18:32:49 +0000 (18:32 +0000)]
Update gtk-doc 'Since' field for cogl_texture_multiple_rectangles
The function has been backported to the 0.8 branch so it will also be
available in Clutter 0.8.6
Emmanuele Bassi [Tue, 13 Jan 2009 14:05:35 +0000 (14:05 +0000)]
[gitignore] Update the ignore file
Emmanuele Bassi [Tue, 13 Jan 2009 12:51:03 +0000 (12:51 +0000)]
Add ClutterBindingPool:name
The BindingPool constructor should only check for duplicate pools
and then set the :name constructor-only property. If a BindingPool
is created without a name we also make a fuss about it.
It is also possible to simply dispose of a binding pool using
g_object_unref(), as long as it has been created by using
clutter_binding_pool_new() or directly with g_object_new(). Only
BindingPools attached to a class are not owned by the user.
Emmanuele Bassi [Tue, 13 Jan 2009 12:34:59 +0000 (12:34 +0000)]
Turn ClutterBindingPool a GObject
ClutterBindingPool is already "problematic" in terms of memory
management for language bindings and gobject-introspection. It
also lacks a GType.
Turning ClutterBindingPool into a GBoxed would not make much
sense, since it does not adhere to the copy/free semantics. It
could be referenced/unreferenced, but in that case we can just
as well use GObject as a base class instead of reimplemeting
a ref-counted object and then boxing it.
ClutterBindingPool is obviously a terminal class, so we just
hide the instance and class structures.
Emmanuele Bassi [Mon, 12 Jan 2009 17:12:24 +0000 (17:12 +0000)]
Whitespace fixes in ClutterTexture
Small whitespace fixes patch; ClutterTexture requires much more
love than I can provide at the moment.
Emmanuele Bassi [Mon, 12 Jan 2009 17:09:47 +0000 (17:09 +0000)]
[async-loading] Do not force the texture size on async load
The size of the texture as retrieved by the filename should
be set as the image size, not as the actor size, in order to
respect the :sync-size property.
When the asynchronous loading process terminates, we queue
a relayout so that the scene is updated.
Emmanuele Bassi [Mon, 12 Jan 2009 16:54:30 +0000 (16:54 +0000)]
[async-loading] Update asynchronous image loading
Provide a main loop-based fallback to the asynchronous loading in
case the GLib threading support hasn't been enabled. This also
allows us to clean up the asynchronous loading machinery and have
it behave consistently across different scenarios.
Emit the ::load-finished even if the asynchronous loading from
disk was not enabled.
Finally, block clutter_texture_set_from_file() until we have an
image width and height, so that querying the texture actor size
after set_from_file() will still yield the correct result even
when asynchronous loading is set.
Emmanuele Bassi [Mon, 12 Jan 2009 16:52:20 +0000 (16:52 +0000)]
Add API for extracting image size from a file
For the asynchronous loading we need a function call that parses
a file, given its path, and retrieves the image width and height.
This commit adds cogl_bitmap_get_size_from_file() to the CoglBitmap
API.
Emmanuele Bassi [Mon, 12 Jan 2009 14:43:53 +0000 (14:43 +0000)]
Merge branch 'master' into async-textures
Havoc Pennington [Mon, 12 Jan 2009 14:19:48 +0000 (14:19 +0000)]
Bug 1087 - virtualize stage_queue_redraw
Add a ClutterStage::queue-redraw signal.
The purpose of this signal is to allow combining the Clutter redraw
idle with another redraw idle such as gtk's (or any other one really;
this is desirable anytime Clutter is not the only thing drawing to
a toplevel window).
To override the default, you would connect to ::queue-redraw and then
stop the signal emission.
Robert Bragg [Mon, 12 Jan 2009 13:02:19 +0000 (13:02 +0000)]
[ClutterGLXTexturePixmap] Use an RGB texture (not ARGB) for 24bpp pixmaps
By creating an ARGB texture for 24bpp pixmaps we were exposing an undefined
alpha channel to the blending and texture combine stages which resulted in
nasty artefacts. (This issue was seen on i945 + DRI2)
Emmanuele Bassi [Mon, 12 Jan 2009 11:21:06 +0000 (11:21 +0000)]
Declare G_LOG_DOMAIN for COGL
In order to get properly namespaced debug and warning messages
inside COGL code we need to define the G_LOG_DOMAIN macro.
Emmanuele Bassi [Mon, 12 Jan 2009 11:18:11 +0000 (11:18 +0000)]
Allow ensuring that a stage viewport is updated
Since we only update the GL viewport when we receive a ConfigureNotify
event on X11, we also need a function to allow other toolkits to tell
a stage that the viewport should be updated.
This commit adds clutter_stage_ensure_viewport(), a function that simply
sets the private SYNC_MATRICES flag on the stage and then queues a
redraw.
This function should be called by libraries integrating Clutter with
other toolkits, like clutter-gtk or clutter-qt.
Emmanuele Bassi [Mon, 12 Jan 2009 11:15:41 +0000 (11:15 +0000)]
[x11] Proper fix for the ClutterStage resize race
Continuation of the fix in commit
00a3c698686f25e193d0311ad25c903f0ad71e8b.
Instead of using a separate flag for the resize process, just
delay the setting of the CLUTTER_ACTOR_SYNC_MATRICES flag on the
stage to the point when we receive a ConfigureNotify event from
X11.
This commit will break the stage embedding into other toolkits.
Emmanuele Bassi [Fri, 9 Jan 2009 14:26:35 +0000 (14:26 +0000)]
[docs] Documentation warnings
Fix the various warnings issued by gtk-doc when enabling the API
reference generation for both COGL and Clutter.
Emmanuele Bassi [Fri, 9 Jan 2009 12:06:46 +0000 (12:06 +0000)]
[x11] Fix a race condition when resizing a stage
There is a race condition when we resize a stage before showing
it on X11.
The race goes like this:
- clutter_init() creates the default stage and realize it, which
will cause a 640x480 Window to be created
- call set_size(800, 600) on the stage will cause the Window to be
resized to 800x600
- call show() on the stage for the first time will cause COGL
to set up an 800 by 600 GL viewport
- the Window will be mapped, which will cause X to notify the
window manager that the Window should be resized to 800x600
- the window manager will approve the resize
- X resizes the drawable to 800x600
To fix the race, we need to defer COGL from setting up the viewport
until we receive a ConfigureNotify event and the X server has resized
the Drawable.
In order to defer the call to cogl_setup_viewport() we add a new
private flag, CLUTTER_STAGE_IN_RESIZE; the flag is checked whenever
we need to change the viewport size along with the SYNC_MATRICES
private flag. Thus, cogl_setup_viewport() will be called only if
SYNC_MATRICES is set and IN_RESIZE is not set.
Emmanuele Bassi [Thu, 8 Jan 2009 17:06:04 +0000 (17:06 +0000)]
[text] Fix GObject properties in ClutterText
Some of the read-write properties of ClutterText were missing
an implementation in clutter_text_get_property(), as well as
the :position and :selection-bound properties being wrongly
converted from fixed point to integer, passing through floating
point values.
Emmanuele Bassi [Thu, 8 Jan 2009 15:45:22 +0000 (15:45 +0000)]
Fix last improper usage of ClutterUnits
ClutterUnits should not be used interchangeably as, or with
ClutterFixed values. ClutterUnits should also not be assumed
to be integers.
This commit fixes the last few improper usages of ClutterUnit
values, and adds a CLUTTER_UNITS_FORMAT macro for safely printing
ClutterUnit values with printf().
Emmanuele Bassi [Thu, 8 Jan 2009 13:38:51 +0000 (13:38 +0000)]
Merge branch 'animatable-iface' into animation-improvements
* animatable-iface:
[docs] Add ClutterAnimatable to the API reference
Add license notice to ClutterAnimation files
[animation] Use ClutterAnimatable inside Animation
[animation] Add ClutterAnimatable
Emmanuele Bassi [Thu, 8 Jan 2009 13:31:27 +0000 (13:31 +0000)]
[docs] Add ClutterAnimatable to the API reference
Emmanuele Bassi [Thu, 8 Jan 2009 13:18:00 +0000 (13:18 +0000)]
Add license notice to ClutterAnimation files
Emmanuele Bassi [Thu, 8 Jan 2009 13:16:20 +0000 (13:16 +0000)]
[docs] Update the ClutterAnimation section
Emmanuele Bassi [Thu, 8 Jan 2009 13:13:39 +0000 (13:13 +0000)]
[animation] Extend ClutterAnimation support to all objects
Instead of limiting the use of ClutterAnimation to ClutterActor
instances, relax the constraint to include all GObject classes.
ClutterAnimation is not using actor-specific API, since it is
only using properties.
The only actor-based API is the clutter_actor_animate() family
of functions.
Emmanuele Bassi [Thu, 8 Jan 2009 12:59:16 +0000 (12:59 +0000)]
[animation] Use ClutterAnimatable inside Animation
ClutterAnimation should check if the object is implementing the
Animatable interface, and if so delegate to it the computation
of the value along the interval initial and final value, depending
on the progress.
Emmanuele Bassi [Thu, 8 Jan 2009 12:56:46 +0000 (12:56 +0000)]
[animation] Add ClutterAnimatable
The ClutterAnimatable interface is meant to be used by GObject
classes to override the value computation for an animatable
property within the boundaries of an interval.
It is composed of a single virtual function, animate_property();
its implementation will receive the ClutterAnimation used to
animate the object; the property name; the initial and final
interval values; and the progress factor as retrieved by the
Alpha object bound to the Animation instance.
Robert Bragg [Wed, 7 Jan 2009 12:33:40 +0000 (12:33 +0000)]
[test-clip] Use gint for hand_{width,height} when calulating -hand_* /2
It was a fluke that this worked out due to how the incorrect integer
result gets converted by CLUTTER_INT_TO_FIXED.
Emmanuele Bassi [Thu, 8 Jan 2009 11:15:09 +0000 (11:15 +0000)]
[animation] Allow registering custom progress function
A ClutterInterval can change the way the progress is computed
by subclassing and overriding the ::compute_value() virtual function.
It should also be possible to register a custom progress function
in the same way it is possible to register a custom transformation
function between two GValues.
This commit adds an internal, global hash table that maintains a
GType <-> progress function association; each ClutterInterval
will check if there is a progress function registered for the
GType of the initial and final values of the interval and, if
it has been found, it will call it to compute the value of the
interval depending on the progress factor.
Robert Bragg [Wed, 7 Jan 2009 12:08:43 +0000 (12:08 +0000)]
[test-depth] Use a gint for width, not guint, when calculating -width/2
It was a fluke that this worked out due to how clutter_actor_set_depth
internally converts the incorrect integer result to fixed point.
Emmanuele Bassi [Wed, 7 Jan 2009 18:18:59 +0000 (18:18 +0000)]
[animation] Interval::compute_value should return a boolean
If the computation of the interval value depending on the progress
was not successful, ClutterInterval::compute_value() should return
this information to the caller.
Chris Lord [Wed, 7 Jan 2009 17:02:43 +0000 (17:02 +0000)]
Update/clean and apply the async-texture patch from bug #1144
Emmanuele Bassi [Wed, 7 Jan 2009 16:26:03 +0000 (16:26 +0000)]
Rename a variable masking index()
The maintainer CFLAGS found another masking of the index() function
by an helpless variable.
Neil Roberts [Wed, 7 Jan 2009 16:10:25 +0000 (16:10 +0000)]
Merge branch multiple-texture-rectangle into master
Bug 1289 - Draw multiple glyphs at once
The multiple-texture-rectangle branch adds a new Cogl texture function
called cogl_texture_multiple_rectangles which is used to draw multiple
rectangles out of a texture using a single GL call. This is
significantly faster than drawing the rectangles with individual calls
on some platforms. The Pango renderer now uses this to speed up
rendering.
The conflicts are just due to the whitespace fixes in cb569a5.
Conflicts:
clutter/cogl/gl/cogl-context.c
clutter/cogl/gl/cogl-context.h
clutter/cogl/gl/cogl-texture.c
Emmanuele Bassi [Wed, 7 Jan 2009 15:54:08 +0000 (15:54 +0000)]
[tests] Update the ClutterText interactive test
Remove the unused functions and if the test fails to load the
text from a file, show the error inside the text actor itself.
Emmanuele Bassi [Wed, 7 Jan 2009 14:53:54 +0000 (14:53 +0000)]
[docs] Documentation fixes
Remove the causes of warnings from the Clutter gtk-doc API reference
generation process.
Emmanuele Bassi [Wed, 7 Jan 2009 13:48:45 +0000 (13:48 +0000)]
[text] Do not use markup on an editable Text
An editable ClutterText should not use pango_layout_set_markup(),
as the contents of the text actor will not match the text.
Only read-only text actors should parse the contents for Pango
markup.
Emmanuele Bassi [Wed, 7 Jan 2009 13:14:13 +0000 (13:14 +0000)]
[text] Do not ensure the cursor if not needed
If the Text actor is neither editable nor has its cursor set
to visible, then we should not be ensuring the cursor position.
This fixes a failure in the conformance test unit for the
layout cache.
Emmanuele Bassi [Wed, 7 Jan 2009 12:17:09 +0000 (12:17 +0000)]
[tests] Make test-scale use ClutterText
The ClutterLabel actor has been superceded by ClutterText.
This is merge fall-out from the text-actor branch.
Emmanuele Bassi [Wed, 7 Jan 2009 12:16:08 +0000 (12:16 +0000)]
[tests] Remove test-opacity interactive test
Merge fall-out from the text-actor branch. The test-opacity test
was moved to the conformance test suite.
Emmanuele Bassi [Wed, 7 Jan 2009 12:06:33 +0000 (12:06 +0000)]
Merge the ClutterText actor
Merge branch 'text-actor'
* text-actor: (108 commits)
Re-align ClutterText header file
[text] Fix cursor sizing
Comments and whitespace fixes to ClutterText
[docs] Add newly added :single-line-mode accessors
Update the ignore file
[tests] Add text field interactive test
[text] Add single-line-mode to ClutterText
[text] Fix the deletion actions
[text] Use cached length when possible
[tests] Add unit for the ClutterText:password-char property
[docs] Update the Text section
[text] Coalesce text visibility and password character
Allow localizations to change the text direction
Clean up the update_pango_context() function
Pass the PangoContext, not the MainContext
Revert the logic of the PangoContext check
Remove the binding pool entry from the list
Remove BindingPool::list_actions()
Add ClutterActor::create_pango_context()
Rename the PangoContext creation functions
...
Emmanuele Bassi [Wed, 7 Jan 2009 11:46:22 +0000 (11:46 +0000)]
Re-align ClutterText header file
The addition of the single line mode accessor methods caused the
re-alignment of the entire file.
Emmanuele Bassi [Wed, 7 Jan 2009 11:44:54 +0000 (11:44 +0000)]
[text] Fix cursor sizing
The cursor should be slightly smaller than the height of the actor, to
allow for painting a border. Let's pad it by 1 pixel on the top and 1
on the bottom.
Also, we should use the cursor size everywhere and not use hardcoded
magic numbers.
Emmanuele Bassi [Wed, 7 Jan 2009 00:43:24 +0000 (00:43 +0000)]
Comments and whitespace fixes to ClutterText
Emmanuele Bassi [Wed, 7 Jan 2009 00:30:59 +0000 (00:30 +0000)]
[docs] Add newly added :single-line-mode accessors
Add the ClutterText:single-line-mode property accessor methods
to the API reference.
Emmanuele Bassi [Wed, 7 Jan 2009 00:29:41 +0000 (00:29 +0000)]
Update the ignore file
Emmanuele Bassi [Wed, 7 Jan 2009 00:27:50 +0000 (00:27 +0000)]
[tests] Add text field interactive test
The test-text-field is a test/example that shows how to use the
ClutterText as a text input field in single line mode.
Emmanuele Bassi [Wed, 7 Jan 2009 00:25:24 +0000 (00:25 +0000)]
[text] Add single-line-mode to ClutterText
Allow using ClutterText as a single line text field. This is useful for
text fields that accept just a single line of contents by default, and
respond to the Enter key press to execute some action.
The :single-line-mode property enables this behaviour inside ClutterText
by clipping and scrolling the contents of the PangoLayout if they do
not fit the allocated width of the Text actor.
Emmanuele Bassi [Tue, 6 Jan 2009 20:54:20 +0000 (20:54 +0000)]
[text] Fix the deletion actions
When using the delete-prev action from the end of the text we end
up either missing the first glyph we have to delete or falling
through the last one in the text.
This commit fixes both issues.
Emmanuele Bassi [Tue, 6 Jan 2009 20:52:03 +0000 (20:52 +0000)]
[text] Use cached length when possible
Since clutter_text_set_text() measures the length of the text
each time, we should use the cached length instead of recomputing
the text length each time. This should save us some time when
dealing with long, multi-byte texts.
Emmanuele Bassi [Tue, 6 Jan 2009 15:30:31 +0000 (15:30 +0000)]
[tests] Add unit for the ClutterText:password-char property
Check that the contents of the Text actor are unaffected by the
:password-char property; that the accessors are correct; and finally
that the initial value for a newly constructed Text actor is valid.
Emmanuele Bassi [Tue, 6 Jan 2009 15:29:44 +0000 (15:29 +0000)]
[docs] Update the Text section
After the
979b6794 commit, the section for ClutterText needs
updating on the renamed and removed accessors.
Emmanuele Bassi [Tue, 6 Jan 2009 15:22:31 +0000 (15:22 +0000)]
[text] Coalesce text visibility and password character
Using two properties to set a password entry can be construed as
both cumbersome and a gtk-ism. And rightly so on both counts.
The :text-visible property has also conflicting semantics with the
:cursor-visible one: while the latter hides the cursor, the former
changes the display of the contents of the Text actor. It is, thus,
not a matter of "visibility" but of "rendering".
Instead of setting the :text-visible and :invisible-char properties
to have a password text field, the Text actor should just have a
single :password-char property holding a Unicode character. If the
value of the :password-char is non-zero, the Text actor will use the
Unicode character to render the contents of the text entry.
This commit removes the following methods:
clutter_text_set_text_visible()
clutter_text_get_text_visible()
clutter_text_set_invisible_char()
clutter_text_get_invisible_char()
And the following properties:
ClutterText:text-visible
ClutterText:invisible-char
In favour of:
clutter_text_set_password_char()
clutter_text_get_password_char()
And:
ClutterText:password-char
Thus making obvious what use the property and accessor methods are
for and simplifying the process of creating a simple password text
field to:
text = clutter_text_new ();
clutter_text_set_password_char (CLUTTER_TEXT (text), '*');
Emmanuele Bassi [Tue, 6 Jan 2009 12:53:30 +0000 (12:53 +0000)]
Animate ClutterColor properties
We can animate a ClutterColor-based property between an interval
of two colors by simply applying the factor to each color component.
Emmanuele Bassi [Tue, 6 Jan 2009 12:35:19 +0000 (12:35 +0000)]
Allow localizations to change the text direction
The locale translators of Clutter are also the ones that should set
the default direction of the text in a Clutter user interface.
This commit adds a translatable string that defines the direction
of the text; the translation authors will change it to the correct
value and that will determine the default direction.
The default text direction can be overridden by using the
CLUTTER_TEXT_DIRECTION environment variable, or by using the
--clutter-text-direction command line switch. In any other case,
the locale will determine the text direction, as it should.
Neil Roberts [Tue, 6 Jan 2009 11:39:14 +0000 (11:39 +0000)]
Fix off-by-one error in clutter_stage_read_pixels
It was always reading one pixel lower than requested. If y was 0 then
it would try to read below the lowest line.
Thanks to Geoff Gustafson for spotting.
Takao Fujiwara [Tue, 6 Jan 2009 12:11:07 +0000 (12:11 +0000)]
Bug 1397 - Allow localizing the command line help
Clutter has a set of command line options that are added to every
application by means of clutter_init() or by obtaining the Clutter
GOptionGroup and using g_option_context_parse(). Thus, every Clutter
application will automatically have an --help command line switch
showing the list of options and their description.
At the moment, Clutter does not enable localization of the help,
thus making it less than useful on non-English locales.
This patch enables the machinery to create a localization file and
load it when initializing Clutter, by means of the GLib macros and
locale.h API we already use.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Neil Roberts [Mon, 5 Jan 2009 17:05:30 +0000 (17:05 +0000)]
Make libdisable-npots a bit more portable
Instead of including GL/gl.h directly it now includes cogl/cogl.h
instead which should include the right GL header.
Instead of using dlopen to specifically open libGL it now tries to use
dlsym with RTLD_NEXT. This requires defining _GNU_SOURCE on GNU
systems. If RTLD_NEXT is not available it will try passing NULL which
is unlikely to work but it will at least catch the case where it
returns the wrapper version of glGetString to prevent infinite
recursion.
This should hopefully make it work on OS X where the name of the
header and library are different (although this is currently
untested).
Emmanuele Bassi [Mon, 5 Jan 2009 16:48:46 +0000 (16:48 +0000)]
Clean up the update_pango_context() function
Logically split the various operations with whitespace so that
it's clear what does what.
Emmanuele Bassi [Mon, 5 Jan 2009 16:45:59 +0000 (16:45 +0000)]
Pass the PangoContext, not the MainContext
When updating the PangoContext with the current options (font name,
options, resolution) pass the PangoContext instead of the Clutter
MainContext structure pointer.
Emmanuele Bassi [Mon, 5 Jan 2009 16:44:52 +0000 (16:44 +0000)]
Revert the logic of the PangoContext check
The branch that creates the global PangoContext should only run
if there is no global PangoContext already.
Emmanuele Bassi [Mon, 5 Jan 2009 16:29:49 +0000 (16:29 +0000)]
Remove the binding pool entry from the list
When removing a binding entry from the binding pool we should not
only remove it from the hash table, but also from the linked list
we use to iterate over inside the block/unblock_action() pair.
Emmanuele Bassi [Mon, 5 Jan 2009 16:25:50 +0000 (16:25 +0000)]
Remove BindingPool::list_actions()
The clutter_binding_pool_list_actions() was not implemented. The
utility of a call listing all the action names is also debatable:
all the functions related to the key bindings take the key symbol
and modifiers -- except the block_action() and unblock_action()
pair.
Emmanuele Bassi [Mon, 5 Jan 2009 15:29:10 +0000 (15:29 +0000)]
Add ClutterActor::create_pango_context()
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.
Emmanuele Bassi [Mon, 5 Jan 2009 15:27:33 +0000 (15:27 +0000)]
Rename the PangoContext creation functions
The _clutter_context_create_pango_context() should create a new
context; the function returning the PangoContext stored inside the
MainContext structure should be named _get_pango_context() instead.
Emmanuele Bassi [Mon, 5 Jan 2009 15:26:57 +0000 (15:26 +0000)]
Whitespace fixes
Neil Roberts [Mon, 5 Jan 2009 13:14:12 +0000 (13:14 +0000)]
Fix some animation_set_* functions so they cope if the value is the same
The following functions are fixed:
clutter_animation_set_actor
clutter_animation_set_timeline
clutter_animation_set_alpha
This is related to bug 1392 which discusses the problem for
behaviour_set_alpha.
Neil Roberts [Mon, 5 Jan 2009 12:05:51 +0000 (12:05 +0000)]
Fix some *_set functions so they work if the object is the same value
Bug 1392 - behaviour_set_alpha set same alpha twice lead to warning
and destroy the input alpha
The following functions are fixed:
clutter_actor_set_shader
clutter_alpha_set_timeline
clutter_behaviour_set_alpha
clutter_clone_texture_set_parent_texture
They either now reference the new value before destroying the old
value, or just return immediately if the values are the same.
Neil Roberts [Mon, 5 Jan 2009 12:52:46 +0000 (12:52 +0000)]
Fix setting the mode on a ClutterAlpha created with animation_set_alpha(NULL)
It previously attempted to set the mode on the alpha using
clutter_animation_set_mode_internal, but this was setting the mode on
priv->alpha. At that point in the code priv->alpha is always NULL.
clutter_animation_set_mode_internal now takes a parameter to specify
which alpha to modify.
Emmanuele Bassi [Mon, 5 Jan 2009 12:52:29 +0000 (12:52 +0000)]
[docs] Add the new API to the BindingPool section
Add the clutter_binding_pool_override_* family of functions to
the BindingPool section of the Clutter API reference.
Emmanuele Bassi [Mon, 5 Jan 2009 12:49:01 +0000 (12:49 +0000)]
Allow overriding actions inside a BindingPool
As of now, a key binding installed into a BindingPool is always there
and cannot be changed.
This is problematic for sub-classes trying to override the callback
or the action for a given key binding.
This commit adds the ability to override the closure for an existing
key binding inside a binding pool -- assumed the caller knows the
key symbol and modifiers used to install the key binding in the first
place.
Neil Roberts [Mon, 5 Jan 2009 12:47:10 +0000 (12:47 +0000)]
In clutter_alpha_set_mode, set priv->mode after setting the func
Otherwise the call to clutter_alpha_set_func sets the mode back to
CLUTTER_CUSTOM_MODE so clutter_alpha_get_mode won't get back the same
value that was set.
Emmanuele Bassi [Mon, 5 Jan 2009 12:27:45 +0000 (12:27 +0000)]
[text] Add select-all binding
Bind Ctrl+A to the "select all" action.
Emmanuele Bassi [Tue, 16 Dec 2008 17:44:13 +0000 (17:44 +0000)]
[docs] Add clutter_text_activate()
Add the last unused symbol to the ClutterText section.
Emmanuele Bassi [Tue, 16 Dec 2008 17:40:41 +0000 (17:40 +0000)]
[docs] Remove ClutterLabel and ClutterEntry sections
Remove the sections for the Label and the Entry actors, which
have been replaced by ClutterText.