Commit Graph

588 Commits

Author SHA1 Message Date
Emmanuele Bassi
b4d3b52b62 actor: Update the underallocations check
Add a failsafe against a NULL parent, to avoid a segfault when calling
clutter_actor_allocate() on the Stage.

We also need to deal with floating point values: straight comparison is
not going to cut it.
2012-01-16 23:35:14 +00:00
Emmanuele Bassi
409c3ed8ff actor: Adjust the allocation prior to call allocate()
ClutterActor has various properties controlling the allocation:

  - x-align, y-align
  - margin-top, margin-bottom, margin-left, margin-right

These properties should adjust the ClutterActorBox passed from the
parent actor to its children when calling clutter_actor_allocate(),
so that the child can just allocate its children at the right origin
with the right available size.
2012-01-16 23:35:14 +00:00
Emmanuele Bassi
a85c53ea0b actor: Clean up property installation 2012-01-16 23:35:14 +00:00
Emmanuele Bassi
a2a38ee797 actor: Add margin properties
The actor class should be able to hold the margin offsets like it does
for expand and alignment flags.

Instead of filling the private data structure with data, we should be
able to use an ancillary data structure, given that all this data is
optional and might never be set in the first place.
2012-01-16 23:35:13 +00:00
Emmanuele Bassi
c8659b6ca5 actor: Add [xy]-align
Allow an actor to define how it should occupy the extra space given to
by its parent during the allocation.
2012-01-16 23:35:13 +00:00
Emmanuele Bassi
4453ee7266 actor: Provide Container::raise/lower implementations 2012-01-16 23:35:13 +00:00
Emmanuele Bassi
752151bc97 actor: Remove is-a(Container) checks
All actors are now Container implementations, so there's no need to add
a type check.
2012-01-16 23:35:13 +00:00
Emmanuele Bassi
f2609dcca4 actor: Add [xy]-expand properties 2012-01-16 23:35:13 +00:00
Emmanuele Bassi
1c40151d0e actor: Default to a fixed layout manager
In case no layout manager was set during construction, we fall back to a
FixedLayout. The FixedLayout has the property of making the fixed
positioning and sizing API, as well as the various Constraints, work
out of the box.
2012-01-16 23:35:13 +00:00
Emmanuele Bassi
11e876c86b actor: Add :layout-manager
Now that ClutterActor implements the Container contract we can actually
defer the size negotiation to a ClutterLayoutManager directly from the
default implementation of the Actor's virtual functions.
2012-01-16 23:35:13 +00:00
Emmanuele Bassi
b45d78e6a1 actor: Provide a default Container implementation
We can provide most of the ClutterContainer implementation directly
within ClutterActor — basically removing the need of having the
Container interface in the first place. For backward compatibility
reasons we can keep the interface, but let Actor implement it directly.
2012-01-16 23:35:13 +00:00
Emmanuele Bassi
8462b5ba45 Do not use set_parent()/unparent() internally
Use add_child()/remove_child() instead.
2012-01-16 23:35:13 +00:00
Emmanuele Bassi
53aa64aeb9 actor: Provide add/remove child and get children methods
Let's try and move away from the reverse implicit scene graph build API,
which we mutuated from GTK+, towards a more traditional node/child API.

The set_parent()/unparent() API is confusing, unless you know the
history; having a add_child()/remove_child() methods pair makes it more
explicit.

We can easily implement the old set_parent()/unparent() pair in terms of
the newly add_child()/remove_child() one.
2012-01-16 23:35:13 +00:00
Emmanuele Bassi
7c14ba7d37 actor: Clean up the debug node for out-of-band transforms
Enclose the check inside a #ifdef CLUTTER_ENABLE_DEBUG ... #endif, so
that we can compile it out; also, use g_string_append() instead of the
g_string_append_printf() function, given that we're just concatenating
strings.
2012-01-16 11:04:44 +00:00
Emmanuele Bassi
95d3e0f962 actor: Change the point of emission of ::destroy
Currently, we're emitting the ClutterActor::destroy at the end of the
dispose implementation - right before we chain up to the parent
implementation.

