After fixing the cursor position issues around the initial
glyph of the layout, the selection position needs fixing as
well.
The fix is similar: check if the position of the selection
is 0 and provide a fast path by setting the offset to 0.
The gdouble value represents an interval along the path from 0.0 to
1.0. This makes more sense than using an alpha value because paths are
not directly related to ClutterAlphas and the rest of the Clutter API
tends to expose gdouble arguments.
This is the port of the patch attached to bug 1266:
ClutterLabel support for pango_layout_set_height()
to the ClutterText actor. This patch adds support for the
pango_layout_set_height() function inside the layout creation
and caching, so that setting the height of a ClutterText will
make PangoLayout try to fill out the given height before
ellipsizing the contents of the ClutterText actor.
The original patch is from Havoc Pennington.
This commit ports the patch to ClutterText and applies a small
change to the height computation pointed out by Behdad Esfahbod
on GNOME's Bugzilla:
http://bugzilla.gnome.org/show_bug.cgi?id=560931
That the layout heights when doing a size request should be
set to be G_MAXINT instead of -1.
Unfortunately, the patch seems to break the conformance suite
when setting the ellipsization on the layout.
The GTest report output allows the developer to know where exactly
a test unit failure happened. The test-text-cache unit makes it
very hard to pinpoint the exact failure location because it relies
on the output to be printed out - which is not the case when the
tests are run as part of a make check.
This commit makes each sub-test inside the unit fail exactly where
the check function fails, which makes it easier to know which sub-test
did actually fail.
The clutter_text_set_selection() function is a convenience
method for setting the cursor position and the selection
boundary to a given position in a single call, with sanity
checks for the positions.
The clutter_text_get_selection() function was not checking the
passed argument, and was still accessing the contents of the
Text actor using clutter_text_get_text().
This commit also adds the last few gtk-doc annotations missing
from ClutterText.
Instead of repeating the same code for the ::activate signal
emission, use the clutter_text_activate() function inside the
'activate' key binding handler.
The clutter_text_activate() function will emit the ::activate
signal if the :activatable property is set.
This function is useful for subclasses or application code, for
example if we are going to use ::captured-event or ::key-press-event
signal handlers to intercept the Return key and emit the ::activate
signal ourselves.
Instead of installing the line-start and line-end key bindings
using the bare ClutterBindingPool API, we can use the internal
clutter_text_add_move_binding(), which automatically installs
the same key binding with the Shift modifier mask.
This allows selecting when pressing Shift+Home or Shift+End.
The selection behaviour is still incorrect around the zeroeth
position, with all the text after the first line being selected.
We can control the width of the cursor when painting by using
a simple property.
The magic -1 number passed to the setter method will reset the
cursor size to the default one of 2px.
The getter method will return an unsigned integer with the
current size.
Moving the text by a "page" depends on being able to define a
"page size" in terms of lines of text. Since we don't define
something similar to an Adjustment that allows us to handle this
behaviour, we should defer the paging implementation to a higher
level class based on ClutterText.
Another fix for the key navigation behaviour around the zeroeth
glyph in the layout.
This commit adds a fast path for for the zero index when the
cursor position is set as zero, in case we are using the line-start
or line-end key bindings, similarly to what we did in commit
be64cbcdc2 for the move-up and
move-down bindings.
The behaviour of ClutterText around the initial position is still
a little bit erratic.
This commit fixes the key navigation with Up and Down arrows around
the first line of text.
We loose precision with a direct conversion for PangoUnits to
pixels, so we should do the conversion as needed, inside the
callers of clutter_text_position_to_coords().
We don't allow changing the cursor geometry inside the ::cursor-event
signal handlers; for starters, it would make binding the signal a
huge mess, and it would also potentially break the whole actor.
Since commit c7c5cf9b ClutterCloneTexture causes an extra paint of the
source actor during the paint run of the cloned texture if the source
is not yet visible. When the stage is first shown it is redrawn
immediatly before it is mapped which means get_paint_visibility will
fail on the source actor so the inner paint will be run. The paint
guards were a global variable so they didn't cope with a second actor
being painted.
The breakage didn't occur until commit d510a4b0 because
get_paint_visibility was also broken.
The ClutterParamSpecFixed constructor is declared in the header
as taking ClutterFixed values, but the implementation takes
ClutterUnit values instead. This obviously works because fixed
and units are exactly the same type.
This commit fixes the wrong parameters.
The nodes of the test path have been reordered because Cairo coalesces
multiple move operations into a single move so the comparison would
fail if the two move nodes are consecutive.
Fix the CairoTexture description, and some of the comments inside
the code, especially with regards to the alpha channel unpremultiplication
that we have to perform each time we upload the image surface to
GL.
If you create a Cairo context in the middle of a paint run and then
you destroy it, the CairoTexture will have to upload the contents of
the image surface to the GL pipeline. This usually leads to slow
downs and general performance degradation.
ClutterCairoTexture will warn to the console if Clutter has been
compiled with the debug messages and if create() or create_region()
are called while an actor is in the middle of a paint.
Since the CLUTTER_ACTOR_IN_PAINT private flag is set as part
of the paint process by clutter_actor_paint(), there is no
need to set it inside the ClutterStage paint function.
When calling clutter_actor_paint() we should be setting the
CLUTTER_ACTOR_IN_PAINT private flag. This allows signalling
to each Actor subclass that we are effectively in the middle
of a paint sequence. Actor subclasses can check for this
private flag and act based on its presence - for instance to
avoid recursion, or to detect performance degradation cases.
Move the ClutterCairo actor from a separate library to an in-tree
actor.
ClutterCairoTexture is a simple texture subclass that allows you
to retrieve a Cairo context for a private image surface. When the
Cairo context is destroyed it will cause the image surface
contents to be uploaded to a GL texture.
The image surface used is not hardware accelerated.
Cairo has been an indirect dependency for Clutter since 0.8, through
the PangoCairo API.
Now we explicitly depend on Cairo in order to merge the clutter-cairo
API into Clutter core.
Add all the unused API to the sections file; there are still
some undocumented bits, but clutter-unused.txt is empty for
the time being.
Also, add ClutterText to the main XML document and remove
ClutterLabel and ClutterEntry.
If we create the PangoContext for ClutterText inside the class
initialization we might not have a Clutter main context yet.
Ideally, we should store the Pango context inside the main context
and create it on clutter_init(), but for now we can lazily create
the PangoContext when we initialize a ClutterText instance for the
first time.
For the time being, just don't include them or compile them; the
files will be removed from the repository as soon as all the
documentation annotations have been ported over to ClutterText.
The test-opacity interactive test is superceded by the equivalent
units inside the conformance test suite.
The test-entry interactive test is superceded by the test-text one.
ClutterText behaviour with regards to the paint opacity has been
changed by commit 07e19fff5ffa9617413fa6c3715914513fec3793.
We need to update the test suite for the paint opacity to reflect
that change as well.
We allow KeyEvents with a key symbol of '0' to fall through only
if they are marked as synthetic. Otherwise we discard them without
mercy.
Synthetic events are useful to test ClutterText behaviour; in fact,
we do use them inside the test suite exactly for that reason.
I understand we are not Pascal developers, and we don't have to
use cute and cuddly names like "i_am_an_integer_counter", but
a ClutterButtonEvent should be stored inside an "event" variable.
Using "bev" instead? Mmmh, not so much.
ClutterText should use the paint opacity for both text and
cursor.
ClutterLabel had the wrong behaviour, as it set the actor's
opacity using the text color's alpha channel, and ClutterEntry
completely disregarded the actor's opacity when painting the
cursor.
This commit harmonizes the ClutterText behaviour to always
use a composition of the actor's paint opacity and the text
and cursor alpha channel values, thus behaving more
consistently with the rest of Clutter.