1
0
Fork 0
Commit graph

2296 commits

Author SHA1 Message Date
Damien Lespiau
8605073edb [units] Add support for centimeters
The only tricky part of the patch is to remember that 1cm is 10mm.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-10-07 16:06:26 +01:00
Damien Lespiau
96859959bd [units] Be more strict in the grammar we are parsing
Current parsing of units has a number of shortcomings:
  * a number followed by trailing space (without any unit specified) was
    not recognized,
  * "5 emeralds" was parsed as 5em,
  * the way we parse the digits after the separator makes us lose
    precision for no good reason (5.0 is parsed as 5.00010014...f which
    makes g_assert_cmpfloat() fail)

Let's define a stricter grammar we can recognize and try to do so. The
description is in EBNF form, removing the optional <> which is a pain
when having to write DocBook, and using '' for the terminal symbols.

Last step, add more ClutterUnits unit test to get a better coverage of
the grammar we want to parse.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-10-07 16:06:26 +01:00
Emmanuele Bassi
4d481e03f3 color: Measure the string just once when parsing
Instead of measuring the color hexadecimal string for each case, just
measure it once and then use a switch() to go to the right case.
2009-10-07 13:00:57 +01:00
Thomas Wood
c7d50083ec [color] allow alpha to be omitted when converting to color from string
Parse #rgb and #rrggbb in addition to forms with the alpha channel
specified. This allows conversion of colour strings from documents such as
CSS where the alpha channel is not specified when using '#' notation.

This patch also adds the relevant conformance test.
2009-10-07 12:56:01 +01:00
Neil Roberts
13ac1fe75b [clutter-id-pool] Also warn if the ID refers to a deleted actor
We should also warn if the glReadPixels happens to generate an ID that
is within the range of the ID array but no longer points to an
existing actor.
2009-10-07 12:53:19 +01:00
Neil Roberts
a4ff4d37a4 [clutter-id-pool] Fix the check for out-of-range IDs
If id == the length of the array then it is also invalid and could
cause a crash.
2009-10-07 12:53:19 +01:00
Thomas Wood
142f886518 Revert "[color] allow alpha to omitted when converting from strings"
This reverts commit eb8daac4b0.

