1
0
Fork 0
Commit graph

2363 commits

Author SHA1 Message Date
Robert Bragg
0ffb6f7aa5 [clutter-alpha.c.0.patch] replace ClutterAngle with float
This is just an update of the patch to reflect that fixed-to-float.sh now
replaces ClutterAngle usage with float.
2009-01-08 11:47:27 +00:00
Robert Bragg
65e7bc6363 Replaces uses of CoglAngle with floats (Though the CoglAngle type remains)
The CoglAngle type can still be used for focused optimisations since the type
and macros remain. Uses of CoglAngle within Cogl have been replaced with floats;
COGL_ANGLE_FROM_DEG is no longer used anywhere and the replacements for
cogl_angle_cos -> cosf (same for sin) have been fixed to convert float values
in degrees to radians. This fixes the cogl-primitives API.
2009-01-08 11:47:27 +00:00
Robert Bragg
e4b1859077 [test-clip] Use gint for hand_{width,height} when calulating -hand_* /2
It was a fluke that this worked out due to how the incorrect integer
result gets converted by CLUTTER_INT_TO_FIXED.
2009-01-08 11:38:31 +00:00
Emmanuele Bassi
28b0f432b7 [animation] Allow registering custom progress function
A ClutterInterval can change the way the progress is computed
by subclassing and overriding the ::compute_value() virtual function.

It should also be possible to register a custom progress function
in the same way it is possible to register a custom transformation
function between two GValues.

This commit adds an internal, global hash table that maintains a
GType <-> progress function association; each ClutterInterval
will check if there is a progress function registered for the
GType of the initial and final values of the interval and, if
it has been found, it will call it to compute the value of the
interval depending on the progress factor.
2009-01-08 11:15:09 +00:00
Robert Bragg
cc8cd8392f [test-depth] Use a gint for width, not guint, when calculating -width/2
It was a fluke that this worked out due to how clutter_actor_set_depth
internally converts the incorrect integer result to fixed point.
2009-01-08 11:03:23 +00:00
Emmanuele Bassi
ff48c3ef7c [animation] Interval::compute_value should return a boolean
If the computation of the interval value depending on the progress
was not successful, ClutterInterval::compute_value() should return
this information to the caller.
2009-01-07 18:18:59 +00:00
Chris Lord
2cea22e6a0 Update/clean and apply the async-texture patch from bug #1144 2009-01-07 17:02:43 +00:00
Emmanuele Bassi
5d5b93bd2a Rename a variable masking index()
The maintainer CFLAGS found another masking of the index() function
by an helpless variable.
2009-01-07 16:41:17 +00:00
Neil Roberts
805b88d4c0 Merge branch multiple-texture-rectangle into master
Bug 1289 - Draw multiple glyphs at once

The multiple-texture-rectangle branch adds a new Cogl texture function
called cogl_texture_multiple_rectangles which is used to draw multiple
rectangles out of a texture using a single GL call. This is
significantly faster than drawing the rectangles with individual calls
on some platforms. The Pango renderer now uses this to speed up
rendering.

The conflicts are just due to the whitespace fixes in cb569a5.

Conflicts:

	clutter/cogl/gl/cogl-context.c
	clutter/cogl/gl/cogl-context.h
	clutter/cogl/gl/cogl-texture.c
2009-01-07 16:25:26 +00:00
Emmanuele Bassi
5913bcf7e3 [tests] Update the ClutterText interactive test
Remove the unused functions and if the test fails to load the
text from a file, show the error inside the text actor itself.
2009-01-07 15:54:08 +00:00
Emmanuele Bassi
0d9c07f824 [docs] Documentation fixes
Remove the causes of warnings from the Clutter gtk-doc API reference
generation process.
2009-01-07 14:53:54 +00:00
Emmanuele Bassi
c1c7131199 [text] Do not use markup on an editable Text
An editable ClutterText should not use pango_layout_set_markup(),
as the contents of the text actor will not match the text.

Only read-only text actors should parse the contents for Pango
markup.
2009-01-07 13:48:45 +00:00
Emmanuele Bassi
368df450b2 [text] Do not ensure the cursor if not needed
If the Text actor is neither editable nor has its cursor set
to visible, then we should not be ensuring the cursor position.