The point of emission makes the ::destroy signal handlers able to just
use the actor pointer - as the actor state will have been mostly cleared
by the time application can run. This (undocumented) behaviour severely
limits the amount of things you can do inside a ::destroy signal
handler, thus making the ::destroy signal just a weird weak reference,
instead of a proper way to break application reference cycles.

Given that this change relaxes some of the conditions, this change
should be safe - obviously, if anything happens, we'll back it out; the
conformance and interactive tests confirm that, for common patterns of
usage, this change does not break existing code.
2012-01-06 14:09:11 +00:00
Emmanuele Bassi
fa39f67eab actor: Use g_clear_object()
GLib has a nice, atomic object clearing function that allows us to drop
code looking like:

  if (priv->object != NULL)
    {
      g_object_unref (priv->object);
      priv->object = NULL;
    }

from the ::dispose implementation.
2012-01-06 14:02:54 +00:00
Emmanuele Bassi
f0a246cdc6 actor: Add queue_redraw_with_clip()
Add a public version of the clipped queue redraw, using a 2D clip. This
allows implementing actors with trackable 2D clipped regions, like the
ClutterX11TexturePixmap, outside of Clutter itself.

https://bugzilla.gnome.org/show_bug.cgi?id=660997
2011-12-12 17:29:58 +00:00
Emmanuele Bassi
26aa4b5290 docs: Remove clutter_stage_get_default()
A lot of the example code in the cookbook and the API reference still
uses the default stage — sometimes as if it were a non-default one,
which once again demonstrates how the default stage was a flawed concept
that just confused people.
2011-11-10 15:37:51 +00:00
Emmanuele Bassi
ba8d682c09 actor: Deprecate [sg]et_geometry()
These methods are short-hands for accessing the position and size,
which are already shorthands for accessing the various dimensional
and positional attributes. Plus, they use ClutterGeometry, which is a
fairly bad data type for a rectangle.
2011-11-08 14:46:55 +00:00
Emmanuele Bassi
81a82867e1 docs: Clarify CLUTTER_ACTOR_IS_MAPPED
There are a couple of gotchas in the 'mapped' flag that are not properly
documented, or are documented only in the actor_invariants.txt file; we
should have a proper description in the API reference as well, to avoid
confusion.
2011-10-25 11:35:04 +01:00
Emmanuele Bassi
be4007ef53 Remove mentions of clutter_redraw() 2011-10-17 10:25:07 +01:00
Emmanuele Bassi
7f3363e1db Tag all deprecated symbols using CLUTTER_DEPRECATED
This requires some minor surgery in the build to disable the deprecation
warnings in the deprecated classes.
2011-10-14 11:34:38 +01:00
Emmanuele Bassi
e0283993f4 Avoid using deprecated API internally
Use the proper API to implement deprecated functions.
2011-10-12 16:44:55 +01:00
Adel Gadllah
e8ec7ebed0 ClutterActor: Add clutter_actor_has_actions
Adds an efficent way to query whether an actor has any
applied actions.

https://bugzilla.gnome.org/show_bug.cgi?id=660471
2011-09-29 19:34:32 +02:00
Adel Gadllah
e81800607c ClutterActor: Add clutter_actor_has_contraints
Adds an efficent way to query whether an actor has any
applied constraints.

https://bugzilla.gnome.org/show_bug.cgi?id=660471
2011-09-29 19:34:31 +02:00
Adel Gadllah
bed2d9e787 ClutterActor: Add clutter_actor_has_effects
Adds an efficent way to query whether an actor has any
applied effects.

https://bugzilla.gnome.org/show_bug.cgi?id=660471
2011-09-29 19:34:24 +02:00
Alexandre Franke
a23e59bd66 Mark forgotten string as translatable
https://bugzilla.gnome.org/show_bug.cgi?id=659928
2011-09-23 17:48:34 +01:00
Tomeu Vizoso
4396bec330 Queue a redraw when removing an effect by name
https://bugzilla.gnome.org/show_bug.cgi?id=659501
2011-09-19 20:01:32 +01:00
Robert Bragg
662d12aeff actor: add oob-transform opt to catch out-of-band transforms
Out-of-band transforms are considered to be all actor transforms done
directly with the Cogl API instead of via ClutterActor::apply_transform.

By running with CLUTTER_DEBUG=oob-transform then Clutter will explicitly
try to detect when un-expected transforms have been applied to the
modelview matrix stack.

