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().
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.
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.
When inserting text on a key press event we should also truncate
the selection.
We should not truncate the selection when inserting any Unicode
character, since changing the selection also changes the cursor
position - and one of the invariants we inherited from ClutterEntry
is that inserting characters programmatically does not change the
cursor position.
If a selection has been truncated inside a key binding handler,
we should just return and let the usual key event handler continue.
This fixes the case where we deleted a selection using the Delete
or the Backspace keys.
ClutterText should use the newly added ClutterBindingPool API to
handle key events, instead of its homegrown code.
This commit removes the action/mapping code and defers the entire
key binding matching to a ClutterBindingPool created inside the
Text class initialization function.
The clutter_text_get_chars() function returns a section of the
contents of the Text actor, delimited by a start and an end position.
This commit adds the implementation for that function and a test
unit that guarantees the offset-to-bytes computations are correct.
The :cursor-color-set property is a read-only property that
reflects whether the ClutterText actor is going to use the
color set inside the :cursor-color property when painting
the cursor.
We should re-use the offset_to_bytes() implementation from ClutterEntry
as it guaranteed some behaviour and sanity checks that we want to keep
inside ClutterText.
A ClutterText can be put in "password mode" by setting the
text as "invisible": every character inside the Text actor's
contents will be replaced when building the Pango layout with
a specific Unicode character.
The Unicode character is set to '*' by default, but the user
can be changed using the provided API.
ClutterText should have the same properties as ClutterLabel.
While at it, we can finally fix the disconnect between the wrap
and wrap-mode properties and its accessors, that we perpetuated
from GtkLabel.
The ClutterText:line-wrap property and ClutterText:line-wrap-mode
are mapped to the set_line_wrap(), get_line_wrap() and
set_line_wrap_mode(), get_line_wrap_mode() accessor functions
respectively. This should simplify bindings the Vala ones that
map a property into a method.
ClutterText replaces ClutterLabel, so it should expose the same
kind of API - ideally with the minimal amount of changes, so that
the porting is trivial.
The TidyText actor is meant as a replacement for both ClutterLabel
and ClutterText.
Any text-displaying and editing actor should derive from ClutterText
and implement the various visual cues to differentiate the editable
from the non-editable state. Those visual cues usually belong to
a high-level toolkit, especially if themeing is involved.