This fixes a failure in the conformance test unit for the
layout cache.
2009-01-07 13:16:11 +00:00
Emmanuele Bassi
c297d1ccf1 [tests] Make test-scale use ClutterText
The ClutterLabel actor has been superceded by ClutterText.

This is merge fall-out from the text-actor branch.
2009-01-07 12:17:09 +00:00
Emmanuele Bassi
796294fd4e [tests] Remove test-opacity interactive test
Merge fall-out from the text-actor branch. The test-opacity test
was moved to the conformance test suite.
2009-01-07 12:17:02 +00:00
Emmanuele Bassi
c54bd99097 Merge the ClutterText actor
Merge branch 'text-actor'

* text-actor: (108 commits)
  Re-align ClutterText header file
  [text] Fix cursor sizing
  Comments and whitespace fixes to ClutterText
  [docs] Add newly added :single-line-mode accessors
  Update the ignore file
  [tests] Add text field interactive test
  [text] Add single-line-mode to ClutterText
  [text] Fix the deletion actions
  [text] Use cached length when possible
  [tests] Add unit for the ClutterText:password-char property
  [docs] Update the Text section
  [text] Coalesce text visibility and password character
  Allow localizations to change the text direction
  Clean up the update_pango_context() function
  Pass the PangoContext, not the MainContext
  Revert the logic of the PangoContext check
  Remove the binding pool entry from the list
  Remove BindingPool::list_actions()
  Add ClutterActor::create_pango_context()
  Rename the PangoContext creation functions
  ...
2009-01-07 12:06:33 +00:00
Emmanuele Bassi
ad7d1b54bc Re-align ClutterText header file
The addition of the single line mode accessor methods caused the
re-alignment of the entire file.
2009-01-07 11:46:22 +00:00
Emmanuele Bassi
328534fc95 [text] Fix cursor sizing
The cursor should be slightly smaller than the height of the actor, to
allow for painting a border. Let's pad it by 1 pixel on the top and 1
on the bottom.

Also, we should use the cursor size everywhere and not use hardcoded
magic numbers.
2009-01-07 11:44:54 +00:00
Emmanuele Bassi
f3142a70dc Comments and whitespace fixes to ClutterText 2009-01-07 00:43:24 +00:00
Emmanuele Bassi
7f9c384099 [docs] Add newly added :single-line-mode accessors
Add the ClutterText:single-line-mode property accessor methods
to the API reference.
2009-01-07 00:30:59 +00:00
Emmanuele Bassi
1223fcbb4f Update the ignore file 2009-01-07 00:29:41 +00:00
Emmanuele Bassi
71c03df967 [tests] Add text field interactive test
The test-text-field is a test/example that shows how to use the
ClutterText as a text input field in single line mode.
2009-01-07 00:27:50 +00:00
Emmanuele Bassi
43f82332dd [text] Add single-line-mode to ClutterText
Allow using ClutterText as a single line text field. This is useful for
text fields that accept just a single line of contents by default, and
respond to the Enter key press to execute some action.

The :single-line-mode property enables this behaviour inside ClutterText
by clipping and scrolling the contents of the PangoLayout if they do
not fit the allocated width of the Text actor.
2009-01-07 00:25:24 +00:00
Emmanuele Bassi
8182b354b1 [text] Fix the deletion actions
When using the delete-prev action from the end of the text we end
up either missing the first glyph we have to delete or falling
through the last one in the text.

