1
0
Fork 0
Commit graph

2622 commits

Author SHA1 Message Date
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
Emmanuele Bassi
172074fd29 [glx] Perform more checks before calling glXMakeCurrent
Right now we just check for a NULL stage before calling glXMakeCurrent().

We can, though, get a valid stage without an implementation attached to
it while we are disposing a stage after a CLUTTER_DELETE event, since the
events processing is performed on a vblank-locked basis.
2009-08-21 12:05:52 +01:00
Owen W. Taylor
93e1d8e7a3 Add ::queue-relayout signal to ClutterActor for ClutterClone
ClutterClone bases its preferred size on the preferred size of
the source actor, so it needs to invalid its cached preferred
size when the preferred size of the source actor changes.

In order for this to work, we need to have notification when
the size of the source actor changes, so add a ::queue-relayout
signal to ClutterActor.

Then connect to this from ClutterClone and queue a relayout
on the clone when a relayout is queued on the source.

http://bugzilla.openedhand.com/show_bug.cgi?id=1755

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-08-20 14:12:54 +01:00
Robert Bragg
56daae9d7b Revert "[cogl] Allow Cogl to create NPOT textures for GLES2"
This reverts commit 3c47a3beb5.

Of course I remembered just after pushing the patch why we hadn't done
this before :-) If you look in the glsl spec:
http://www.khronos.org/registry/gles/specs/2.0/es_full_spec_2.0.24.pdf
Section 3.7.10 Texture Completeness and Non-Power-Of-Two Textures
you can see GLES 2.0 doesn't support mipmaps for npot textures.

There is possibly some way we could support this in Cogl but at least
it's not as simple as or-ing in the feature flag, sadly.
2009-08-20 12:53:32 +01:00
Robert Bragg
3c47a3beb5 [cogl] Allow Cogl to create NPOT textures for GLES2
The core GLES2 API supports NPOT textures, i.e. there is no extension as for
OpenGL, so we now add COGL_FEATURE_TEXTURE_NPOT to the feature flags in
_cogl_features_init.

Thanks to Gordon Williams for spotting this.
2009-08-20 12:17:56 +01:00
Robert Bragg
a5fe4ae4ec [cogl] %.c: %.glsl codegen: use BUILT_SOURCES var + fix stringify.sh
Don't let stringify.sh write to the $srcdir + use the BUILT_SOURCES var in
Makefile.am so as to ensure all .c.  and .h files get generated from their
corresponding .glsl files before building other targets.
2009-08-19 15:43:20 +01:00
Jonas Bonn
3761e9cd47 Check timeline direction when forcing final state
If the timeline is running backwards, the completed signal handler should
set the final state from the interval's initial value.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-08-19 14:57:07 +01:00
Emmanuele Bassi
373b165b3f Use AM_SILENT_RULES if automake >= 1.11 is installed
Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1756

Based on a patch by: Javier Jardón <javierjc1982@gmail.com>
2009-08-19 13:42:36 +01:00
Neil Roberts
6a9130f10f [pango-display-list] Don't premultiply the colour twice
When rendering a glyph run from a texture we were premultiplying the
colour once in display_list_render() and then again in
display_list_render_texture(). This was causing the color to come out
wrong. This fixes bug #1775.

Thanks to Pierre-Luc Beaudoin for reporting.
2009-08-19 10:28:51 +01:00
Robert Bragg
9befb055d0 [cogl-material] Fix some brackets in _layer_flush_gl_sampler_state
The wrong part of an expression was bracketed in the test to determine
when a new texture matrix needed to be loaded which resulted in the
first pass through _cogl_material_layer_flush_gl_sampler_state
not uploading any user matrix.
2009-08-18 16:57:38 +01:00
Emmanuele Bassi
366e0725ce [docs] texture_polygon() is called polygon()
Remove the mentions to the old name of cogl_polygon().
2009-08-18 11:11:29 +01:00
Emmanuele Bassi
f655b28e66 [build] Nothing can be prepended to QUIET_* rules
Move the LD_LIBRARY_PATH override after the QUIET_GEN rule and
unbreak the typelib compilation.
2009-08-17 23:27:22 +01:00
Jussi Kukkonen
8c00d705c0 [text] move_word_backward/forward fixes
clutter_text_move_word_backward/forward() calls did not use the
start argument consistently. Also, clutter_text_move_word_forward()
bound check checked the wrong end.

Fixes #1765

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-08-17 22:53:36 +01:00
Neil Roberts
99437c4761 [text] Don't interpret the unicode value when the control modifier is on
When a letter key is pressed with the control key held down one of
three things will happen :-

a) If the stage is embedded within a GtkClutterEmbed the unicode value
   will be filled from gdk_keyval_to_unicode. This will be the same
   value as if control was not pressed (so Ctrl+V will be 'v').

b) If the stage is not in a GtkClutterEmbed and Clutter is running on
   the X11 backend then it will try to fill in the unicode value from
   XLookupString. This *will* take into account the control so the
   unicode value will represent a control character (Ctrl+V will be
   '\x16').

c) Most other backends will not bother to fill in the unicode
   value. Therefore clutter_keysym_to_unicode will be used which also
   does not take into account the control key (so Ctrl+V will be 'v').

For cut and paste to work in Nbtk, the control keys need to bubble up
to the parent NbtkEntry container. This works fine for 'b' but not 'a'
and 'c'.

This patch makes ClutterText always allow the event to bubble if the
key is not handled by the binding pool and the control modifier is
down.

Ideally ClutterText would always get a unicode value that takes into
account the modifiers but this is probably best left up to the input
methods.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-08-17 22:50:23 +01:00
Owen W. Taylor
5d7c2e7c44 Set LD_LIBRARY_PATH when running g-ir-compiler
g-ir-compiler currently opens the library for the .gir it is compiling;
to make that work we need to set LD_LIBRARY_PATH before running
g-ir-compiler to include .libs.

(I think this may have been working earlier because there was a
hack that substituted .so with .la and tried opening that; that
works for the incorrect libclutter-glx-1.0.so but not for the
correct libclutter-glx-1.0.so.0)

http://bugzilla.openedhand.com/show_bug.cgi?id=1771
2009-08-17 22:39:12 +01:00
Owen W. Taylor
4c1248c5e9 Full fix for the G-I support in Clutter
Update the sed hack for the shared library to be more robust.

Remove the --shared-library command line argument from g-ir-scanner,
as no distribution will ever ship the .la files. This effectively
reverts commit 68f8a98cfb.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-08-17 15:42:33 +01:00
Götz Waschk
68f8a98cfb Specify the shared library for g-ir-compile
Use the --shared-library option to specify the shared object to link
against when compiling the typelib from the GIR data.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-08-17 14:21:42 +01:00
Götz Waschk
366e0f9cd7 Update Clutter to use G-I 0.6.4
Following bug #1762, the syntax of g-ir-scanner was changed in
gobject-introspection, so Clutter does not build anymore with 0.6.4.

See the bugzilla bug:

  http://bugzilla.gnome.org/show_bug.cgi?id=591669

GObject-Introspection now uses a different mechanism to extract the
SONAME when building the gir file and it needs the libtool archive as
option.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-08-17 14:14:18 +01:00
Emmanuele Bassi
90d8f31831 [units] Do not be locale-dependant on string conversion
When dumping a ClutterUnits structure to a string we are using a bare
g_strdup_printf(), which unfortunately is locale dependant. So, for
instance, a type of CLUTTER_UNIT_EM and a value of 42 are stringified
as:

        C:      42.00 em
        en_GB   42.00 em
        it_IT   42,00 em
        fr_FR   42,00 em

This would not be a problem -- clutter_units_from_string() allows both
'.' and ',' as fractionary part delimiters. The test suite, on the
other hand, does not know that, and it checks for exact matches with
the C locale.

Calling setlocale(LC_ALL,"C") at the beginning of the conformance test
suite is not a good idea, because it would prevent external testing; and
it's a lame cop out from doing exactly what we have to do -- pick a format
and stick with it.

Like other platforms, languages and frameworks before us, we opt to
be less liberal in what we create; so, we choose to always stringify
ClutterUnits with fractionary parts using '.' as the delimiter.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1763
2009-08-14 16:05:33 +01:00
Emmanuele Bassi
5274b4e4c4 [build] Clean up the eglnative and fruity Makefile.am
* Do not use CLUTTER_MAJORMINOR

* Use per-target compiler flags and libraries
2009-08-14 13:08:17 +01:00
Xu Li
f7edc97d8d Add new Atom atom_NET_WM_PID to set pid info
Clutter advertises itself on X11 as implementing the _NET_WM_PING protocol,
which is needed to be able to detect frozen applications; this allows us to
stop the destruction of the stage by blocking the CLUTTER_DELETE event and
wait for user feedback without the Window Manager thinking that the app has
gone unresponsive.

In order to implement the _NET_WM_PING protocol properly, though, we need
to add the _NET_WM_PID property on the Stage window, since the EWMH states:

  [_NET_WM_PID] MAY be used by the Window Manager to kill windows which
  do not respond to the _NET_WM_PING protocol.

Meaning that an unresponsive Clutter application might not be killable by
the window manager.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1748

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-08-14 12:41:01 +01:00
Emmanuele Bassi
3abf393b87 [build] Clean up cogl-pango Makefile
* Do _not_ use CLUTTER_MAJORMINOR to define the installation path
  for the headers; we must use CLUTTER_API_VERSION for that.

* Do not put the C compiler flags in the INCLUDES directive.

Bases on a patch by: Gary Ching-Pang Lin <glin@novell.com>
2009-08-14 11:30:16 +01:00
Emmanuele Bassi
5c8ae6d2dc [json] Fix compilation of the internal JSON-GLib
Define the symbols needed to pass the single include policy when
compiling the static object.
2009-08-13 18:05:38 +01:00
Emmanuele Bassi
8a794a8533 [docs] Fix the examples for animate()
Update the examples to reference to existing easing modes and to
make sure to use floating point values for floating point properties.
2009-08-13 16:13:55 +01:00
Emmanuele Bassi
f25cdf066c [actor] Allow unsetting width and height separately
It is possible to unset the size of an actor specified with set_width()
and set_height() by using:

  clutter_actor_set_size (actor, -1, -1);

Which works by unsetting the :min-*-set and the :natural-*-set properties.

Calling set_width(-1) and set_height(-1) separately, though, doesn't work
thus implicitly breaking the assumption that set_size() is nothing more
than set_width()+set_height(). This was obviously due to the face that
pre-1.0 set_width() and set_height() took an unsigned integer as an
argument.
2009-08-13 16:13:07 +01:00
Colin Walters
d3e06bc1e5 Add (allow-none) for clutter_stage_set_key_focus()
The @actor argument can be NULL to unset the key focus.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-08-13 10:49:39 +01:00
Emmanuele Bassi
9766fb1300 [script] Fix Actor's ad-hoc parser
ClutterActor parses positional and dimensional properties with a
custom deserializer. We need to:

  - handle G_TYPE_INT64, the default integer type for JSON-GLib
  - use G_TYPE_FLOAT for properties, since Actor switched to it
    for the pixel-based ones

This makes ClutterScript work again.
2009-08-12 16:02:23 +01:00
Emmanuele Bassi
cfbbacb807 [script] Fix the default deserialization
Properties parsed from ClutterScript should now use G_TYPE_INT64
and automatically convert between G_TYPE_INT and G_TYPE_INT64.
2009-08-12 16:01:25 +01:00
Emmanuele Bassi
4d52245637 [json] Update the internal copy of JSON-GLib
JSON-GLib switch to 64 bit integers upstream, to avoid the undefined
integer size of the JSON RFC. All integers are automatically promoted
to gint64.
2009-08-12 16:00:13 +01:00
Emmanuele Bassi
2b70b0d4ed Include clutter-json.h, not json-types.h
The json-types.h header is found by the mere fact of it being
in the project; if we are compiling against the system JSON-GLib
this could be horribly out of date.

We need to use clutter-json.h, which will include the right
header for us.
2009-08-12 15:57:25 +01:00
Emmanuele Bassi
cc6aa6e4d5 Clutter GIR depends on ClutterJson GIR conditionally
If we're building Clutter with a system JSON-GLib we need to skip
the typelib compilation of ClutterJson since we depend on Json-1.0.gir
directly.
2009-08-12 15:32:18 +01:00
Emmanuele Bassi
6fcf5c1820 [json] Include only json-glib.h
JSON-GLib moved to a single include scheme, so we should only include
json-glib.h. If we use the internal copy it doesn't matter, since the
header does the right thing.
2009-08-12 15:31:16 +01:00
Emmanuele Bassi
8c49e22753 Add copyright and license notice
The clutter-script-parser.c does not have a copyright and license
notices; even though the LGPL is a per-project license and not a
per-file license, having those notices in every source file is a
good idea.
2009-08-12 10:30:11 +01:00
zhou jiangwei
13e055a351 [eglx] Update the EGLX backend
The EGLX backend needs to be updated to the new ClutterBackendX11
code.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-08-11 14:19:24 +01:00
zhou jiangwei
2ab9bef587 [cogl] Fix the GLES 2.0 backend
Update the GLES 2.0 backend to the new COGL API after the breakage
introduced by the journal.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-08-11 14:19:24 +01:00
Robert Bragg
dbfd3f0f44 [cogl_clear] Also pass the alpha component of the CoglColor to glClearColor
Previously we were passing a constant of 0.0 for the alpha component which
wasn't as flexible.
2009-08-11 14:15:44 +01:00
Emmanuele Bassi
f0cb337d92 [build] Fix LDADD -> LIBADD usage 2009-08-11 13:27:25 +01:00
Emmanuele Bassi
dfc32b60c4 [osx] Clean up Makefile.am
The OS X backend Makefile.am was missing a line concatenation, and
so the -xobjective-c directive was always ignored.

Instead of dumping everything into INCLUDES and LDADD we should follow
what the rest of the backends do, and use per-target CFLAGS and LDADD,
and reserve the INCLUDES to -D and -I directives.

Thanks to: Christian Hergert <chris@dronelabs.com>
2009-08-11 13:11:34 +01:00
Emmanuele Bassi
d0748b3b9b Merge branch 'system-json-glib'
* system-json-glib:
  [script] Simplify the parser code
  Update JSON-GLib dependency
2009-08-10 17:21:20 +01:00
Emmanuele Bassi
d263e7a78b [build] Install JSON headers inside the right directory
Don't install inside the clutter-MAJOR_MINOR/ directory, but use
the API_VERSION (1.0).

Otherwise we'd have the Clutter headers for 1.x inside:

        $includedir/clutter-1.0/clutter

And the JSON-related headers inside:

        $includedir/clutter-1.<minor>/clutter
2009-08-10 17:19:04 +01:00
Emmanuele Bassi
420ed353b5 [x11] Do not ask to destroy an empty Window
The fix for bug 1750 inside commit b190448e made Clutter-GTK spew
BadWindow errors. The reason for that is that we call XDestroyWindow()
without checking if the old Window is None; this happens if we call
clutter_x11_set_stage_foreign() on a new ClutterStage before it has
been realized.

