1
0
Fork 0
Commit graph

1948 commits

Author SHA1 Message Date
Neil Roberts
2ed60a5270 In clutter_alpha_set_mode, set priv->mode after setting the func
Otherwise the call to clutter_alpha_set_func sets the mode back to
CLUTTER_CUSTOM_MODE so clutter_alpha_get_mode won't get back the same
value that was set.
2009-01-05 12:47:10 +00:00
Emmanuele Bassi
55a22d5750 [text] Add select-all binding
Bind Ctrl+A to the "select all" action.
2009-01-05 12:27:45 +00:00
Emmanuele Bassi
92e8b886d2 [docs] Add clutter_text_activate()
Add the last unused symbol to the ClutterText section.
2009-01-05 12:07:19 +00:00
Emmanuele Bassi
605ec10c32 [docs] Remove ClutterLabel and ClutterEntry sections
Remove the sections for the Label and the Entry actors, which
have been replaced by ClutterText.
2009-01-05 12:07:19 +00:00
Emmanuele Bassi
fd2d78918b Merge branch 'units-rework'
* units-rework:
  [texture] Do not mix fixed point and units values
  [tests] Fix the actor detection
  [units] Do not use fixed point and units interchangeably
2009-01-05 11:11:10 +00:00
Robert Bragg
cb569a5443 White space clean up across a number of files (only removing trailing spaces)
Removed trailing white space from the following files:
- clutter-clone-texture.c
- clutter-texture.c
- clutter-texture.h
- cogl/cogl-texture.h
- cogl/gl/cogl-context.c
- cogl/gl/cogl-texture.c
- cogl/gl/cogl-context.h
2008-12-24 00:48:32 +00:00
Emmanuele Bassi
7649e9de07 Remove a masking with index()
The binding-pool test unit had a variable masking the index() function
declared inside string.h.
2008-12-23 21:06:05 +00:00
Emmanuele Bassi
c9cdf1ef0a Fix an empty block
Remove a stray ';' that prevented the get_bounds() method of the
ClutterBehaviourRotate to correctly return the start angle value.
2008-12-23 20:55:35 +00:00
Emmanuele Bassi
affd915b84 Add more maintainer CFLAGS
Be even more anal-retentive when the maintainer flags are enabled.

Kudos to Benjamin Otte.
2008-12-23 20:55:23 +00:00
Emmanuele Bassi
f777bc629a [docs] Document the newly added functions
Document the ClutterBackend font name accessors, and the
clutter_actor_get_pango_context() getter method.
2008-12-23 16:59:14 +00:00
Emmanuele Bassi
9389d9755d Add the ability to set the text direction
The direction of the text depends on the locale, and it is the
basic setting needed to enable internationalization of user
interfaces.

This commit allows setting the direction of the PangoContext instance
used by Clutter by using the CLUTTER_TEXT_DIRECTION environment
variable, or by passing the --clutter-text-direction command line
argument. Valid values are:

        ltr     - for left-to-right locales
        rtl     - for right-to-left locales

The default is LTR.