The original commit was incorrect and pushed accidentally.
2009-10-07 12:15:26 +01:00
Thomas Wood
bdf7499207 [color] add a note to the documentation to specify the values of the alpha
The alpha channel is fully opaque at 255 and fully transparent at 0.
2009-10-07 11:40:41 +01:00
Thomas Wood
eb8daac4b0 [color] allow alpha to omitted when converting from strings
Parse #rgb and #rrggbb in addition to forms with the alpha channel
specified. This allows conversion of colour strings from documents such as
CSS where the alpha channel is not specified when using '#' notation.
2009-10-07 11:38:08 +01:00
Damien Lespiau
9e03d92316 [path] MOVE_TO and LINE_TO only use a pair of coordinates
The documentation of ClutterPathNode had a small typo and stated that
they use 2 pairs of coordinates.
2009-10-06 10:43:41 +01:00
Robert Bragg
dd8e4dcd62 [debug] Guard the use of gdk_pixbuf for pick debugging by #ifdef USE_GDKPIXBUF
gdk is an optional clutter dependency, so the pick buffer debugging option
needs some guards so we don't break, for example, the OSX builds.  This also
adds a comment for the bit fiddling done on the pick colors used to ensure
the pick colors are more distinguished while debugging.  (we swap the
nibbles of each color component so that pick buffers don't just look black.)
2009-10-05 17:35:46 +01:00
Emmanuele Bassi
f7c0264245 [sdl] Update the SDL backend to the new StageWindow API
The SDL backend remains experimental and not meant for public
consumption, but at least it compiles and runs successfully.
2009-10-05 15:57:14 +01:00
Emmanuele Bassi
3fee43560d [eglx] Create a StageWindow, not an Actor
The Backend should create a StageWindow instance, not an Actor.
2009-10-05 15:57:14 +01:00
Neil Roberts
40222e891b [ClutterGroup] Don't take into account the left edges when calculating the size
ClutterGroup previously calculated the size as the distance from the
left edge of the leftmost child to the right edge of the rightmost
child except if there were any chidren left of the origin then the
left edge would be zero.

However the group is always allocated its size relative to its
origin so if all of the children are to the right of the origin then
the preferred size would not be large enough to reach the rightmost
child.

    origin
    ┼──────────┐
    │Group     │
    │ ┌────────┼─┐
    │ │Child   │ │
    │ │        │ │
    └─┼────────┘ │
      │          │
      └──────────┘
       group size
      ╟──────────╢

This patch makes it so the size is always just the rightmost edge.

    origin
    ┼────────────┐
    │Group       │
    │ ┌──────────┤
    │ │Child     │
    │ │          │
    │ │          │
    │ │          │
    └─┴──────────┘
      group size
    ╟────────────╢

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1825
2009-10-05 15:34:00 +01:00
Emmanuele Bassi
14e12ae4fd [eglx] Update the EGLX Stage to the new StageWindow API
Move the ::realize and ::unrealize implementations over to the
StageWindow instead of using Actor.
2009-10-05 15:05:24 +01:00
Damien Lespiau
a799f6ccec Fix string parsing when no unit is given
The check should really be on the character pointed by str. Added the
corresponding test case.
2009-10-05 13:08:16 +01:00
Damien Lespiau
4d7b8c9d42 clutter_value_get_unit() has not be renamed
Since the Great Rework of ClutterUnits, functions have been using
'units' not 'unit' in their name. clutter_value_get_unit() is a left
over from a dark age, its declaration and documentation have been
updated but not the symbol itself.
2009-10-05 13:08:13 +01:00
Emmanuele Bassi
72243081b5 Merge branch 'stage-window-object'
* stage-window-object:
  [x11] Fix Stage user-initiated resize
  [x11] Remove a useless forced paint
  [stage] Rework the Stage implementation class
2009-10-05 12:37:08 +01:00
Emmanuele Bassi
ad83caaed1 Clarify the IdPool warning
Instead of having an assertion failure with a message of dubious
usefulness, we should probably use a more verbose warning explaining
what is the problem and what might be the cause.
2009-10-05 12:34:48 +01:00
Emmanuele Bassi
111512a2a0 [x11] Fix Stage user-initiated resize
The user-initiated resize is conflicting with the allocated size. This
happens because we change the size of the stage's X Window behind the
back of the size allocation machinery.

Instead, we should change the size of the actor whenever we receive a
ConfigureNotify event to reflect the new size of the actor.
2009-10-05 12:24:19 +01:00
Emmanuele Bassi
e3c2ed0009 [x11] Remove a useless forced paint
We force the redraw before mapping, in the hope that when a composited
window manager maps the window it will have its contents ready; that is
not going to work: the solution for this problem requires the implementation
of a protocol for compositors, and not a hack.

Moreover, painting before mapping will cause a paint with the wrong
GL viewport size, which is the wrong thing to do on GLX.
2009-10-05 12:21:02 +01:00
Robert Bragg
ab76d64df0 [cogl-debug] avoid warnings when using COGL_NOTE with unbraced else clauses
When not building a debug build the compiler was warning about empty
else clauses with no braces due to code like:
  if (blah)
	do_foo();
  else
	COGL_NOTE (DRAW, "a-wibble");

This simply ensures that even for non debug builds COGL_NOTE will expand to
a single statement.
2009-09-24 21:41:50 +01:00
Robert Bragg
904c495c6d [cogl-vertex-buffer] fix n_components validation for GL's builtin attributes
glVertexPointer expects positions with 2, 3 or 4 components, glColorPointer
expects colors with 3 or 4 components and glNormalPointer expects normals
with three components so when adding vertex buffer atributes with the names
"gl_Vertex", "gl_Color" or "gl_Normal" we assert these constraints and print
an explanation to the developer if not met.

This also fixes the previosly incorrect constraint that gl_Normal attributes
must have n_components == 1; thanks to Cat Sidhe for reporting this:

Bug: http://bugzilla.openedhand.com/show_bug.cgi?id=1819
2009-09-24 21:41:50 +01:00
Robert Bragg
dae569b468 [debug] Adds a dump-pick-buffers CLUTTER_DEBUG option
Now if you export CLUTTER_DEBUG=dump-pick-buffers clutter will write out a
png, e.g.  pick-buffer-00000.png, each time _clutter_to_pick() is called.
It's a rather crude way to debug the picking (realtime visualization in a
second stage would probably be nicer) but it we've used this approach
successfully numerous times when debugging Clutter picking issues so it
makes sense to have a debug option for it.
2009-09-24 21:41:49 +01:00
Neil Roberts
27ae9722de [container] Remove the unused 'object' variable in destroy_child_meta
Since commit b2f958a61 this variable is no longer used so it was
causing compiler warnings.
2009-09-22 17:55:04 +01:00
Robert Bragg
b710ed0eea [backend-egl] fix clutter_backend_egl_get_visual_info to not use Xalloc
It looks like the intention was to duplicate an XVisualInfo in such a way
that the pointer could be returned and then later freed using XFree.  But
Xalloc isn't an Xlib counterpart to XFree; Xlib doesn't provide a general
purpose malloc wrapper afik.  By shuffling things about a bit, it was
possible to avoid the need for this hack.
2009-09-21 23:06:44 +01:00
Damien Lespiau
6e50e26c86 Add a few annotations on Cogl primitives functions
By default, float * is considered as an out argument by gobject
introspection which is wrong for quite a few Cogl symbols. Start adding
annotations to fix that for the ones in the "Primitives" gtk-doc
section.
2009-09-21 18:40:20 +01:00
Robert Bragg
1b37cb6cb7 [container] cast actor to gobject before calling g_object_set_qdata
A minor compiler warning fix: in destroy_child_meta we weren't casting the
first argument to g_object_set_qdata to a gobject.
2009-09-21 18:17:12 +01:00
Øyvind Kolås
b2f958a618 [container] unset the child meta qdata on the child, not the container
In the default implementation of container::destroy_child_meta Set child
meta qdata to NULL on the child and not the container, since the child
is the object that owns the data.
2009-09-21 15:55:58 +01:00
Thomas Wood
d4e46bb893 [container] set the child meta qdata on the child, not the container
Set child meta qdata on the child and not the container, since the child is
the object that owns the data.
2009-09-21 15:40:53 +01:00
Neil Roberts
1c3d5a0e87 [cogl] Remove CoglContext->journal_vbo{,_len}
The lifetime of the journal VBO is entirely within the scope of the
cogl_journal_flush function so there is no need to store it globally
in the Cogl context. Instead, upload_vertices_to_vbo just returns the
new VBO. cogl_journal_flush stores this in a local variable and
destroys it before returning.