This commit fixes both issues.
2009-01-06 20:54:20 +00:00
Emmanuele Bassi
3d32d464e9 [text] Use cached length when possible
Since clutter_text_set_text() measures the length of the text
each time, we should use the cached length instead of recomputing
the text length each time. This should save us some time when
dealing with long, multi-byte texts.
2009-01-06 20:52:03 +00:00
Robert Bragg
1eeb21c155 [fixed-to-float.sh] COGL_FIXED_FROM_INT wasn't casting to a float
It's necissary to replace COGL_FIXED_FROM_INT with a (float) cast otherwise
the replacement maths may end up with integer rounding errors. This was
causing text to not be displayed due to the texture coordinate calculation
always rounding to (0,0)
2009-01-06 18:54:00 +00:00
Robert Bragg
e42d756a69 [clutter-alpha.c.0.patch] Normalizes sine values [0,1] before calculating alpha
The previous patch broke some of the normalization done before the sine value
gets multiplied with CLUTTER_ALPHA_MAX. This e.g. broke test-actors when sine
values went through to -1, as the o-hands were scaled so large all you saw was
the red 'O'.
2009-01-06 18:54:00 +00:00
Neil Roberts
12ea2933bd [cogl-material] Restore the GL_TEXTURE_ENV_MODE after material_rectangle
The rest of Cogl expects the texture mode to be GL_MODULATE so it
needs to be restored after calling cogl_material_rectangle. Otherwise
cogl_texture_rectangle will fail to blend with the Cogl color properly
and all of the labels will be black.
2009-01-06 18:24:57 +00:00
Neil Roberts
606d34f2aa [cogl-material] Make the user_tex_coords parameter of _rectangle const
The array is only used for input so it should be const.
2009-01-06 16:09:55 +00:00
Neil Roberts
b3b7312f33 [test-cogl-material] Remove return value from material_rectangle_paint
The paint signal has no return value so it isn't needed. This fixes
a compiler warning.
2009-01-06 16:01:23 +00:00
Neil Roberts
f5288b1918 Add cogl-material.h and cogl-matrix.h to libclutterinclude_HEADERS
Otherwise they won't get installed
2009-01-06 15:53:35 +00:00
Emmanuele Bassi
87ab64d291 [tests] Add unit for the ClutterText:password-char property
Check that the contents of the Text actor are unaffected by the
:password-char property; that the accessors are correct; and finally
that the initial value for a newly constructed Text actor is valid.
2009-01-06 15:30:31 +00:00
Emmanuele Bassi
c4475c6bfc [docs] Update the Text section
After the 979b6794 commit, the section for ClutterText needs
updating on the renamed and removed accessors.
2009-01-06 15:29:44 +00:00
Emmanuele Bassi
979b6794bb [text] Coalesce text visibility and password character
Using two properties to set a password entry can be construed as
both cumbersome and a gtk-ism. And rightly so on both counts.

The :text-visible property has also conflicting semantics with the
:cursor-visible one: while the latter hides the cursor, the former
changes the display of the contents of the Text actor. It is, thus,
not a matter of "visibility" but of "rendering".

Instead of setting the :text-visible and :invisible-char properties
to have a password text field, the Text actor should just have a
single :password-char property holding a Unicode character. If the
value of the :password-char is non-zero, the Text actor will use the
Unicode character to render the contents of the text entry.

This commit removes the following methods:

  clutter_text_set_text_visible()
  clutter_text_get_text_visible()
  clutter_text_set_invisible_char()
  clutter_text_get_invisible_char()

And the following properties:

  ClutterText:text-visible
  ClutterText:invisible-char

In favour of:

  clutter_text_set_password_char()
  clutter_text_get_password_char()

And:

  ClutterText:password-char

Thus making obvious what use the property and accessor methods are
for and simplifying the process of creating a simple password text
field to:

  text = clutter_text_new ();
  clutter_text_set_password_char (CLUTTER_TEXT (text), '*');
2009-01-06 15:22:31 +00:00
Emmanuele Bassi
854cf5d499 Animate ClutterColor properties
We can animate a ClutterColor-based property between an interval
of two colors by simply applying the factor to each color component.
2009-01-06 12:53:30 +00:00
Emmanuele Bassi
1892f8cb1d Allow localizations to change the text direction
The locale translators of Clutter are also the ones that should set
the default direction of the text in a Clutter user interface.

This commit adds a translatable string that defines the direction
of the text; the translation authors will change it to the correct
value and that will determine the default direction.

The default text direction can be overridden by using the
CLUTTER_TEXT_DIRECTION environment variable, or by using the
--clutter-text-direction command line switch. In any other case,
the locale will determine the text direction, as it should.
2009-01-06 12:35:19 +00:00
Neil Roberts
e4272fba69 Fix off-by-one error in clutter_stage_read_pixels
It was always reading one pixel lower than requested. If y was 0 then
it would try to read below the lowest line.

Thanks to Geoff Gustafson for spotting.
2009-01-06 12:27:13 +00:00
Takao Fujiwara
8e6423a1b6 Bug 1397 - Allow localizing the command line help
Clutter has a set of command line options that are added to every
application by means of clutter_init() or by obtaining the Clutter
GOptionGroup and using g_option_context_parse(). Thus, every Clutter
application will automatically have an --help command line switch
showing the list of options and their description.

At the moment, Clutter does not enable localization of the help,
thus making it less than useful on non-English locales.

