profile/ivi/clutter.git
15 years agoAccumulate small deltas
Neil Roberts [Thu, 30 Apr 2009 17:47:59 +0000 (18:47 +0100)]
Accumulate small deltas

The clutter frame source tries to average out the frame deltas so that
if one frame takes 1 interval plus a little bit of extra time then the
next frame will be 1 interval minus that little bit of extra
time. Therefore the deltas can sometimes be less than the frame
interval. ClutterTimeline should accumulate these small differences
otherwise it will end up missing out frames so the total duration of
the timeline will be a lot longer.

For example this was causing test-actors to appear to run very slow.

15 years ago[tests] Manually advance the timelines
Emmanuele Bassi [Fri, 1 May 2009 14:08:42 +0000 (15:08 +0100)]
[tests] Manually advance the timelines

The units in the Timeline test suite just rely on the timeline
being a timeout automatically advanced by the main loop. This
is not the case anymore, since the merge of the master-clock.

To make the test units work again we need to "emulate" the master
clock without effectively having a stage to redraw; we do this
by creating a frame source and manually advancing the timelines
we create for test purposes, using the advance_msecs() "protected"
method.

15 years ago[timeline] Expose the msec advancement
Emmanuele Bassi [Fri, 1 May 2009 14:05:51 +0000 (15:05 +0100)]
[timeline] Expose the msec advancement

The method of ClutterTimeline that advances the timeline by a
delta (in millisecond) is going to be useful for testing the
timeline's behaviour -- and unbreak the timeline test suite that
was broken by the MasterClock merge.

15 years ago[tests] Verify that Clone can paint hidden sources
Emmanuele Bassi [Fri, 1 May 2009 11:42:37 +0000 (12:42 +0100)]
[tests] Verify that Clone can paint hidden sources

With the change in commit 87e4e2 painting of hidden source actors
in ClutterClone was fixed. This commit changes the test-actor-clone
to visually verify this.

15 years ago[gitignore] Ignore the new invariants units
Emmanuele Bassi [Fri, 1 May 2009 11:42:30 +0000 (12:42 +0100)]
[gitignore] Ignore the new invariants units

15 years ago[clone] Allow painting hidden source actors
Emmanuele Bassi [Fri, 1 May 2009 11:33:42 +0000 (12:33 +0100)]
[clone] Allow painting hidden source actors

With the introduction of the map/unmap flags and the split of the
visible state from the mapped state we require that every part of
a scene graph branch is mapped in order to be painted. This breaks
the ability of a ClutterClone to paint an hidden source actor.

In order to fix this we need to introduce an override flag, similar
in spirit to the current modelview and paint opacity overrides that
Clone is already using.

The override flag, when set, will force a temporary map on a
Clone source (and its children).

15 years ago[actor] Use foreach_with_internals()
Emmanuele Bassi [Fri, 1 May 2009 11:31:06 +0000 (12:31 +0100)]
[actor] Use foreach_with_internals()

ClutterContainer provides a foreach_with_internals() vfunc for
iterating over all of a container's children, be them added using
the Container API or be them internal to the container itself.

We should be using the foreach_with_internals() function instead
of the plain foreach().

15 years ago[clone] Redraw when the source changes
Owen W. Taylor [Fri, 27 Feb 2009 19:43:47 +0000 (14:43 -0500)]
[clone] Redraw when the source changes

Bug 1484 - Redraw ClutterClone when the source changes, even for
           !visible sources

Connect to ::queue-redraw on the clone source and queue a redraw.
This allows redrawing the Clone when the source changes, even in
case of a non visible source actor.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
15 years agoUse a single master "clock" to drive timelines
Emmanuele Bassi [Sat, 21 Mar 2009 20:39:32 +0000 (20:39 +0000)]
Use a single master "clock" to drive timelines

Currently, all timelines install a timeout inside the TimeoutPool
they share. Every time the main loop spins, all the timeouts are
updated. This, in turn, will usually lead to redraws being queued
on the stages.

This behaviour leads to the potential starvation of timelines and
to excessive redraws.

One lesson learned from the games developers is that the scenegraph
should be prepared in its entirety before the GL paint sequence is
initiated. This means making sure that every ::new-frame signal
handler is called before clutter_redraw() is invoked.

In order to do so a TimeoutPool is not enough: we need a master
clock. The clock will be responsible for advancing all the active
timelines created inside a scene, but only when the stage is
being redrawn.

The sequence is:

  + queue_redraw() is invoked on an actor and bubbles up
    to the stage

  + if no redraw() has already been scheduled, install an
    idle handler with a known priority

  + inside the idle handler:

    - advance the master clock, which will in turn advance
      every playing timeline by the amount of milliseconds
      elapsed since the last redraw; this will make every
      playing timeline emit the ::new-frame signal

    - queue a relayout

    - call the redraw() method of the backend

This way we trade multiple timeouts with a single frame source
that only runs if a timeline is playing and queues redraws on
the various stages.

15 years agoRelinquish the focus when unmapped while owning it
Johan Bilien [Wed, 8 Apr 2009 09:33:39 +0000 (10:33 +0100)]
Relinquish the focus when unmapped while owning it

Bug 1547 - when an actor is unmapped while owning the focus, it should
           release it

When an actor is unmapped while owning the focus, the should release it.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
15 years agoEnforce invariants on mapped, realized, visibility states
Havoc Pennington [Thu, 2 Apr 2009 13:16:43 +0000 (09:16 -0400)]
Enforce invariants on mapped, realized, visibility states

Bug 1138 - No trackable "mapped" state

* Add a VISIBLE flag tracking application programmer's
  expected showing-state for the actor, allowing us to
  always ensure we keep what the app wants while tracking
  internal implementation state separately.

