profile/ivi/clutter.git
15 years agoReturn the default font name if no font name is set
Emmanuele Bassi [Tue, 23 Dec 2008 16:27:54 +0000 (16:27 +0000)]
Return the default font name if no font name is set

When calling clutter_backend_get_font_name(), if no default font
name has previously been set, we just set the default and return
a pointer to it - like we do for the font options.

15 years agoUse the default font from the Backend
Emmanuele Bassi [Tue, 23 Dec 2008 15:05:16 +0000 (15:05 +0000)]
Use the default font from the Backend

Instead of storing the default font name and size as a pre-processor
macro, use the newly added ClutterBackend API to retrieve the current
default font from the backend.

15 years agoStore the default font name inside ClutterBackend
Emmanuele Bassi [Tue, 23 Dec 2008 15:03:11 +0000 (15:03 +0000)]
Store the default font name inside ClutterBackend

The default backend stores some of the global defaults, like the
font options, text resolution, double click settings. It should also
store the default font name, to allow various text-based actors to
share the same settings.

When the font name changes, the ::font-changed signal is emitted,
to allow actors to pick up the change.

15 years agoUpdate the PangoContext on backend changes
Emmanuele Bassi [Tue, 23 Dec 2008 14:34:16 +0000 (14:34 +0000)]
Update the PangoContext on backend changes

When the ClutterBackend notifies of changes in the resolution or
font options, update the PangoContext stored by Clutter's main
context. This allows changing the backend font-related settings at
runtime.

15 years agoStore the PangoContext inside the main context
Emmanuele Bassi [Tue, 23 Dec 2008 14:27:41 +0000 (14:27 +0000)]
Store the PangoContext inside the main context

The PangoContext should be stored once, and inside the main
Clutter context. Each actor for which clutter_actor_get_pango_context()
has been called will hold a reference on the Pango context as well.

This makes it possible to update the text rendering for Clutter
by using only public API.

15 years agoDo not leak the PangoContext
Emmanuele Bassi [Tue, 23 Dec 2008 14:15:10 +0000 (14:15 +0000)]
Do not leak the PangoContext

We hold a reference on the PangoContext we use for an actor, so
we should remove the reference inside the dispose implementation.

15 years agoCreate the PangoContext of the Text actor
Emmanuele Bassi [Tue, 23 Dec 2008 14:11:27 +0000 (14:11 +0000)]
Create the PangoContext of the Text actor

Instead of creating a single, private PangoContext for every
Text actor, use the newly added clutter_actor_get_pango_context()
function.

15 years agoAdd a per-actor PangoContext
Emmanuele Bassi [Tue, 23 Dec 2008 14:06:55 +0000 (14:06 +0000)]
Add a per-actor PangoContext

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.

15 years agoAdd signals for Backend options
Emmanuele Bassi [Tue, 23 Dec 2008 13:55:51 +0000 (13:55 +0000)]
Add signals for Backend options

The ClutterBackend instance at the moment lacks the ability to
notify runtime changes of the font options and the resolution.

For this reason, this commit adds a ::resolution-changed and a
::font-changed signals to the Backend class.

The ::resolution-changed signal is emitted when set_resolution()
is called with a different DPI; ::font-changed is emitted when the
cairo_font_options_t* changes from the default.

15 years agoUse "" as the default value for the :text property
Emmanuele Bassi [Mon, 22 Dec 2008 13:29:10 +0000 (13:29 +0000)]
Use "" as the default value for the :text property

This follows the convention of GtkLabel/GtkEntry in GTK+ and the old
ClutterEntry.

It makes it easier to use strlen/strcmp etc on the output, since we can
assume that it is always a string.

This commit also updates the test unit for ClutterText to verify that
the clutter_text_get_text() function also returns an empty string when
a ClutterText actor has been created.

15 years agoDo not include cogl-pango.h multiple times
Emmanuele Bassi [Mon, 22 Dec 2008 13:24:52 +0000 (13:24 +0000)]
Do not include cogl-pango.h multiple times

The clutter-private.h header already includes cogl-pango.h with
the correct inclusion path, because the main context stores a
pointer to the font map.

There is no need for clutter-text.c to include cogl-pango.h
again since it already includes clutter-private.h.

15 years agoFix the selection behaviour around the 0th glyph
Emmanuele Bassi [Tue, 16 Dec 2008 15:53:57 +0000 (15:53 +0000)]
Fix the selection behaviour around the 0th glyph

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.