Ideally, this should be a value set by the localization teams on the
PO file, but this step requires some build system surgery to allow
the translation of the Clutter strings.
2008-12-23 16:40:26 +00:00
Emmanuele Bassi
b4a3944b2b 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.
2008-12-23 16:27:54 +00:00
Emmanuele Bassi
e3785f4f45 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.
2008-12-23 15:05:16 +00:00
Emmanuele Bassi
7262542155 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.
2008-12-23 15:03:11 +00:00
Emmanuele Bassi
977bdcf89b 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.
2008-12-23 14:34:16 +00:00
Emmanuele Bassi
213d8f0e4e 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.
2008-12-23 14:27:41 +00:00
Emmanuele Bassi
61d47ee301 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.
2008-12-23 14:15:10 +00:00
Emmanuele Bassi
a865a5d4ea 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.
2008-12-23 14:11:27 +00:00
Emmanuele Bassi
78628edf2f 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.
2008-12-23 14:06:55 +00:00
Emmanuele Bassi
b8b8b155c4 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.
2008-12-23 13:55:51 +00:00
Emmanuele Bassi
b021f518c1 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.
2008-12-22 13:43:41 +00:00
Emmanuele Bassi
4a934c363c 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.
2008-12-22 13:24:52 +00:00
Owen Taylor
6a980793c6 Return something reasonable from clutter_x11_handle_event()
Instead of returning CLUTTER_X11_FILTER_CONTINUE always from
clutter_x11_handle_event() return CLUTTER_X11_FILTER_REMOVE if
the event was on a stage and translated to a ClutterEvent.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2008-12-22 13:11:59 +00:00
Robert Bragg
8e88a487d9 [gitignore] Adds *.swn + *.swo (Vim files) & *.orig + *.reg (patch conflicts) 2008-12-21 21:52:58 +00:00
Robert Bragg
3a6ffe3b7d [build] Replaces use of #include <cairo/cairo.h> with #include <cairo.h>
The cairo pkg-config is crafted such that #include <cairo.h> should be used.
If building with a private build of cairo installed to a custom prefix
<cairo/cairo.h> can cause an un-intended cairo header to be picked up during
compilation due to /usr/include being in the header search path.
2008-12-21 21:52:50 +00:00
Robert Bragg
c700d4c9a1 [tests] Ensures that test-viewport.c is built
test-viewport.c wasn't listed correctly in the UNIT_TESTS variable
(it was missing the .c extension, and so it wasn't being built.)
2008-12-21 14:07:35 +00:00
Robert Bragg
a40666469d [tests] Ensure that test-launcher.sh is found for out of tree builds
When building out of tree the generated scripts for the unit tests
need to explicitly reference the original src dir to be able to find
test-launcher.sh, like this:
 $(top_srcdir)/tests/conform/test-launcher.sh

Also test-launcher.sh now passes -m slow --verbose to gtester. Without
-m slow then the wrappers dont work for some of the timeline tests.
2008-12-21 14:07:22 +00:00
Emmanuele Bassi
4e493d1937 Avoid masking math.h exported variables
Our beloved math.h exports, from bits/mathcalls.h, a bare "y1" symbol.
Apparently, it's unthinkable for code including <math.h> to also declare
arguments or variable named "y0", "y1" and "yn".

Anyway, the quick fix already used elsewhere in Clutter's codebase is
to rename the colliding variables "y_0", "y_1" and "y_n" - and
obviously everything similar to them as well, using the same pattern.
2008-12-19 18:21:36 +00:00
Emmanuele Bassi
42bba13135 [docs] Remove a duplicate definition
ClutterScriptable was defined twice inside the sections file.
2008-12-19 17:49:57 +00:00
Emmanuele Bassi
c93cd4a096 [docs] Documentation fixes for CairoTexture
Sync up the arguments name inside the gtk-doc annotations with their
name inside the function declaration in the header file.
2008-12-19 17:48:30 +00:00
Emmanuele Bassi
2f23003425 Whitespace fixes
Let's try to honour the coding style document, now that we have one.
2008-12-19 17:44:24 +00:00
Emmanuele Bassi
81541e6940 [docs] Parameter naming fixes
The name of the parameter in the header and the one in the gtk-doc
annotation on top of a function must match.

Unfortunately, there is an index() function declared inside strings.h
which makes gcc complain for the "index" argument as soon as we
enable the extra compiler flags we use when distchecking.

Hence, we need to rename "index" to "index_" in the header and in
the source files.
2008-12-19 17:41:44 +00:00
Emmanuele Bassi
2e98fa46df [docs] Add last few missing symbols to the sections file 2008-12-19 17:30:50 +00:00
Emmanuele Bassi
cc52bbce0b [docs] Add shader symbols to their sections 2008-12-19 17:28:42 +00:00
Emmanuele Bassi
6a4a5e0a3b [docs] Add ClutterPath unused symbols
Add the symbols that gtk-doc can track to the sections file.
2008-12-19 17:25:18 +00:00
Emmanuele Bassi
4094590a52 [docs] Fix a typo in the binding pool section 2008-12-19 17:21:30 +00:00
Emmanuele Bassi
8d98c28dfa Merge branch 'cairo-texture'
* cairo-texture:
  [cairo-texture] Remove the construct only restriction on surface size
  [cairo-texture] Silently discard 0x0 surfaces
  Re-indent ClutterPath header
  Add a test case for the new cairo path functions
  Add clutter_path_to_cairo_path and clutter_path_add_cairo_path
  Warn instead of returning in the IN_PAINT check
  Small documentation fixes
  Print a warning when creating a cairo_t while painting
  Do not set the IN_PAINT flag inside the Stage paint
  Set the IN_PAINT private flag
  [docs] Add ClutterCairoTexture to the API reference
  Add ClutterCairoTexture
  Require Cairo as a Clutter dependency

Conflicts:

  Fix merge conflict in clutter/clutter-path.h
2008-12-19 16:44:40 +00:00
Neil Roberts
64de0411ea [cairo-texture] Remove the construct only restriction on surface size
It is possible to change the surface size after construction with
clutter_cairo_texture_set_surface_size so it doesn't seem right to
restrict changing the properties.

clutter_cairo_texture_resize_surface_internal is called in a handler
for the notify signal. It is called there rather than directly in the
set_property handler so that changing both properties in a single
g_object_set will only cause one resize. The constructed override is
no longer needed.

resize_surface_internal will now bail out if the size of the surface
is already the right size.
2008-12-19 15:35:14 +00:00
Emmanuele Bassi
cf5d69139d [texture] Do not mix fixed point and units values
Like we did for ClutterActor in commit cdb78ec4, fix ClutterTexture
usage of CoglFixed and ClutterUnit values without conversion between
the two types.
2008-12-19 13:42:17 +00:00
Emmanuele Bassi
f6e9a701e4 [tests] Fix the actor detection
The test-unproject interactive test assumed that only the rectangle was
on the stage. As it turns out, labels can be picked as well.
2008-12-19 13:03:53 +00:00
Emmanuele Bassi
cdb78ec4d2 [units] Do not use fixed point and units interchangeably
Clutter units are, at the moment, implemented as a value in fixed point
notation using the same format as CoglFixed. This is, though, an
implementation detail. For this reason, units should not be treated as
CoglFixed values and should be converted to and from fixed point using
the provided macros.

This commit updates the usage of units and fixed point values in
ClutterActor and rationalises some of the transformation code that
heavily relied on the equivalency between them.
2008-12-19 12:53:57 +00:00
Emmanuele Bassi
5560157428 [docs] Fix a copy-and-paste typo in the coding style 2008-12-18 18:14:22 +00:00
Emmanuele Bassi
b63b1584bd [docs] Add coding style document
We should formalise the current coding style of Clutter for
third parties that wish to start hacking and contribute back
patches.
2008-12-18 18:03:43 +00:00
Robert Bragg
5e0daa8ecd Improves tfp performance on Nvidia
Some drivers (e.g. Nvidia) get upset if you try to create multiple glx pixmaps
for the same server side pixmap object, even though you might have unique
client side names, we now avoid hitting this problem by destroying the current
glx pixmap early within clutter_glx_texture_pixmap_create_glx_pixmap.
2008-12-18 17:54:35 +00:00
Neil Roberts
9cd92fc540 [test-scale] Add a label showing the gravity
A label is now displayed under the rectangle showing the current
gravity. The text for the gravity is taken from the GEnumClass. This
makes it easier to verify that the test is working correctly.
2008-12-18 17:40:36 +00:00
Neil Roberts
4168ed09de Fix calculation in clutter_cubic_bezier
The calculation for cubic bezier curves had an extra multiplication by
3 which was causing the curve to go over 1.0 very quickly. This had
the affect of making test-animation appear to complete much before the
completed signal is emitted.
2008-12-18 12:20:46 +00:00
Neil Roberts
2bf815131a [clutter-interval] Fix calculation of interval for unsigned types
The patch makes it cast to double before subtracting the original
value from the target value. Otherwise if the target value is less
than the original value then the subtraction will overflow and the
factor will be multiplied by a very large number instead of the
desired interval.

The problem is demonstrable using the border-width property of
ClutterRectangle.
2008-12-17 19:26:24 +00:00
Emmanuele Bassi
e130e0c9b3 [cairo-texture] Silently discard 0x0 surfaces
The current CairoTexture can be created with a surface size of 0
by 0 pixels, but a warning will be printed.

Worse, the surface can be resized to be 0 by 0 pixels without a
warning. The :surface-width and :surface-height properties accept
a minimum value of 0, and not check is performed on either the
constructor or set_surface_size() parameters to enforce the "greater
than zero" rule.

The correct and consistent behaviour is to allow a 0 by 0 pixels
surface size everywhere; inside surface_resize_internal(), the
current surface will be destroyed and if either :surface-width or
:surface-height are set to 0, the resizing terminates.

Attempting to create a Cairo context from a CairoTexture with
either :surface-width or :surface-height set to 0 will result in
a warning.

This allows:

  - creating a CairoTexture with :surface-width or :surface-height
    set to zero and delaying the surface resize at a later point;
  - resizing the surface to 0 by 0 pixels to destroy the image
    surface used internally;
  - increase the consistency in the usage of CairoTexture.
2008-12-17 15:58:11 +00:00
Neil Roberts
140e4e1be2 Minor fix to documentation for clutter_actor_get_anchor_point
In both versions of clutter_actor_get_anchor_point the description of
the @anchor_y parameter was slightly wrong in different ways.
2008-12-17 15:05:08 +00:00
Emmanuele Bassi
335b650d0b [tests] Create a real file for each test unit
Currently, the conformance test suite creates symbolic links pointing
to a wrapper script that just parses the name used to invoke it and
calls the gtester with the correct path.

Unfortunately, this presents two issues:

        - it does not really work on file systems that do not
          support symbolic links
        - it leaves behind the symbolic links, which cannot
          be automatically cleaning by 'make clean'

Both can be solved by creating a small script that invokes the wrapper
one with the test unit path.

The Makefile will use test-conform to extract the unit test paths
and generate a list that will be iterated over to create the
executable name (using the "test-name" convention also used by the
interactive tests, instead of "test_name"); the executable is then
just a simple shell script that invokes the wrapper script passing
the unit test path on the command line. The wrapper script will
use the first argument to work correctly, so it could be simply
executed like:

        ./test-wrapper.sh /path/to/unit_test

Which is another improvement over the current implementation, where
the wrapper script does not work when invoked directly.
2008-12-17 14:08:08 +00:00