Since Clutter-GTK does not need to realize the Stage it is going to
embed anymore (the only reason for that was to obtain a proper Visual
but now there's ClutterBackendX11 API for that), the set_stage_foreign()
call is effectively setting the StageX11 Window for the first time.
2009-08-07 08:26:18 +01:00
Emmanuele Bassi
335fb07ab0 [actor] Add missing return_if_fail()
The queue_relayout() method was missing the argument check.

Thanks to: Neil Patel <njpatel@gmail.com>
2009-08-05 17:50:31 +01:00
Neil Roberts
1434d72134 Small doc fix to clutter_text_get_color
Bug reported by Rob Bradford.
2009-08-05 15:51:49 +01:00
Emmanuele Bassi
b190448ed4 [x11] Destroy the Window we own when setting a foreign one
When we replace the stage Window using a foreign one we also need to
destroy the Window we created, if needed, to avoid leaking resources
all around.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1750
2009-08-04 16:59:15 +01:00
Emmanuele Bassi
79288b46ed [docs] Fix a missing parameter 2009-08-04 11:38:48 +01:00
Emmanuele Bassi
9cda8d130f [actor] Be more explicit when warning about invariants
The "catch all" warning for a the mapped invariant violation is too
generic: it doesn't tell you why the invariant was broken in case
we are trying to map an unparented actor - e.g. through a Clone.
2009-08-04 11:15:05 +01:00
Emmanuele Bassi
f8a964b422 [cogl] Expose cogl_is_vertex_buffer()
The function is public and available in the shared object, but
it's not present in the header, so this is not an API/ABI change.
2009-08-04 11:15:05 +01:00
Damien Lespiau
c9c87543e8 [debug] CLUTTER_{NOTE,MARK,DBG,GLERR,TIMESTAMP} should always be statements
In case someone tries to do:
	if (foo)
		CLUTTER_NOTE(DOMAIN, "%s", blah);

CLUTTER_NOTE () should always be a statement
2009-08-03 14:25:09 +01:00
Damien Lespiau
cd35f3b384 [debug] Fix __GNUC__ typo
The right gcc define is __GNUC__ not __GNUC_. This typo had the side
effect that we were using the non gcc specific debug macros leading to
a less optmised CLUTTER_NOTE () than one could have dreamed of.
2009-08-03 14:25:09 +01:00
Damien Lespiau
94b35a4a5e [build] GCC_FLAGS is no more, MAINTAINER_CFLAGS is the One.
CC_FLAGS was a left over from the 0.8.x age. Killed it and use the
newer MAINTAINER_CFLAGS variable instead.
2009-08-03 14:25:08 +01:00
Emmanuele Bassi
b2ab2b9535 [actor] Use the right vertex
The vertex that should be used by the apply_relative_transform
is the one passed in as const, and the result should be placed
inside the non-const ClutterVertext. Currently, we are using
the latter, and thus the function is completely useless.
2009-08-02 18:34:17 +01:00
Emmanuele Bassi
ae2a861a0b [x11] Force a redraw before mapping the stage
Does as it says on the tin: run a paint cycle before calling
XMapWindow().
2009-07-31 10:29:33 +01:00
Emmanuele Bassi
77fdd7494e Fix compiler warnings when COGL debug level=minimum 2009-07-28 13:57:46 +01:00
Emmanuele Bassi
a5d6b23308 [units] Add binding-friendly initializers
We should follow the convention for boxed types initializers of:

  <type_name>_from_<another_type> (boxed, value)

For ClutterUnits as well; so:

  clutter_units_pixels -> clutter_units_from_pixels
  clutter_units_em     -> clutter_units_from_em
  ...

We should still keep the short-hand version as a macro, though.
2009-07-28 13:46:11 +01:00
Emmanuele Bassi
57baa2f0bc [animation] Fix variable use
Instead of using the proper typed variables we were overwriting
the gpointer for the Interval's final value.
2009-07-28 13:21:57 +01:00
Neil Roberts
f4ad3761c4 [win32] Remove the call to clutter_redraw in clutter_stage_win32_show
Since commit 7b811f8b this is done in clutter_stage_show so there is
no need for it in the backends.
2009-07-28 12:13:44 +01:00
Neil Roberts
df586eb507 [win32] Move the show/hide to be implementations of the interface
This makes clutter_stage_win32_show/hide be implementations of
ClutterStageWindowIface rather than overriding the methods in
ClutterActor. This reflects the changes in e4ff24bc for the X11
backend.
2009-07-28 12:13:44 +01:00
Ole André Vadla Ravnås
a1cef026c5 Avoid near/far identifier names.
Leads to conflict with system headers on Windows, where macros named
"near" and "far" are defined.
2009-07-28 12:13:44 +01:00
Ole André Vadla Ravnås
05883af1f6 Remove unused variable to fix compiler warning. 2009-07-28 12:13:44 +01:00
Ole André Vadla Ravnås
0157851270 Call glClientActiveTexture() through COGL context.
Fixes build issues on systems with OpenGL header older than 1.3.
2009-07-28 12:13:43 +01:00
Ole André Vadla Ravnås
f61f66c6fe Avoid C99 to fix compilation with compilers like MSVC. 2009-07-28 12:13:43 +01:00
Ole André Vadla Ravnås
ab5a10768c Initialize pixel data before glReadPixels(). 2009-07-28 12:13:43 +01:00
Haakon Sporsheim
e4eed92177 Reposition variable declarations to avoid C99. 2009-07-28 12:13:42 +01:00
Emmanuele Bassi
fa3728126f [animation] Force the final state inside ::completed
In case we are skipping too many frames, we should force the animation
instance to apply the final state of the animated interval inside the
::completed signal handler.
2009-07-28 11:43:05 +01:00
Emmanuele Bassi
42ea471e33 Remove explicit size of the Vertex arrays
The Vertex arrays passed to some ClutterActor methods should not
have the size. Albeit being technically correct, it's not a good
practice.
2009-07-27 16:10:07 +01:00
Emmanuele Bassi
fe0e7f9f74 [stage] Add a warning for :offscreen usage
The Stage:offscreen property hasn't been tested for ages, and it
should really just use a FBO, not indirect rendering on a X Pixmap
only on X11. There are better ways anyway to get the current
contents of ClutterStage as a buffer anyway.

We might remove it at any later date, or actually make it work
properly.
2009-07-27 15:42:31 +01:00
Emmanuele Bassi
6e6d0a5ea6 [glx] Explicitly set the depth size for GLX visuals
When requesting a GLX visual from the X server we should explicitly
set the GL_DEPTH_SIZE and the GL_ALPHA_SIZE bits, otherwise some
functionality might just not work, or work unreliably.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1723
2009-07-27 15:08:03 +01:00
Emmanuele Bassi
88e77b25df Convert gint to GLints in the Shader types wrapper
The GValue wrappers for ClutterShader types should always store
values using GL types (GLfloat, GLint) internally, but give and
take generic C types (float, int) to the Clutter side.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1359
2009-07-27 15:01:52 +01:00
Emmanuele Bassi
ad7dcc9896 [color] Fix HLS to RGB colorspace conversion
The HLS to RGB conversion in case the S value is zero is:

  R = G = B = luminance

ClutterColor uses a byte (0 to 255) for the R, G and B channels
encoding, while luminance is expressed using a floating point value
in the closed interval [0, 1]; thus the case above becomes:

  R = G = B = (luminance * 255)

The clutter_color_from_hls() code is missing the final step of
de-normalizing the luminance value, and so it breaks the roundtrip
colorspace conversion between RGB and HLS.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1695
2009-07-27 12:04:40 +01:00
Owen W. Taylor
894fe4ba93 Always create the Damage object for ClutterX11TexturePixmap auto updates
If clutter_x11_texture_set_window() was called after
clutter_x11_texture_pixmap_set_automatic(), then the Damage object would
not be properly created so updates to the window were ignored.

Refactor creation of the damage object to a separate function, and
call it from clutter_x11_texture_set_window() and clutter_x11_texture_set_pixmap()
as appropriate. Addition and removal of the filter function is made
conditional on priv->damage to make free_damage_resources() cleanly
idempotent.

See: http://bugzilla.gnome.org/show_bug.cgi?id=587189 for the original
bug report.

http://bugzilla.openedhand.com/show_bug.cgi?id=1710

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-07-27 10:49:38 +01:00
Michael Mortensen
2c2f31b1be [osx] Update events to floating point coordinates
The event translation code should be using the float type for
coordinates.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1725

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-07-27 10:45:26 +01:00
Emmanuele Bassi
13f32cb3b9 [osx] Implement StageWindow::show/::hide
Instead of using the Actor class ::show and ::hide virtual function,
use the StageWindow interface API.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1724
2009-07-26 20:10:42 +01:00
Emmanuele Bassi
e860d939f9 [text] Allow key navigation by word
When pressing Ctrl with the left and right arrow keys we should
skip to (or select until) the previous and next word, respectively.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1713
2009-07-23 19:04:27 +01:00
Geoff Gustafson
6a1506bd5f [text] Queue a redraw when the selection is cleared
If you select all the text in a ClutterText, there is an invisible
cursor position either at the beginning or end. If it's at the beginning,
the bug is that left arrow won't clear the selection. If it's at the end,
the bug is that the right arrow won't.

Here are the ways to reproduce it:

a. Ctrl-A selects all and moves the hidden cursor position to the left.
b. For single line: End, Shift-Home does the same.
c. Or manually moving to the end and doing Shift-Left Arrow to the
   beginning.

These all put it in the state where right arrow will properly clear
selection and move to cursor position 1, but left arrow fails to clear
the selection.

For b and c above, the opposite will give you the end case where right
arrow doesn't work.

Anyway, it turns out clear_selection is getting called, it just doesn't
show up because it's not doing a queue_redraw. So the attached patch
seems to fix things.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-07-23 18:26:16 +01:00
Emmanuele Bassi
fdfd208c04 Fix copy-and-paste errors in the deprecation macros
Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1704
2009-07-21 09:22:38 +01:00
Emmanuele Bassi
eff857bc7f [docs] Improve the Units to and from string conversion
Make sure to document the conversion to and from strings for ClutterUnits,
with negative examples and with the behaviour for fractionary bits.
2009-07-20 20:59:18 +01:00
Emmanuele Bassi
b1d98c25f4 [doc] Miscellaneous documentation fixes
Remove private symbols, and add missing public ones.
2009-07-20 12:49:35 +01:00
Emmanuele Bassi
cdb239756b [cogl] Make the blend string error domain public
The error domain and codes must present in a publicly installed header
otherwise they won't be usable to match a GError.
2009-07-20 12:47:53 +01:00
Emmanuele Bassi
56ef6727b5 Allow disabling motion event throttling
It might be desirable for some applications and/or platforms to get
every motion event that was delivered to Clutter from the windowing
backend. By adding a per-stage flag we can bypass the throttling
done when processing the events.

  http://bugzilla.openedhand.com/show_bug.cgi?id=1665
2009-07-20 11:44:52 +01:00
Robert Bragg
da37e1e27d [doc] Remove references to cogl_vertex_buffer_delete_indices
These referencese were left over from before indices got CoglHandles to
uniquely identify them.  cogl_handle_unref can be used to delete indices
now.
2009-07-19 10:23:00 +01:00
Emmanuele Bassi
dc0b1cddf5 [cogl/gles] Fix missing symbols in CoglContext
Keep the CoglContext in sync between GL and GLES backends. We ought
to find a way to have a generic context, though, and have backend
specific sections.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1698
2009-07-18 16:59:54 +01:00
Owen W. Taylor
a11b912dea Fix parallel build of introspection
We need to explicitly force order so that ClutterJson.gir and Cogl.gir
are present in the parent directory before we try to build Clutter.typelib.

http://bugzilla.openedhand.com/show_bug.cgi?id=1700

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-07-18 16:53:08 +01:00
Owen W. Taylor
7654ef10ab Fix building introspection when dolt is not in use
On some platforms (anything but Linux, and on obscure Linux
architectures) dolt isn't used, so $(top_builddir)/doltlibtool
won't exist. $(top_builddir)/libtool will always be generated
even if dolt is used, so just use that unconditionally. We don't
need the extra speed when linking the single program for
introspection.

http://bugzilla.openedhand.com/show_bug.cgi?id=1699

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-07-18 16:52:57 +01:00
Neil Roberts
7b811f8be4 [stage] Force an allocation before showing the stage
A lot of applications change the size of the stage from the default
before the stage is initially shown. The size change won't take affect
until the first allocation run. However we want the window to be at
the correct size when we first map it so we should force an allocation
run before showing the stage.

There was an explicit call to XResizeWindow in
clutter_stage_x11_show. This is not needed anymore because
XResizeWindow will already have been called by the allocate method.
2009-07-17 12:43:52 +01:00
Marcos
8f9f6aaf41 [win32] Compilation fixes
Remove the usage of the old CLUTTER_UNITS_* macros and put back a
missing ';'.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-07-13 17:04:05 +01:00
Emmanuele Bassi
7a8895944b [osx] Enable motion event dispatch
By default NSWindow does not listen to mousemoved events and hence the
default behaviour for Actors using the "motion-event" signal  differs
from backend to backend.

Using setAcceptsMouseMovedEvents seems to fix it; unfortunately, I
cannot verify it, but since nobody is currently working on the Quartz
backend I guess it cannot get more broken than how currently is.

Thanks to: Michael <michael@f3k.org>

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1687
2009-07-13 16:56:47 +01:00
Emmanuele Bassi
d59b9333a1 [osx] Remove old units macros
Remove the usage of CLUTTER_UNITS_* macros and at least get the
chance to make the OSX backend compile.

Hopefully, since I can't currently test it.
2009-07-13 16:53:06 +01:00
Emmanuele Bassi
af5e432ba9 [actor] Allow querying whether we are painted by a Clone
It would be useful inside a custom actor's paint function to be able to
tell if this is a primary paint call, or if we are in fact painting on
behalf of a clone.

In Mutter we have an optimization not to paint occluded windows; this is
desirable for the windows per se, to conserve bandwith to the card, but
if something like an application switcher is using clones of these windows,
they will not get painted either; currently we have no way of
differentiating between the two.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1685
2009-07-13 16:18:27 +01:00
Emmanuele Bassi
43d394ebae Remove unused TEXTURE_IN_CLONE_PAINT private flag
The CLUTTER_TEXTURE_IN_CLONE_PAINT was used with the old CloneTexture
actor; now that we have ClutterClone nothing sets the private flag
anymore, and the flag itself is not needed.
2009-07-13 16:16:38 +01:00
Xu Li
13f31d8319 [x11] update_wm_hints after unsetting WITHDRAWN
Updating the WM hints on the stage window shortcircuits if the stage
is in WITHDRAWN state, so we need to move the update_wm_hints() call
after the flag has been unset.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-07-13 15:33:21 +01:00
Emmanuele Bassi
07453a5861 [glx] Make the wait_for_vblank function private
Nobody should be using the function to wait for the vblank outside
of the GLX backend.
2009-07-13 15:31:38 +01:00
Owen W. Taylor
5425a6e311 Call glFinish() before manually waiting for VBLANK
If we manually wait for the VBLANK with:

  - SGI_video_sync
  - Direct usage of the DRM ioctl

Then we should call glFinish() first, or otherwise the swap-buffers
may be delayed by pending drawing and cause a tear.

http://bugzilla.openedhand.com/show_bug.cgi?id=1636

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-07-13 15:18:12 +01:00
Evan Martin
ea56a5e7a8 [docs] Fix typos and remove mentions of SVN
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-07-12 01:38:40 +01:00
Jakub Higersberger
efc16a4d90 Use correct signal detail
The Animation should connect to the notify::alpha signal, not to
the non-existing notify::value signal.

Fixes bugs:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1674
  http://bugzilla.openedhand.com/show_bug.cgi?id=1688

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-07-12 01:32:24 +01:00
Emmanuele Bassi
5a554bf063 Small code clean up
Make ClutterTexture slightly more similar to the rest of the code base.
2009-07-12 01:27:31 +01:00
Robert Bragg
1920b03381 [cogl] Fix more brokeness with _cogl_material_equal
commit e2c4a2a9f8 fixed one thing but broke many others things :-/
hopfully this fixes that.

It turned out that the journal was mistakenly setting the OVERRIDE_LAYER0
flush option for all entries, but some other logic errors were also
uncovered in _cogl_material_equal.
2009-07-10 19:00:16 +01:00
pippin
8fb3a48ae2 serialize upload of asyncronously loaded textures
Rate limit the uploading of textures to stop if it uses more than 5ms
during one master clock iteration.
2009-07-10 11:38:59 +01:00
Robert Bragg
211bf79854 ensure next iteration
Added an internal clutter function, _clutter_master_clock_ensure_next_iteration
that ensures another iteration of the master clock, can be called from repaint
functions as well as other threads.
2009-07-10 11:38:42 +01:00
Robert Bragg
e2c4a2a9f8 [cogl] Fix drawing with sliced textures using material layer0 overrides
To help us handle sliced textures; When flushing materials there is an
override option that can be given to replace the texture name for layer0
so we may iterate the slices without needing to modify the material
in use.

Since improving the journal's ability to batch state changes we added a
_cogl_material_equals function that is used by the journal to compare
materials and identify when a state change is required, but this wasn't
correctly considering the layer0 override resulting in false positives that
meant the journal wouldn't update the GL state and the first texture name
was used for all slices.
2009-07-07 10:34:37 +01:00
Robert Bragg
df4429462f [cogl matrix stack] Create a client side matrix stack for the projection matrix
The cost of glGetFloatv with Mesa is still representing a majority of our
time in OpenGL for some applications, and the last thing left using this is
the current-matrix API when getting the projection matrix.

This adds a matrix stack for the projection matrix, so all getting, setting
and modification of the projection matrix is now managed by Cogl and it's only
when we come to draw that we flush changes to the matrix to OpenGL.

This also brings us closer to being able to drop internal use of the
deprecated OpenGL matrix functions, re: commit 54159f5a1d
2009-07-07 10:32:56 +01:00
Emmanuele Bassi
c3cc553c49 Add more (allow-none) annotations 2009-07-02 14:21:16 +01:00
Colin Walters
f1044a279c Use the (allow-none) annotation for clutter_init*
We accept NULL for some parameters in the initialization functions.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-07-02 13:15:42 +01:00
Emmanuele Bassi
45c85c4213 [actor] Remove the unused get_allocation_coords()
The clutter_actor_get_allocation_coords() is not used, and since
the switch to floats in the Actor's API, it returns exactly what
the get_allocation_box() returns.
2009-07-01 15:30:21 +01:00
Emmanuele Bassi
37bd35f592 [actor] Allow changing the transformations matrix
Currently, the transformation matrix for an actor is constructed
from scenegraph-related accessors. An actor, though, can call COGL
API to add new transformations inside the paint() implementation,
for instance:

  static void
  my_foo_paint (ClutterActor *a)
  {
    ...
    cogl_translate (-scroll_x, -scroll_y, 0);
    ...
  }

Unfortunately these transformations will be completely ignored by
the scenegraph machinery; for instance, getting the actor-relative
coordinates from event coordinates is going to break badly because
of this.

In order to make the scenegraph aware of the potential of additional
transformations, we need a ::apply_transform() virtual function. This
vfunc will pass a CoglMatrix which can be used to apply additional
operations:

  static void
  my_foo_apply_transform (ClutterActor *a, CoglMatrix *m)
  {
    CLUTTER_ACTOR_CLASS (my_foo_parent_class)->apply_transform (a, m);
    ...
    cogl_matrix_translate (m, -scroll_x, -scroll_y, 0);
    ...
  }

The ::paint() implementation will be called with the actor already
using the newly applied transformation matrix, as expected:

  static void
  my_foo_paint (ClutterActor *a)
  {
    ...
  }

The ::apply_transform() implementations *must* chain up, so that the
various transformations of each class are preserved. The default
implementation inside ClutterActor applies all the transformations
defined by the scenegraph-related accessors.

Actors performing transformations inside the paint() function will
continue to work as previously.
2009-07-01 15:30:21 +01:00
Emmanuele Bassi
0414daf0fb Split the typdef to avoid confusing scanners
Scanners like gtk-doc and g-ir-scanner get confused by:

  typedef struct _Foo {
    ...
  } Foo;

And expect instead:

  typedef struct _Foo Foo;

  struct _Foo {
    ...
  };

CoglMatrix definition should be changed to avoid the former type.
2009-07-01 15:30:21 +01:00
Emmanuele Bassi
250b775926 [x11] Fix the race between resize and glViewport calls
The race we were experiencing in the X11 backends is apparently
back after the fix in commit 00a3c698.

This time, just delaying the setting of the SYNC_MATRICES flag
is not enough, so we can resume the use of a STAGE_IN_RESIZE
private flag.

This should also fix bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1668
2009-07-01 15:30:21 +01:00
Emmanuele Bassi
3726213291 Add debug notes for calls to glViewport()
In order to validate the sequence of:

        XResizeWindow
        ConfigureNotify
        glViewport

that should happen on X11 we need to add debug annotations to the
calls to glViewport() done through COGL.
2009-07-01 15:30:18 +01:00
Robert Bragg
3bab787103 [cogl] cache the viewport width and height
This avoids some calls to glGetFloatv, which have at least proven to be very
in-efficient in mesa at this point in time, since it always updates all derived
state even when it may not relate to the state being requested.
2009-07-01 15:23:10 +01:00
Robert Bragg
358d7c30dc [cogl] Ensure well defined semantics for COGL_INVALID_HANDLE material layers
Fixes and adds a unit test for creating and drawing using materials with
COGL_INVALID_HANDLE texture layers.

This may be valid if for example the user has set a texture combine string
that only references a constant color.

_cogl_material_flush_layers_gl_state will bind the fallback texture for any
COGL_INVALID_HANDLE layer, later though we could explicitly check when the
current blend mode does't actually reference a texture source in which case
binding the fallback texture is redundant.

This tests drawing using cogl_rectangle, cogl_polygon and
cogl_vertex_buffer_draw.
2009-06-30 17:35:07 +01:00
Robert Bragg
33400c0aae [cogl] Improve ability to break out into raw OpenGL via begin/end mechanism
Although we wouldn't recommend developers try and interleve OpenGL drawing
with Cogl drawing - we would prefer patches that improve Cogl to avoid this
if possible - we are providing a simple mechanism that will at least give
developers a fighting chance if they find it necissary.

Note: we aren't helping developers change OpenGL state to modify the
behaviour of Cogl drawing functions - it's unlikley that can ever be
reliably supported - but if they are trying to do something like:

   - setup some OpenGL state.
   - draw using OpenGL (e.g. glDrawArrays() )
   - reset modified OpenGL state.
   - continue using Cogl to draw

They should surround their blocks of raw OpenGL with cogl_begin_gl() and
cogl_end_gl():

   cogl_begin_gl ();
   - setup some OpenGL state.
   - draw using OpenGL (e.g. glDrawArrays() )
   - reset modified OpenGL state.
   cogl_end_gl ();
   - continue using Cogl to draw

Again; we aren't supporting code like this:
   - setup some OpenGL state.
   - use Cogl to draw
   - reset modified OpenGL state.
When the internals of Cogl evolves, this is very liable to break.

cogl_begin_gl() will flush all internally batched Cogl primitives, and emit
all internal Cogl state to OpenGL as if it were going to draw something
itself.

The result is that the OpenGL modelview matrix will be setup; the state
corresponding to the current source material will be setup and other world
state such as backface culling, depth and fogging enabledness will be also
be sent to OpenGL.

Note: no special material state is flushed, so if developers want Cogl to setup
a simplified material state it is the their responsibility to set a simple
source material before calling cogl_begin_gl. E.g. by calling
cogl_set_source_color4ub().

Note: It is the developers responsibility to restore any OpenGL state that they
modify to how it was after calling cogl_begin_gl() if they don't do this then
the result of further Cogl calls is undefined.
2009-06-30 17:13:38 +01:00
Robert Bragg
6d9498da7c Adds a cogl_flush() to give developers breaking into raw GL a fighting chance
This function should only need to be called in exceptional circumstances
since Cogl can normally determine internally when a flush is necessary.

As an optimization Cogl drawing functions may batch up primitives
internally, so if you are trying to use raw GL outside of Cogl you stand a
better chance of being successful if you ask Cogl to flush any batched
geometry before making your state changes.

cogl_flush() ensures that the underlying driver is issued all the commands
necessary to draw the batched primitives.  It provides no guarantees about
when the driver will complete the rendering.

This provides no guarantees about the GL state upon returning and to avoid
confusing Cogl you should aim to restore any changes you make before
resuming use of Cogl.

If you are making state changes with the intention of affecting Cogl drawing
primitives you are 100% on your own since you stand a good chance of
conflicting with Cogl internals.  For example clutter-gst which currently
uses direct GL calls to bind ARBfp programs will very likely break when Cogl
starts to use ARBfb programs internally for the material API, but for now it
can use cogl_flush() to at least ensure that the ARBfp program isn't applied
to additional primitives.

This does not provide a robust generalized solution supporting safe use of
raw GL, its use is very much discouraged.
2009-06-30 17:13:38 +01:00
Robert Bragg
87f99e214a [cogl-material] Be more carefull about flushing in cogl_material_remove_layer
Previously we would call _cogl_material_pre_change_notify unconditionally, but
now we wait until we really know we are removing a layer before notifying the
change, which will require a journal flush.

Since the convenience functions cogl_set_source_color4ub and
cogl_set_source_texture share a single material, cogl_set_source_color4ub
always calls cogl_material_remove_layer.  Often this is a NOP though and
shouldn't require a journal flush.

This gets performance back to where it was before reverting the per-actor
material commits.
2009-06-30 17:13:38 +01:00
Robert Bragg
6ee8e15654 Revert "[rectangle] Avoid modifying materials mid scene"
This reverts commit 8cf42ea8ac5c05f6b443c453f9c6c2a3cd75acfa.

Since the journal puts material colors in the vertex array accumulated for
drawing we don't need to flush the journal simply due to color changes which
means using cogl_set_source_color4ub is no longer a concern.
2009-06-30 17:13:38 +01:00
Robert Bragg
5ffbe05248 Revert "[actor] Avoid modifying materials mid-scene to improve journal batching"
This reverts commit 85243da382025bd516937c76a61b8381f6e74689.

Since the journal puts material colors in the vertex array accumulated for
drawing we don't need to flush the journal simply due to color changes
which means using cogl_set_source_color4ub is no longer a concern.
2009-06-30 17:13:38 +01:00
Robert Bragg
8b67916cc1 [cogl-vertex-buffer] Disable unused client tex coord arrays
Before any cogl vertex buffer drawing we call
enable_state_for_drawing_buffer which sets up the GL state, but we weren't
disabling unsed client texture coord arrays.
2009-06-30 17:13:37 +01:00
Robert Bragg
8873c6a11a [cogl] disable all client tex coord arrays in _cogl_add_path_to_stencil_buffer
After flushing the journal an unknown number of client side texture arrays
may be left enabled. Disable them all before using glDrawArrays.
2009-06-30 17:13:37 +01:00
Robert Bragg
ca0a0e9dac [cogl] flush matrices in _cogl_add_path_to_stencil_buffer
Before calling glRectf we need to ensure we flush the modelview and
projection matrices.
2009-06-30 17:13:37 +01:00
Robert Bragg
f386b1f002 [journal] Don't resize a singlton VBO; create and destroy a VBO each flush
This simplifies the vertex data uploading in the journal, and could improve
performance.  Modifying a VBO mid-scene could reqire synchronizing with the
GPU or some form of shadowing/copying to avoid modifying data that the GPU
is currently processing; the buffer was also being marked as GL_STATIC_DRAW
which could have made things worse.

Now we simply create a GL_STATIC_DRAW VBO for each flush and and delete it
when we are finished.
2009-06-30 17:13:37 +01:00
Robert Bragg
7b7787b050 [cogl] avoid using the journal in _cogl_add_path_to_stencil_buffer
Using cogl_rectangle (and thus the journal) in
_cogl_add_path_to_stencil_buffer means we have to consider all the state
that the journal may change in case it may interfer with the direct GL calls
used.  This has proven to be error prone and in this case the journal is an
unnecissary overhead.  We now simply call glRectf instead of using
cogl_rectangle.
2009-06-30 17:13:37 +01:00
Robert Bragg
6562f3224a [pango-display-list] Use the Cogl journal for short runs of text
For small runs of text like icon labels, we can get better performance
going through the Cogl journal since text may then be batched together
with other geometry.

For larger runs of text though we still use VBOs since the cost of logging
the quads becomes too expensive, including the software transform which
isn't at all optimized at this point.  VBOs also have the further advantage
of avoiding repeated validation of vertices by the driver and repeated
mapping of data into the GPU so long as the text doesn't change.

Currently the threshold is 100 vertices/25 quads. This number was plucked
out of thin air and should be tuned later.

With this change I see ~180% fps improvment for test-text. (x61s + i965 +
Mesa 7.6-devel)
2009-06-30 17:13:36 +01:00
Robert Bragg
6ac3b5a564 [material] _cogl_material_equal: catch the simplest case of matching handles
We were missing the simplest test of all: are the two CoglHandles equal and
are the flush option flags for each material equal?  This should improve
batching for some common cases.
2009-06-30 17:13:36 +01:00
Robert Bragg
9afa52f056 [material] avoid flushing the journal when just changing the color
Whenever we modify a material we call _cogl_material_pre_change_notify which
checks to see if the material is referenced by the journal and if so flushes
if before we modify the material.

Since the journal logs material colors directly into a vertex array (to
avoid us repeatedly calling glColor) then we know we never need to flush
the journal when material colors change.
2009-06-30 17:13:36 +01:00
Robert Bragg
efbf483d8c [cogl journal] Perform software modelview transform on logged quads.
Since most Clutter actors aren't much more than textured quads; flushing the
journal typically involves lots of 'change modelview; draw quad' sequences.

The amount of overhead involved in uploading a new modelview and queuing
that primitive is huge in comparison to simply transforming 4 vertices by
the current modelview when logging quads.  (Note if your GPU supports HW
vertex transform, then it still does the projective and viewport transforms)

At the same time a --cogl-debug=disable-software-transform option has been
added for comparison and debugging.

This change allows typical pick scenes to be batched into a single draw call
and I'm seeing test-pick run over 200% faster with this.  (i965 + Mesa
7.6-devel)
2009-06-30 17:13:36 +01:00
Robert Bragg
612a1e2dea [Cogl journal] use G_UNLIKLEY around runtime debugging conditions
May as well improve the branch prediction around runtime debugging code.
2009-06-30 17:13:36 +01:00
Robert Bragg
7d1876fd26 [cogl journal] Adds a --cogl-debug=batching option to trace batching
Enabling this option makes Cogl trace how the journal is managing to batch
your rectangles.  The journal staggers how it emmits state to the GL driver
and the batches will normally get smaller for each stage, but ideally you
don't want to be in a situation where Cogl is only able to draw one quad per
modelview change and draw call.