15 years ago[tests] Make the layout cache fail at the right place
Emmanuele Bassi [Tue, 16 Dec 2008 13:58:54 +0000 (13:58 +0000)]
[tests] Make the layout cache fail at the right place

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.

15 years ago[docs] Add clutter_text_set_selection to gtk-doc
Emmanuele Bassi [Tue, 16 Dec 2008 12:42:44 +0000 (12:42 +0000)]
[docs] Add clutter_text_set_selection to gtk-doc

Insert the newly added symbol to the ClutterText section in
the API reference.

15 years agoAdd ClutterText::set_selection()
Emmanuele Bassi [Tue, 16 Dec 2008 12:41:20 +0000 (12:41 +0000)]
Add ClutterText::set_selection()

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.

15 years agoFix ClutterText::get_selection()
Emmanuele Bassi [Tue, 16 Dec 2008 12:25:45 +0000 (12:25 +0000)]
Fix ClutterText::get_selection()

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.

15 years ago[docs] Add more gtk-doc annotations
Emmanuele Bassi [Tue, 16 Dec 2008 12:25:15 +0000 (12:25 +0000)]
[docs] Add more gtk-doc annotations

Almost reaching full documentation.

15 years agoUse clutter_text_activate()
Emmanuele Bassi [Tue, 16 Dec 2008 12:05:10 +0000 (12:05 +0000)]
Use clutter_text_activate()

Instead of repeating the same code for the ::activate signal
emission, use the clutter_text_activate() function inside the
'activate' key binding handler.

15 years agoAdd ClutterText::activate()
Emmanuele Bassi [Tue, 16 Dec 2008 12:02:58 +0000 (12:02 +0000)]
Add ClutterText::activate()

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.

15 years ago[docs] Add more gtk-doc annotations for ClutterText
Emmanuele Bassi [Tue, 16 Dec 2008 11:52:57 +0000 (11:52 +0000)]
[docs] Add more gtk-doc annotations for ClutterText

Document the ClutterText constructors and the :editable, :selectable
and :activatable properties accessors.

15 years ago[docs] Annotate properties and fix signals docs
Emmanuele Bassi [Tue, 16 Dec 2008 11:30:47 +0000 (11:30 +0000)]
[docs] Annotate properties and fix signals docs

Annotate the properties without gtk-doc description, to get the
"Since" attribute.

Also, fix the ::cursor-event and ::activate signals documentation.

15 years ago[docs] Add :cursor-size property accessors
Emmanuele Bassi [Tue, 16 Dec 2008 10:43:05 +0000 (10:43 +0000)]
[docs] Add :cursor-size property accessors

Add the ClutterText:cursor-size property accessors to the
known gtk-doc symbols for the ClutterText section.

15 years agoAllow selecting with line-start and line-end bindings
Emmanuele Bassi [Tue, 16 Dec 2008 10:39:52 +0000 (10:39 +0000)]
Allow selecting with line-start and line-end bindings

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.

15 years agoAdd :cursor-size property to ClutterText
Emmanuele Bassi [Tue, 16 Dec 2008 10:37:45 +0000 (10:37 +0000)]
Add :cursor-size property to ClutterText

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.

15 years agoRemove unused page up/down key bindings
Emmanuele Bassi [Tue, 16 Dec 2008 10:19:56 +0000 (10:19 +0000)]
Remove unused page up/down key bindings

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.

15 years agoFix line start and line end key binding behaviour
Emmanuele Bassi [Tue, 16 Dec 2008 10:15:57 +0000 (10:15 +0000)]
Fix line start and line end key binding behaviour

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
be64cbcdc22952ce2fa9f902e153e3bd9f4a08c9 for the move-up and
move-down bindings.

15 years agoFix up/down key navigation
Emmanuele Bassi [Mon, 15 Dec 2008 18:46:08 +0000 (18:46 +0000)]
Fix up/down key navigation

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.

15 years agoUse units in position_to_coords()
Emmanuele Bassi [Mon, 15 Dec 2008 18:24:42 +0000 (18:24 +0000)]
Use units in position_to_coords()

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().

15 years agoConstify the cursor geometry in ::cursor-event
Emmanuele Bassi [Mon, 15 Dec 2008 18:23:25 +0000 (18:23 +0000)]
Constify the cursor geometry in ::cursor-event

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.