This also fixes an assertion when using the GLES backend which was
caused by nothing initialising the journal_vbo variable.
2009-09-17 18:30:55 +01:00
Emmanuele Bassi
ecfa0c4f92 [build] Split out the custom silent rules
The silent rules we use for custom targets should be moved into a
separate Makefile.am that gets included from all the others.
2009-09-16 17:47:59 +01:00
Emmanuele Bassi
9dc012c07d [timeline] Account for clock roll backs between frames
If the system clock rolls back between two frames then we need
to account for the change, to avoid stopping the timeline.

The best option, since a roll back can be any arbitrary amount
of milliseconds, is to skip a frame.

Fixes bug:

  http://bugzilla.moblin.org/show_bug.cgi?id=3839
2009-09-16 11:57:57 +01:00
Robert Bragg
0d08f6e070 [cogl-fbo] Disable mipmap filters before calling glCheckFramebufferStatusEXT
The framebuffer_object spec isn't clear in defining whether attaching a
texture as a renderbuffer with mipmap filtering enabled while the mipmaps
have not been uploaded should result in an incomplete framebuffer object.
(different drivers make different decisions)

To avoid an error with drivers that do consider this a problem we explicitly
set non mipmapped filters before calling glCheckFramebufferStatusEXT.  The
filters will later be reset when the texture is actually used for rendering
according to the filters set on the corresponding CoglMaterial.
2009-09-15 17:54:07 +01:00
Emmanuele Bassi
abbe2ebf8b [container] Use a 1:1 mapping between child and ChildMeta
Since an actor can only be parented to one container we don't need
the extra complications of maintaining a list of ChildMeta objects
attached to an actor in the default implementation of the Container
interface.
2009-09-15 11:27:43 +01:00
Damien Lespiau
6e3afa4ebe [docs] Clutter's model implementation is called ClutterListModel
It was renamed from ClutterModelDefault to ClutterListModel a while
back. Update the reference to this class in ClutterModel documentation.
2009-09-10 13:28:54 +01:00
Øyvind Kolås
3cc56b2b13 [text] implement get_property for "use-markup" 2009-09-08 14:15:18 +01:00
Emmanuele Bassi
6988744db7 [stage] Rework the Stage implementation class
Instead of using ClutterActor for the base class of the Stage
implementation we should extend the StageWindow interface with
the required bits (geometry, realization) and use a simple object
class.