E.g. this is a fairly ideal example:
BATCHING: journal len = 101
BATCHING:  vbo offset batch len = 101
BATCHING:   material batch len = 101
BATCHING:    modelview batch len = 101

This isn't:
BATCHING: journal len = 1
BATCHING:  vbo offset batch len = 1
BATCHING:   material batch len = 1
BATCHING:    modelview batch len = 1
BATCHING: journal len = 1
BATCHING:  vbo offset batch len = 1
BATCHING:   material batch len = 1
BATCHING:    modelview batch len = 1
<repeat>
2009-06-30 17:13:36 +01:00
Robert Bragg
d03e6cfb2c [Cogl journal] Adds a --cogl-debug=journal option for tracing the journal
When this option is used Cogl will print a trace of all quads that get
logged into the journal, and a trace of quads as they get flushed.

If you are seeing a bug with the geometry being drawn by Cogl this may give
some clues by letting you sanity check the numbers being logged vs the
numbers being emitted.
2009-06-30 17:13:35 +01:00
Robert Bragg
3ea7816499 [cogl] Adds a debug option for disabling use of VBOs --cogl-debug=disable-vbos
For testing the VBO fallback paths it helps to be able to disable the
COGL_FEATURE_VBOS feature flag.  When VBOs aren't available Cogl should use
client side malloc()'d buffers instead.
2009-06-30 17:13:35 +01:00
Robert Bragg
54159f5a1d [cogl] Force Cogl to always use the client side matrix stack
Previously we only used the Cogl matrix stack API for indirect contexts, but
it's too costly to keep on requesting modelview matrices from GL (for
logging in the journal) even for direct rendering.

I also experimented with a patch for mesa to improve performance and
discussed this with upstream, but we agreed to consider the GL matrix API
essentially deprecated.  (For reference the GLES 2 and GL 3 specs have
removed the matrix APIs)
2009-06-30 17:13:35 +01:00
Robert Bragg
713af6535d [cogl-debug] Adds a "client-side-matrices" Cogl debug option
This allows us to force Cogl to use the client side matrix stack even when
direct rendering.
2009-06-30 17:13:35 +01:00
Robert Bragg
a8be68c83c [cogl-color] Adds a cogl_color_equal() function
CoglColors shouldn't be compared using memcmp since they may contain
uninitialized padding bytes.

The prototype is also suitable for passing to g_hash_table_new as the
key_equal_func.

_cogl_pango_display_list_add_texture now uses this instead of memcmp.
2009-06-30 17:13:35 +01:00
Robert Bragg
aca1bf4329 [cogl material] optimize logging of material colors in the journal
We now put the color of materials into the vertex array used by the journal
instead of calling glColor() but the number of requests for the material
color were quite expensive so we have changed the material color to
internally be byte components instead of floats to avoid repeat conversions
and added _cogl_material_get_colorubv as a fast-path for the journal to
copy data into the vertex array.
2009-06-30 17:13:35 +01:00
Robert Bragg
938452f1b1 [rectangle] Avoid modifying materials mid scene
To improve batching of geometry in the Cogl journal we need to avoid modifying
materials midscene.

Currently cogl_set_source_color and cogl_set_source_texture simply modify a
single shared material. In the future we can improve this so they use a pool
of materials that gets recycled as the journal is flushed, but for now we
give all ClutterRectangles their own private materials for painting with.
2009-06-30 17:13:35 +01:00
Robert Bragg
dc1ca79398 [actor] Avoid modifying materials mid-scene to improve journal batching
Currently cogl_set_source_color uses a single shared material which means
each actor that uses it causes the journal to flush if the color changes.
Until we improve cogl_set_source_color to use a pool of materials that can
be recycled as the journal is flushed we avoid mid-scene material changes by
giving all actors a private material instead.
2009-06-30 17:13:34 +01:00
Robert Bragg
40cfaeaffc [journal] Always pad our vertex data as if at least 2 layers are enabled
The number of material layers enabled when logging a quad in the journal
determines the stride of the corresponding vertex data (since we need a set
of texture coordinates for each layer.) By padding data in the case where we
have only one layer we can avoid a change in stride if we are mixing single
and double layer primitives in a scene (e.g.  relevent for a composite
manager that may use 2 layers for all shaped windows) Avoiding stride
changes means we can minimize calls to gl{Vertex,Color}Pointer when flushing
the journal.

Since we need to update the texcoord pointers when the actual number of
layers changes, this adds another batch_and_call() stage to deal with
glTexCoordPointer and enabling/disabling the client arrays.
2009-06-30 17:13:34 +01:00
Robert Bragg
845ff67301 [cogl] Improving Cogl journal to minimize driver overheads + GPU state changes
Previously the journal was always flushed at the end of
_cogl_rectangles_with_multitexture_coords, (i.e.  the end of any
cogl_rectangle* calls) but now we have broadened the potential for batching
geometry.  In ideal circumstances we will only flush once per scene.

In summary the journal works like this:

When you use any of the cogl_rectangle* APIs then nothing is emitted to the
GPU at this point, we just log one or more quads into the journal.  A
journal entry consists of the quad coordinates, an associated material
reference, and a modelview matrix.  Ideally the journal only gets flushed
once at the end of a scene, but in fact there are things to consider that
may cause unwanted flushing, including:

- modifying materials mid-scene
    This is because each quad in the journal has an associated material
    reference (i.e. not copy), so if you try and modify a material that is
    already referenced in the journal we force a flush first)

    NOTE: For now this means you should avoid using cogl_set_source_color()
	      since that currently uses a single shared material. Later we
	  should change it to use a pool of materials that is recycled
	  when the journal is flushed.

- modifying any state that isn't currently logged, such as depth, fog and
  backface culling enables.

The first thing that happens when flushing, is to upload all the vertex data
associated with the journal into a single VBO.

We then go through a process of splitting up the journal into batches that
have compatible state so they can be emitted to the GPU together.  This is
currently broken up into 3 levels so we can stagger the state changes:

1) we break the journal up according to changes in the number of material layers
   associated with logged quads. The number of layers in a material determines
   the stride of the associated vertices, so we have to update our vertex
   array offsets at this level. (i.e. calling gl{Vertex,Color},Pointer etc)
2) we further split batches up according to material compatability. (e.g.
   materials with different textures) We flush material state at this level.
3) Finally we split batches up according to modelview changes. At this level
   we update the modelview matrix and actually emit the actual draw command.

This commit is largely about putting the initial design in-place; this will be
followed by other changes that take advantage of the extended batching.
2009-06-30 17:13:34 +01:00
Øyvind Kolås
04bb789941 [texture] fix load-async and load-data-async properties.
Removed the G_PARAM_CONSTRUCT from the property registration of
"load-async" and "load-data-async". It made it impossible to use only
load-data-async, as the async loading state would be unset when
load-async got set it's default FALSE value.
2009-06-30 16:48:53 +01:00
Robert Bragg
722360774c [clip-stack] Use signed integers while combining window space clip rectangles
Use signed integers while combining window space clip rectangles, so we avoid
arithmatic errors later resulting in glScissor getting negative width and
height arguments.
2009-06-30 10:16:29 +01:00
Robert Bragg
d63cda3b76 [cogl] Remove unused ctx->polygon_vertices array
This array used to be used by cogl_polygon but was changed to use
ctx->logged_vertices some time ago.
2009-06-29 23:49:07 +01:00
Robert Bragg
30f13cafc5 [cogl] Give the default (fallback) texture a format of RGBA_8888_PRE
Previously this was RGBA_8888. It souldn't really make a difference but for
consistency we expect almost all textures in use to have an internaly
premultiplied pixel format.
2009-06-29 23:49:07 +01:00
Robert Bragg
4680b34046 [cogl-texture] use the right format when downloading sliced textures from GL
_cogl_texture_download_from_gl needs to create transient CoglBitmaps when
downloading sliced textures from GL, and then copies these as subregions
into the final target_bitmap. _cogl_texture_download_from_gl also supports
target_bitmaps with a different format to the source CoglTexture being
downloaded.

The problem was that in the case of slice textures we were always looking
at the format of the CoglTexture, not of the target_bitmap when setting
up the transient slice bitmap.
2009-06-29 23:49:07 +01:00
Robert Bragg
24ca92951f [cogl] Adds cogl_read_pixels to replace direct use of glReadPixels
To allow for flushing of batched geometry within Cogl we can't support users
directly calling glReadPixels.  glReadPixels is also awkward, not least
because it returns upside down image data.