15 years ago[docs] Add annotations for ClutterText structures
Emmanuele Bassi [Mon, 15 Dec 2008 15:10:55 +0000 (15:10 +0000)]
[docs] Add annotations for ClutterText structures

ClutterText and ClutterTextClass were missing annotations for
gtk-doc to pick up.

15 years agoRemove ClutterLabel and ClutterEntry
Emmanuele Bassi [Mon, 15 Dec 2008 15:08:12 +0000 (15:08 +0000)]
Remove ClutterLabel and ClutterEntry

Both ClutterLabel and ClutterEntry have been deprecated by
ClutterText.

15 years ago[docs] Update the API reference
Emmanuele Bassi [Thu, 11 Dec 2008 15:01:28 +0000 (15:01 +0000)]
[docs] Update the API reference

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.

15 years agoFix documentation issues
Emmanuele Bassi [Thu, 11 Dec 2008 15:00:22 +0000 (15:00 +0000)]
Fix documentation issues

Provide a description for the ClutterText section, and fix some
misnamed arguments inside the header file.

15 years agoLazily create the PangoContext on Text::init
Emmanuele Bassi [Thu, 11 Dec 2008 14:57:46 +0000 (14:57 +0000)]
Lazily create the PangoContext on Text::init

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.

15 years agoRemove ClutterEntry and ClutterLabel from the build
Emmanuele Bassi [Thu, 11 Dec 2008 13:49:39 +0000 (13:49 +0000)]
Remove ClutterEntry and ClutterLabel from the build

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.

15 years agoUpdate the micro-bench tests to ClutterText
Emmanuele Bassi [Thu, 11 Dec 2008 13:48:45 +0000 (13:48 +0000)]
Update the micro-bench tests to ClutterText

Test the ClutterText rendering speed instead of ClutterLabel's.

15 years agoUpdate the interactive tests to ClutterText
Emmanuele Bassi [Thu, 11 Dec 2008 13:48:01 +0000 (13:48 +0000)]
Update the interactive tests to ClutterText

Instead of using ClutterLabel, use ClutterText to display some
text where needed.

15 years agoDo not compile the opacity and entry interactive tests
Emmanuele Bassi [Thu, 11 Dec 2008 13:45:22 +0000 (13:45 +0000)]
Do not compile the opacity and entry interactive tests

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.

15 years agoUpdate ignore file
Emmanuele Bassi [Thu, 11 Dec 2008 13:39:35 +0000 (13:39 +0000)]
Update ignore file

Add the conformance test units for ClutterText.

15 years agoUpdate the paint opacity unit test
Emmanuele Bassi [Thu, 11 Dec 2008 12:26:47 +0000 (12:26 +0000)]
Update the paint opacity unit test

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.

15 years agoAllow only synthetic events with keyval 0
Emmanuele Bassi [Thu, 11 Dec 2008 12:24:45 +0000 (12:24 +0000)]
Allow only synthetic events with keyval 0

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.

15 years agoDo not use contractions when not needed
Emmanuele Bassi [Thu, 11 Dec 2008 12:21:57 +0000 (12:21 +0000)]
Do not use contractions when not needed

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.

15 years agoUse the paint opacity when painting a ClutterText
Emmanuele Bassi [Thu, 11 Dec 2008 12:18:26 +0000 (12:18 +0000)]
Use the paint opacity when painting a ClutterText

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.

15 years agoAdd documentation annotations
Emmanuele Bassi [Thu, 11 Dec 2008 12:17:11 +0000 (12:17 +0000)]
Add documentation annotations

ClutterText is heavily under-documented. This commit ports most of
the API documentation from ClutterLabel and ClutterEntry to
ClutterText.

15 years agoCode style fixes
Emmanuele Bassi [Thu, 11 Dec 2008 12:15:49 +0000 (12:15 +0000)]
Code style fixes

Fix the arguments alignment whenever not consistent with the
coding style rules.

15 years agoRemove unused types
Emmanuele Bassi [Thu, 11 Dec 2008 12:14:53 +0000 (12:14 +0000)]
Remove unused types

Since ClutterText now uses ClutterBindingPool there is no more
need for the internal key mapping types.

15 years agoRemove units for Entry and Label
Emmanuele Bassi [Thu, 11 Dec 2008 12:13:26 +0000 (12:13 +0000)]
Remove units for Entry and Label

ClutterText should supercede all unit tests for ClutterLabel and
ClutterEntry.