* Make MAPPED reflect whether the actor will be painted;
  add notification on a ClutterActor::mapped property.
  Keep MAPPED state updated as the actor is shown,
  ancestors are shown, actor is reparented, etc.

* Require a stage and realized parents to realize; this means
  at realization time the correct window system and GL resources
  are known. But unparented actors can no longer be realized.

* Allow children to be unrealized even if parent is realized.
  Otherwise in effect either all actors or no actors are realized,
  i.e. it becomes a stage-global flag.

* Allow clutter_actor_realize() to "fail" if not inside a toplevel

* Rework clutter_actor_unrealize() so internally we have
  a flavor that does not mess with visibility flag

* Add _clutter_actor_rerealize() to encapsulate a somewhat
  tricky operation we were doing in a couple of places

* Do not realize/unrealize children in ClutterGroup,
  ClutterActor already does it

* Do not realize impl by hand in clutter_stage_show(),
  since showing impl already does that

* Do not unrealize in various dispose() methods, since
  ClutterActor dispose implementation already does it
  and chaining up is mandatory

* ClutterTexture uses COGL while unrealizable (before it's
  added to a stage). Previously this breakage was affecting
  ClutterActor because we had to allow realize outside
  a stage. Move the breakage to ClutterTexture, by making
  ClutterTexture just use COGL while not realized.

* Unrealize before we set parent to NULL in clutter_actor_unparent().
  This means unrealize() implementations can get to the stage.
  Because actors need the stage in order to detach from stage.

* Update clutter-actor-invariants.txt to reflect latest changes

* Remove explicit hide/unrealize from ClutterActor::dispose since
  unparent already forces those
  Instead just assert that unparent() occurred and did the right thing.

* Check whether parent implements unrealize before chaining up
  Needed because ClutterGroup no longer has to implement unrealize.

* Perform unrealize in the default handler for the signal.
  This allows non-containers that have children to work properly,
  and allows containers to override how it's done.

* Add map/unmap virtual methods and set MAPPED flag on self and
  children in there. This allows subclasses to hook map/unmap.
  These are not signals, because notify::mapped is better for
  anything it's legitimate for a non-subclass to do.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
15 years agoUnnecessary glColorMask on alpha drops performance
Johan Bilien [Fri, 24 Apr 2009 14:07:49 +0000 (15:07 +0100)]
Unnecessary glColorMask on alpha drops performance

Bug 1228 - Unnecessary glColorMask on alpha drops performance

With DRI2, alpha is allowed in the window's framebuffer

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
15 years agoAllow passing the pick mode to get_actor_at_pos()
Emmanuele Bassi [Fri, 24 Apr 2009 14:05:02 +0000 (15:05 +0100)]
Allow passing the pick mode to get_actor_at_pos()

Bug 1513 - Allow passing in ClutterPickMode to
           clutter_stage_get_actor_at_pos()

At the moment, clutter_stage_get_actor_at_pos() uses CLUTTER_PICK_ALL
internally to find an actor. It would be useful to allow passing in
ClutterPickMode to clutter_stage_get_actor_at_pos(), so that the caller
can specify CLUTTER_PICK_REACTIVE as a criteria.

15 years ago[x11] Use XWithdrawWindow()
Emmanuele Bassi [Fri, 24 Apr 2009 13:59:18 +0000 (14:59 +0100)]
[x11] Use XWithdrawWindow()

Bug 1516 - Does not withdraw toplevels correctly

clutter_stage_x11_hide() needs to use XWithdrawWindow(), not
XUnmapWindow().

As it stands now, if the window is already unmapped (say the WM has
minimized it), then the WM will not know that Clutter has closed the
window and will keep the window managed, showing it in the task list
and so forth.

15 years agoAdd ClutterContainer::foreach_with_internals()
Havoc Pennington [Mon, 23 Mar 2009 14:15:00 +0000 (10:15 -0400)]
Add ClutterContainer::foreach_with_internals()

Bug 1517 - clutter_container_foreach_with_internals()

This allows us to iterate over all children (for things like maintaining
map/realize invariants) or only children that apps added and care about.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
15 years ago[docs] Increase verbosity for commit messages
Emmanuele Bassi [Thu, 23 Apr 2009 10:38:58 +0000 (11:38 +0100)]
[docs] Increase verbosity for commit messages

Apparently, not everyone read the HACKING file, especially the
section about commit messages. This lead to some confusion with
regards to the acceptable (i.e. mandatory) format for commit
messages in Clutter. Let's clarify it a little bit before I start
enforcing it and reverting commits.

15 years ago[alpha] Sanitize easing equations
Emmanuele Bassi [Thu, 23 Apr 2009 10:35:10 +0000 (11:35 +0100)]
[alpha] Sanitize easing equations

Bug 1561 - Bad code in clutter-alpha.c

The implementation of the easing modes equations followed closely
the JavaScript and ActionScript counterparts. Obviously, JS and AS
are not C-compatible, so later versions of gcc (4.4.0 for instance)
would complain about uninitialized variables and such. The code is
also obfuscated and hard to debug/understand.

For these reasons, the implementation should be unobfuscated and
sanitized.

15 years ago[x11-texture-pixmap] Fixes a reported lockup due to an undesireable X server grab
Robert Bragg [Fri, 17 Apr 2009 18:05:21 +0000 (19:05 +0100)]
[x11-texture-pixmap] Fixes a reported lockup due to an undesireable X server grab

A lockup was reported by fargoilas on #clutter and removing the server grab in
clutter_x11_texture_pixmap_sync_window fixed the problem.