All the unit tests have been swithed over and clutter_stage_read_pixels now
sits on top of this too.
2009-06-29 23:49:06 +01:00
Robert Bragg
27fff12a6a [cogl matrix] Adds ability to dirty state cached by the client matrix apis
To be able to load matrices to GL manually within Cogl we need a way to
dirty the state cached by the client matrix stack API.
2009-06-29 23:49:06 +01:00
Robert Bragg
26d5afd203 [debug] Adds a "nop-picking" clutter debug option to NOP _clutter_do_pick()
I've found this is something I do quite often when debugging rendering
problems since its a simple way to wipe out lots of geometry and removes a
lot of unpredictable noise when logging geometry passing through the Cogl
journal.
2009-06-29 23:49:06 +01:00
Robert Bragg
56bc54d242 [cogl_polygon] fixes a buffer overrun and color format bug
We were calculating our vertex stride and allocating our vertex array
differently depending on whether the user passed TRUE for use_color or not.
The problem was that we were always writting color data to the array
regardless of use_color.

There was also a bug with _cogl_texture_sliced_polygon in that it was
writing byte color components but we were expecting float components.  We
now use byte components in _cogl_multitexture_unsliced_polygon too and pass
GL_UNSIGNED_BYTE to glColorPointer.
2009-06-29 23:49:06 +01:00
Robert Bragg
8f734ccbb4 [vertex-buffer] Add cogl_vertex_buffer_indices_get_type API
cogl_vertex_buffer_indices lets you query back the data type used for the
given indices handle.
2009-06-29 23:49:05 +01:00
Robert Bragg
555159776b [vertex-buffer] Remove the COGL_INDICES_TYPE_UNSIGNED_INT indicies type
Since some embedded GPUs may not support 32bit integer indices we wont
include it until there is a particular need.
2009-06-29 23:49:05 +01:00
Damien Lespiau
a66f027c61 [cogl] Add COGL_HAS_GL and COGL_HAS_GLES
Cogl already add similar defines but with the CLUTTER namespace
(CLUTTER_COGL_HAS_GL and CLUTTER_COGL_HAS_GLES). Let's just add two
similar defines with the COGL namespace. Removing the CLUTTER_COGL ones
could break applications silently for no real good reason.
2009-06-29 21:37:02 +02:00
Damien Lespiau
30b5dac7c3 [misc] Update headers #endif comments
While grepping through the public headers looking for invalid use of
private HAVE_* defines, I stumbled upon two out of sync comments. Yes
it's a very minor trivial change.
2009-06-29 21:37:02 +02:00
Emmanuele Bassi
df572d089c [script] Simplify the parser code
JSON-GLib provides simple accessors for basic types so that we
can avoid getting the JsonNode out of a complex type. This makes
the code simpler to understand.
2009-06-29 17:01:15 +01:00
Emmanuele Bassi
354fa437cd Update JSON-GLib dependency
Currently, Clutter depends on the internal copy of JSON-GLib for
the ClutterScript parser. This is done to allow building Clutter
on platforms that do not have the library installed on the system.

Just like we use the internal PNG/JPEG loader as a fallback in
case we don't have GdkPixbuf or CoreGraphics available, we should
use the internal copy of JSON-GLib only in case the system copy
is not present.

The change is simply to move the default for the --with-json
configure switch from "internal" to "check".

In order to allow stricter compliance, a third setting should
be present: "system", which fails if the system copy is not
available.

We should also change the introspection generation to avoid
breaking in case we require the installed Json-1.0.gir instead
of the generated ClutterJson.gir
2009-06-29 17:01:11 +01:00
Emmanuele Bassi
81bc2b4cc7 [actor] Remove unused clutter_actor_pick()
The clutter_actor_pick() function just emits the ::pick signal
on the actor. Nobody should be using it, since the paint() method
is already context sensitive and will result in a ::pick emission
by itself. The clutter_actor_pick() is just confusing things.
2009-06-29 17:01:10 +01:00
Emmanuele Bassi
bd668cf156 Add more debug notes inside the master clock 2009-06-29 17:01:10 +01:00
Emmanuele Bassi
de745e93c9 [docs] Fix the ActorBox annotations
The ClutterActorBox API is incorrectly annotated and gtk-doc is unable
to pick it up.
2009-06-25 14:54:16 +01:00
Tim Horton
e9d277609d Add element-type annotations for animate*v functions
Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1653

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-22 12:27:17 +01:00
Ole André Vadla Ravnås
c272a7b2a2 [master clock] Fix MT safety issues
Fix MT issues when enabling threading in Clutter.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1655

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-22 12:17:41 +01:00
Emmanuele Bassi
ba6c0c27f9 [texture] Revert to integer parameters in ::size-change
In the int-to-float switch for actor properties, the ::size-change signal
was moved to use floats instead of integers. Sub-pixel precision for image
size is meaningless, though, so we should revert it back to ints.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1659
2009-06-22 12:15:17 +01:00
Emmanuele Bassi
a79d6228aa Remove the last few fixed-point entry points
The last fixed-point entry points are just a few, and trivial. The
end user is expected to do the conversion using the CoglFixed type
and macros.
2009-06-19 16:38:35 +01:00
Emmanuele Bassi
cb4e5c9083 [x11] Simplify the XInput support
Instead of using a specific function to check whether the X
server supports the XInput extension we can use the generic
Xlib function XQueryExtension(). This cuts down the extra
checks inside the configure.ac and simplifies the code inside
clutter_x11_register_xinput().
2009-06-19 15:12:32 +01:00
Emmanuele Bassi
21608fe5f7 [x11] Add a command line switch for enabling XInput
Currently, XInput support requires a function call. In order to
make it easier for people to test it, we can also add a command
line switch that moves the pointer device detection and handling
to XInput. This should ensure that, at least for people building
Clutter with --enable-xinput, applications can be easily migrated
and regressions can be caught.
2009-06-19 14:32:37 +01:00
Emmanuele Bassi
a6b4697367 [backend] Do not store the stage manager singleton
The StageManager singleton instance is already kept around
by the clutter_stage_manager_get_default() function; there is
no need to have it inside the main Clutter context as well.
2009-06-19 14:19:39 +01:00
Emmanuele Bassi
b6e404a406 [x11] Use _clutter_context_is_initialized()
Instead of using _clutter_context_get_default() and checking the
is_initialized flag, we should use the newly added private function
that does not cause side effects, especially for functions that have
to be called before any other Clutter function.
2009-06-19 14:12:36 +01:00
Emmanuele Bassi
b5f4befeaa Allow checking initialization without side-effects
The _clutter_context_get_default() function will automatically
create the main Clutter context; if we just want to check whether
Clutter has been initialized this will complicate matters, by
requiring a call to g_type_init() inside the client code.

Instead, we should simply provide an internal API that checks
whether the main Clutter context exists and if it has been
initialized, without any side effect.
2009-06-19 14:09:42 +01:00
Emmanuele Bassi
184df2a5fa [input] Rework input device API
The input device API is split halfway thorugh the backends in a very
weird way. The data structures are private, as they should, but most
of the information should be available in the main API since it's
generic enough.

The device type enumeration, for instance, should be common across
every backend; the accessors for device type and id should live in the
core API. The internal API should always use ClutterInputDevice and
not the private X11 implementation when dealing with public structures
like ClutterEvent.

By adding accessors for the device type and id, and by moving the
device type enumeration into the core API we can cut down the amount
of symbols private and/or visible only to the X11 backends; this way
when other backends start implementing multi-pointer support we can
share the same API across the code.
2009-06-19 13:12:05 +01:00
Damien Lespiau
3653a9a64d Public headers should not have #ifdefs relying on private defines
HAVE_COGL_GLES2 is defined in config.h through the configure script and
should not be used in public headers.

The patch makes configure generate the right define that can be used
later in the header.
2009-06-19 06:43:34 +01:00
Emmanuele Bassi
c6fba47a52 Hide clutter_context_get_default()
The clutter_context_get_default() function is private, but shared
across Clutter. For this reason, it should be prefixed by '_' so
that the symbol is hidden from the shared object.
2009-06-18 14:20:28 +01:00
Emmanuele Bassi
8c676ebd87 Remove an unusued member from MainContext
The MainContext structure has a field for the master clock, but
clutter_master_clock_get_default() will return the same instance
from everywhere.
2009-06-17 15:43:53 +01:00
Matthew Allum
1aa8c89f2c [XInput] Get XInput working again.
Check for distros shipping out of sync header vs libXi,
call in g_type_init() in test-devices, fix ifdef so
XInput events get correctly selected.
2009-06-17 15:09:16 +01:00
Emmanuele Bassi
3035092edb Do not use the --pkd switch for g-ir-scanner
Revert commit 8aacff0e0f
2009-06-16 18:08:52 +01:00
Emmanuele Bassi
8aacff0e0f [introspection] Add --pkg switch pointing at Clutter
Add a <package/> element pointing to Clutter's pkg-config
file name.
2009-06-16 16:43:00 +01:00
Emmanuele Bassi
9f83e7dc2e [stage] Remove an assertion
We might get a size request on destruction, so it should be safe
to avoid an assertion failure because we don't have the stage
implementation anymore.
2009-06-16 16:43:00 +01:00
Emmanuele Bassi
4bed539b21 Add more ActorBox utility methods
ActorBox should have methods for easily extracting the X and Y
coordinates of the origin, and the width and height separately.

These methods will make it easier for high-level language bindings
to manipulate ActorBox instances and avoid the Geometry type.
2009-06-16 16:43:00 +01:00
Emmanuele Bassi
275f292ab9 Add accessors for the boxed types
The Vertex and ActorBox boxed types are meant to be used across
the API, but are fairly difficult to bind. Their memory management
is also unclear, and has to go through the indirection of
g_boxed_copy() and g_boxed_free().
2009-06-16 16:42:59 +01:00
Colin Walters
63c84c46f8 Plug minor memory leak in cogl_vertex_buffer_submit_real
Free a temporary list.
2009-06-16 15:46:51 +01:00
Neil Roberts
f95f4ba3cb [ClutterCairoTexture] Use the right component ordering when uploading data
Cairo stores the image data in ARGB native byte order so we need to
upload this as BGRA on little endian architectures and ARGB on big
endian. ClutterTexture doesn't currently expose any flags to describe
ARGB format so until we can fix the Clutter API it now uses the Cogl
API directly.
2009-06-15 12:41:13 +01:00
Emmanuele Bassi
c6b4ea8b44 [cairo-texture] Clean up and whitespace fixes
Simple clean up of the CairoTexture to remove unneeded checks,
redundant variables and white space.
2009-06-15 11:50:23 +01:00
Emmanuele Bassi
9799750c03 [animation] Rework animation chaining
In order to chain up animations using clutter_actor_animate() and
friends you have to use an idle handler that guarantees that the
main loop spins at least once after the animation pointer has been
detached from the actor.

This has several drawbacks, first and foremost the fact that the
slice of the main loop for the idle handler might be starved by
other operations, like redrawing. This inevitably leads to tricks
with priorities and the like, contributing to the overall complexity.

Instead, we should guarantee that the animation instance created by
clutter_actor_animate() is valid for the ::completed signal until
it reaches its default handler; after that, the animation is detached
from the actor and destroyed. This means that it's possible to
create a new animation after the first is complete by simply using
g_signal_connect_after().

This unfortunately makes it impossible to keep a reference to the
animation pointer attached to the actor by using g_object_ref(); a
way to "fix" this would be to have a clutter_animation_attach()
and a clutter_animation_detach() pair of methods that allow attaching
any animation to an actor. This might overcomplicate what it is
the simple animation API, though, so it's currently not implemented
and left for future versions.

The test-easing interactive demo has been modified to show how
the animation queuing works by adding a command line switch that
recenters the animated actor once the first animation has ended.
2009-06-15 11:49:33 +01:00
Emmanuele Bassi
612d1cded7 [animation] Allow swapped/after signal variants
Continuing in the tradition on making clutter_actor_animate() the
next g_object_connect(), here's the addition of the signal-after::
and signal-swapped:: modifiers for the automagic signal connection
arguments.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1646
2009-06-15 11:48:42 +01:00
Emmanuele Bassi
0415d62d40 Disable single header inclusion for GLib
In order to be ready for the next major version of GLib we need to
disable single header inclusion by using the G_DISABLE_SINGLE_INCLUDES
define in the build process.
2009-06-15 11:29:37 +01:00
Owen W. Taylor
e6a987d670 Fix redraw queueing in the presence of cloning
We can't short-circuit the emission of ::queue-redraw for not-visible
actors, since ClutterClone uses that signal to know when things need
to be redrawn.

Calling clutter_actor_queue_redraw() out of clutter_actor_real_map() /
clutter_actor_real_unmap() was causing the flag state to get set
incorrectly from _clutter_actor_set_enable_paint_unmapped(), because
a paint queueing a redraw was not expected.

Moving queuing the redraw to clutter_actor_hide()/show() fixes this, and
also fixes a problem where showing a child of a cloned actor wouldn't
cause the clone to be repainted.

http://bugzilla.openedhand.com/show_bug.cgi?id=1484

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-15 11:29:37 +01:00
Owen W. Taylor
795e005566 Fix handling of not-visible texture pixmaps
If we have an not-visible texture pixmap, we need to:

 - Still update it if it is realized, since it won't be
   updated when shown. And it might be also be cloned.

 - Queue a redraw if even if not visible, since it
   it might be cloned.

http://bugzilla.openedhand.com/show_bug.cgi?id=1647

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-15 11:29:37 +01:00
Robert Bragg
9d82995773 [_cogl_texture_bitmap_prepare] use bitmap format for FORMAT_ANY + no alpha
My patch to choose a premultiplied format when the user gives
COGL_PIXEL_FORMAT_ANY for the internal_format broke the case where the data
in question doesn't have and alpha channel.

This was accidentally missed when merging the premultiplication branch
since I merged a local version of the branch that missed this commit.
2009-06-11 18:49:30 +01:00
Robert Bragg
71b62e75d2 [cogl] Don't allow calling cogl_set_source_texture with an INVALID_HANDLE
Although the underlying materials should allow layers with INVALID_HANDLES
it shouldn't be necissary to expose that via cogl_set_source_texture() and
it's easier to resolve a warning/crash here than odd artefacts/crashes later
in the pipeline.
2009-06-11 16:28:01 +01:00
Robert Bragg
96827db740 Bug 1406 - Handling of premultiplication in clutter
Merge branch 'premultiplication'

[cogl-texture docs] Improves the documentation of the internal_format args
[test-premult] Adds a unit test for texture upload premultiplication semantics
[fog] Document that fogging only works with opaque or unmultipled colors
[test-blend-strings] Explicitly request RGBA_888 tex format for test textures
[premultiplication] Be more conservative with what data gets premultiplied
[bitmap] Fixes _cogl_bitmap_fallback_unpremult
[cogl-bitmap] Fix minor copy and paste error in _cogl_bitmap_fallback_premult
Avoid unnecesary unpremultiplication when saving to local data
Don't unpremultiply Cairo data
Default to a blend function that expects premultiplied colors
Implement premultiplication for CoglBitmap
Use correct texture format for pixmap textures and FBO's
Add cogl_color_premultiply()
2009-06-11 16:00:28 +01:00
Robert Bragg
ec77b91398 [cogl-texture docs] Improves the documentation of the internal_format args
Clarifies that if you give COGL_PIXEL_FORMAT_ANY as the internal format for
cogl_texture_new_from_file or cogl_texture_new_from_data then Cogl will
choose a premultiplied internal format.
2009-06-11 14:31:01 +01:00
Robert Bragg
70636b4815 [fog] Document that fogging only works with opaque or unmultipled colors
The fixed function fogging provided by OpenGL only works with unmultiplied
colors (or if the color has an alpha of 1.0) so since we now premultiply
textures and colors by default a note to this affect has been added to
clutter_stage_set_fog and cogl_set_fog.

test-depth.c no longer uses clutter_stage_set_fog for this reason.

In the future when we can depend on fragment shaders we should also be
able to support fogging of premultiplied primitives.
2009-06-11 14:17:53 +01:00
Robert Bragg
a9b011f3ed [premultiplication] Be more conservative with what data gets premultiplied
We don't want to force texture data to be premultipled if the user
explicitly specifies a non premultiplied internal_format such as
COGL_PIXEL_FORMAT_RGBA_8888.  So now Cogl will only automatically
premultiply data when COGL_PIXEL_FORMAT_ANY is given for the
internal_format, or a premultiplied internal format such as
COGL_PIXEL_FORMAT_RGBA_8888_PRE is requested but non-premultiplied source
data is given.

This approach is consistent with OpenVG image formats which have already
influenced Cogl's pixel format semantics.
2009-06-11 14:17:53 +01:00
Robert Bragg
9d3aa57604 [bitmap] Fixes _cogl_bitmap_fallback_unpremult
The _cogl_unpremult_alpha_{first,last} functions which
_cogl_bitmap_fallback_unpremult depends on were incorrectly casting each
of the byte components of a texel to a gulong and performing shifts as
if it were dealing with the whole texel.

It now just uses array indexing to access the byte components without
needing to cast or manually shift any bits around.

Even though we used to depend on unpremult whenever we used a
ClutterCairoTexture, clutter_cairo_texture_context_destroy had it's own
unpremult code which worked which is why this bug wouldn't have been noticed
before.
2009-06-11 14:17:52 +01:00
Robert Bragg
cb959ef457 [cogl-bitmap] Fix minor copy and paste error in _cogl_bitmap_fallback_premult
The returned bitmap format should include the COGL_PREMULT_BIT flag not
have it explicitly removed as for _cogl_bitmap_fallback_unpremult.
2009-06-11 14:17:52 +01:00
Owen W. Taylor
5e18cee77a Avoid unnecesary unpremultiplication when saving to local data
Now that we typically have premultiplied data stored in Cogl
textures, when fetching a texture into local data for temporary
storage, use a premultiplied format to avoid an unpremultiply/
premultiply roundtrip.

http://bugzilla.openedhand.com/show_bug.cgi?id=1406

Signed-off-by: Robert Bragg <robert@linux.intel.com>
2009-06-11 14:17:52 +01:00
Owen W. Taylor
1e5b5d10c5 Don't unpremultiply Cairo data
Instead of unpremultiplying the Cairo data, pass it directly to Cogl
in premultiplied form; we now *prefer* premultiplied data.

http://bugzilla.openedhand.com/show_bug.cgi?id=1406