This patch enables the machinery to create a localization file and
load it when initializing Clutter, by means of the GLib macros and
locale.h API we already use.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-01-06 12:15:02 +00:00
Neil Roberts
e5543a658f Make libdisable-npots a bit more portable
Instead of including GL/gl.h directly it now includes cogl/cogl.h
instead which should include the right GL header.

Instead of using dlopen to specifically open libGL it now tries to use
dlsym with RTLD_NEXT. This requires defining _GNU_SOURCE on GNU
systems. If RTLD_NEXT is not available it will try passing NULL which
is unlikely to work but it will at least catch the case where it
returns the wrapper version of glGetString to prevent infinite
recursion.

This should hopefully make it work on OS X where the name of the
header and library are different (although this is currently
untested).
2009-01-05 17:11:44 +00:00
Emmanuele Bassi
1187004099 Clean up the update_pango_context() function
Logically split the various operations with whitespace so that
it's clear what does what.
2009-01-05 16:48:46 +00:00
Emmanuele Bassi
a5f9c72694 Pass the PangoContext, not the MainContext
When updating the PangoContext with the current options (font name,
options, resolution) pass the PangoContext instead of the Clutter
MainContext structure pointer.
2009-01-05 16:45:59 +00:00
Emmanuele Bassi
c79112bd3c Revert the logic of the PangoContext check
The branch that creates the global PangoContext should only run
if there is no global PangoContext already.
2009-01-05 16:44:52 +00:00
Emmanuele Bassi
700b34148b Remove the binding pool entry from the list
When removing a binding entry from the binding pool we should not
only remove it from the hash table, but also from the linked list
we use to iterate over inside the block/unblock_action() pair.
2009-01-05 16:29:49 +00:00
Emmanuele Bassi
c988b7b736 Remove BindingPool::list_actions()
The clutter_binding_pool_list_actions() was not implemented. The
utility of a call listing all the action names is also debatable:
all the functions related to the key bindings take the key symbol
and modifiers -- except the block_action() and unblock_action()
pair.
2009-01-05 16:25:50 +00:00
Emmanuele Bassi
982a678053 Add ClutterActor::create_pango_context()
Sometimes an actor needs to set specific font rendering options on
the PangoContext without changing settings for every other text-rendering
actor.

In order to do this, we need a new public method to create a Pango
context object -- preset with all the default settings -- owned by the
developer and not shared with the rest of Clutter.

This new method is called clutter_actor_create_pango_context(); while
it does not strictly depend on a ClutterActor, it is a good idea to
have it inside the ClutterActor API to map the current get_pango_context()
method and in case we start storing screen-specific data to the Actor
itself during the 1.x API cycle.
2009-01-05 15:29:10 +00:00
Emmanuele Bassi
d622a4dd89 Rename the PangoContext creation functions
The _clutter_context_create_pango_context() should create a new
context; the function returning the PangoContext stored inside the
MainContext structure should be named _get_pango_context() instead.
2009-01-05 15:27:33 +00:00
Emmanuele Bassi
33459f63d6 Whitespace fixes 2009-01-05 15:26:57 +00:00
Neil Roberts
ff73fe3e1f Fix some animation_set_* functions so they cope if the value is the same
The following functions are fixed:

clutter_animation_set_actor
clutter_animation_set_timeline
clutter_animation_set_alpha

This is related to bug 1392 which discusses the problem for
behaviour_set_alpha.
2009-01-05 13:19:40 +00:00
Neil Roberts
39f4848b93 Fix some *_set functions so they work if the object is the same value
Bug 1392 - behaviour_set_alpha set same alpha twice lead to warning
and destroy the input alpha

The following functions are fixed:

clutter_actor_set_shader
clutter_alpha_set_timeline
clutter_behaviour_set_alpha
clutter_clone_texture_set_parent_texture

They either now reference the new value before destroying the old
value, or just return immediately if the values are the same.
2009-01-05 13:19:40 +00:00
Neil Roberts
62cfc6487f Fix setting the mode on a ClutterAlpha created with animation_set_alpha(NULL)
It previously attempted to set the mode on the alpha using
clutter_animation_set_mode_internal, but this was setting the mode on
priv->alpha. At that point in the code priv->alpha is always NULL.

clutter_animation_set_mode_internal now takes a parameter to specify
which alpha to modify.
2009-01-05 12:52:46 +00:00