Commit Graph

1716 Commits

Author SHA1 Message Date
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
Neil Roberts
008693d8b2 * 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.
2008-12-08 12:02:36 +00:00
Emmanuele Bassi
2410f74e29 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)
2008-12-05 17:44:12 +00:00
Neil Roberts
b105efae7b * clutter/clutter-entry.c: Fix the 'Since' annotation in the
gtk-doc.
2008-12-05 14:29:57 +00:00
Neil Roberts
74ba6fd8c4 * 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.
2008-12-05 14:08:06 +00:00
Neil Roberts
1a63414966 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
2008-12-05 13:13:37 +00:00
Neil Roberts
98035e4d8a 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.
2008-12-04 17:24:33 +00:00
Neil Roberts
89e7552ca3 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.
2008-12-04 13:45:09 +00:00
Robert Bragg
bb2272992b 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.
2008-12-03 18:00:05 +00:00
Neil Roberts
55cec1f651 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.
2008-12-01 16:27:54 +00:00
Neil Roberts
f052335bb4 * tests/conform/test-backface-culling.c (TEXTURE_SIZE): Don't set
to a funny size on GLES because it will break cogl_texture_polygon
2008-11-28 17:45:54 +00:00
Neil Roberts
72f2fc22ad * 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
2008-11-28 17:36:37 +00:00
Neil Roberts
1cbafc99d6 * 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.
2008-11-28 16:25:20 +00:00
Emmanuele Bassi
dfa730909c 2008-11-26 Emmanuele Bassi <ebassi@linux.intel.com>
* clutter/clutter-group.c:
	(clutter_group_real_raise), (clutter_group_real_lower): Repaint
	the Group on raise and lower.
2008-11-26 16:46:48 +00:00
Neil Roberts
ce189e7d77 * clutter/cogl/gl/cogl-texture.c (cogl_texture_rectangle): Fixed
the test for whether to use hardware tiling. Previously it assumed
	that texture coordinates are in increasing order but this is not
	the case since bug 1057 was fixed. The texture coordinates are now
	sorted later. It also allowed negative coordinates which doesn't
	make sense if the texture has waste.
2008-11-26 16:35:25 +00:00
Emmanuele Bassi
0ea346bcf7 2008-11-25 Emmanuele Bassi <ebassi@linux.intel.com>
* configure.ac: Remove stray dependency on gdk-pixbuf-xlib; we
	don't use the xlib specific API anymore. (thanks to Matthias
	Clasen)
2008-11-25 16:45:47 +00:00
Neil Roberts
50868579a0 Bug 1299 - clutter_score_remove will segmentation fault if
timelines are more than 52 and continue to remove them

	* clutter/clutter-score.c (traverse_children): Don't destroy the
	entry in the handler for REMOVE_BY_ID. It will be removed again
	anyway in the call to g_node_traverse. This was causing a
	crash. Thanks to zhangwei for spotting.
2008-11-25 13:19:48 +00:00
Neil Roberts
596d4628e6 Add a wrapper library to help testing without NPOTs.
* tests/tools/Makefile.am: Optionally build the
	libdisable-npots.la library depending on whether libdl was
	detected in the configure script. A helper script is also
	generated to setup the LD_PRELOAD.

	* tests/conform/Makefile.am: There are now two versions of the
	test-report and full-report rules. test-report-normal is the same
	as before and test-report-disable-npots runs the tests with the
	disable-npots wrapper script. The full-report rule runs both of
	them and displays two separate HTML files. The test-report rule
	just runs the normal version as before.

	* configure.ac: Add a test for libdl

	* tests/tools/disable-npots.sh.in: New file. Template for the
	helper script

	* tests/tools/disable-npots.c: New file
2008-11-24 15:44:16 +00:00
Neil Roberts
8ff85615b3 * clutter/cogl/gl/cogl-texture.c (cogl_texture_polygon): Fix the
equation for calculating texture coordinates when using sliced
	textures. This became broken in revision 3520.
2008-11-24 12:27:48 +00:00
Neil Roberts
46d4506478 Bug 1270 - Update to mingw-cross-compile.sh
* build/mingw/mingw-cross-compile.sh: Update to download latest
	binaries. Patch thanks to David Kedves.
2008-11-21 16:38:34 +00:00
Neil Roberts
21617cc0f1 Bug 1271 - mingw compiling failed: undefined reference to
`_glDrawRangeElements@24'

	Resolve glDrawRangeElements with cogl_get_proc_address instead of
	calling it directly because functions defined in GL > 1.1 are not
	directly exported under Windows.

	* clutter/cogl/common/cogl-mesh.c: Use the function pointer from
	the context

	* clutter/cogl/gl/cogl-context.c (cogl_create_context): Initialise
	function pointer.

	* clutter/cogl/gl/cogl-context.h (CoglContext): Add a function
	pointer

	* clutter/cogl/gl/cogl-defines.h.in: Add a typedef for the
	function pointer.

	* clutter/cogl/gl/cogl.c (_cogl_features_init): Resolve
	glDrawRangeElements
2008-11-21 16:18:58 +00:00
Neil Roberts
fccc087959 * tests/interactive/Makefile.am:
* tests/conform/Makefile.am: Use $(EXEEXT) when specifying a
	dependency on an executable otherwise there won't be a rule to
	build it on Windows.
2008-11-21 16:18:47 +00:00
Neil Roberts
1c4bd93b11 Bug 1269 - mingw32 building failed at clutter-media.c
* clutter/clutter-media.c: Rename the 'ERROR' signal enum to
	'ERROR_SIGNAL' otherwise it clashes with windgi.h. Thanks to David
	Kedves
2008-11-21 16:18:38 +00:00
Neil Roberts
8ca07482dd * clutter/pango/cogl-pango.h: Include pango/pango.h to get
pango-renderer.h. In versions prior to 1.18.4 pangocairo.h does
	not include pango-renderer.h
2008-11-21 16:18:31 +00:00
Neil Roberts
1ce98c97cf Bug 1280 - clutter_score_append_at_marker lead to segmentation
fault in trunk and incorrect appearance in clutter-0.8

	* clutter/clutter-score.c (start_children_entries): Check whether
	the child timeline is actually attached at a marker before
	comparing whether the marker's name matches the marker
	reached. This fixes a crash that happens when a marker is reached
	on a timeline that also has child timelines attached at the
	end. Thanks to zhangwei for spotting.
2008-11-21 12:01:41 +00:00