Signed-off-by: Robert Bragg <robert@linux.intel.com>
2009-06-11 14:17:52 +01:00
Owen W. Taylor
c3448314d5 Default to a blend function that expects premultiplied colors
Many operations, like mixing two textures together or alpha-blending
onto a destination with alpha, are done most logically if texture data
is in premultiplied form. We also have many sources of premultiplied
texture data, like X pixmaps, FBOs, cairo surfaces. Rather than trying
to work with two different types of texture data, simplify things by
always premultiplying texture data before uploading to GL.

Because the default blend function is changed to accommodate this,
uses of pure-color CoglMaterial need to be adapted to add
premultiplication.

gl/cogl-texture.c gles/cogl-texture.c: Always premultiply
  non-premultiplied texture data before uploading to GL.

cogl-material.c cogl-material.h: Switch the default blend functions
  to ONE, ONE_MINUS_SRC_ALPHA so they work correctly with premultiplied
  data.

cogl.c: Make cogl_set_source_color() premultiply the color.

cogl.h.in color-material.h: Add some documentation about
  premultiplication and its interaction with color values.

cogl-pango-render.c clutter-texture.c tests/interactive/test-cogl-offscreen.c:
  Use premultiplied colors.

http://bugzilla.openedhand.com/show_bug.cgi?id=1406

Signed-off-by: Robert Bragg <robert@linux.intel.com>
2009-06-11 14:17:52 +01:00
Owen W. Taylor
888a261999 Implement premultiplication for CoglBitmap
cogl-bitmap.c cogl-bitmap-pixbuf.c cogl-bitmap-fallback.c cogl-bitmap-private.h:
  Add _cogl_bitmap_can_premult(), _cogl_bitmap_premult() and implement
  a reasonably fast implementation in the "fallback" code.

http://bugzilla.openedhand.com/show_bug.cgi?id=1406

Signed-off-by: Robert Bragg <robert@linux.intel.com>
2009-06-11 14:17:51 +01:00
Owen W. Taylor
4dcd5f6134 Use correct texture format for pixmap textures and FBO's
RGBA data in X pixmaps and in FBOs is already premultiplied; use
the right format when creating cogl textures.

http://bugzilla.openedhand.com/show_bug.cgi?id=1406

Signed-off-by: Robert Bragg <robert@linux.intel.com>
2009-06-11 14:17:51 +01:00
Owen W. Taylor
f90017ab4e Add cogl_color_premultiply()
Add a convenience function to convert an ARGB color from
non-premultiplied to premultiplied form.

http://bugzilla.openedhand.com/show_bug.cgi?id=1406

Signed-off-by: Robert Bragg <robert@linux.intel.com>
2009-06-11 14:17:51 +01:00
Emmanuele Bassi
eb55397423 [build] Fix distcheck for the json-glib internal copy
Since commit d743aeaa updated the internal copy of JSON-GLib and
added a new private header file, we need to fix the build to avoid
a distcheck failure.
2009-06-11 13:24:34 +01:00
Emmanuele Bassi
61c45da90a Bug 1637 - Master clock improvements
Merge branch 'master-clock-updates'

* master-clock-updates: (22 commits)
  Change the paint forcing on the Text cache text
  [timelines] Improve marker hit check and don't fudge the delta
  Revert "[timeline] Don't clamp the elapsed time when a looping tl reaches the end"
  [tests] Don't add a newline to the end of g_test_message calls
  [test-timeline] Add a marker at the beginning of the timeline
  [timeline] Don't clamp the elapsed time when a looping tl reaches the end
  [master-clock] Throttle if no redraw was performed
  [docs] Update Clutter's API reference
  Force a paint instead of calling clutter_redraw()
  Fix clutter_redraw() to match the redraw cycle
  Run the repaint functions inside the redraw cycle
  Remove useless manual timeline ticking
  Move elapsed-time calculations into ClutterTimeline
  Limit the frame rate when not syncing to VBLANK
  Decrease the main-loop priority of the frame cycle
  Avoid motion-compression in test-picking test
  Compress events as part of the frame cycle
  Remove stage update idle and do updates from the master clock
  Call g_main_context_wakeup() when we start running timelines
  Remove unused msecs_delta member
  ...
2009-06-11 13:01:34 +01:00
Neil Roberts
f1000db3ca [timelines] Improve marker hit check and don't fudge the delta
Markers added at the start of the timeline need to be special cased
because we effectively check whether the marker time is greater than
the old frame time or less than or equal to the new frame time but we
never actually emit a frame for the start of the timeline.

If the timeline is looping then it adjusts the position to interpolate
a wrapped around position. However we do not emit a new frame after
setting this position so we need to check for markers again there.

clutter_timeline_get_delta should return the actual wall clock time
between emissions of the new-frame signal - even if the elapsed time
has been fudged at the end of the timeline. To make this work it no
longer directly manipulates priv->msecs_delta but instead passes a
delta value to check_markers.
2009-06-11 12:14:53 +01:00
Tommi Komulainen
bf0c21e015 stage: set key focus actor to NULL before emitting focus-out
Someone might hide the previously focused actor in the focus-out signal
handler and as key focus still appears to be on that actor we'd get
re-entrant call and get glib critical from g_object_weak_unref

This changes clutter_stage_get_key_focus() to return stage/NULL during
focus-out signal emission. It used to be the actor focus-out was being
emitted on.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1547

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-11 12:14:10 +01:00
Neil Roberts
9021aa2909 Revert "[timeline] Don't clamp the elapsed time when a looping tl reaches the end"
This reverts commit 9c5663d671.

The patch was causing problems for applications that expect the
elapsed_time to be at either end of the timeline when the completed
signal is fired. For example test-behave swaps the direction of the
timeline in the completed handler but if the time has overflowed the
end then the timeline would only take a short time to get back the
beginning. This caused the animation to just vibrate around the
beginning.
2009-06-11 11:46:41 +01:00
Neil Roberts
9c5663d671 [timeline] Don't clamp the elapsed time when a looping tl reaches the end
The new-frame signal of a timeline was previously guaranteed to be
emitted with the elapsed_time set to the end before it emits the
completed signal. This doesn't necessarily make sense for looping
timelines because it would cause the elapsed time to be clamped to a
slightly off value whenever the timeline restarts. This patch makes it
perform the wrap around before emitting the new-frame signal so that
the elapsed time always corresponds to the time elapsed since the
timeline was started.

Additionally it no longer fudges the msecs_delta property to make the
marker check work so clutter_timeline_get_delta will always return the
wall clock time since the last frame.
2009-06-10 17:47:33 +01:00
Emmanuele Bassi
df839e22e6 [text] Do not leak the effective attributes
Thanks to Iain Holmes for catching the leak.
2009-06-10 16:23:35 +01:00
Neil Roberts
acf7722a41 [master-clock] Throttle if no redraw was performed
A flag in the master clock is now set whenever the dispatch caused an
actual redraw of a stage. If this flag is not set during the prepare
and check functions then it will resort to limiting the redraw
attempts to the default frame rate as if vblank syncing was
disabled. Otherwise if a timeline is running that does not cause the
scene to change then it would busy-wait with 100% CPU until the next
frame.

This fix was suggested by Owen Taylor in:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1637

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-10 15:50:27 +01:00
Emmanuele Bassi
eca73fe6c7 [docs] Annotate fixed sized arrays 2009-06-10 14:54:42 +01:00
Emmanuele Bassi
0f9dea0337 Force a paint instead of calling clutter_redraw()
We do not need the whole redraw machinery inside
clutter_stage_read_pixels(): instead, we want Clutter to drop everything,
paint and call glReadPixels() with the current buffer.
2009-06-10 14:52:53 +01:00
Emmanuele Bassi
bd3254c0f8 [docs] Various gtk-doc fixes for COGL
Try to keep the gtk-doc errors down to a minimum.
2009-06-10 12:57:36 +01:00
Emmanuele Bassi
e1cac4fece Fix clutter_redraw() to match the redraw cycle
The clutter_redraw() function is used by embedding toolkits to
force a redraw on a stage. Since everything is performed by
toggling a flag inside the Stage itself and then letting the
master clock advance, we need a ClutterStage method to ensure
that we start the master clock and redraw.
2009-06-09 16:29:29 +01:00
Emmanuele Bassi
7099d251c6 Run the repaint functions inside the redraw cycle
Now that every redraw is performed within the master clock we
need to run the repaint functions inside it.
2009-06-09 16:28:25 +01:00
Owen W. Taylor
6705ce6c6a Move elapsed-time calculations into ClutterTimeline
Instead of calculating a delta in the master clock, and passing that
into each timeline, make each timeline individually responsible for
remembering the last time and computing the delta.

This:

 - Fixes a problem where we could spin infinitely processing
   timeline-only frames with < 1msec differences.
 - Makes timelines consistently start timing on the first frame;
   instead of doing different things for the first started timeline
   and other timelines.
 - Improves accuracy of elapsed time computations by avoiding
   accumulating microsecond => millisecond truncation errors.

http://bugzilla.openedhand.com/show_bug.cgi?id=1637

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-09 15:03:56 +01:00
Owen W. Taylor
dcd8d28314 Limit the frame rate when not syncing to VBLANK
clutter-master-clock.c clutter-master-clock.h: When the
  SYNC_TO_VBLANK feature is not available, wait for 1/frame_rate
  seconds since the start of the last frame before drawing the next
  frame. Add _clutter_master_clock_start_running() to abstract
  the usage of g_main_context_wakeup()

clutter-stage.c: Add _clutter_master_clock_start_running()

clutter-main.c: Update docs for clutter_set_default_frame_rate()
  clutter_get_default_frame_rate() to no longer talk about timeline
  frame rates.

test-text-perf.c test-text.c: Set a frame rate of 1000fps so that
  frame-rate limiting doesn't affect the result.

http://bugzilla.openedhand.com/show_bug.cgi?id=1637

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-09 15:03:56 +01:00
Owen W. Taylor
64bb2e694f Decrease the main-loop priority of the frame cycle
Change CLUTTER_PRIORITY_REDRAW to be lower than the GTK+ resize
  and relayout priorities to avoid starving GTK+ when run in the
  same process as clutter.
Remove the unused CLUTTER_PRIORITY_TIMELINE

http://bugzilla.openedhand.com/show_bug.cgi?id=1637

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-09 15:03:56 +01:00
Owen W. Taylor
6e69692e22 Compress events as part of the frame cycle
Instead of trying to guess about which motion events are
extraneous, queue up all events until we process a frame.
This allows us to look ahead and reliably compress consecutive
sequence of motion events.

clutter-main.c: Feed received events to the stage for queueing.
  Remove old compression code. Remove clutter_get_motion_events_frequency()
  clutter_set_motion_events_frequency()
clutter-stage.c: Keep a queue of pending events.
clutter-master-clock.c: Add processng of queued events to the
  clock source dispatch function.

http://bugzilla.openedhand.com/show_bug.cgi?id=1637

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-09 15:03:56 +01:00
Owen W. Taylor
89a8fd7755 Remove stage update idle and do updates from the master clock
When a redraw is queued on a stage, simply set a flag; then in
the check/prepare functions of the master clock source, check
for stages that need redrawing.

This avoids the complexity of having multiple competing sources
at the same priority and makes the update ordering more reliable and
understandable.

http://bugzilla.openedhand.com/show_bug.cgi?id=1637

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-09 15:03:56 +01:00
Owen W. Taylor
77cd4e2bc8 Call g_main_context_wakeup() when we start running timelines
If a timeline is added from a different thread, we need to
call g_main_context_wakeup() to wake the main thread up to
start updating the timeline.

http://bugzilla.openedhand.com/show_bug.cgi?id=1637

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-09 15:03:55 +01:00
Owen W. Taylor
4b63f9524e Remove unused msecs_delta member
msecs_delta member of ClutterMasterClock was set but not used.

http://bugzilla.openedhand.com/show_bug.cgi?id=1637

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-09 15:03:55 +01:00
Owen W. Taylor
ebaec9798e Simplify timeout list handling for the master clock
Instead of keeping a list of all timelines, and connecting to
signals and weak notifies, simply keep a list of running timelines;
this greatly simplifies both the book-keeping, and also determining
if there are any running timelines.

http://bugzilla.openedhand.com/show_bug.cgi?id=1637

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-09 15:03:55 +01:00
Owen W. Taylor
3ab303b662 Only advance the master clock before drawing a frame
Remove code to advance the master clock after drawing a frame; if
there are any running timelines the master clock will do another
frame by itself, and the clock will be advanced before running
that frame.

With this change, there is no point in queueing an extra frame
redraw after completing a timeline, since we are always advancing
the timeline *before* redrawing, so remove that code as well.
(This does mean that calling clutter_timeline_stop() won't implicitly
cause the stage to be redrawn; this doesn't seem like something
an app should rely on in any case.)

http://bugzilla.openedhand.com/show_bug.cgi?id=1637

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-09 15:03:55 +01:00
Emmanuele Bassi
19c2e66398 [docs] Various gtk-docs fixes 2009-06-09 14:47:36 +01:00
Emmanuele Bassi
33f5fe73b3 [stage] Rename fullscreen methods
The clutter_stage_fullscreen() and clutter_stage_unfullscreen() are
a GDK-ism. The underlying implementation is already using an accessor
with a boolean parameter.

This should take the amount of collisions between properties, methods
and signals to zero.
2009-06-09 14:07:35 +01:00
Emmanuele Bassi
7c89a0ccfa [stage] Rename :fullscreen to :fullscreen-set
The :fullscreen property is very much confusing as it is implemented.
It can be written to a value, but the whole process might fail. If we
set:

  g_object_set (stage, "fullscreen", TRUE, NULL);

and the fullscreen process fails or it is not implemented, the value
will be reset to FALSE (if we're lucky) or left TRUE (most of the
times).

The writability is just a shorthand for invoking clutter_stage_fullscreen()
or clutter_stage_unfullscreen() depending on a boolean value without
using an if.

The :fullscreen property also greatly confuses high level languages,
since the same symbol is used:

  - for a method name (Clutter.Stage.fullscreen())
  - for a property name (Clutter.Stage.fullscreen)
  - for a signal (Clutter.Stage::fullscreen)

For these reasons, the :fullscreen should be renamed to :fullscreen-set
and be read-only. Implementations of the Stage should only emit the
StageState event to change from normal to fullscreen, and the Stage
will automatically update the value of the property and emit a notify
signal for it.
2009-06-09 14:07:35 +01:00
Emmanuele Bassi
d743aeaa21 [json] Update the internal JSON-GLib copy
There have been changes in JSON-GLib upstream to clean up the
data structures, and facilitate introspection.

We still not use the updated JsonParser with the (private) JsonScanner
code, since it's a fork of GLib's GScanner.
2009-06-09 14:07:22 +01:00
Emmanuele Bassi
91856b1bed [introspection] Add --c-include to g-ir-scanner
Since Clutter has a single-include header policy we need to put
the header to be included inside the GIR file.
2009-06-09 12:45:23 +01:00
Neil Roberts
4b125d7fde [CoglTexture] Initialise tex->first_pixels to NULL in all constructors
Otherwise if there is an error before the slices are created it will
try to free the first_pixels array and crash.

It now also checks whether first_pixels has been created before using
it to update the mipmaps. This should only happen for
cogl_texture_new_from_foreign and doesn't matter if the FBO extension
is available. It would be better in this case to fetch the first pixel
using glGetTexImage as Owen mentioned in the last commit.
2009-06-09 11:13:11 +01:00
Owen W. Taylor
1d7a7bf1e6 Fix unitialized first_pixels for foreign textures
tex->first_pixels was never set for foreign textures, leading
to a crash when the texture object is freed.

As a quick fix, simply set to NULL. A more complete fix would
require remembering if we had ever seen the first pixel uploaded,
and if not, doing a glReadPixel to get it before triggering the
mipmap update.

http://bugzilla.openedhand.com/show_bug.cgi?id=1645

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2009-06-09 10:54:54 +01:00
Owen W. Taylor
08d580f68a On bad blend strings, print the error if not returning it
It's very common that there's no reasonable fallback to do if the
blend or combine string you set isn't supported. So, rather than
requiring everybody to pass in a GError purely to catch syntax erorrs,
automatically g_warning() if a parse error is encountered and @error
is NULL.

http://bugzilla.openedhand.com/show_bug.cgi?id=1642

Signed-off-by: Robert Bragg <robert@linux.intel.com>
2009-06-08 23:51:08 +01:00
Garry Bodsworth
d873a57ec9 Fix for new potential memory leak in ClutterGLXTexturePixmap.
This fixes a new instance of glXDestroyGLXPixmap which should be
glXDestroyPixmap.

Signed-off-by: Robert Bragg <robert@linux.intel.com>
2009-06-08 23:51:08 +01:00
Owen W. Taylor
fd0a490ced Properly adjust msecs_delta when clamping elapsed time
When we complete a timeline, we clamp the elapsed_time variable
to the range of the timeline. We need to adjust msecs_delta so that
when we check for hit markers we have the correct interval.

http://bugzilla.openedhand.com/show_bug.cgi?id=1641

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-08 15:03:16 +01:00
Emmanuele Bassi
fd19d33746 [animation] Keep a reference during notify::alpha
The Animation should be referenced during the notification of the
alpha value, since the callback is invoked depending on the Alpha
and it won't vivify the Animation instance for us.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1537
2009-06-08 14:42:22 +01:00
Emmanuele Bassi
41e85f3073 introspection-friendly ClutterEvent accessors
ClutterEvent is not really gobject-introspection friendly because
of the whole discriminated union thing. In particular, if you get
a ClutterEvent in a signal handler, you probably can't access the
event-type-specific fields, and you probably can't call methods
like clutter_key_event_symbol() either, because you can't cast the
ClutterEvent to a ClutterKeyEvent.

The cleanest solution is to turn every accessor into ClutterEvent
methods, accepting a ClutterEvent* and internally checking the event
type.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1585
2009-06-08 12:05:20 +01:00
Garry Bodsworth
04dc4106e5 [glx-texture-pixmap] Unref a cogl texture handle.
According to clutter_texture_set_cogl_texture you should unref the handle as
the texture takes its own.

Signed-off-by: Robert Bragg <robert@linux.intel.com>
2009-06-08 11:58:47 +01:00
Garry Bodsworth
c968b06f15 Fix memory leak in ClutterGLXTexturePixmap.
The OpenGL spec states that if you create a pixmap using glXCreatePixmap you
should use glXDestroyPixmap to destroy it.