15 years agoTruncate selections on text insertion
Emmanuele Bassi [Thu, 11 Dec 2008 12:10:46 +0000 (12:10 +0000)]
Truncate selections on text insertion

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.

15 years agoChange the binding propagation when truncating a selection
Emmanuele Bassi [Thu, 11 Dec 2008 12:08:20 +0000 (12:08 +0000)]
Change the binding propagation when truncating a selection

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.

15 years agoComment out the mapping API
Emmanuele Bassi [Thu, 11 Dec 2008 12:07:20 +0000 (12:07 +0000)]
Comment out the mapping API

The test-text interactive test for ClutterText should not use
the mapping API, since ClutterText does not have it anymore.

15 years agoUse ClutterBindPool inside ClutterText
Emmanuele Bassi [Thu, 11 Dec 2008 12:03:17 +0000 (12:03 +0000)]
Use ClutterBindPool inside ClutterText

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.

15 years agoAdd Text::get_chars() implementation and tests
Emmanuele Bassi [Thu, 11 Dec 2008 11:59:50 +0000 (11:59 +0000)]
Add Text::get_chars() implementation and tests

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.

15 years agoDo not namespace internal data structures
Emmanuele Bassi [Thu, 11 Dec 2008 11:57:46 +0000 (11:57 +0000)]
Do not namespace internal data structures

Since the internal data structures are not exported (duh!), we
can eschew the namespacing and save us some characters.

15 years agoAdd comments in the test suite
Emmanuele Bassi [Thu, 11 Dec 2008 11:56:44 +0000 (11:56 +0000)]
Add comments in the test suite

Comment why we need to enable the editability of the Text actor
inside the test suite.

This should clarify commit ea508ea528d61ae478d8bc4c88f54a89304f18e8

15 years agoMove internal data structures on top
Emmanuele Bassi [Thu, 11 Dec 2008 11:55:39 +0000 (11:55 +0000)]
Move internal data structures on top

Try to keep the declarations section of the source files clean and
possibly consistent.

15 years agoCoding style consistency
Emmanuele Bassi [Thu, 11 Dec 2008 11:54:32 +0000 (11:54 +0000)]
Coding style consistency

Channel mitch's spirit.

This is also how I get to have the highest commit count on Clutter's
repository.

15 years agoImplement Text:max-length
Emmanuele Bassi [Thu, 11 Dec 2008 11:54:07 +0000 (11:54 +0000)]
Implement Text:max-length

The :max-length property establishes the maximum available
length for the Text actor's contents, in characters.

15 years agoUpdate the ClutterText test unit
Emmanuele Bassi [Thu, 11 Dec 2008 11:51:28 +0000 (11:51 +0000)]
Update the ClutterText test unit

Whenever we are sending specially crafted KeyEvents to a ClutterText
we also need to set it editable, since the event handling code depends
on the editability setting.

15 years agoUse the stored contents length in ::delete_chars()
Emmanuele Bassi [Thu, 11 Dec 2008 11:50:02 +0000 (11:50 +0000)]
Use the stored contents length in ::delete_chars()

Instead of recomputing it, we can reuse the contents length we
compute and store inside clutter_text_set_text().

15 years agoImprove the safety checks inside the text setters
Emmanuele Bassi [Thu, 11 Dec 2008 11:49:45 +0000 (11:49 +0000)]
Improve the safety checks inside the text setters

We should check that the contents of the Text actor are
not NULL when computing the offsets in bytes.

15 years agoAdd :cursor-color-set property declaration
Emmanuele Bassi [Thu, 11 Dec 2008 11:49:14 +0000 (11:49 +0000)]
Add :cursor-color-set property declaration

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.

15 years agoGeneral whitespace fixes in ClutterText
Emmanuele Bassi [Thu, 11 Dec 2008 11:48:17 +0000 (11:48 +0000)]
General whitespace fixes in ClutterText

Let's keep whitespace fixes to their own commit to avoid
polluting git-blame.

15 years agoReplace offset_to_bytes() implementation
Emmanuele Bassi [Thu, 11 Dec 2008 11:47:06 +0000 (11:47 +0000)]
Replace offset_to_bytes() implementation

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.

15 years agoAdd a separate test unit for ClutterText
Emmanuele Bassi [Thu, 11 Dec 2008 11:45:37 +0000 (11:45 +0000)]
Add a separate test unit for ClutterText