Out-of-band transforms can lead to awkward bugs in Clutter applications
because Clutter itself doesn't know about them and this can disrupt
Clutter's input handling and calculations of actor paint-volumes
which can lead to visual artifacts.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-09-19 14:48:06 +01:00
Emmanuele Bassi
27502af591 actor: Pack bitfields in ClutterActorPrivate
Bitfields should go at the end, to avoid holes in the middle of the
struct.
2011-09-12 11:33:18 +01:00
Emmanuele Bassi
2af7ac4c13 actor: Fix annotations for out Vertex parameters 2011-09-07 13:00:35 +01:00
Robert Bragg
0aacbd47b7 actor: make offscreen_redirect prop take flags + default off
Because we have had several reports about significant performance
regressions since we enabled offscreen redirection by default for
handling correct opacity we are now turning this feature off by default.

We feel that clutter should prioritize performance over correctness in
this case. Correct opacity is still possible if required but the
overhead of the numerous offscreen allocations as well as the cost of
many render target switches per-frame seems too high relative the
improvement in quality for many cases.

On reviewing the offscreen_redirect property so we have a way to
disable redirection by default we realized that it makes more sense for
it to take a set of flags instead of an enum so we can potentially
extend the number of things that might result in offscreen redirection.

We removed the ability to say REDIRECT_ALWAYS_FOR_OPACITY, since it
seems that implies you don't trust the implementation of an actor's
has_overlaps() vfunc which doesn't seem right.

The default value if actor::redirect_offscreen is now 0 which
effectively means don't ever redirect the actor offscreen.
2011-08-30 16:20:16 +01:00
Emmanuele Bassi
2559fb1d0d actor: Add a comment on the unmapping order
Let's add a comment to avoid reshuffling the unmap() implementation and
end up triggering these bugs:

  http://bugzilla.clutter-project.org/show_bug.cgi?id=2621
  https://bugzilla.gnome.org/show_bug.cgi?id=652036
2011-08-23 10:58:09 +01:00
Robert Bragg
ccb740f167 actor: Don't update last-paint-volume during picking
Actually this change has two notable effects; firstly we no longer
perform culling during picking and secondly we avoid updating the
last-paint-volume of an actor when picking.

We shouldn't perform culling during picking until clutter-stage.c is
updated to setup the clipping planes appropriately.

Since the last-paint-volume is intended to represent the visible region
of the actor the last time it was painted on screen it doesn't make
sense to update this during off screen pick renders since we are liable
to end up with a last-paint-volume that maps to an actors new position
when we next come to paint for real.

This fixes a bug in gnome-shell with dragging dash icons leaving a
messy trail on the screen.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-08-15 18:25:43 +01:00
Evan Nemerson
a6bd11ac62 introspection: add missing introspection data from Vala bindings
https://bugzilla.gnome.org/show_bug.cgi?id=655387
2011-07-29 13:06:51 +01:00
Emmanuele Bassi
8b03ec9d16 actor: There is no need to implement animate_property()
It's a deprecated virtual function, and its replacement does the right
thing by default.
2011-07-29 11:36:18 +01:00
Emmanuele Bassi
78049c38bf docs: Fixes for building the API reference 2011-07-26 13:44:12 +01:00
Emmanuele Bassi
e1327f5591 actor: Clean up the allocate() checks
Move the conditions to their own boolean flags, to avoid making the
if() incomprehensible.
2011-07-19 14:03:02 +01:00
Emmanuele Bassi
538559391c actor: Plug a leak in an error path
If the meta for the animation property is not found, the name of the
property to look for is still from the token, and we need to free the
memory allocated for it.
2011-07-15 15:53:55 +01:00
Robert Bragg
df751a8a25 actor: improve rounding in get_allocation_geometry
Instead of relying on C to round the floating point allocation to
integers by flooring the values we now use CLUTTER_NEARBYINT to round
the allocation's position and size to the nearest integers instead. Using
floor leads to rather unstable rounding for the width and height when
there may be tiny fluctuations in the floating point width/height.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-07-14 13:54:09 +01:00
Emmanuele Bassi
9a3b97b55e Revert "build: Detect the appropriate default flavour"
Ouch, butterfingers and git commit -a.