Signed-off-by: Robert Bragg <robert@linux.intel.com>
2009-06-08 11:52:24 +01:00
Owen W. Taylor
1e6e41190b Straighten out 'realize' handling for ClutterGLXTexturePixmap
Setting the pixmap for an unrealized ClutterGLXTexturePixmap should
not cause it to be realized, and certainly shouldn't cause the the
REALIZED flag to be set without using clutter_actor_realize().

This patch uses the simple approach that;

 - pixmap changes on an unrealized ClutterGLXTexturePixmap
   are ignored
 - when the ClutterGLXTexturePixmap is realized, we then create
   the GLXPixmap and the corresponding texture.

The call to clutter_glx_texture_pixmap_update_area() is moved
from create_cogl_texture() to
clutter_glx_texture_pixmap_create_glx_pixmap() since
create_cogl_texture() is only called from one place, and updating
the area is really something we do *after* creating the texture,
not part of creating the texture.

clutter_glx_texture_pixmap_create_glx_pixmap() is reorganized a
bit to avoid debug-logging confusingly if it's called before a pixmap
has been set, and for readability.

http://bugzilla.openedhand.com/show_bug.cgi?id=1635

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-08 11:07:43 +01:00
Owen W. Taylor
d28c9e5db1 Remove unnecessary setting of CLUTTER_ACTOR_REALIZED flag
An implementaton of realize() never needs to set the
CLUTTER_ACTOR_REALIZED flag, though it can unset the flag if
things fail unexpectedly. (Previously, stage backend implementations
had to do this since clutter_actor_realize() wasn't used; this
is no longer the case.)

http://bugzilla.openedhand.com/show_bug.cgi?id=1634

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-08 11:07:33 +01:00
Owen W. Taylor
2b7e98f4b3 Be more tolerant about natural_width < min_width
Due to the accumulation of floating point errors, natural_width
and min_width can diverge significantly even if the math for
computing them is correct. So just clamp natural_width to
min_width instead of warning about it.

http://bugzilla.openedhand.com/show_bug.cgi?id=1632

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-08 11:07:13 +01:00
Owen W. Taylor
583a86b537 Use double temporaries when computing group size
If we use float temporaries when computing the bounds of
a group, then, depending on what variables are kept in registers
and what stored on the stack, the accumulated difference between
natural_width and min_width can be more than FLOAT_EPSILON.

Using double temporaries will eliminate the difference in most
cases, or, very rarely, reduce it to a last-bit error.

http://bugzilla.openedhand.com/show_bug.cgi?id=1632

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-08 11:07:05 +01:00
Owen W. Taylor
009eafb9ee Handle a clone of an actor with an unmapped parent
If we are cloning an source actor with an unmapped parent, then when
we temporarily map the source actor:

 - We need to skip the check that a mapped actor has a mapped
   parent.
 - We need to realize the actor's parents before mapping it,
   or we'll get an assertion failure in clutter_actor_update_map_state()
   because an actor with an unmapped parent is !may_be_realized.

http://bugzilla.openedhand.com/show_bug.cgi?id=1633

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-08 11:06:11 +01:00
Emmanuele Bassi
12b4e0400c [x11] Do not forcibly set the stage size on fullscreen
Setting the stage size using clutter_actor_set_size() is almost always
wrong: the X11 stage implementation should save the size and queue a
relayout -- like it does when receiving a ConfigureNotify. The same
should happen when setting it to be full screen.
2009-06-08 02:04:27 +01:00
Owen W. Taylor
ca305d2a40 [build] Search for Cogl GIR in the right place
Since we build the Cogl GIR inside /clutter/cogl we should be looking
there when building the Clutter GIR. Otherwise g-ir-scanner will look
inside the gir directory -- and if you never built Clutter before it
will error out.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1638

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-08 01:59:04 +01:00
Emmanuele Bassi
9691827b5b [texture] Fix error reporting on ::load-finished
The load-finished signal has a GError* argument which is meant to
signify whether the loading was successful. However many of the
places in ClutterTexture that emit this signal directly pass their
'error' variable which is a GError** and will be NULL or not
completely independently of whether there was an error. If the
argument was dereferenced it would probably crash.

The test-texture-async interactive test case should also verify
that the ::load-finished signal is correctly emitted.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1622
2009-06-06 16:13:41 +01:00
Emmanuele Bassi
ea9bd6761a [units] Always recompute pixels
When asking for the pixels value we should always recompute it.

The "pixel_set" guard can be left in place for future use.
2009-06-06 15:59:45 +01:00
Emmanuele Bassi
c3dc03997c Fixes for some compiler warnings 2009-06-06 14:37:41 +01:00
Owen W. Taylor
5f0afa5218 [actor] get_transformed_position(): initialize Z value
Initialize the Z value in the point we pass to
clutter_actor_apply_transform_to_point().

http://bugzilla.openedhand.com/show_bug.cgi?id=1630

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-06 13:01:32 +01:00
Owen W. Taylor
276952d6f9 Fix stopping a timeline
Correctly apply De Morgan's laws to the short-circuit test in
clutter_timeline_pause(); it was short-circuiting always and
never actually pausing.

http://bugzilla.openedhand.com/show_bug.cgi?id=1629

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-06 13:01:17 +01:00
Johan Bilien
f87e10c024 Fix the leak of the GList of layers in CoglMaterial
http://bugzilla.openedhand.com/show_bug.cgi?id=1624

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-06 12:59:31 +01:00
Bastian Winkler
6f7afdf553 Broken fixed:: arguments
The commit 2c95b378 prevents clutter_animation_setup_property from being
called with fixed:: property names. This patch adds a additional
parameter "is_fixed" to clutter_animation_setup_property instead of
searching for "fixed::" in property_name.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-06 12:58:00 +01:00
Neil Roberts
ea15e4c7f0 [CoglPangoDisplayList] Don't store the base color in the display list
It should be possible render a single PangoLayout with different
colors without recalculating the layout. This was not working because
the color used at the first edit was being stored in the display
list. This broke changing the opacity on a ClutterText.

Now each node in the display list has a 'color override' flag which
marks whether it should use the base color or not. The base color is
now passed in from _cogl_pango_display_list_render_texture. The alpha
value is always taken from the base color.
2009-06-05 18:28:27 +01:00
Emmanuele Bassi
6fe22ac850 [repaint] Run the repaint functions in clutter_redraw()
The clutter_redraw() function is used by libraries embedding
Clutter inside another toolkit, instead of queueing a redraw
on the embedded stage. This means that clutter_redraw() should
perform the same sequence of actions done by the redraw idle
callback.
2009-06-05 17:57:05 +01:00
Robert Bragg
01e1aae7dd [cogl] cogl_material_set_layer does nothing if resetting the same texture
This avoids dirtying the layer, and should avoid some uneeded state changes
2009-06-05 17:18:32 +01:00
Emmanuele Bassi
6b92296e7f [build] Fix compiler warnings
Silence GCC
2009-06-05 16:46:12 +01:00
Emmanuele Bassi
02fa34f65b Fix a compiler warning 2009-06-05 16:39:18 +01:00
Neil Roberts
b061a00f4c [ClutterActor] Fix check for zero opacity when being painted from a clone
Clutter short-circuits painting when an actor's opacity is
zero. However if the actor is being painted from a ClutterClone then
it will be painted using the clone's opacity instead so the test was
broken.
2009-06-05 16:25:39 +01:00
Emmanuele Bassi
7e33fe3175 Merge branch '1.0-integration'
* 1.0-integration: (138 commits)
  [x11] Disable XInput by default
  [xinput] Invert the XI extension version check
  [cogl-primitives] Fix an unused variable warning when building GLES
  [clutter-stage-egl] Pass -1,-1 to clutter_stage_x11_fix_window_size
  Update the GLES backend to have the layer filters in the material
  [gles/cogl-shader] Add a missing semicolon
  [cogl] Move the texture filters to be a property of the material layer
  [text] Fix Pango unit to pixels conversion
  [actor] Force unrealization on destroy only for non-toplevels
  [x11] Rework map/unmap and resizing
  [xinput] Check for the XInput entry points
  [units] Validate units against the ParamSpec
  [actor] Add the ::allocation-changed signal
  [actor] Use flags to control allocations
  [units] Rework Units into logical distance value
  Remove a stray g_value_get_int()
  Remove usage of Units and macros
  [cogl-material] Allow setting a layer with an invalid texture handle
  [timeline] Remove the concept of frames from timelines
  [gles/cogl-shader] Fix parameter spec for cogl_shader_get_info_log
  ...

Conflicts:
	configure.ac
2009-06-05 12:41:42 +01:00
Emmanuele Bassi
cbb748f7c0 [x11] Disable XInput by default
The XInput support in Clutter is still using XI 1.x. This will never
work correctly, and we are all waiting for XInput 2 anyway. The changes
internally should be minimal, so we can leave everything in place, but
it's better to disable XInput support by default -- at least for the
time being.
2009-06-05 12:30:08 +01:00
Neil Roberts
3ee093e356 Merge branch 'timeline-no-fps' into 1.0-integration 2009-06-05 12:20:41 +01:00
Emmanuele Bassi
745ca8a62c [xinput] Invert the XI extension version check
Since having XQueryInputVersion means also having XGetExtensionVersion
we need to check the former first to avoid the deprecation warning.
2009-06-05 12:08:41 +01:00
Neil Roberts
fa3ed19db5 [cogl-primitives] Fix an unused variable warning when building GLES
The 'tex' variable is only used if #ifdef'd GL code so it was throwing
an error under GLES. The variable is now moved into a block inside the
#ifdef.
2009-06-04 22:20:18 +01:00
Neil Roberts
810e936164 [clutter-stage-egl] Pass -1,-1 to clutter_stage_x11_fix_window_size
This reflects the changes made to e4ff24bc for the egl stage.
2009-06-04 22:15:41 +01:00
Neil Roberts
6efbb92c58 Update the GLES backend to have the layer filters in the material
This reflects the changes made in 54d8aadf1d for the GLES backend.
2009-06-04 22:12:33 +01:00
Neil Roberts
eff82a546d [gles/cogl-shader] Add a missing semicolon
cogl_shader_get_info_log was missing a semicolon which broke the build
on GLES 2.
2009-06-04 22:10:33 +01:00
Neil Roberts
54d8aadf1d [cogl] Move the texture filters to be a property of the material layer
The texture filters are now a property of the material layer rather
than the texture object. Whenever a texture is painted with a material
it sets the filters on all of the GL textures in the Cogl texture. The
filter is cached so that it won't be changed unnecessarily.

The automatic mipmap generation has changed so that the mipmaps are
only generated when the texture is painted instead of every time the
data changes. Changing the texture sets a flag to mark that the
mipmaps are dirty. This works better if the FBO extension is available
because we can use glGenerateMipmap. If the extension is not available
it will temporarily enable automatic mipmap generation and reupload
the first pixel of each slice. This requires tracking the data for the
first pixel.

The COGL_TEXTURE_AUTO_MIPMAP flag has been replaced with
COGL_TEXTURE_NO_AUTO_MIPMAP so that it will default to
auto-mipmapping. The mipmap generation is now effectively free if you
are not using a mipmap filter mode so you would only want to disable
it if you had some special reason to generate your own mipmaps.

ClutterTexture no longer has to store its own copy of the filter
mode. Instead it stores it in the material and the property is
directly set and read from that. This fixes problems with the filters
getting out of sync when a cogl handle is set on the texture
directly. It also avoids the mess of having to rerealize the texture
if the filter quality changes to HIGH because Cogl will take of
generating the mipmaps if needed.
2009-06-04 19:03:40 +01:00
Emmanuele Bassi
c27f429819 [text] Fix Pango unit to pixels conversion
When going from Pango units to pixels we need to divide by 1024,
and not multiply by 1024.
2009-06-04 17:28:35 +01:00
Emmanuele Bassi
5ea3b47144 [actor] Force unrealization on destroy only for non-toplevels
We cannot force unrealization on toplevels ourselves, so we need
to check inside clutter_actor_destroy() if we want to avoid a
warning.
2009-06-04 16:50:19 +01:00
Emmanuele Bassi
e4ff24bcff [x11] Rework map/unmap and resizing
The mapping and unmapping of the X11 stage implementation is
a bit bong. It's asynchronous, for starters, when it really
can avoid it by tracking the state internally.

The ordering of the map/unmap sequence is also broken with
respect to the resizing.

By tracking the state internally into StageX11 we can safely
remove the MapNotify and UnmapNotify X event handling.

In theory, we should use _NET_WM_STATE a lot more, and reuse
the X11 state flags for fullscreening as well.
2009-06-04 16:30:32 +01:00
Emmanuele Bassi
0a4a28a950 [xinput] Check for the XInput entry points
Apparently, the XInput extension is using the same pkg-config
file ('xi') for both the 1.x and the 2.x API, so we need to
check for both the 1.x XGetExtensionVersion and the 2.x
XQueryInputVersion.
2009-06-04 16:30:31 +01:00
Emmanuele Bassi
876dc22633 [units] Validate units against the ParamSpec
When declaring a property using ClutterParamSpecUnits we pass a
default type to limit the type of units we accept as valid values
for the property.

This means that we need to add the unit type check as part of the
validation process.
2009-06-04 16:30:31 +01:00
Emmanuele Bassi
5ebb59e6b0 [actor] Add the ::allocation-changed signal
Sometimes it is useful to be able to track changes in the allocation
flags, like the absolute origin, inside children of a container.

Using the notify::allocation signal is not enough, in these cases, so
we need a specific signal that gives us both the allocation box and the
allocation flags.
2009-06-04 16:30:31 +01:00
Emmanuele Bassi
0187bb3965 [actor] Use flags to control allocations
Instead of passing a boolean value, the ::allocate virtual function
should use a bitmask and flags. This gives us room for expansion
without breaking API/ABI, and allows to encode more information to
the allocation process instead of just changes of absolute origin.
2009-06-04 16:30:31 +01:00
Emmanuele Bassi
0d5e17ecd1 [units] Rework Units into logical distance value
Units as they have been implemented since Clutter 0.4 have always been
misdefined as "logical distance unit", while they were just pixels with
fractionary bits.

Units should be reworked to be opaque structures to hold a value and
its unit type, that can be then converted into pixels when Clutter needs
to paint or compute size requisitions and perform allocations.

The previous API should be completely removed to avoid collisions, and
a new type:

        ClutterUnits

should be added; the ability to install GObject properties using
ClutterUnits should be maintained.
2009-06-04 16:30:31 +01:00
Emmanuele Bassi
1580ffb884 Remove a stray g_value_get_int()
Now that all properties are float, using g_value_get_int() to
retrieve the value of the :anchor-x property is going to print
out a warning.
2009-06-04 16:30:30 +01:00
Emmanuele Bassi
046e571bae Remove usage of Units and macros
The ClutterUnit and relative macros should not be used when dealing
with pixels -- which is to say, all the time when inside Clutter.
2009-06-04 16:30:30 +01:00
Neil Roberts
26f07abc65 [cogl-material] Allow setting a layer with an invalid texture handle
It was previously possible to create a material layer with no texture
by setting some property on it such as the matrix. However it was not
possible to get back to that state without removing the layer and
recreating it. It is useful to be able to remove the texture to free
resources without forgetting the state of the layer so we can put a
different texture in later.
2009-06-04 14:04:32 +01:00
Neil Roberts
9c7afe0c5b [timeline] Remove the concept of frames from timelines
Timelines no longer work in terms of a frame rate and a number of
frames but instead just have a duration in milliseconds. This better
matches the working of the master clock where if any timelines are
running it will redraw as fast as possible rather than limiting to the
lowest rated timeline.

Most applications will just create animations and expect them to
finish in a certain amount of time without caring about how many
frames are drawn. If a frame is going to be drawn it might as well
update all of the animations to some fraction of the total animation
rather than rounding to the nearest whole frame.

The 'frame_num' parameter of the new-frame signal is now 'msecs' which
is a number of milliseconds progressed along the
timeline. Applications should use clutter_timeline_get_progress
instead of the frame number.

Markers can now only be attached at a time value. The position is
stored in milliseconds rather than at a frame number.

test-timeline-smoothness and test-timeline-dup-frames have been
removed because they no longer make sense.
2009-06-04 13:21:57 +01:00
Neil Roberts
c20886c5e3 [gles/cogl-shader] Fix parameter spec for cogl_shader_get_info_log
The stub version of cogl_shader_get_info_log needed to be updated to
match the changes to the function signature in 61deeafa.
2009-06-04 12:04:47 +01:00
Neil Roberts
fa0b33ec30 [clutter-stage-win32] Call clutter_actor_map instead of setting the flags
The clutter_actor_map and unmap functions need to be called to
properly update the mapped state. This matches the changes to the X11
stage in 125bded8.
2009-06-04 11:59:17 +01:00
Neil Roberts
af68945486 [clutter-event-win32] Fix the argument types to clutter_actor_get_size
clutter_actor_get_size now takes float pointers so it was issuing a
warning.
2009-06-04 11:50:52 +01:00
Neil Roberts
f89ff7f383 Load glBlendEquation and glBlendColor using cogl_get_proc_address
These are defined since OpenGL 1.2 and since Windows doesn't export
any functions defined after 1.1 we need to load them dynamically.
2009-06-04 11:50:06 +01:00
Neil Roberts
daa95b561e Rename 'near' and 'far' variables to 'z_near' and 'z_far'
The Windows headers define near and far to be empty so it breaks the
build.
2009-06-04 11:48:51 +01:00
Emmanuele Bassi
6825b9db1c [actor] Unrealize on destroy
If the application code calls for destruction of an actor we need
to make sure that the actor is unrealized before running the dispose
sequence; otherwise, we might trigger an assertion failure on composite
actors.
2009-06-03 14:05:06 +01:00
Emmanuele Bassi
181ba67114 Revert commit 762873e7
The commit 762873e79e is completely
and utterly wrong and I should have never pushed it.

Serves me well for trying to work on three different branches and
on three different things.
2009-06-03 14:05:05 +01:00
Emmanuele Bassi
762873e79e [master clock] Avoid excessive redraws
Currently, the clock source spins a redraw every time there is at
least a timeline running. If the timelines were not advanced in
the previous frame, though, because their interval is larger than
the vblanking interval then this will lead to excessive redraws of
the scenegraph even if nothing has changed.

