Commit Graph

1740 Commits

Author SHA1 Message Date
Emmanuele Bassi
45de6df615 Update ignore file
Add the conformance test units for ClutterText.
2008-12-11 13:39:35 +00:00
Emmanuele Bassi
edd6b65743 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.
2008-12-11 12:26:47 +00:00
Emmanuele Bassi
786bc4d4d5 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.
2008-12-11 12:24:45 +00:00
Emmanuele Bassi
77b3b9d5f4 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.
2008-12-11 12:21:57 +00:00
Emmanuele Bassi
2ca7cb46f9 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.
2008-12-11 12:18:26 +00:00
Emmanuele Bassi
e9c369f86d Add documentation annotations
ClutterText is heavily under-documented. This commit ports most of
the API documentation from ClutterLabel and ClutterEntry to
ClutterText.
2008-12-11 12:17:11 +00:00
Emmanuele Bassi
cfb6022831 Code style fixes
Fix the arguments alignment whenever not consistent with the
coding style rules.
2008-12-11 12:15:49 +00:00
Emmanuele Bassi
7a93bcb64e Remove unused types
Since ClutterText now uses ClutterBindingPool there is no more
need for the internal key mapping types.
2008-12-11 12:14:53 +00:00
Emmanuele Bassi
06b00f9dfc Remove units for Entry and Label
ClutterText should supercede all unit tests for ClutterLabel and
ClutterEntry.
2008-12-11 12:13:26 +00:00
Emmanuele Bassi
f13e00b411 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.
2008-12-11 12:10:46 +00:00
Emmanuele Bassi
35172a7615 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.
2008-12-11 12:08:20 +00:00
Emmanuele Bassi
ec4c15f8e7 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.
2008-12-11 12:07:20 +00:00
Emmanuele Bassi
eae98800d2 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.
2008-12-11 12:03:17 +00:00
Emmanuele Bassi
b1c366a143 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.
2008-12-11 11:59:50 +00:00
Emmanuele Bassi
2fedd3263c 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.
2008-12-11 11:57:46 +00:00
Emmanuele Bassi
e93a7e243c 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
2008-12-11 11:56:44 +00:00
Emmanuele Bassi
4a1f4d6f9a Move internal data structures on top
Try to keep the declarations section of the source files clean and
possibly consistent.
2008-12-11 11:55:39 +00:00
Emmanuele Bassi
d84a88ac3b Coding style consistency
Channel mitch's spirit.

This is also how I get to have the highest commit count on Clutter's
repository.
2008-12-11 11:54:32 +00:00
Emmanuele Bassi
d10f7127a2 Implement Text:max-length
The :max-length property establishes the maximum available
length for the Text actor's contents, in characters.
2008-12-11 11:54:07 +00:00
Emmanuele Bassi
191d1aebff 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.
2008-12-11 11:51:28 +00:00
Emmanuele Bassi
1ff02f570e 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().
2008-12-11 11:50:02 +00:00
Emmanuele Bassi
4cc57bdc41 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.
2008-12-11 11:49:45 +00:00
Emmanuele Bassi
c72722df8c 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.
2008-12-11 11:49:14 +00:00
Emmanuele Bassi
bdb0cc462d General whitespace fixes in ClutterText
Let's keep whitespace fixes to their own commit to avoid
polluting git-blame.
2008-12-11 11:48:17 +00:00
Emmanuele Bassi
7fa93ebe9e 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.
2008-12-11 11:47:06 +00:00
Emmanuele Bassi
94789e3cc3 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.
2008-12-11 11:45:37 +00:00
Emmanuele Bassi
9169dff794 Add text editing methods
Port the text editing methods from ClutterEntry, so that
ClutterText exposes the same API.
2008-12-11 11:43:56 +00:00
Emmanuele Bassi
74257dfa27 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.
2008-12-11 11:43:37 +00:00
Emmanuele Bassi
7af992974e Initialize the cursor position
By default, the cursor position is initialized to -1, meaning
"place the cursor always at the end of the text".
2008-12-11 11:42:33 +00:00
Emmanuele Bassi
d5df1bebcf 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.
2008-12-11 11:40:55 +00:00
Emmanuele Bassi
64af7bafe3 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.
2008-12-11 11:37:46 +00:00
Emmanuele Bassi
97cf7e6819 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.
2008-12-11 11:35:52 +00:00
Emmanuele Bassi
fc168a3482 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.
2008-12-11 11:33:10 +00:00
Emmanuele Bassi
c5f51f7027 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.
2008-12-11 11:31:48 +00:00
Emmanuele Bassi
430d1cf347 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>
2008-12-11 11:22:46 +00:00
Emmanuele Bassi
40fb75052b 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.
2008-12-11 11:21:39 +00:00
Emmanuele Bassi
437f96982e Expose the Text accessors as public API
Fix up the header to expose ClutterText accessors for the main
properties, matching ClutterLabel.
2008-12-11 11:20:14 +00:00
Emmanuele Bassi
5ac16652df 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.
2008-12-11 11:18:05 +00:00
Emmanuele Bassi
4d62da80ad 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.
2008-12-11 11:17:26 +00:00
Emmanuele Bassi
a91bb5450f 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.
2008-12-11 11:15:56 +00:00
Emmanuele Bassi
f9bf187e5d Use internal headers
Since ClutterText is part of Clutter, it can use the internal
and private headers instead of the catch-all clutter.h.
2008-12-11 11:15:11 +00:00
Emmanuele Bassi
a98720ae19 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.
2008-12-11 11:12:48 +00:00
Emmanuele Bassi
4973b684a6 Resort the main Clutter include file
Just for overall sanity we keep the include file sorted.
2008-12-11 11:11:11 +00:00
Emmanuele Bassi
ee72352de0 Update ignore file 2008-12-10 23:12:22 +00:00
Emmanuele Bassi
bc6a107ff6 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.
2008-12-10 23:00:48 +00:00
Neil Roberts
dc6545ccd1 * 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.
2008-12-10 12:13:20 +00:00
Neil Roberts
c81a0b3281 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.
2008-12-10 11:27:14 +00:00
Emmanuele Bassi
e3dd18dc0c 2008-12-08 Emmanuele Bassi <ebassi@linux.intel.com>
* clutter/clutter-binding-pool.h: Fix the ActivateFunc
	documentation by adding a "return value" annotation.
2008-12-08 14:22:52 +00:00
Emmanuele Bassi
5165ff3934 2008-12-08 Emmanuele Bassi <ebassi@linux.intel.com>
* clutter/clutter-docs.xml:
	* clutter/clutter-sections.txt: Add ClutterBindingPool
	section and link.
2008-12-08 14:22:39 +00:00
Emmanuele Bassi
8a537b6299 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.
2008-12-08 13:57:10 +00:00