This require a wee bit of changes across Backend, Stage and
StageWindow, even though it's mostly re-shuffling.

First of all, StageWindow should get new virtual functions:

  * geometry:
    - resize()
    - get_geometry()

  * realization
    - realize()
    - unrealize()

This covers all the bits that we use from ClutterActor currently
inside the stage implementations.

The ClutterBackend::create_stage() virtual function should create
a StageWindow, and not an Actor (it should always have been; the
fact that it returned an Actor was a leak of the black magic going
on underneath). Since we never guaranteed ABI compatibility for
the Backend class, this is not a problem.

Internally to ClutterStage we can finally drop the shenanigans of
setting/unsetting actor flags on the implementation: if the realization
succeeds, for instance, we set the REALIZED flag on the Stage and
we're done.

As an initial proof of concept, the X11 and GLX stage implementations
have been ported to the New World Order(tm) and show no regressions.
2009-09-08 10:52:58 +01:00
Emmanuele Bassi
742cc4d95b [docs] Small annotation fixes 2009-09-08 10:21:46 +01:00
Neil Roberts
c69209a253 [animation] Move the check for the 'signal::' prefix into a separate function
The old code checked whether the property began with 'signal-' and
then checked for 'signal-swapped' and 'signal-after'. This prevented
you from animating a property called for example 'signal-strength'.

The check for the prefix is now in a separate function which also adds
a 'signal-swapped-after' prefix for completeness.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1798
2009-09-07 12:44:06 +01:00
Samuel Degrande
763f5a9d01 DOT3_RGB[A] cannot be used in a Blend String
The blend string compiler checks that the syntax of a function name is
[A-Za-z_]*, preventing the use of DOT3_RGB[A].

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-09-02 16:27:22 +01:00
Emmanuele Bassi
a5e081dc9c [model] Do not attempt to free empty column names
The column names are optional - ClutterModel will use the GType name
if there is no user-specified column name. Hence, the ::finalize vfunc
should not try to free an empty column names vector.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1790
2009-09-02 15:30:45 +01:00
Neil Roberts
db6b0a91e0 Take a reference to the material in clutter_texture_set_cogl_material
The material is unref'd in clutter_texture_finalize and the
documentation explicitly states that the function will take a ref so
it really should.
2009-08-26 18:28:35 +01:00
Neil Roberts
bad7782ab4 Fix the documentation for clutter_texture_set_cogl_material
The documentation was a copy of the docs for set_cogl_texture so it
was somewhat broken.
2009-08-26 18:25:10 +01:00
Emmanuele Bassi
bb17dc1ce5 [script] Clean up the ad hoc parsing code in Actor
The old parsing code still assumed we had integers for pixels
and floating point values for percentages; this is not the case
anymore.
2009-08-26 16:49:45 +01:00
Emmanuele Bassi
2ffebad3d9 [script] Convert double to float when parsing
The default floating point type for JSON is double precision; this means
that we need to conver to single precision when setting a property with
type G_TYPE_FLOAT.
2009-08-26 16:48:32 +01:00
Øyvind Kolås
f1d5881207 [group] Use floating point in sort_z_order 2009-08-25 17:40:17 +01:00
Emmanuele Bassi
95a6e1c925 Fix the warnings for Animation::update_interval()
The bindings for update_interval() were copied from bind().
2009-08-25 12:18:32 +01:00
Emmanuele Bassi
899f051cd9 [animation] Add Animation::update()
Currently, to update a property inside an animation you have to
get the interval for that property and then call the set_final_value()
method.

We can provide a simpler, bind()-like method for the convenience of
the developers that just validates everything and then calls the
Interval.set_final_value().
2009-08-25 12:16:41 +01:00
Neil Roberts
4ca375e8fe [cogl-texture] Set GL_PACK_ROW_LENGTH when downloading texture data
Otherwise the rowstride passed in from an application is not used
correctly so you can not download to an area with a much larger
rowstride.
2009-08-24 12:50:57 +01:00