This reverts commit 81e8c8dec9.
2011-07-13 14:26:05 +01:00
Emmanuele Bassi
81e8c8dec9 build: Detect the appropriate default flavour
If we're building on/for Windows, set 'win32' as the default flavour; if
we're building on OS X, set 'osx' as the default flavour. For everything
else, use 'glx'.
2011-07-13 14:20:47 +01:00
Neil Roberts
bd3762b719 clutter-actor: Don't apply shaders during picking
Commit 0ede622f51 inadvertently made it so that shaders are applied
during picking. This was making test-shader fail to respond to clicks.

The commit also makes it so that culling is applied during
picking. Presumably this is also unintentional because the commit
message does not mention it. However I think it may make sense to do
culling during picking so it might as well stay that way.

https://bugzilla.gnome.org/show_bug.cgi?id=653959
2011-07-05 13:30:42 +01:00
Robert Bragg
b66c22ac1c actor: documents _get/apply_relative_transform_matrix
Although this patch doesn't make them public, it documents the
_clutter_actor_get/apply_relative_transform_matrix functions so they
could easily be made public if desired. I think these API could be
useful to have publicly, and I originally documented them because I
thought they would be needed in the MX toolkit.
2011-06-17 18:38:29 +01:00
Neil Roberts
87d55ffcfa actor: Don't use propagated_one_redraw to determine effect dirty state
Previously ClutterActor was using priv->propagated_one_redraw to
determine whether to pass CLUTTER_EFFECT_PAINT_ACTOR_DIRTY to the
paint method of the effect. This isn't a good idea because the
propagated_one_redraw flag is cleared whenever clutter_actor_paint is
called, even if the actor isn't actually painted because of the zero
opacity shortcut. Instead of this, ClutterActor now has a separate
flag called is_dirty that gets set whenever queue_redraw_full is
called or whenever the queue redraw signal is bubbled up from a child
actor. The flag is only cleared in clutter_actor_paint if the effects
are actually run. Therefore it will stay set even if the opacity is
zero or if the parent actor decides not to paint the child.

Previously there were two places set propagated_one_redraw to FALSE -
once if the opacity is zero and once just before we emit the paint
signal.  Now that propagated_one_redraw is only used to determine
whether to pass on the queue redraw signal it seems to make sense to
just clear it in one place right at the start of clutter_actor_paint.

https://bugzilla.gnome.org/show_bug.cgi?id=651784
2011-06-17 18:06:51 +01:00
Robert Bragg
1720b77d29 actor: review use of _apply_modelview_transform_recursive
On reviewing the clutter-actor.c code using
_apply_modelview_transform_recursive I noticed various comments stating
that it will never call the stage's ->apply_transform vfunc to transform
into eye coordinates, but actually looking at the implementation that's
not true. The comments probably got out of sync with an earlier
implementation that had that constraint. This removes the miss-leading
comments and also updates various uses of the api where we were manually
applying the stage->apply_transform.
2011-06-17 17:44:16 +01:00
Robert Bragg
1741c805be debug: Use cogl_primitive api for paint-volume visualization
Instead of using the cogl_vertex_buffer API this uses the more concise
cogl_primitive API instead. The aim is to get rid of the
cogl_vertex_buffer API eventually so we should be trying out the
replacement API wherever possible.
2011-06-17 16:59:20 +01:00
Robert Bragg
d7bf214397 debug: avoid visualization code during picking
This makes sure we don't try and draw paint-volumes or culling results
during a pick cycle since that results in us reading back invalid ids
from the pick-buffer.
2011-06-17 16:58:36 +01:00
Neil Roberts
1e2e0f21b8 clutter-actor: Add a debug flag for disabling offscreen redirect
This adds CLUTTER_PAINT=disable-offscreen-redirect to help diagnose
problems with the correct opacity changes. This just makes it so that
it never installs the flatten effect so it will never automatically
redirect an actor offscreen.
2011-06-17 12:15:19 +01:00
Emmanuele Bassi
74a9b71060 effect: Rename RunFlags to PaintFlags
Since run() was replaced and both paint() and pick() use the
enumeration.

https://bugzilla.gnome.org/show_bug.cgi?id=651700
2011-06-13 16:00:45 +01:00