1
0
Fork 0
Commit graph

2661 commits

Author SHA1 Message Date
Emmanuele Bassi
5d2d8297e2 [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().
2009-05-01 12:31:06 +01:00
Neil Roberts
20cd885c3d [ClutterTexture] Check before unrefing the fbo_handle
When replacing the fbo_handle with a new handle it first unrefs the
old handle. This was previously a call to cogl_offscreen_unref which
silently ignored attempts to unref COGL_INVALID_HANDLE. However the
new cogl_handle_unref does check for this so we should make sure the
handle is valid to avoid the warning.
2009-04-30 15:09:04 +01:00
Neil Roberts
4f692cc3ee [ClutterTexture] Attach the FBO texture to a layer in the material
Bug 1565 - test-fbo case failed in many platform

clutter_texture_new_from_actor was broken because it created the FBO
texture but then never attached it to the material so it was never
used for rendering. The old behaviour in Clutter 0.8 was to assign the
texture directly to priv->tex. In 0.9 priv->tex is replaced with
priv->material which has a reference to the tex in layer 0. So putting
the FBO texture directly in layer 0 more closely matches the original
behaviour.
2009-04-30 15:09:04 +01:00
Øyvind Kolås
8e6e09c8ef [events] Added handling of missing type to clutter_event_get_state
clutter_event_get_state wasn't returning the state for
CLUTTER_BUTTON_RELEASE, the information was there it just needed to
be returned correctly.
2009-04-30 11:54:09 +01:00
Neil Roberts
bb156970de Render pango layouts with vertex buffers
When rendering a pango layout CoglPangoRenderer now records the
operations into a list called a CoglPangoDisplayList. The entries in
the list are either glyph renderings from a texture, rectangles or
trapezoids. Multiple consecutive glyph renderings from the same glyph
cache texture are combined into a single entry. Note the
CoglPangoDisplayList has nothing to do with a GL display list.

After the display list is built it is attached to the PangoLayout with
g_object_set_qdata so that next time the layout is rendered it can
bypass rebuilding it.

The glyph rendering entries are drawn via a VBO. The VBO is attached
to the display list so it can be used multiple times. This makes the
common case of rendering a PangoLayout contained in a single texture
subsequent times usually boil down to a single call to glDrawArrays
with an already uploaded VBO.

The VBOs are accessed via the cogl_vertex_buffer API so if VBOs are
not available in GL it will resort to a fallback.

Note this will fall apart if the pango layout is altered after the
first render. I can't find a way to detect when the layout is
altered. However this won't affect ClutterText because it creates a
new PangoLayout whenever any properties are changed.
2009-04-29 19:53:24 +01:00
Emmanuele Bassi
48ac45f060 [gitignore] Update with the new Model test 2009-04-29 15:41:12 +01:00
Emmanuele Bassi
d2cd636fb6 [docs] Add ClutterModel::get_filter_set() 2009-04-29 15:40:13 +01:00
Emmanuele Bassi
f3e33bd25a [tests] Exercise the Model filtering
Add a test unit that exercises the ClutterModel iteration API
when there is a filter in place.
2009-04-29 15:39:23 +01:00
Emmanuele Bassi
01d172293c [model] Rework Model behaviour with a filter
Currently ClutterModel::get_iter_at_row() ignores whether we have
a filter in place. This also extends to the get_n_rows() method.

The more consistent, more intuitive and surely more correct way to
handle a Model with a filter in place is to take into account the
presence of the filter itself -- that is:

  - get_n_rows() should take into account the filter and return the
    number of *filtered* rows

  - get_iter_at_row() should also take the filter into account and
    get the first non-filtered row

These two changes make the ClutterModel with a filter function
behave like a subset of the original Model without a filter in
place.

For instance, given a model with three rows:

  - [row 0]     <does not match filter>
  - [row 1]     <matches filter>
  - [row 2]     <matches filter>
  - [row 3]     <does not match filter>

The get_n_rows() method will return "2", since only two rows will
match the filter; the get_first_iter() method will ask for the
zero-eth row, which will return an iterator pointing to the contents
of row 1 (but the :row property of the iterator will be set to 0);
the get_last_iter() method will ask for the last row, which will
return an iterator pointing to the contents of row 2 (but the :row
property of the iterator will be set to 1).

This changes will hopefully make the Model API more consistent
in its usage whether there is a filter in place or not.
2009-04-29 15:26:05 +01:00
Emmanuele Bassi
44fefa2afe [model] Add :filter-set
Currently, there is no way for implementations of the ClutterModel
abstract class to know whether there is a filter in place. Since
subclasses might implement some optimization in case there is no
filter present, we need a simple (and public) API to ask the model
itself.
2009-04-29 15:14:40 +01:00
Neil Roberts
9fdc9ca583 [ClutterText] Fix actors with a width but no wrapping and the wrap modes
Setting the wrap mode on the PangoLayout seems to have disappeared
during the text-actor-layout-height branch merge so this brings it
back. The test for this in test-text-cache no longer needs to be
disabled.

We also shouldn't set the width on the layout if there is no wrapping
or ellipsizing because otherwise it implicitly enables wrapping. This
only matters if the actor gets allocated smaller than its natural
size.
2009-04-27 17:43:48 +01:00
Owen W. Taylor
e260296cb5 [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>
2009-04-24 15:30:59 +01:00
Emmanuele Bassi
678f99677f 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.
2009-04-24 15:28:15 +01:00
Johan Bilien
51f4e9680b 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>
2009-04-24 15:27:47 +01:00
Havoc Pennington
125bded814 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>
2009-04-24 15:27:19 +01:00
Johan Bilien
b73ee6992c 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>
2009-04-24 15:26:32 +01:00
Emmanuele Bassi
08ba42a5ab 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.
2009-04-24 15:25:58 +01:00
Emmanuele Bassi
6064572703 [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.
2009-04-24 15:25:31 +01:00
Havoc Pennington
4f663384c7 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>
2009-04-24 15:25:08 +01:00
Emmanuele Bassi
27bea43a4d [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.
2009-04-23 11:38:58 +01:00
Emmanuele Bassi
d6ccecd79e [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.
2009-04-23 11:35:10 +01:00
Robert Bragg
1d2ac51ea3 [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.
2009-04-22 13:43:53 +01:00
Emmanuele Bassi
ffefbe4661 [text] Avoid a Pango warning with empty markup
When the markup string is empty Pango complains about invalid
characters.
2009-04-21 14:08:55 +01:00
Neil Roberts
bced9c65e7 [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.
2009-04-21 13:15:34 +01:00
Emmanuele Bassi
77dc4fd66b [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.
2009-04-21 12:13:43 +01:00
Emmanuele Bassi
1c42e6334e [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.
2009-04-21 12:11:42 +01:00
Emmanuele Bassi
4518cf140c [tests] Visually verify ellipsization
Verify that the non-editable, single line entries are still
correctly ellipsized when a maximum width is set.
2009-04-21 12:11:42 +01:00
Emmanuele Bassi
368f61fa65 [text] Return the correct minimum height
The correct minimum height in case of ellipsis is still 1px.
2009-04-21 12:11:41 +01:00
Emmanuele Bassi
5c8263ecb7 [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.
2009-04-21 12:11:41 +01:00
Robert Bragg
e4d3b0536f [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
2009-04-20 14:20:37 +01:00
Robert Bragg
46c20f1523 [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.
2009-04-20 13:04:34 +01:00
Robert Bragg
ac21e7b182 [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.
2009-04-17 15:25:28 +01:00
Robert Bragg
169d472d17 Use $(MAINTAINER_CFLAGS) in clutter/{x11,glx}/Makefile.am
These makefile weren't resulting in the addition of the maintainer flags while
building clutter.
2009-04-17 14:53:24 +01:00
Bastian Winkler
5c50be1bdc 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>
2009-04-16 17:16:31 +01:00
Chris Lord
56ac4baf17 [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.
2009-04-16 16:34:15 +01:00
Emmanuele Bassi
425fa78a27 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
2009-04-15 18:08:14 +01:00
Emmanuele Bassi
d4b47af153 [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.
2009-04-15 17:27:04 +01:00
Emmanuele Bassi
709bb69970 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.
2009-04-15 17:25:50 +01:00
Emmanuele Bassi
f8256e4b23 [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.
2009-04-15 17:23:45 +01:00
Neil Roberts
fbd9c59c7c [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.
2009-04-15 14:46:45 +01:00
Emmanuele Bassi
5af99660cb [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>
2009-04-15 12:18:55 +01:00
Øyvind Kolås
269598a2cf [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.
2009-04-08 18:19:46 +01:00
Neil Roberts
a9f24351e9 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.
2009-04-07 15:24:48 +01:00
Neil Roberts
1edc19d1d3 [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.
2009-04-06 15:22:31 +01:00
Neil Roberts
3fdacf9762 [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.
2009-04-06 12:44:15 +01:00
Robert Bragg
e464acff7a [cogl] cogl_is_*(): Don't dereference an invalid handle; just return FALSE
An invalid handle is implicitly not of any type.
2009-04-06 11:35:10 +01:00
Neil Roberts
fff5585b5f [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.
2009-04-06 11:14:43 +01:00
Emmanuele Bassi
a1cc1f57ac [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.
2009-04-05 20:32:15 +01:00
Emmanuele Bassi
6bf883da6c [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.
2009-04-03 14:19:20 +01:00
Emmanuele Bassi
1762795990 [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.
2009-04-03 13:36:30 +01:00