To avoid this a simple guard should be set by the MasterClock::advance
method in case no timeline was effectively advanced, and checked
before dispatching the stage redraws.
2009-06-03 12:02:56 +01:00
Neil Roberts
f4a431a947 [cogl-texture] Don't take ownership of the data in cogl_texture_new_from_bitmap
When creating a Cogl texture from a Cogl bitmap it would steal the
data by setting the bitmap_owner flag and clearing the data pointer
from the bitmap. The data would be freed by the time the
new_from_bitmap is finished. There is no reason to do this because the
data will be freed when the Cogl bitmap is unref'd and it is confusing
not to be able to reuse the bitmap for creating multiple textures.
2009-06-02 18:01:41 +01:00
Robert Staudinger
bd13a4ddc4 [color] Add support for the "#rgba" color format
clutter_color_from_string() only supported the "#rrggbbaa" format with
alpha channel, this patch adds support for "#rgba".

Colors in "#rrggbb" format were parsed manually, this is now left to
the pango color parsing fallback, since that's handling it just fine.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-01 18:42:28 +01:00
Emmanuele Bassi
61deeafa71 [cogl-shader] Make get_info_log() slightly nicer
The cogl_shader_get_info_log() function is very inconvenient for
language bindings and for regular use, as it requires a static
buffer to be filled -- basically just providing a wrapper around
glGetInfoLogARB().

Since COGL aims to be a more convenient API than raw GL we should
just make cogl_shader_get_info_log() return an allocated string
with the GLSL compiler log.
2009-06-01 17:40:23 +01:00
Neil Roberts
5c26cc6ba7 Use GL_QUADS for flushing a quad batch
Instead of using GL_TRIANGLES and uploading the indices every time, it
now uses GL_QUADS instead on OpenGL. Under GLES it still uses indices
but it uses the new cogl_vertex_buffer_indices_get_for_quads function
to avoid uploading the vertices every time.

This requires the _cogl_vertex_buffer_indices_pointer_from_handle
function to be exposed privately to the rest of Cogl.

The static_indices array has been removed from the Cogl context.
2009-06-01 17:29:01 +01:00
Emmanuele Bassi
6cd1cb21cc [introspection] Remove Cogl symbols from Clutter GIR
The GIR file for Clutter still contains symbols from COGL, even
though we provide a Cogl GIR as well. The Clutter GIR should
depend on the Cogl GIR instead.
2009-06-01 15:51:59 +01:00
Marc-André Lureau
86230eb9fa build: don't double install clutter-version.h
Automake 1.11 installs several files in one command, and it fails if
the same file is installed two times.

See NEWS for details:
http://lists.gnu.org/archive/html/automake/2009-05/msg00093.html

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-06-01 15:49:11 +01:00
Emmanuele Bassi
c759aeb6a7 Uniformly use floats in Actor properties
All the underlying implementation and the public entry points have
been switched to floats; the only missing bits are the Actor properties
that deal with positioning and sizing.

This usually means a major pain when dealing with GValues and varargs
functions. While GValue will warn you when dealing with the wrong
conversions, varags will simply die an horrible (and hard to debug)
death via segfault. Nothing much to do here, except warn people in the
release notes and hope for the best.
2009-06-01 14:57:18 +01:00
Emmanuele Bassi
bafa448666 [texture] Increase verbosity of error messages
The GError messages in set_from_rgb_data() and set_from_yuv_data()
are a little bit too thin on details.
2009-06-01 14:57:18 +01:00
Emmanuele Bassi
8b71fa1acb [docs] Remove misleading text
The documentation for ClutterTexture's set_from_rgb_data() and
set_from_yuv_data() says:

  Note: This function is likely to change in future versions.

This is not true, since they'll remain for the whole 1.x API cycle.
2009-06-01 14:57:18 +01:00
Neil Roberts
3b70e0b6b7 [pango-display-list] Use the CoglAttributeType macros instead of GL_FLOAT
Cogl now has an enum for the VBO attribute type so we should use that
instead of the GL enums.
2009-06-01 14:50:52 +01:00
Neil Roberts
97921a7d13 [pango-display-list] Use indexed vertices on GLES
Now that CoglVertexBuffers support indices we can use them with GLES
to avoid duplicating vertices. Regular GL still uses GL_QUADS because
it is shown to still have a performance benefit over indices with the
Intel drivers.
2009-06-01 14:50:52 +01:00
Neil Roberts
67544f38d4 [cogl-vertex-buffer] Add cogl_vertex_buffer_indices_get_for_quads
This function can be used as an efficient way of drawing groups of
quads without using GL_QUADS. It generates a VBO containing the
indices needed to render using pairs of GL_TRIANGLES. The VBO is
globally cached so that it only needs to be uploaded whenever more
indices are requested than ever before.
2009-06-01 14:50:52 +01:00
Emmanuele Bassi
4afe1e9a8b [actor] Add allocate_available_size()
The allocate_available_size() method is a convenience method in
the same spirit as allocate_preferred_size(). While the latter
will allocate the preferred size of an actor regardless of the
available size provided by the actor's parent -- and thus it's
suitable for simple fixed layout managers like ClutterGroup -- the
former will take into account the available size provided by the
parent and never allocate more than that; it is, thus, suitable
for simple fluid layout managers.
2009-05-29 17:53:19 +01:00
Emmanuele Bassi
293eeed507 [build] Remove cogl-enum-types.h on distclean
The cogl-enum-types.h file is created by glib-mkenums under
/clutter/cogl/common, and then copied in /clutter/cogl in order
to make the inclusion of that file work inside cogl.h.

Since we're copying it in a different location, the Makefile
for that location has to clean up the copy.
2009-05-29 17:50:58 +01:00
Emmanuele Bassi
936f638a42 [build] Fix dist issues
* cogl-deprecated.h is not being installed

* cogl-enum-types.c.in is not part of the dist
2009-05-29 17:10:27 +01:00
Jonas Bonn
faec5c468b Freeze notifiers around property setters
Notifications should be fired off from both the internal timeline and
the wrapping animation here, so notifiers should be frozen around these
property setters.

Signed-off-by: Jonas Bonn <jonas@southpole.se>
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-05-29 16:22:46 +01:00
Jonas Bonn
1187972e45 [animation] Final cleanups to new Animation model
Just a couple of final cleanups after the reimplementation of the
Animation model.

i)  _set_mode does not need to set the timeline on the alpha
ii) freeze notifications around the setting of a new alpha

Signed-off-by: Jonas Bonn <jonas@southpole.se>
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-05-29 16:22:27 +01:00
Emmanuele Bassi
c5e659d592 [master clock] Use StageManager::peek_stages()
Use the new StageManager::peek_stages() method to avoid a copy
of the stages list.
2009-05-29 15:13:55 +01:00
Emmanuele Bassi
5d4974ed36 [stage manager] Add peek_stages()
We need an method for StageManager that returns a const pointer
to the internal list, to avoid the copy.
2009-05-29 15:13:55 +01:00
Emmanuele Bassi
63c7cc0175 [master clock] Handle Timeline::started signal correctly
The "started" signal is sent first after the timeline has been set to the
'running' state. For this reason, checking if the clock has any running
timelines running will always return true in the "started" signal handler:
the timeline that sent the signal is running.

What needs to be checked in the signal handler is if there are any
timelines running other than the one that emitted the ::started signal,
which we know is running anyway.

This prevents frames from being lost at the beginning of an animation when
a timeline is started after a quiescent period.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1617

Signed-off-by: Jonas Bonn <jonas@southpole.se>
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-05-29 15:13:55 +01:00
Emmanuele Bassi
cbbc1a9ca3 [build] Copy cogl-enum-types.h under the guard
We avoid rebuilding cogl-enum-types.h and cogl-enum-types.c by
using a "guard" -- a stamp file that will block Makefile. Since
we need cogl-enum-types.h into /clutter/cogl as well for the
cogl.h include to work, if we copy the cogl-enum-types.h
unconditionally it will cause a rebuild of the whole COGL; which
will cause a full rebuild.

To solve this, we can copy the header file when generating it
under the stamp file.
2009-05-29 15:13:55 +01:00
Emmanuele Bassi
e565c1f1db [build] Encode the target into the backend library
The libclutter-cogl internal object should be the only dependency
for Clutter, since we are already copying it inside clutter/cogl
for the introspection scanner. For this reason, the backend-specific,
real internal object should be built with the backend encoded into
the file name, like libclutter-common. This makes the build output
a little bit more clear: instead of having two:

  LINK libclutter-cogl-common.la
  ...
  LINK libclutter-cogl.la
  LINK libclutter-cogl.la

We'll have:

  LINK libclutter-cogl-common.la
  ...
  LINK libclutter-cogl-gl.la
  LINK libclutter-cogl.la

Same applies for the GLES backend.
2009-05-29 12:50:48 +01:00
Emmanuele Bassi
b4861cbd21 Use g_once when registering enumeration types
Just like we do with GObject types and G_DEFINE_TYPE, we should
use the g_once_init_enter/g_once_init_leave mechanism to make the
GType registration of enumeration types thread safe.
2009-05-29 12:40:23 +01:00
Emmanuele Bassi
3248bb1b75 [cogl] Generate enumeration GTypes
COGL is starting to have more enumerations than I can handle
by hand. Let's use glib-mkenums and be done with it.
2009-05-29 12:31:47 +01:00
Emmanuele Bassi
7b75f93db1 [docs] Fixes for the API reference
* Add unused symbols

* Document and sync argument names with their gtk-doc counterpart

* Add missing descriptions
2009-05-28 17:18:13 +01:00
Emmanuele Bassi
9557328e4e Merge branch 'master' into 1.0-integration
* master:
  [test-text-perf] Use queue_redraw instead of painting the stage directly
  [actor] In paint when opacity == 0, clear the queued_redraw flag
2009-05-28 15:53:56 +01:00
Emmanuele Bassi
7252c14197 [cogl] Make cogl_setup_viewport() a private function
The setup_viewport() function should only be used by Clutter and
not by application code.

It can be emulated by changing the Stage size and perspective and
requeueing a redraw after calling clutter_stage_ensure_viewport().
2009-05-28 14:14:50 +01:00
Emmanuele Bassi
32018584c0 [cogl deprecated] Add backface culling deprecation
The backface culling enabling function was split and renamed, just
like the depth testing one, so we need to add the macro to the
cogl-deprecated.h header.
2009-05-28 14:14:50 +01:00
Robert Bragg
be826ed4e7 [cogl vertex buffers] Give indices a CoglHandle so they are shareable
Previously indices were tightly bound to a particular Cogl vertex buffer
but we would like to be able to share indices so now we have
cogl_vertex_buffer_indices_new () which returns a CoglHandle.

In particular we could like to have a shared set of indices for drawing
lists of quads that can be shared between the pango renderer and the
Cogl journal.
2009-05-28 13:27:54 +01:00
Robert Bragg
f0849fc3e2 [cogl journal] If we are only flushing one quad use a TRIANGLE_FAN
At the moment Cogl doesn't do much batching of quads so most of the time we
are flushing a single quad at a time.  This patch simplifies how we submit
those quads to OpenGL by using glDrawArrays with GL_TRIANGLE_FAN mode
instead of sending indexed vertices using GL_TRIANGLES mode.

Note: I hope to follow up soon with changes that improve our batching and
also move the indices into a VBO so they don't need to be re-validated every
time we call glDrawElements.
2009-05-28 02:43:36 +01:00
Robert Bragg
57cb20dc06 [deprecated defines] Adds some missing cogl_texture_* deprecated defines
To assist people porting code from 0.8, the cogl_texture_* functions that
have been replaced now have defines that give some hint as to how they
should be replaced.
2009-05-28 02:43:36 +01:00
Robert Bragg
605243d952 [cogl] renamed cogl_enable_* to cogl_set_*_enabled + added getters
cogl_enable_depth_test and cogl_enable_backface_culling have been renamed
and now have corresponding getters, the new functions are:
  cogl_set_depth_test_enabled
  cogl_get_depth_test_enabled
  cogl_set_backface_culling_enabled
  cogl_get_backface_culling_enabled
2009-05-28 02:43:36 +01:00
Robert Bragg
96188bab62 [cogl matrix] Support ortho and perspective projections.
This adds cogl_matrix api for multiplying matrices either by a perspective
or ortho projective transform.  The internal matrix stack and current-matrix
APIs also have corresponding support added.

New public API:
cogl_matrix_perspective
cogl_matrix_ortho
cogl_ortho
cogl_set_modelview_matrix
cogl_set_projection_matrix
2009-05-28 02:43:35 +01:00
Robert Bragg
12c8ff8606 [cogl] Remove cogl_{create,destroy}_context from the public API
cogl_create_context is dealt with internally when _cogl_get_default context
is called, and cogl_destroy_context is currently never called.

It might be nicer later to get an object back when creating a context so
Cogl can support multiple contexts, so these functions are being removed
from the API until we get a chance to address context management properly.

For now cogl_destroy_context is still exported as _cogl_destroy_context so
Clutter could at least install a library deinit handler to call it.
2009-05-28 02:43:35 +01:00
Robert Bragg
59bd824404 [vbo indices] tweak add_indices api to return an id and add delete_indices api
Originally cogl_vertex_buffer_add_indices let the user pass in their own unique
ID for the indices; now the Id is generated internally and returned to the
caller.
2009-05-28 02:43:35 +01:00
Robert Bragg
d51faed660 [cogl-vertex-buffer] Seal GL types from the public API
We now have CoglAttributeType and CoglVerticesMode typedefs to replace the
use of GLenum in the public API.
2009-05-28 02:43:35 +01:00
Robert Bragg
6bb6686666 [cogl-vertex-buffers] Support putting index arrays into VBOS
It's now possible to add arrays of indices to a Cogl vertex buffer and
they will be put into an OpenGL vertex buffer object. Since it's quite
common for index arrays to be static it saves the OpenGL driver from
having to validate them repeatedly.

This changes the cogl_vertex_buffer_draw_elements API: It's no longer
possible to provide a pointer to an index array at draw time. So
cogl_vertex_buffer_draw_elements now takes an indices identifier that
should correspond to an idendifier returned when calling
cogl_vertex_buffer_add_indices ()
2009-05-28 02:43:34 +01:00
Robert Bragg
68214fe4b8 [cogl] Remove cogl_flush_gl_state from the API
This is being removed before we release Clutter 1.0 since the implementation
wasn't complete, and so we assume no one is using this yet.  Util we have
someone with a good usecase, we can't pretend to support breaking out into
raw OpenGL.
2009-05-28 02:43:34 +01:00
Robert Bragg
f322da3794 [material] Reduce the material API in preperation for releasing Clutter 1.0
There were a number of functions intended to support creating of new
primitives using materials, but at this point they aren't used outside of
Cogl so until someone has a usecase and we can get feedback on this
API, it's being removed before we release Clutter 1.0.
2009-05-28 02:43:34 +01:00
Robert Bragg
f28d5e481b [cogl-material] Removes all the API made redundant by the blend strings API
This removes the following API:
  cogl_material_set_blend_factors
  cogl_material_set_layer_combine_function
  cogl_material_set_layer_combine_arg_src
  cogl_material_set_layer_combine_arg_op

These were rather awkward to use, so since it's expected very few people are
using them at this point and it should be straight forward to switch over
to blend strings, the API is being removed before we release Clutter 1.0.
2009-05-28 02:43:34 +01:00
Robert Bragg
33994caa71 [cogl-material] Support string based blending and layer combine descriptions
Setting up layer combine functions and blend modes is very awkward to do
programatically.  This adds a parser for string based descriptions which are
more consise and readable.

E.g. a material layer combine function could now be given as:
  "RGBA = ADD (TEXTURE[A], PREVIOUS[RGB])"
or
  "RGB = REPLACE (PREVIOUS)"
  "A = MODULATE (PREVIOUS, TEXTURE)"

The simple syntax and grammar are only designed to expose standard fixed
function hardware, more advanced combining must be done with shaders.

This includes standalone documentation of blend strings covering the aspects
that are common to blending and texture combining, and adds documentation
with examples specific to the new cogl_material_set_blend() and
cogl_material_layer_set_combine() functions.

Note: The hope is to remove the now redundant bits of the material API
before 1.0
2009-05-28 02:43:28 +01:00
Robert Bragg
ef1a771fde [build] Fixes some compiler warnings when building for GLES 2
There were a number of variables shadowing other symbols, and an unused
display variable.
2009-05-28 01:15:41 +01:00
Emmanuele Bassi
ccd3b4c886 [animation] Simplify the Animation code
After long deliberation, the Animation class handling of the
:mode, :duration and :loop properties, as well as the conditions
for creating the Alpha and Timeline instances, came out as far too
complicated for their own good.

This is a rework of the API/parameters matrix and behaviour:

  - :mode accessors will create an Alpha, if needed
  - :duration and :loop accessors will create an Alpha and a Timeline
    if needed
  - :alpha will set or unset the Alpha
  - :timeline will set or unset the Timeline

Plus, more documentation on the Animation class itself.

Many thanks to Jonas Bonn <jonas@southpole.se> for the feedback
and the ideas.
2009-05-27 18:28:37 +01:00
Emmanuele Bassi
6fff1bcdc6 [animatable] Allow validation in ::animate_property
The Animatable interface implementation will always have the computed
value applied, whilst the non-Animatable objects go through the
interval validation first to avoid incurring in assertions and
warnings.

The Animatable::animate_property() should also be able to validate the
property it's supposed to interpolate, and eventually discard it. This
requires adding a return value to the virtual function (and its wrapper
function).

The Animation code will then apply the computed value only if the
animate_property() returns TRUE -- unifying the code path with the
non-Animatable objects.
2009-05-27 13:01:31 +01:00
Emmanuele Bassi
7edaf8ece8 [animation] Proxy properties whenever possible
The Animation class should proxy the :mode, :duration and :loop
properties whenever possible, to avoid them going out of sync when
changed using the Alpha and Timeline instances directly.

Currently, if Timeline:duration is changed, querying Animation:duration
will yield the old value, but the animation itself (being driven by
the Timeline) will use the Timeline's :duration new value. This holds
for the :loop and :mode properties as well.