Instead of changing the unit for ClutterEntry, we add a new
test unit specifically for ClutterText so that we can later tweak
it specifically for the behaviour changes needed to make ClutterText
work better.

15 years agoAdd text editing methods
Emmanuele Bassi [Thu, 11 Dec 2008 11:43:56 +0000 (11:43 +0000)]
Add text editing methods

Port the text editing methods from ClutterEntry, so that
ClutterText exposes the same API.

15 years agoAdd missing basic constructor
Emmanuele Bassi [Thu, 11 Dec 2008 11:43:37 +0000 (11:43 +0000)]
Add missing basic constructor

ClutterText should have an empty constructor, mostly for
bindings to use, that just proxies call to g_object_new()
without setting any property.

15 years agoInitialize the cursor position
Emmanuele Bassi [Thu, 11 Dec 2008 11:42:33 +0000 (11:42 +0000)]
Initialize the cursor position

By default, the cursor position is initialized to -1, meaning
"place the cursor always at the end of the text".

15 years agoAdd text-visibility accessors for ClutterText
Emmanuele Bassi [Thu, 11 Dec 2008 11:40:55 +0000 (11:40 +0000)]
Add text-visibility accessors for 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.

15 years agoMove test-threads to ClutterText
Emmanuele Bassi [Thu, 11 Dec 2008 11:37:46 +0000 (11:37 +0000)]
Move test-threads to ClutterText

The test-threads interactive test is a good candidate for the
switch from ClutterLabel to ClutterText to verify that the
behaviour of the two classes is the same.

15 years agoCorrectly initialize the initial state of ClutterText
Emmanuele Bassi [Thu, 11 Dec 2008 11:35:52 +0000 (11:35 +0000)]
Correctly initialize the initial state of ClutterText

Some of the values in ClutterText have an initial state that
does not match a zero-ed out ClutterTextPrivate structure.

15 years agoMerge the ClutterLabel properties into ClutterText
Emmanuele Bassi [Thu, 11 Dec 2008 11:33:10 +0000 (11:33 +0000)]
Merge the ClutterLabel properties into ClutterText

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.

15 years agoAdd Text::get_chars() method declaration
Emmanuele Bassi [Thu, 11 Dec 2008 11:31:48 +0000 (11:31 +0000)]
Add Text::get_chars() method declaration

Add the declaration for a clutter_text_get_chars() function that
returns a portion of the contents of a Text actor.

15 years agoAdd Actor::grab_key_focus() method
Emmanuele Bassi [Thu, 11 Dec 2008 11:22:46 +0000 (11:22 +0000)]
Add Actor::grab_key_focus() method

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>
15 years agoMerge Label and Entry API into ClutterText
Emmanuele Bassi [Thu, 11 Dec 2008 11:21:39 +0000 (11:21 +0000)]
Merge Label and Entry API into ClutterText

ClutterText should expose both ClutterLabel and ClutterEntry
functionality using an API that matches the one provided by
those two classes.

15 years agoExpose the Text accessors as public API
Emmanuele Bassi [Thu, 11 Dec 2008 11:20:14 +0000 (11:20 +0000)]
Expose the Text accessors as public API

Fix up the header to expose ClutterText accessors for the main
properties, matching ClutterLabel.

15 years agoUpdate the ClutterText interactive test
Emmanuele Bassi [Thu, 11 Dec 2008 11:18:05 +0000 (11:18 +0000)]
Update the ClutterText interactive test

Use ClutterText's own API instead of relying on the Label's API.

ClutterText is not meant to be a subclass of ClutterLabel.

15 years agoCoalesce ClutterLabel API usage
Emmanuele Bassi [Thu, 11 Dec 2008 11:17:26 +0000 (11:17 +0000)]
Coalesce ClutterLabel API usage

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.

15 years agoGroup all the integer private fields
Emmanuele Bassi [Thu, 11 Dec 2008 11:15:56 +0000 (11:15 +0000)]
Group all the integer private fields

Integer fields using the ": <bits>" notation should be packed
together so that the compiler can optimize the structure size
correctly.

15 years agoUse internal headers
Emmanuele Bassi [Thu, 11 Dec 2008 11:15:11 +0000 (11:15 +0000)]
Use internal headers

Since ClutterText is part of Clutter, it can use the internal
and private headers instead of the catch-all clutter.h.

15 years agoInitial import of the Text actor from Tidy
Emmanuele Bassi [Thu, 11 Dec 2008 11:12:48 +0000 (11:12 +0000)]
Initial import of the Text actor from Tidy

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.