We were doing an x server grab to guarantee that if the XGetWindowAttributes
request reported that our redirected window was viewable then we would also
be able to get a valid pixmap name.  (the composite protocol says it's an
error to request a name for a window if it's not viewable) Without the grab
there would be a race condition.

Instead we now handle error conditions gracefully.

15 years ago[text] Avoid a Pango warning with empty markup
Emmanuele Bassi [Thu, 2 Apr 2009 09:28:37 +0000 (10:28 +0100)]
[text] Avoid a Pango warning with empty markup

When the markup string is empty Pango complains about invalid
characters.

15 years ago[test-pick] Improve to include a covering actor
Neil Roberts [Fri, 27 Mar 2009 21:55:40 +0000 (21:55 +0000)]
[test-pick] Improve to include a covering actor

Three tests are now performed on the picked squares. First there is no
covering actor which is the same as the original test. Then there is a
hidden covering actor which should not affect the results. Finally
there is a covering actor with a clip set on it so that only actors
at the borders of the stage should be pickable.

15 years ago[tests] Disable a subtest of the Text cache unit
Emmanuele Bassi [Tue, 21 Apr 2009 11:09:59 +0000 (12:09 +0100)]
[tests] Disable a subtest of the Text cache unit

The wrap mode sub-test inside the ClutterText layout cache test
unit has been broken by the recent changes inside the Text actor.

The sub-test itself might require tweaking.

15 years ago[text] Emit ::cursor-event only on changes
Emmanuele Bassi [Tue, 21 Apr 2009 11:06:14 +0000 (12:06 +0100)]
[text] Emit ::cursor-event only on changes

The documentation for the ::cursor-event says that the signal
is emitted only when the cursor position changes. Right now it
is being emitted every time we ensure the cursor position during
the Text paint sequence.

The clutter_text_ensure_cursor_position() function should check
whether the stored cursor position has changed since the last
paint, and emit the ::cursor-event signal only when there has
been a change.

15 years ago[tests] Visually verify ellipsization
Emmanuele Bassi [Tue, 21 Apr 2009 11:03:41 +0000 (12:03 +0100)]
[tests] Visually verify ellipsization

Verify that the non-editable, single line entries are still
correctly ellipsized when a maximum width is set.

15 years ago[text] Return the correct minimum height
Emmanuele Bassi [Tue, 21 Apr 2009 11:01:52 +0000 (12:01 +0100)]
[text] Return the correct minimum height

The correct minimum height in case of ellipsis is still 1px.

15 years ago[text] Limit the Layout width
Emmanuele Bassi [Tue, 21 Apr 2009 10:59:38 +0000 (11:59 +0100)]
[text] Limit the Layout width

We only want to eschew the pango_layout_set_width() on editable,
single-line Text actors because they can "scroll" the PangoLayout.

This fixes the ellipsization on entries.

15 years ago[gl/cogl.c] #include <gmodule.h> for OS X builds
Robert Bragg [Mon, 20 Apr 2009 11:36:43 +0000 (12:36 +0100)]
[gl/cogl.c] #include <gmodule.h> for OS X builds

In unifying the {gl,gles}/cogl.c code recently, moving most of the code into
common/cogl.c the gmodule.h include was also mistakenly moved.

Thanks to Felix Rabe for reporting this issue.

Note: I haven't tested this fix myself, as I'm not set up to be able to
build for OS X

15 years ago[cogl vertex buffers] Adds fallbacks for drivers without VBO support
Robert Bragg [Wed, 15 Apr 2009 18:25:55 +0000 (19:25 +0100)]
[cogl vertex buffers] Adds fallbacks for drivers without VBO support

Buffer objects aren't currently available for glx indirect contexts, so we
now have a fallback that simply allocates fake client side vbos to store the
attributes.

15 years ago[cogl debug] --cogl-debug=rectangles now outlines all cogl rectangles
Robert Bragg [Fri, 17 Apr 2009 14:10:55 +0000 (15:10 +0100)]
[cogl debug] --cogl-debug=rectangles now outlines all cogl rectangles

This makes the #if 0'd debug code that was in _cogl_journal_flush_quad_batch
- which we have repeatedly found usefull for debugging various geometry
issues in Clutter apps - a runtime debug option.

The outline colors rotate in order from red to green to blue which can also
help confirm the order that your geometry really drawn.

The outlines are not affected by the current material state, so if you e.g.
have a blending bug where geometry mysteriously disappears this can confirm
if the underlying rectangles are actually being emitted but blending is
causing them to be invisible.

15 years agoUse $(MAINTAINER_CFLAGS) in clutter/{x11,glx}/Makefile.am
Robert Bragg [Fri, 17 Apr 2009 13:53:24 +0000 (14:53 +0100)]
Use $(MAINTAINER_CFLAGS) in clutter/{x11,glx}/Makefile.am

These makefile weren't resulting in the addition of the maintainer flags while
building clutter.

15 years agoPrevent a possible zero division
Bastian Winkler [Thu, 16 Apr 2009 11:06:58 +0000 (13:06 +0200)]
Prevent a possible zero division

A zero division might occur in clutter_path_get_position if the length
of a curved node is zero.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
15 years ago[ClutterText] Return 1 for min width when editable
Chris Lord [Thu, 16 Apr 2009 15:34:15 +0000 (16:34 +0100)]
[ClutterText] Return 1 for min width when editable

Editable ClutterText will scroll when allocated less width than is
necessary to lay out the entire layout on a single line, so return 1 for
the minimum width in this case.

Approved by Emmanuele Bassi, fixes bug #1555.

15 years agoMerge branch 'text-actor-layout-height'
Emmanuele Bassi [Wed, 15 Apr 2009 17:08:14 +0000 (18:08 +0100)]
Merge branch 'text-actor-layout-height'

* text-actor-layout-height:
  [clutter-text] Fix ellipsizing
  Support pango_layout_set_height() in ClutterText

Conflicts:
clutter/clutter-text.c

15 years ago[stage] Warn if perspective's z_far - z_near is 0
Emmanuele Bassi [Wed, 15 Apr 2009 16:27:04 +0000 (17:27 +0100)]
[stage] Warn if perspective's z_far - z_near is 0

Since we have to do (z_far - z_near) and use it in a division we
should check that the user is not passing a value that would
cause a division by zero.

15 years agoAdd debug annotations for the layout process
Emmanuele Bassi [Wed, 15 Apr 2009 16:25:50 +0000 (17:25 +0100)]
Add debug annotations for the layout process

If we need to check that the layout sequence is correct in
terms of order of execution and with respect to caching, then
having a CLUTTER_DEBUG_LAYOUT debug flag would make things
easier.

15 years ago[text] Do not ellipsize non-editable layouts
Emmanuele Bassi [Wed, 15 Apr 2009 16:23:45 +0000 (17:23 +0100)]
[text] Do not ellipsize non-editable layouts

If a ClutterText is set as non-editable then its PangoLayout
will occupy as much width as its contents and ignore the
ellipsization setting.

15 years ago[clutter-text] Fix ellipsizing
Neil Roberts [Wed, 15 Apr 2009 13:46:45 +0000 (14:46 +0100)]
[clutter-text] Fix ellipsizing

Ellipsizing was effectively broken for two reasons. There was a typo
in the code to set the width so it always ended up being some massive
value. If no height should be set on the layout it was being set to
G_MAXINT. Setting a height greater than 0 enables wrapping which so
ellipsizing is not performed. It should be left at the default of -1
instead.

15 years ago[json] Avoid leaks on error code paths
Emmanuele Bassi [Wed, 15 Apr 2009 11:18:55 +0000 (12:18 +0100)]
[json] Avoid leaks on error code paths

Bug 1476 - JSON Parser memory leak

Static analysis of the code showed that the in-tree copy of
the JsonParser object leaks objects and arrays on parse errors.

Thanks to Gordon Williams <gordon.williams@collabora.co.uk>

15 years ago[group] avoid double evaluation of arguments in clutter_group_add
Øyvind Kolås [Wed, 8 Apr 2009 17:18:31 +0000 (18:18 +0100)]
[group] avoid double evaluation of arguments in clutter_group_add

clutter_group_add would evaluate the actor argument twice, which is
bad if this is a function call creating a new actor and not a variable.

15 years agoFix fullscreening when the stage is unrealized and on dual-head
Neil Roberts [Tue, 7 Apr 2009 14:24:48 +0000 (15:24 +0100)]
Fix fullscreening when the stage is unrealized and on dual-head

If the stage is unrealized (such as will be the case if the stage was
created with clutter_stage_new) then it would set the size of the
stage display but it was not setting the fullscreen_on_map flag so it
never got the _NET_WM_STATE_FULLSCREEN property. Now it always sets
the flag regardless of whether the window is created yet.

There was also problems with dual-headed displays because in that case
DisplayWidth/Height will return the size of the combined display but
Metacity (and presumably other WMs) will sensibly try fit the window
to only one of the monitors. However we were setting the size hints so
that the minimum size is that of the combined display. Metacity tries
to honour this by setting the minimum size but then it no longer
positions the window at the top left of the screen.

The patch makes it avoid setting the minimum size when the stage is
fullscreen by checking the fullscreen_on_map flag. This also means we
can remove the static was_resizable flag which would presumably have
caused problems for multi-stage.

15 years ago[clutter-text] Add a separate property for the selection color
Neil Roberts [Mon, 6 Apr 2009 14:22:31 +0000 (15:22 +0100)]
[clutter-text] Add a separate property for the selection color

Adds a new property so that the selection color can be different from
the cursor color. If no selection color is specified it will use the
cursor color as before. If no cursor color is specified either it will
use the text color.

15 years ago[cogl-handle] Fix the broken debug macros
Neil Roberts [Mon, 6 Apr 2009 11:43:16 +0000 (12:43 +0100)]
[cogl-handle] Fix the broken debug macros

The debug macros for tracking reference counting of CoglHandles had
some typos introduced in c3d9f0 which meant it failed to compile when
COGL_DEBUG is 1.

15 years ago[cogl] cogl_is_*(): Don't dereference an invalid handle; just return FALSE
Robert Bragg [Sat, 4 Apr 2009 18:02:01 +0000 (19:02 +0100)]
[cogl] cogl_is_*(): Don't dereference an invalid handle; just return FALSE

An invalid handle is implicitly not of any type.

15 years ago[cogl-pango-render] Fix returning to default color after a color attribute
Neil Roberts [Mon, 6 Apr 2009 10:14:43 +0000 (11:14 +0100)]
[cogl-pango-render] Fix returning to default color after a color attribute

Since the Cogl material branch merge when changing the color of a part
using pango attributes (such as using <span color="red" /> markup)
then it wouldn't return to the default color for the rest of the
layout. pango_renderer_get_color returns NULL if there is no color
override in which case it needs to revert to the color specified as
the argument to cogl_pango_render_layout. The 'color' member of
CoglPangoRenderer has been reinstated to store that default color and
now cogl_pango_render_set_color_for_part is the only place that sets
the material color.

15 years ago[animation] Do not connect to ::completed multiple times
Emmanuele Bassi [Sun, 5 Apr 2009 19:32:15 +0000 (20:32 +0100)]
[animation] Do not connect to ::completed multiple times

The clutter_actor_animate*() family of functions should only connect
to the Animation::completed signal once, during the construction of
the Animation object attached to the Actor. Otherwise, the completed
signal handler will be run multiple times, and will try to unref()
the Animation for each call -- leading to a segmentation fault.

15 years ago[animation] Add the ::started signal
Emmanuele Bassi [Fri, 3 Apr 2009 13:19:20 +0000 (14:19 +0100)]
[animation] Add the ::started signal

The Animation class is missing a ::started signal matching the
::completed one. A ::started signal is useful for debugging,
initial state set up, and checks.

15 years ago[group] Fix compilation
Emmanuele Bassi [Fri, 3 Apr 2009 12:36:30 +0000 (13:36 +0100)]
[group] Fix compilation

A case of rebase FAIL. The sorting of the children was still
done using the now removed group function call instead of the
Container one.

15 years ago[animation] Do not unref on ::complete by default
Emmanuele Bassi [Fri, 3 Apr 2009 11:39:35 +0000 (12:39 +0100)]
[animation] Do not unref on ::complete by default

Bug 1535 - Complete animation always unrefs ClutterAnimation (even
           after g_object_ref_sink)

Animations created through clutter_animation_new() should not
automagically unref themselves by default on ::complete. We
only want that behaviour for Animations created by the
clutter_actor_animate* family of functions, since those provide
the automagic memory management.

15 years ago[group] Remove long deprecated API
Emmanuele Bassi [Wed, 1 Apr 2009 10:22:42 +0000 (11:22 +0100)]
[group] Remove long deprecated API

ClutterGroup still ships with API deprecated since 0.4. We did
promise to keep it around for a minor release cycle -- not for 3.

Since we plan on shipping 1.0 without the extra baggage of the
deprecated entry points, here's the chance to remove the accumulated
cruft.

All the removed methods and signals have a ClutterContainer
counterpart.

15 years ago[shader] Remove deprecated set_uniform_1f()
Emmanuele Bassi [Wed, 1 Apr 2009 10:08:28 +0000 (11:08 +0100)]
[shader] Remove deprecated set_uniform_1f()

Since we're planning to release 1.0 without any of the deprecated
API baggage, we can simply remove the set_uniform_1f() method from
ClutterShader public API and add it to the deprecated header.

15 years ago[cogl-handle] Optimize how we define cogl handles
Robert Bragg [Wed, 1 Apr 2009 16:16:44 +0000 (17:16 +0100)]
[cogl-handle] Optimize how we define cogl handles

The cogl_is_* functions were showing up quite high on profiles due to
iterating through arrays of cogl handles.

This does away with all the handle arrays and implements a simple struct
inheritance scheme. All cogl objects now add a CoglHandleObject _parent;
member to their main structures. The base object includes 2 members a.t.m; a
ref_count, and a klass pointer. The klass in turn gives you a type and
virtual function for freeing objects of that type.

Each handle type has a _cogl_##handle_type##_get_type () function
automatically defined which returns a GQuark of the handle type, so now
implementing the cogl_is_* funcs is just a case of comparing with
obj->klass->type.

Another outcome of the re-work is that cogl_handle_{ref,unref} are also much
more efficient, and no longer need extending for each handle type added to
cogl. The cogl_##handle_type##_{ref,unref} functions are now deprecated and
are no longer used internally to Clutter or Cogl. Potentially we can remove
them completely before 1.0.

15 years ago[cogl] handle_automatic_blend_enable(): consider layers with invalid textures
Robert Bragg [Thu, 2 Apr 2009 10:50:44 +0000 (11:50 +0100)]
[cogl] handle_automatic_blend_enable(): consider layers with invalid textures

A layer object may be instantiated when setting a combine mode, but before a
texture is associated. (e.g. this is done by the pango renderer) if this is the
case we shouldn't call cogl_texture_get_format() with an invalid cogl handle.

This patch skips over layers without a texture handle when determining if any
textures have an alpha channel.

15 years agoUnifies 90% of the code in {gl,gles}/cogl.c in common/cogl.c
Robert Bragg [Mon, 30 Mar 2009 16:07:31 +0000 (17:07 +0100)]
Unifies 90% of the code in {gl,gles}/cogl.c in common/cogl.c

This code keeps on diverging and we get bugs and fixes in one version but
not the other. This should make things a bit more maintainable.

15 years agoRemoves cogl_blend_func prototype from cogl-internal.h
Robert Bragg [Mon, 30 Mar 2009 15:41:02 +0000 (16:41 +0100)]
Removes cogl_blend_func prototype from cogl-internal.h

cogl_blend_func was removed a while ago so this was just a left over from then

15 years ago[docs] Fix some inconsistency in Animation
Bastian Winkler [Mon, 30 Mar 2009 15:38:42 +0000 (17:38 +0200)]
[docs] Fix some inconsistency in Animation

For some examples of clutter_actor_animate the parameters of @mode and
@duration are swapped.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
15 years ago[texture] Queue a relayout when changing :keep-aspect-ratio
Havoc Pennington [Mon, 30 Mar 2009 16:32:54 +0000 (17:32 +0100)]
[texture] Queue a relayout when changing :keep-aspect-ratio

Bug 1528 - queue relayout when setting ClutterTexture:keep-aspect-ratio

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
15 years ago[text] Use the base class binding pool
Raymond Liu [Mon, 30 Mar 2009 15:57:11 +0000 (16:57 +0100)]
[text] Use the base class binding pool

Bug 1518 - [Patch] Widget derivied from ClutterText will crash on
           key_press_event

In clutter_text_key_press() we are using G_OBJECT_TYPE_NAME to find
out the actor's type name. However, if some widget is derived from
ClutterText, when the key press handler is called, G_OBJECT_TYPE_NAME
will return the name of the derived widget.

The default implementation should get the binding pool for the base
class.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
15 years ago[text] Different selection modes with multiple clicks
Emmanuele Bassi [Mon, 30 Mar 2009 15:46:57 +0000 (16:46 +0100)]
[text] Different selection modes with multiple clicks

ClutterText should offer multiple selection modes depending on the
number of pointer clicks.

Following the GTK+ conventions:

  - double click selects the current word
  - triple click selects the current line

15 years ago[animation] add varargs support for signal::completed
Øyvind Kolås [Mon, 30 Mar 2009 11:10:41 +0000 (12:10 +0100)]
[animation] add varargs support for signal::completed

Added support for registering a handler for the completed signal
directly amongst the varargs making it easier to attach code
to be executed when animations complete.

15 years ago[text] Check text length in ::button-press-event
Emmanuele Bassi [Mon, 30 Mar 2009 06:54:42 +0000 (07:54 +0100)]
[text] Check text length in ::button-press-event

Bug 1529 - Selection bound out of sync with an empty Text actor

When the user clicks on a Text actor the cursor position and the
selection bound are set using bytes_to_offset(); if the Text is
empty, this means placing them both to 0. Setting the selection
bound to 0 means that when the user inserts a character by typing
it into the Text, the selection will be [0,1]; this will select
the first character, which will then be overwritten when typing
a new character.

The Text actor should, instead, check if there are no contents
and set the cursor position and the selection bound to -1.

The clutter_text_set_selection_bound() method should also validate
the value passed, in case it's bigger than the text lenght, or
smaller than -1.

15 years ago[docs] Fix typo in the AnimationMode name
Emmanuele Bassi [Fri, 27 Mar 2009 14:28:08 +0000 (14:28 +0000)]
[docs] Fix typo in the AnimationMode name

15 years ago[ClutterTimeline] Fix clutter_timeline_set_delay
Chris Lord [Thu, 26 Mar 2009 20:28:04 +0000 (20:28 +0000)]
[ClutterTimeline] Fix clutter_timeline_set_delay

When setting a delay, timeout_add was being used with msecs. timeout_add
takes fps since the fix to bug #1495. Delay now uses g_timeout_add
instead.

15 years ago[gitignore] Ignore two newly introduced tests
Damien Lespiau [Wed, 25 Mar 2009 20:58:22 +0000 (20:58 +0000)]
[gitignore] Ignore two newly introduced tests

15 years ago[doc] Fix two small typos in cogl-vertex-buffer
Neil Roberts [Wed, 25 Mar 2009 14:53:58 +0000 (14:53 +0000)]
[doc] Fix two small typos in cogl-vertex-buffer

The symbol name for cogl_vertex_buffer_draw_elements was wrong so it
ended up with no documentation. The name for the vertex attribute was
incorrect in cogl_vertex_buffer_add.

15 years ago[build] Fixes a cogl-vertex-buffer.c warning when building for GLES
Robert Bragg [Mon, 23 Mar 2009 12:46:20 +0000 (12:46 +0000)]
[build] Fixes a cogl-vertex-buffer.c warning when building for GLES

GLES 1 doesn't support GLSL so it never needs to use the generic_index
variable for generic attributes which was flagging a warning.

15 years ago[cogl] Move rect and poly drawing code from cogl-texture.c to cogl-primitives.c
Robert Bragg [Mon, 23 Mar 2009 12:29:15 +0000 (12:29 +0000)]
[cogl] Move rect and poly drawing code from cogl-texture.c to cogl-primitives.c

None of this code directly related to implementing CoglTextures, and the
code was needlessly duplicated between the GL and GLES backends. This moves
the cogl_rectangle* and cogl_polygon* code into common/cogl-primitives.c
makes which makes lot of sense since the two copies keep needlessly
diverging introducing or fixing bugs in one but not the other. For instance
I came accross one such bug regarding the enabling of texture units when
unifying the code.

15 years ago[cogl_rectangles] A minor doc fix, and missing newline between functions
Robert Bragg [Mon, 23 Mar 2009 11:39:40 +0000 (11:39 +0000)]
[cogl_rectangles] A minor doc fix, and missing newline between functions

The gtk-doc had a copy and paste error, saying the float array should be 8
elements per rectangle instead of 4. There was also no newline in the gles
code before the new function.

15 years agoAllow using array of vertices even without textures
Johan Bilien [Fri, 20 Mar 2009 19:22:23 +0000 (19:22 +0000)]
Allow using array of vertices even without textures

It's often nice to be able to draw a batch of vertices, even if these
have no texture coordinates. This add a cogl_rectangles, similar to
cogl_rectangles_with_texture_coords, only without.

15 years agoRemoves a hack in gles/cogl.c that was already fixed in gl/cogl.c
Robert Bragg [Thu, 19 Mar 2009 16:46:07 +0000 (16:46 +0000)]
Removes a hack in gles/cogl.c that was already fixed in gl/cogl.c

It removes the need to cast a CoglMatrix to a float * for transforming
a vertex manually instead of using cogl_matrix_transform_point.

15 years ago[doc] Update the should_pick_paint() documentation
Emmanuele Bassi [Thu, 19 Mar 2009 11:40:13 +0000 (11:40 +0000)]
[doc] Update the should_pick_paint() documentation

The should_pick_paint() method of ClutterActor is not clearly
documented.

15 years ago[glx-texture-pixmap] Don't enable the texture target when binding the texture
Neil Roberts [Thu, 19 Mar 2009 17:54:17 +0000 (17:54 +0000)]
[glx-texture-pixmap] Don't enable the texture target when binding the texture

There's no need to enable the texture target unless it is going to be
used for rendering. Enabling it directly with glEnable calls confuses
Cogl's state caching.

This is a replacement for the patch in bug 1483 which was reverted.

15 years agoRevert "Use COGL to establish GL state for ClutterGLXTexturePixmap"
Neil Roberts [Thu, 19 Mar 2009 17:48:15 +0000 (17:48 +0000)]
Revert "Use COGL to establish GL state for ClutterGLXTexturePixmap"

This reverts commit f9d996a4603bef1f52e32e99f9f69a32b7c823ba.

The change from calling glBindTexture to using the material API with
cogl_material_flush_gl_state does not always work because it doesn't
necessarily leave the active texture unit as GL_TEXTURE0. For example,
if the previously rendered texture was multi-layered then the last
thing cogl_material_flush_gl_state will do is select GL_TEXTURE1 just
to disable it.

15 years ago[actor] use an epsilon whens sanity checking sizes
Øyvind Kolås [Thu, 19 Mar 2009 14:42:50 +0000 (14:42 +0000)]
[actor] use an epsilon whens sanity checking sizes

Clutter was complaining about netural width smaller than minimum widths
(differences around 0.0005) by using an epsilon value of 1e-4 for these
floating point comparisons, these warnings have now been silenced.

15 years ago[docs] Remove unused arguments
Emmanuele Bassi [Wed, 18 Mar 2009 17:07:50 +0000 (17:07 +0000)]
[docs] Remove unused arguments

The documentation for some X11TexturePixmap method does not reflect
the actual API.

15 years ago[docs] Pick up backend-specific API
Emmanuele Bassi [Wed, 18 Mar 2009 17:06:56 +0000 (17:06 +0000)]
[docs] Pick up backend-specific API

The various backend API outside from clutter-x11.h and clutter-win32.h
is documented but not picked up by gtk-doc.

15 years agoRemove usage of the grave accent as quotation mark
Emmanuele Bassi [Tue, 17 Mar 2009 14:12:01 +0000 (14:12 +0000)]
Remove usage of the grave accent as quotation mark

See:

  http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html

This should make Thomas happy.

15 years ago[cogl] Apply the fix from 2c1c836417 (Flush matrix before clip planes) to GLES
Robert Bragg [Tue, 17 Mar 2009 00:12:27 +0000 (00:12 +0000)]
[cogl] Apply the fix from 2c1c836417 (Flush matrix before clip planes) to GLES

glClipPlane() is affected by modelview matrix so we need to flush before
calling it.

15 years ago[test-cogl-vertex-buffer] Use clutter_color_from_hls instead of hsl_to_rgb
Robert Bragg [Tue, 17 Mar 2009 00:26:38 +0000 (00:26 +0000)]
[test-cogl-vertex-buffer] Use clutter_color_from_hls instead of hsl_to_rgb

There is no need for a custom hsl to rgb converter since Clutter implements
this logic; originally it wasn't quite as optimal, but that has now been
fixed.

15 years ago[clutter-color] Use a different hls->rgb algorithm + use floating point
Robert Bragg [Tue, 17 Mar 2009 00:01:56 +0000 (00:01 +0000)]
[clutter-color] Use a different hls->rgb algorithm + use floating point

Using test-cogl-vertex-buffer as a test case which is CPU bound due to
hls -> rgb conversions this alternative algorithm looked to be ~10%
faster when tested on an X61s Lenovo.

15 years ago[docs] More information on animation queueing
Emmanuele Bassi [Mon, 16 Mar 2009 18:20:58 +0000 (18:20 +0000)]
[docs] More information on animation queueing

Queuing an animation on an actor cannot be done from within the
::completed signal handler, because we guarantee that the Animation
instance is valid and attached to the actor it animates for the
whole duration of the signal emission chain.

In order to queue animations you have to install an idle handler
on the main loop, and call clutter_actor_animate() inside it.

The documentation should be more clear about this caveat in the
memory management of ClutterAnimations created by the animate()
family of functions.

15 years agoPost-release bump to 0.9.3
Emmanuele Bassi [Mon, 16 Mar 2009 17:09:57 +0000 (17:09 +0000)]
Post-release bump to 0.9.3

15 years ago[release] Release 0.9.2
Emmanuele Bassi [Mon, 16 Mar 2009 16:28:45 +0000 (16:28 +0000)]
[release] Release 0.9.2

15 years agoUpdate release notes
Emmanuele Bassi [Mon, 16 Mar 2009 16:14:12 +0000 (16:14 +0000)]
Update release notes

15 years ago[docs] Ignore the TimeoutInterval internal API
Emmanuele Bassi [Mon, 16 Mar 2009 16:55:48 +0000 (16:55 +0000)]
[docs] Ignore the TimeoutInterval internal API

The TimeoutInterval API is internal, and thus should not be part
of the API reference.

15 years ago[docs] Fix naming of the interval parameter
Emmanuele Bassi [Mon, 16 Mar 2009 16:54:58 +0000 (16:54 +0000)]
[docs] Fix naming of the interval parameter

The interval parameter is now expressed in frames per second and not
in milliseconds.

15 years agoFix release date of 0.9.0
Emmanuele Bassi [Mon, 16 Mar 2009 16:09:05 +0000 (16:09 +0000)]
Fix release date of 0.9.0

15 years ago[cogl] Don't endlessly print the same warning regarding layer fallbacks
Robert Bragg [Mon, 16 Mar 2009 14:58:00 +0000 (14:58 +0000)]
[cogl] Don't endlessly print the same warning regarding layer fallbacks

There are various constraints for when we can support multi-texturing and
when they can't be met we try and print a clear warning explaining why the
operation isn't supported, but we shouldn't endlessly repeat the warning for
every primitive of every frame. This patch fixes that.

15 years ago[tests] Adds an interactive cogl vertex buffer unit test
Robert Bragg [Mon, 16 Mar 2009 12:47:45 +0000 (12:47 +0000)]
[tests] Adds an interactive cogl vertex buffer unit test

The test is a sanity check that dynamic updating of vertex data via the cogl
vertex buffer api works and has reasonable performance. (though it can't be
considered a well designed benchmark since it wastes casual amounts of CPU
time simply choosing pretty colors.)

The code also aims to demonstrate one way of creating, updating and efficiently
drawing a quad mesh structure via the vertex buffer api which could be applied
to lots of different use cases.

15 years ago[cogl-vertex-buffer] fix cogl_vertex_buffer_draw_elements prototype
Robert Bragg [Mon, 9 Mar 2009 10:26:31 +0000 (10:26 +0000)]
[cogl-vertex-buffer] fix cogl_vertex_buffer_draw_elements prototype

This function was renamed a while ago in the .c file from
cogl_vertex_buffer_draw_range_elements  but the corresponding .h and
doc/reference/cogl changes weren't made.

15 years ago[cogl-vertex-buffer] Allow querying back the number of vertices a buffer represents
Robert Bragg [Sat, 28 Feb 2009 17:39:38 +0000 (17:39 +0000)]
[cogl-vertex-buffer] Allow querying back the number of vertices a buffer represents

This may be convenient e.g. at draw time if you are simply drawing all vertices

15 years ago[cogl-vertex-buffer] Add a flush of attribute changes in the *_draw() functions
Robert Bragg [Sat, 28 Feb 2009 17:36:25 +0000 (17:36 +0000)]
[cogl-vertex-buffer] Add a flush of attribute changes in the *_draw() functions

For convenience it is now valid to avoid a seperate call to
cogl_vertex_buffer_submit() and assume that the _draw() calls will do this
for you (though of course if you do this you still need to ensure the
attribute pointers remain valid until your draw call.)

15 years agoCount timeline frames using the FPS instead of an integer interval
Neil Roberts [Mon, 9 Mar 2009 17:12:27 +0000 (17:12 +0000)]
Count timeline frames using the FPS instead of an integer interval

Bug 1495 - Timelines run 4% short

Previously the timelines were timed by calculating the interval
between each frame stored as an integer number of milliseconds so some
precision is lost. For example, requesting 60 frames per second gets
converted to 16 ms per frame which is actually 62.5 frames per
second. This makes the timeline shorter by 4%.

This patch merges the common code for timing from the timeout pools
and frame sources into an internal clutter-timeout-interval file. This
stores the interval directly as the FPS and counts the number of
frames that have been reached instead of the elapsed time.

15 years ago[cogl] Flush matrix before clip planes
Havoc Pennington [Mon, 16 Mar 2009 15:09:33 +0000 (15:09 +0000)]
[cogl] Flush matrix before clip planes

glClipPlane() is affected by modelview matrix so we need to flush
before calling it.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
15 years ago[docs] Bring down the undocumented symbols to 2%
Emmanuele Bassi [Mon, 16 Mar 2009 15:00:55 +0000 (15:00 +0000)]
[docs] Bring down the undocumented symbols to 2%

The usual pre-release documentation blitzing. Most of the remaining
symbols are either COGL or X11 specific, or dummy interface typedefs.

15 years ago[animation] Enhance consistency of the Animation API
Emmanuele Bassi [Mon, 16 Mar 2009 14:16:18 +0000 (14:16 +0000)]
[animation] Enhance consistency of the Animation API

The Animation API should follow this pattern:

  - functions with an Interval as part of the arguments should have
    "interval" inside their name, e.g.:

      clutter_animation_bind_interval
      clutter_animation_update_interval

  - functions dealing with property names should have "property"
    inside their name, e.g.:

      clutter_animation_has_property
      clutter_animation_unbind_property

    - unless -

  - functions dealing with a property and its value should not
    have any modifier, e.g.:

      clutter_animation_bind

The change from update_property() to update_interval() frees up
clutter_animation_update(), to be added at a later date.

15 years ago[docs] Update after Animation API changes
Emmanuele Bassi [Mon, 16 Mar 2009 14:02:09 +0000 (14:02 +0000)]
[docs] Update after Animation API changes

Rename the bind/unbind_property functions, and add the bind_interval,
completed method.

Also, add clutter_actor_get_animation().

15 years ago[docs] Add description of queue_redraw
Emmanuele Bassi [Mon, 16 Mar 2009 14:01:43 +0000 (14:01 +0000)]
[docs] Add description of queue_redraw

15 years ago[tests] Remove unused variables
Emmanuele Bassi [Mon, 16 Mar 2009 12:17:03 +0000 (12:17 +0000)]
[tests] Remove unused variables

The size of the pixmap is passed by the ::size-changed signal, so
we can remove the unused w, h variables and avoid a compiler warning.

15 years ago[actor] Add ::queue-redraw signal
Havoc Pennington [Tue, 17 Feb 2009 17:22:02 +0000 (12:22 -0500)]
[actor] Add ::queue-redraw signal

Bug 1454 - move queue_redraw virtualization to ClutterActor

The ClutterActor::queue-redraw signal allows parent containers to
track whether their children need a redraw.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
15 years ago[actor] Add :clip-to-allocation property
Havoc Pennington [Mon, 16 Mar 2009 11:58:58 +0000 (11:58 +0000)]
[actor] Add :clip-to-allocation property

A common use of setting clip is to keep an actor inside its allocation;
right now to do this you have to set up a callback on notify::allocation.

There's no overhead added by sticking another bit in ClutterActor
clip-to-allocation that will clip painting to the allocation if set.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
15 years ago[animation] Enhance the bind API
Colin Walters [Fri, 6 Mar 2009 04:10:00 +0000 (23:10 -0500)]
[animation] Enhance the bind API

Bug 1419 - Add clutter_animation_bind, rename clutter_animation_bind_interval

This is a different approach from the clutter_actor_animatev
vector variant.  The single call should be even easier on
automatic bindings, since calls can be chained like:

  new Clutter.Animation({object: myactor}).bind("x", 42).bind("y", 43);

Note clutter_animation_bind_property which took a ClutterInterval
is renamed to clutter_animation_bind_interval for clarity, and to
discourage use since there are friendlier APIs about.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>