Instead, the getters for the Animation's :duration, :loop and
:mode properties should ask the relevant object -- if any. The
loop, duration and mode values inside AnimationPrivate should only
be used if no Timeline or no Alpha instances are available, or
when creating new instances.
2009-05-27 12:12:11 +01:00
Emmanuele Bassi
1f44c3584c [animation] Defer the timeline handling to the Alpha
The Animation should not directly manipulate a Timeline instance,
but it should defer to the Alpha all handling of the timeline.

This means that:

  - set_duration() and set_loop() will either create a Timeline or
    will set the :duration and :loop properties on the Timeline; if
    the Timeline must be created, and no Alpha instance is available,
    then a new Alpha instance will be created as well and the newly
    create Timeline will be assigned to the Alpha

  - if set_mode() on an Animation instance without an Alpha, the
    Alpha will be created; a Timeline will also be created

  - set_alpha() will replace the Alpha; if the new Alpha does not
    have a Timeline associated then a Timeline will be created using
    the current :duration and :loop properties of Animation; otherwise,
    if the replaced Alpha had a timeline, the timeline will be
    transferred to the new one
2009-05-27 11:52:40 +01:00
Emmanuele Bassi
b05d4be19d Use GLib variant of strcasecmp()
The GLib version of strcasecmp() ignores any non-ASCII character,
unlike the original which is locale-dependent.
2009-05-25 12:42:17 +01:00
Emmanuele Bassi
ec374c7ab9 [build] Clean up cogl-pango Makefile 2009-05-25 12:41:16 +01:00
Emmanuele Bassi
71498a6376 [cogl] Remove max_waste argument from Texture ctors
The CoglTexture constructors expose the "max-waste" argument for
controlling the maximum amount of wasted areas for slicing or,
if set to -1, disables slicing.

Slicing is really relevant only for large images that are never
repeated, so it's a useful feature only in controlled use cases.
Specifying the amount of wasted area is, on the other hand, just
a way to mess up this feature; 99% the times, you either pull this
number out of thin air, hoping it's right, or you try to do the
right thing and you choose the wrong number anyway.

Instead, we can use the CoglTextureFlags to control whether the
texture should not be sliced (useful for Clutter-GST and for the
texture-from-pixmap actors) and provide a reasonable value for
enabling the slicing ourself. At some point, we might even
provide a way to change the default at compile time or at run time,
for particular platforms.

Since max_waste is gone, the :tile-waste property of ClutterTexture
becomes read-only, and it proxies the cogl_texture_get_max_waste()
function.

Inside Clutter, the only cases where the max_waste argument was
not set to -1 are in the Pango glyph cache (which is a POT texture
anyway) and inside the test cases where we want to force slicing;
for the latter we can create larger textures that will be bigger than
the threshold we set.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Signed-off-by: Robert Bragg <robert@linux.intel.com>
Signed-off-by: Neil Roberts <neil@linux.intel.com>
2009-05-23 19:35:19 +01:00
Emmanuele Bassi
87465355d3 Add repaint functions
Sometimes it is necessary for third party code to have a
function called during the redraw process, so that you can
update the scenegraph before it is painted.
2009-05-23 19:33:04 +01:00
Neil Roberts
654c26a130 [actor] In paint when opacity == 0, clear the queued_redraw flag
If we are short-circuiting the paint when the opacity is zero we still
need to clear the queued_redraw flag otherwise it won't be possible to
queue another redraw of the actor until something else has caused a
paint first.
2009-05-22 14:50:37 +01:00
Emmanuele Bassi
c262ab0b63 Merge branch 'master' into 1.0-integration
* master:
  [cogl-vertex-buffer] Ensure the clip state before rendering
  [test-text-perf] Small fix-ups
  Add a test for text performance
  [build] Ensure that cogl-debug is disabled by default
  [build] The cogl GE macro wasn't passing an int according to the format string
  Use the right internal format for GL_ARB_texture_rectangle
  [actor_paint] Ensure painting is a NOP for actors with opacity = 0
  Make backface culling work with vertex buffers
2009-05-22 12:00:33 +01:00
Neil Roberts
b3fe1b8a8a [cogl-vertex-buffer] Ensure the clip state before rendering
Before any rendering is done by Cogl it needs to ensure the clip stack
is set up correctly by calling cogl_clip_ensure. This was not being
done for the Cogl vertex buffer so it would still use the clip from
the previous render.
2009-05-22 11:48:34 +01:00
Damien Lespiau
309f680d32 [texture] size-change closure is now VOID:FLOAT,FLOAT
Now that everything is float, the marsharlling function of the
size-change signal should reflect that fact.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-05-22 09:09:31 +01:00
Neil Roberts
d513c1c540 Merge branch 'pango-vbo' into 1.0-integration
This makes it cache the geometry of PangoLayouts into a VBO as
described in bug #1572.
2009-05-21 16:52:23 +01:00
Neil Roberts
7e18109f9b [cogl-pango-display-list] Use GL_TRIANGLES under GLES
GLES doesn't support GL_QUADS. This patch makes it use GL_TRIANGLES
instead in that case. Unfortunately this means submitting two extra
vertices per quad. It could be better to use indexed elements once
CoglVertexBuffers gains support for that.
2009-05-21 15:51:25 +01:00
Robert Bragg
14c3ef1f8d [build] The cogl GE macro wasn't passing an int according to the format string
This patch simply updates the arguments passed to g_warning inline with the
given format string.
2009-05-21 15:10:38 +01:00
Owen W. Taylor
5481681e5c Use the right internal format for GL_ARB_texture_rectangle
When ClutterGLXTexturePixmap uses GL_ARB_texture_rectangle,
it needs to pass the right internal format (GL_RGB or GL_RGBA)
when it initializes the texture with glTexImage2D() or later
handling won't recognize the alpha channel.

http://bugzilla.openedhand.com/show_bug.cgi?id=1586

Signed-off-by: Robert Bragg <robert@linux.intel.com>
2009-05-21 15:10:37 +01:00
Robert Bragg
2c6719502a [actor_paint] Ensure painting is a NOP for actors with opacity = 0
Since it is convenient to use geometry with an opacity of 0 for input only
purposes it's a worthwhile optimization to avoid submitting anything
for such actors while painting.
2009-05-21 15:10:37 +01:00
Neil Roberts
f13c3ee309 Make backface culling work with vertex buffers
Backface culling is enabled as part of cogl_enable so the different
rendering functions in Cogl need to explicitly opt-in to have backface
culling enabled. Cogl vertex buffers should allow backface culling so
they should check whether it is enabled and then set the appropriate
cogl_enable flag.
2009-05-21 14:57:07 +01:00
Neil Roberts
3fc64dfaa7 [pango-render] Keep a reference to the first line to detect layout changes
In order to cope with the situation where an application renders with
a PangoLayout, makes some changes and then renders again with the same
layout, CoglPangoRenderer needs to detect that the changes have
occured so that it can recreate the display list. This is acheived by
keeping a reference to the first line of the layout. When the layout
is changed Pango will clear the layout pointer in the first line and
create a new line. So if the layout pointer in the line becomes NULL
then we know the layout has changed. This trick was suggested by
Behdad Esfahbod in this email:

http://mail.gnome.org/archives/gtk-i18n-list/2009-May/msg00019.html
2009-05-21 12:17:12 +01:00
Neil Roberts
085be4cebc [cogl-pango-render] Fix the positioning when calling cogl_pango_render_layout
When a position is given to cogl_pango_render_layout_subpixel it
translates the GL matrix by the coordinates. However it was not
dividing by PANGO_SCALE so the coordinates were completely wrong.
2009-05-21 12:09:16 +01:00
Emmanuele Bassi
1985fa75b1 [texture] Use a box instead of int coordinates
Most of the operations involving the texture's allocated area require
floats -- either for computations or for setting the geometry into
COGL. So it doesn't make any sense to use get_allocation_coords() and
cast everything to floats.
2009-05-20 17:38:58 +01:00
Emmanuele Bassi
3428e4dd1d [actor] Do not try to dereference NULL data
If the shader_data bound to an Actor is NULL we should not try to access
its members.
2009-05-20 17:26:39 +01:00
Emmanuele Bassi
f8f54989be Merge commit 'origin/master' into 1.0-integration
Conflicts:
	clutter/clutter-texture.c
	clutter/cogl/gl/cogl-fbo.c
2009-05-20 16:49:22 +01:00
Emmanuele Bassi
4f5a5f38f7 Add more padding in Model and ModelIter classes
ClutterModel and ClutterModelIter have 4 padding slots, but if they
have to survive the 1.x API cycle they will need at least twice that
amount.
2009-05-20 16:06:09 +01:00
Emmanuele Bassi
c74586d019 [cogl] Do no include gprintf.h
We are not using any of the g_printf* family of functions, so we
can import glib.h instead.
2009-05-20 15:21:32 +01:00
Emmanuele Bassi
1f1d19f634 [cogl] Move debugging to a configure-time switch
Currently, COGL depends on defining debug symbols by manually
modifying the source code. When it's done, it will forcefully
print stuff to the console.

Since COGL has also a pretty, runtime selectable debugging API
we might as well switch everything to it.

In order for this to happen, configure needs a new:

        --enable-cogl-debug

command line switch; this will enable COGL debugging, the
CoglHandle debugging and will also turn on the error checking
for each GL operation.

The default setting for the COGL debug defines is off, since
it slows down the GL operations; enabling it for a particular
debug build is trivial, though.
2009-05-19 16:00:18 +01:00
Emmanuele Bassi
df1a9b7a74 [cogl] Rework the debug messages
COGL has a debug message system like Clutter's own. In parallel,
it also uses a coupld of #defines. Spread around there are also
calls to printf() instead to the more correct g_log* wrappers.

This commit tries to unify and clean up the macros and the
debug message handling inside COGL to be more consistent.
2009-05-19 14:44:29 +01:00
Emmanuele Bassi
529e48fbbe Remove duplicate cogl-internal.h header
The cogl-internal.h header has been moved inside cogl/common in
commit 8a1b4f8326 but has been left behind inside cogl/gl and
cogl/gles.
2009-05-19 14:42:37 +01:00
Emmanuele Bassi
407ac5075f [texture] Add missing accessors
ClutterTexture has many properties that can only be accessed using
the GObject API. This is fairly inefficient and makes binding the
class overly complicated.

The Texture class should have accessor methods for all its properties,
properly documented.
2009-05-19 13:24:56 +01:00
Emmanuele Bassi
3115a61688 [cogl] Rework the GL-error-to-string conversion
The code for the conversion of the GL error enumeration code
into a string is not following the code style and conventions
we follow in Clutter and COGL.

The GE() macro is also using fprintf(stderr) directly instead
of using g_warning() -- which is redirectable to an alternative
logging system using the g_log* API.
2009-05-19 13:24:56 +01:00
Emmanuele Bassi
cd3acca2b7 [build] Link Cogl against -lm
We use math routines inside Cogl, so it's correct to have it in
the LIBADD line. In normal usage something else was pulling in
-lm, but the introspection is relying on linking against the
convenience library.

Based on a patch by: Colin Walters <walters@verbum.org>

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-05-14 23:23:00 +01:00
Emmanuele Bassi
08ac50faae [build] List cogl-internal.h
During the Makefile clean up, cogl-internal.h got lost and this
broke the dist. Let's put it back in.
2009-05-14 19:51:03 +01:00
Emmanuele Bassi
2f5012e38c [animation] Do not leak timelines
The timeline created when calling set_timeline(NULL) is referenced
even though we implicitly own it. When the Animation is destroyed,
the timeline is then leaked.

Thanks to: Richard Heatley <richard.heatley@starleaf.com>

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1548
2009-05-14 16:20:12 +01:00
Emmanuele Bassi
21e3901d62 [text] Expose position_to_coords()
The clutter_text_position_to_coords() is useful for ClutterText
subclasses.

See bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1521

Based on a patch by: Raymond Liu <raymond.liu@intel.com>
2009-05-14 16:19:15 +01:00
Emmanuele Bassi
ca23838752 [text] Add ClutterText::delete_selection()
Add a method for deleting the current selection inside a Text actor.

This is useful for subclasses.

See bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1521

Based on a patch by: Raymond Liu <raymond.liu@intel.com>
2009-05-14 16:16:06 +01:00
Emmanuele Bassi
79cb0a3515 [animation] Remove InitiallyUnowned from Animation
ClutterAnimation currently inherits the initial floating reference
semantics from GInitiallyUnowned. An Animation is, though, meant to
be used as a top-level object, like a Timeline or a Behaviour, and
not "owned" by another object. For this reason, the initial floating
reference does not make any sense.
2009-05-14 16:12:36 +01:00
Emmanuele Bassi
092b41d53b [docs] Document the destructor for Timeline
The rest of the API reference lists the destructor for the class
inside the constructor's return value -- except Timeline.
2009-05-14 16:11:38 +01:00
Dan Winship
1c6580afd6 [cairo-texture] Document redrawing behavior
Document that repeated calls to clutter_cairo_texture_create()
continue drawing on the same cairo_surface_t. Add
clutter_cairo_texture_clear() for when you don't want that behavior.

http://bugzilla.openedhand.com/show_bug.cgi?id=1599

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-05-14 15:53:59 +01:00
Thomas Wood
81a536238d [text] fix problems with scrolling interaction
The cursor x position is already translated, so we do not need to take the
actors allocation into account when calculating scrolling.

Additionally, we need to update the text_x value before running
clutter_text_ensure_cursor_position.
2009-05-14 15:08:31 +01:00
Thomas Wood
a3a5fe5594 [text] scroll to the cursor position if it is outside the allocation
Adjust the text offset to keep the cursor within the allocation. This means
the text will scroll per character
2009-05-14 13:31:51 +01:00
Thomas Wood
cf6c2d9721 [text] account for scrolling in text selections
Account for any scrolling offset in single line mode when calculating the
area that should be selected.
2009-05-14 13:31:21 +01:00
Thomas Wood
e79fd1055d [text] account for scrolling in clutter_text_position_to_coords
Add any scrolling offset to the x value when in single line mode.

Now that the offset is taken into account in the position_to_coords
function, we do not need to adjust the cursor x manually in
clutter_text_paint.
2009-05-14 13:31:21 +01:00
Thomas Wood
16185c78fc [text] take scrolling into account when calculating cursor position
Account for the scrolling in single line more when calculating the cursor
position from coordinates.
2009-05-14 13:31:20 +01:00
Thomas Wood
e162d0b060 [text] position the cursor correctly in single line mode
The position of the text should be increased by the value of TEXT_PADDING
and the cursor offset by the same value as the text offset.
2009-05-14 13:31:20 +01:00
Thomas Wood
cd86e70f41 [text] take text padding into account when in single line mode
In single line mode, extra padding is added to the text which must be
taken into account when reporting the natural size of the actor.
2009-05-14 13:31:20 +01:00
Emmanuele Bassi
0d43d81ee0 [text] Maintain the cursor at the end when deleting
If the cursor is already at the end of the Text contents then we
need to maintain its position when deleting the previous character
using the relative key binding.
2009-05-14 12:00:51 +01:00
Emmanuele Bassi
8174f66cc6 [text] Reset the cursor when setting empty text
When setting the contents of Text to an empty string we should
reset the cursor position and selection bound to -1.
2009-05-14 11:50:42 +01:00
Emmanuele Bassi
608c3e3ab4 [build] Fix with --disable-introspection
The required "fake" libclutter-cogl.la upon with the main clutter
shared object depends is only built with introspection enabled
instead of being built unconditionally.
2009-05-14 10:03:31 +01:00
Owen W. Taylor
d8aa6827ee Don't build Cogl.gir against installed Clutter library
Passing:

 --library=clutter-@CLUTTER_FLAVOUR@-@CLUTTER_API_VERSION@

to g-ir-scanner, when building Cogl was causing g-ir-scanner to
link the introspection program against the installed clutter library,
if it existed or fail otherwise. Instead copy the handling from
the json/ directory where we link against the convenience library
to scan, and do the generation of the typelib later in the
main clutter/directory.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1594

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-05-13 23:31:43 +01:00
Emmanuele Bassi
447e04bdce [text] Return the correct minimum height
If text is set, ClutterText should never return less than the layout
height for minimum and preferred heights.

This holds unless ellipsize and wrap are enabled, in which case the
minimum height should be the height of the first line -- which is
the height needed to at the very least show the ellipsization.

Based on a patch by: Thomas Wood <thomas@openedhand.com>

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1598

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-05-13 23:06:43 +01:00
Emmanuele Bassi
aa1246e891 [backend] Abstract the GL context creation
This is the another step into abstracting the backend operations
that are currently spread all across the board back into the
backend implementations where they belong.

The GL context creation, for instance, is demanded to the stage
realization which makes it a critical path for every operation
that is GL-context bound. This usually does not make any difference
since we realize the default stage, but at some point we might
start looking into avoiding the default stage realization in order
to make the Clutter startup faster.

It also makes the code maintainable because every part is self
contained and can be reworked with the minimum amount of pain.
2009-05-13 22:21:48 +01:00
Emmanuele Bassi
1d7a79f343 Update the redraw priority
The master clock is using the redraw priority to create the source
that will be used to spin the paint sequence if something is being
animated using a timeline.

Unfortunately, the priority is too high and this causes starvation
when embedding into other toolkits -- like gtk+.

Thanks to Havoc Pennington for catching this.
2009-05-13 22:20:19 +01:00
Emmanuele Bassi
e59a19bd03 [x11] Abstract XVisualInfo creation
The XVisualInfo for GL is created when a stage is being realized.
When embedding Clutter inside another toolkit we might not want to
realize a stage to extract the XVisualInfo, then set the stage
window using a foreign X Window -- which will cause a re-realization.

Instead, we should abstract as much as possible into the X11 backend.

Unfortunately, the XVisualInfo for GL is requested using GLX API; for
this reason we have to create a ClutterBackendX11 method that we
override inside the ClutterBackendGLX implementation.

This also allows us to move a little bit of complexity from out of
the stage realization, which is currently a very delicate and hard
to debug section.
2009-05-13 21:49:45 +01:00
Robert Bragg
2b1759385e [text] Ensure clutter_text_get_selection copes with start/end positions of -1
I was seeing clutter_text_get_selection trying to malloc up to 4Gb due to
unexpected negative arithmetic for the start/end offsets which resulted
in a crash.

This just tests for positions of -1 before deciding if the start/end
positions need to be swapped.  The conversion from position to byte offset
already works with -1.
2009-05-13 14:34:00 +01:00