15 years agoResort the main Clutter include file
Emmanuele Bassi [Thu, 11 Dec 2008 11:11:11 +0000 (11:11 +0000)]
Resort the main Clutter include file

Just for overall sanity we keep the include file sorted.

15 years agoUpdate ignore file
Emmanuele Bassi [Wed, 10 Dec 2008 23:12:22 +0000 (23:12 +0000)]
Update ignore file

15 years agoDo not modify parameters in place
Emmanuele Bassi [Wed, 10 Dec 2008 23:00:48 +0000 (23:00 +0000)]
Do not modify parameters in place

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.

15 years ago * clutter/cogl/gl/cogl.c:
Neil Roberts [Wed, 10 Dec 2008 12:13:20 +0000 (12:13 +0000)]
* clutter/cogl/gl/cogl.c:
* clutter/cogl/gl/cogl-defines.h.in:
* clutter/cogl/gl/cogl-context.h:
* clutter/cogl/common/cogl-mesh.c: Rename the glBufferDataSub
function to glBufferSubData. When calling glXGetProcAddress with
the former Mesa returns a stub dispatch function which will
segfault if you try to use it. With NVIDIA it returns NULL so
_cogl_features_init decides the card doesn't have VBO support.

15 years ago Bug 1323 - ClutterBehaviorDepth conflicts with other behaviors
Neil Roberts [Wed, 10 Dec 2008 11:27:14 +0000 (11:27 +0000)]
Bug 1323 - ClutterBehaviorDepth conflicts with other behaviors

* clutter/clutter-behaviour-ellipse.c (actor_apply_knot_foreach):
Don't set the depth if there is no x or y tilt. That way it can
still be used in conjunction with ClutterBehaviourDepth. Thanks to
Tonny Tzeng.

15 years ago2008-12-08 Emmanuele Bassi <ebassi@linux.intel.com>
Emmanuele Bassi [Mon, 8 Dec 2008 14:22:52 +0000 (14:22 +0000)]
2008-12-08  Emmanuele Bassi  <ebassi@linux.intel.com>

* clutter/clutter-binding-pool.h: Fix the ActivateFunc
documentation by adding a "return value" annotation.

15 years ago2008-12-08 Emmanuele Bassi <ebassi@linux.intel.com>
Emmanuele Bassi [Mon, 8 Dec 2008 14:22:39 +0000 (14:22 +0000)]
2008-12-08  Emmanuele Bassi  <ebassi@linux.intel.com>

* clutter/clutter-docs.xml:
* clutter/clutter-sections.txt: Add ClutterBindingPool
section and link.

15 years ago2008-12-08 Emmanuele Bassi <ebassi@linux.intel.com>
Emmanuele Bassi [Mon, 8 Dec 2008 13:57:10 +0000 (13:57 +0000)]
2008-12-08  Emmanuele Bassi  <ebassi@linux.intel.com>

* clutter/Makefile.am:
* clutter/clutter.h: Add ClutterBindingPool to the build.

* clutter/clutter-binding-pool.c:
* clutter/clutter-binding-pool.h: Add ClutterBindingPool, a data
structure meant to hold (key symbol, modifiers) pairs and associate
them to a closure. The ClutterBindingPool can be used to install
key bindings for actors and then execute closures inside the
key-press-event signal handlers, removing the need for big
switch() or if() blocks for each key.

* clutter/clutter-event.c: Consistently use "key symbol" instead
of "key value".

* clutter/clutter-event.h: Add more modifier masks.

* clutter/clutter-marshal.list:

* tests/conform/Makefile.am:
* tests/conform/test-binding-pool.c:
* tests/conform/test-conform-main.c: Add ClutterBindingPool
conformance test.

* tests/interactive/Makefile.am:
* tests/interactive/test-binding-pool.c: Add interactive test (and
example code) for the ClutterBindingPool usage.

15 years ago * clutter/clutter-main.c (_clutter_do_pick): Restore the GL_DITHER
Neil Roberts [Mon, 8 Dec 2008 12:02:36 +0000 (12:02 +0000)]
* clutter/clutter-main.c (_clutter_do_pick): Restore the GL_DITHER
state after reading the pixel value instead of before. Suggested
in bug 1328 thanks to Guy Zadickario.

15 years ago2008-12-05 Emmanuele Bassi <ebassi@linux.intel.com>
Emmanuele Bassi [Fri, 5 Dec 2008 17:44:12 +0000 (17:44 +0000)]
2008-12-05  Emmanuele Bassi  <ebassi@linux.intel.com>

Bug 1309 - clutter_timeline_new and clutter_timeline_set_speed
have two standard of the fps limitation

* clutter/clutter-timeline.c:
(clutter_timeline_class_init): Set the maximum value of the
:fps property to be G_MAXUINT. (Zhang Wei)

15 years ago * clutter/clutter-entry.c: Fix the 'Since' annotation in the
Neil Roberts [Fri, 5 Dec 2008 14:29:57 +0000 (14:29 +0000)]
* clutter/clutter-entry.c: Fix the 'Since' annotation in the
gtk-doc.

15 years ago * clutter/clutter-timeline.c:
Neil Roberts [Fri, 5 Dec 2008 14:08:06 +0000 (14:08 +0000)]
* clutter/clutter-timeline.c:
* clutter/clutter-texture.c:
* clutter/clutter-stage.c:
* clutter/clutter-label.c:
* clutter/clutter-behaviour-path.c:
* clutter/clutter-actor.c: Fix the 'Since' annotation in the
gtk-doc.

15 years ago Bug 1252 - Merge ClutterBehaviourPath and ClutterBehaviourBspline
Neil Roberts [Fri, 5 Dec 2008 13:13:37 +0000 (13:13 +0000)]
Bug 1252 - Merge ClutterBehaviourPath and ClutterBehaviourBspline

* clutter/clutter-path.h:
* clutter/clutter-path.c: Implementation of new ClutterPath object
to represent a path combining straight line and bezier curve
elements.

* clutter/clutter.h: Include clutter-path.h and remove
clutter-behaviour-bspline.h

* tests/interactive/test-threads.c (test_threads_main):
* tests/interactive/test-script.c:
* tests/interactive/test-behave.c (test_behave_main): Use new path
API

* clutter/clutter-effect.c: Use the new ClutterBehaviourPath API.

* clutter/clutter-bezier.h:
* clutter/clutter-bezier.c: Moved bezier curve handling code out
from clutter-behaviour-bspline.c to a separate file.

* clutter/clutter-behaviour-path.h:
* clutter/clutter-behaviour-path.c: Reimplemented to work with a
ClutterPath

* clutter/clutter-behaviour-bspline.h:
* clutter/clutter-behaviour-bspline.c: Removed

* clutter/Makefile.am: Add clutter-path and clutter-bezier, remove
clutter-behaviour-bspline.

* tests/conform/test-path.c: New automatic test for ClutterPath
consistency

* tests/conform/test-conform-main.c (main): Add test_path

* tests/conform/Makefile.am (test_conformance_SOURCES): Add
test-path.c

* clutter/clutter-sections.txt: Add ClutterPath docs

* clutter/clutter.types:
* clutter/clutter-docs.xml:
* doc/reference/clutter/clutter-animation-tutorial.xml: Remove
mention of ClutterBehaviourBspline

* clutter/clutter-marshal.list: Add VOID:UINT

15 years ago Bug 1297 - Bring back support for GL_ARB_texture_rectangle
Neil Roberts [Thu, 4 Dec 2008 17:24:33 +0000 (17:24 +0000)]
Bug 1297 - Bring back support for GL_ARB_texture_rectangle

* clutter/cogl/gl/cogl-texture.c (cogl_texture_new_from_foreign,
(_cogl_texture_quad_hw, cogl_texture_polygon),
(_cogl_texture_quad_sw): Support GL_ARB_texture_rectangle textures

* clutter/glx/clutter-glx-texture-pixmap.c: Use rectangle textures
when NPOTs are not available or it is forced by the
CLUTTER_PIXMAP_TEXTURE_RECTANGLE environment variable.

* clutter/cogl/gl/cogl.c (cogl_enable): Allow enabling
GL_TEXTURE_RECTANGLE_ARB.

15 years ago Bug 1172 - Disjoint paths and clip to path
Neil Roberts [Thu, 4 Dec 2008 13:45:09 +0000 (13:45 +0000)]
Bug 1172 - Disjoint paths and clip to path

* clutter/cogl/cogl-path.h:
* clutter/cogl/common/cogl-primitives.c:
* clutter/cogl/common/cogl-primitives.h:
* clutter/cogl/gl/cogl-primitives.c:
* clutter/cogl/gles/cogl-primitives.c: Changed the semantics of
cogl_path_move_to. Previously this always started a new path but
now it instead starts a new disjoint sub path. The path isn't
cleared until you call either cogl_path_stroke, cogl_path_fill or
cogl_path_new. There are also cogl_path_stroke_preserve and
cogl_path_fill_preserve functions.

* clutter/cogl/gl/cogl-context.c:
* clutter/cogl/gl/cogl-context.h:
* clutter/cogl/gles/cogl-context.c:
* clutter/cogl/gles/cogl-context.h: Convert the path nodes array
to a GArray.

* clutter/cogl/gl/cogl-texture.c:
* clutter/cogl/gles/cogl-texture.c: Call cogl_clip_ensure

* clutter/cogl/common/cogl-clip-stack.c:
* clutter/cogl/common/cogl-clip-stack.h: Simplified the clip
stack code quite a bit to make it more maintainable.  Previously
whenever you added a new clip it would go through a separate route
to immediately intersect with the current clip and when you
removed it again it would immediately rebuild the entire clip. Now
when you add or remove a clip it doesn't do anything immediately
but just sets a dirty flag instead.

* clutter/cogl/gl/cogl.c:
* clutter/cogl/gles/cogl.c: Taken away the code to intersect
stencil clips when there is exactly one stencil bit. It won't work
with path clips and I don't know of any platform that doesn't have
eight or zero stencil bits. It needs at least three bits to
intersect a path with an existing clip. cogl_features_init now
just decides you don't have a stencil buffer at all if you have
less than three bits.

* clutter/cogl/cogl.h.in: New functions and documentation.

* tests/interactive/test-clip.c: Replaced with a different test
that lets you add and remove clips. The three different mouse
buttons add clips in different shapes. This makes it easier to
test multiple levels of clipping.

* tests/interactive/test-cogl-primitives.c: Use
cogl_path_stroke_preserve when using the same path again.

* doc/reference/cogl/cogl-sections.txt: Document the new
functions.

15 years ago Bug 1303 - clutter_glx_texture_pixmap_using_extension doesn't check if
Robert Bragg [Wed, 3 Dec 2008 18:00:05 +0000 (18:00 +0000)]
Bug 1303 - clutter_glx_texture_pixmap_using_extension doesn't check if
fallbacks are being used

* glx/clutter-glx-texture-pixmap.c:
clutter_glx_texture_pixmap_using_extension now checks to see if
priv->use_fallback is TRUE not just that the tfp extension is
available.

15 years ago Bug 1305 - NPOT textures unaligned to a pixel sometimes have
Neil Roberts [Mon, 1 Dec 2008 16:27:54 +0000 (16:27 +0000)]
Bug 1305 - NPOT textures unaligned to a pixel sometimes have
border artifacts

* clutter/cogl/gl/cogl-texture.c: Set the wrap mode of a texture
on demand

Instead of setting the wrap mode once per texture at creation, it
is now changed whenever the texture is drawn. The previous value
is cached so that it isn't changed if the value is the same.

This is used in _cogl_texture_quad_hw to only enable GL_REPEAT
mode when the coordinates are not in the range [0,1]. Otherwise it
can pull in pixels from the other edge when the texture is
rendered off-pixel.

15 years ago * tests/conform/test-backface-culling.c (TEXTURE_SIZE): Don't set
Neil Roberts [Fri, 28 Nov 2008 17:45:54 +0000 (17:45 +0000)]
* tests/conform/test-backface-culling.c (TEXTURE_SIZE): Don't set
to a funny size on GLES because it will break cogl_texture_polygon

15 years ago * tests/conform/test-backface-culling.c: New test for backface
Neil Roberts [Fri, 28 Nov 2008 17:36:37 +0000 (17:36 +0000)]
* tests/conform/test-backface-culling.c: New test for backface
culling

* tests/conform/test-conform-main.c (main): Add
/texture/test_backface_culing

* tests/conform/Makefile.am (test_conformance_SOURCES): Add
test-backface-culling.c

15 years ago * tests/conform/test-mesh-mutability.c:
Neil Roberts [Fri, 28 Nov 2008 16:25:20 +0000 (16:25 +0000)]
* tests/conform/test-mesh-mutability.c:
* tests/conform/test-mesh-interleved.c:
* tests/conform/test-mesh-contiguous.c: Remove the idle source
after the test is complete so that it won't interfere with other
tests.