Commit Graph

5110 Commits

Author SHA1 Message Date
Emmanuele Bassi
fa1792c394 actor: Use flags to control add/remove child
The internal versions of add_child() and remove_child() currently use
boolean arguments to control things like the ChildMeta instances and
the emissions of signals; using more than one boolean argument is an
indication that you need flags to avoid readability issues, as well as
providing a way to add new behaviours without a combinatorial explosion
of arguments, later on.
2012-01-16 23:37:13 +00:00
Emmanuele Bassi
72fa75c034 actor: Remove automagic "expand" flag
I don't feel comfortable with this feature, and its implementation
still has too many rough edges. We can safely punt it for now, and
introduce it at a later point, as it doesn't block existing features
or API.
2012-01-16 23:37:13 +00:00
Emmanuele Bassi
72b523c9e9 table-layout: Override compute_expand()
The TableLayout has two expansion flags that need to be taken into
consideration when computing the Actor expansion flags.
2012-01-16 23:37:13 +00:00
Emmanuele Bassi
5f79f6ee37 box-layout: Override compute_expand()
ClutterBoxLayout has an expansion flag, and we need to take that into
consideration when computing the Actor expansion flags.
2012-01-16 23:37:13 +00:00
Emmanuele Bassi
508f09f0a0 actor: Ask the LayoutManager to compute the expansion flags
If an actor has a layout manager, we want to involve the delegate object
into the lazy computation of the expansion flags state.
2012-01-16 23:37:13 +00:00
Emmanuele Bassi
2956116561 layout-manager: Add compute_expand() vfunc
This virtual function will let layout managers with legacy expansion
flags be able to influence the lazy computation of the expansion flags
on ClutterActor.
2012-01-16 23:37:13 +00:00
Emmanuele Bassi
fd5e422b9f actor: Paint the background color in the paint class handler
We need to paint the background color in the default class handler for
two reasons: it's logically appropriate, and we don't want actor
subclasses overriding the ::paint class handler to change behaviour only
because somebody decided to set the background color.
2012-01-16 23:37:12 +00:00
Emmanuele Bassi
e6082fe42f docs: Clean up ClutterContainer's description
The API to add/remove/iterate over children is in ClutterActor, now.
2012-01-16 23:37:12 +00:00
Emmanuele Bassi
7f092af15b container: Add diagnostic warnings for deprecated vfuncs
The old add(), remove(), and foreach() virtual functions are deprecated;
ClutterContainer should warn if the public API detects that the vfuncs
have been overridden.

Strictly speaking, it's still legal to override those vfuncs: you can
chain up to the default vtable, or you could just provide an equivalent
implementation. The goal is to avoid having to override the Container
interface, until we can safely deprecate it and remove it in Clutter
2.0.
2012-01-16 23:37:12 +00:00
Emmanuele Bassi
477c60c185 container: Provide default implementation of vfuncs
Instead of making ClutterActor implement the basic add/remove/foreach
virtual functions of ClutterContainer, we can simply do that from
within the ClutterContainer implementation.
2012-01-16 23:37:12 +00:00
Emmanuele Bassi
959f875cbc container: Deprecate more methods
The get_children(), foreach(), and foreach_with_internals() methods and
virtual functions are superceded by the Actor API, and should not be
used in newly written code.
2012-01-16 23:37:12 +00:00
Emmanuele Bassi
4eaa899871 group: Use Actor.remove_all_children()
To implement the remove_all() method.
2012-01-16 23:37:12 +00:00
Emmanuele Bassi
1979faee00 cally: Use Actor.get_children()
Instead of the Container method, given that the new get_children() gives
us more actors by default.
2012-01-16 23:37:12 +00:00
Emmanuele Bassi
425ead5bd7 actor: Add some debug spew 2012-01-16 23:37:12 +00:00
Emmanuele Bassi
86152f478d docs: Update the Actor API reference
Given the size and scope of the changes in ClutterActor, we ought to
rewrite the overall description of what an actor is, what it does, and
how are you supposed to use it and subclass it.
2012-01-16 23:37:11 +00:00
Emmanuele Bassi
5959099473 Deprecate Container add() and remove() methods
This will make things interesting.

We have better replacements in ClutterActor, that do The Right Thing™
instead of deferring control and requiring reimplementation in every
single container actor.
2012-01-16 23:37:11 +00:00
Emmanuele Bassi
f61916fc5e actor: Add remove_all_children()
A simple method for removing all children of an actor in one fell swoop.
2012-01-16 23:37:11 +00:00
Emmanuele Bassi
673961f40c docs: Clarify the Actor's iterator API behaviour
It should be noted in the documentation that it is not safe to operate
on the list of children of an Actor while iterating over it.
2012-01-16 23:37:11 +00:00
Emmanuele Bassi
4f470b9231 actor: Provide a proper implementation of replace_child()
The correct sequence of actions should be remove(old) → insert(new), not
insert(new) → remove(old). We can implement a simple delegate insertion
functions to insert the new child between the previous and next siblings
of the old child.

While we're at it, let's also add a unit test for replace_child().
2012-01-16 23:37:11 +00:00
Emmanuele Bassi
5cba801207 actor: Fix get_paint_volume() default implementation
Providing a default get_paint_volume() that takes into account the
children of an actor was a goal of the whole First Apocalypse; if we
make all the containers rely on it, and yet we return a FALSE value
(meaning: we don't have a valid paint volume) even when we do have it,
then we are going to break the whole machinery, though.
2012-01-16 23:37:11 +00:00
Emmanuele Bassi
3ad77b417c stage: Use the Actor iteration API 2012-01-16 23:37:11 +00:00
Emmanuele Bassi
aa9e2a382c Remove usage of Actor/Container.get_children()
ClutterBox and ClutterGroup are still using the get_children() method
instead of the child iteration API.
2012-01-16 23:37:11 +00:00
Emmanuele Bassi
62535bdc73 actor: Simplify first/last child updates 2012-01-16 23:37:11 +00:00
Emmanuele Bassi
ab429f4f45 Drop some more ClutterContainer.get_children() uses 2012-01-16 23:37:10 +00:00
Emmanuele Bassi
ec6873958b fixed-layout: Use the Actor iteration API
Forgot to migrate the FixedLayout layout manager like we did for the
other layout managers provided by Clutter.
2012-01-16 23:37:10 +00:00
Emmanuele Bassi
4d75e7a0f4 cally: Use the Actor API instead of ClutterContainer
Cally is doing a bunch of list traversals through the list returned by
ClutterContainer.get_children(); this means a traversal already, plus
a bunch of allocations. We can do better than that, now that we have
a proper graph iteration API inside ClutterActor.
2012-01-16 23:37:10 +00:00
Emmanuele Bassi
bd58694678 actor: Add replace_child() method
A simple method that atomically replaces a child actor with another one.
2012-01-16 23:37:10 +00:00
Emmanuele Bassi
238a6eb03d actor: Deprecate the old parent modifiers
The old API should not be used in newly written code; we have better
methods for setting up and modifying the scene graph, now.
2012-01-16 23:37:10 +00:00
Emmanuele Bassi
813eef4325 actor: Fix child insertion issues
The insert_child_at_index, insert_below and insert_above messed up the
first and last child pointers in various cases. This commit fixes all
the instances of first and last child pointers being stale or set to
NULL.
2012-01-16 23:37:10 +00:00
Emmanuele Bassi
7e377b5aee Port remaining layout managers to the new child iteration API
TableLayout and FlowLayout now use the ClutterActor API for iterating
over the children of an actor.
2012-01-16 23:37:09 +00:00
Emmanuele Bassi
9c9ab42060 Begin porting layout managers to the new child iteration API
Instead of getting the list of children to iterate over it, let's use
the newly added child iteration API; this should save us a bunch of
allocations, as well as indirections.

Ported: ClutterBinLayout and ClutterBoxLayout.
2012-01-16 23:37:09 +00:00
Emmanuele Bassi
8b430507b5 actor: Add children iteration methods
Instead of requiring every consumer of the ClutterActor API that wishes
to iterate over the children of an actor to use the get_children()
method, we should provide an iteration API directly inside ClutterActor
itself.
2012-01-16 23:37:09 +00:00
Emmanuele Bassi
22259e0965 actor: Define the scene structure inside Actor
Instead of storing the list of children, let's turn Actor inside a
proper node of a tree.

This change adds the following members to the Actor private data
structure:

  first_child
  last_child
  prev_sibling
  next_sibling

and removes the "children" GList from it; iteration is performed through
the direct pointers to the siblings and children.

This change makes removal, insertion before a sibling, and insertion
after a sibling constant time operations, but it still retains the
feature of ClutterActor.add_child() to build the list of children while
taking into account the depth set on the newly added child, to allow the
default painter's algorithm we employ inside the paint() implementation
to at least try and cope with the :depth property (albeit in a fairly
naïve way). Changes in the :depth property will not change the paint
sequence any more: this functionality will be restored later.
2012-01-16 23:37:09 +00:00
Emmanuele Bassi
71545ae56f actor: Use a cairo_rectangle_t instead of a ridiculous array
Make the code maintainable and readable.
2012-01-16 23:35:17 +00:00
Emmanuele Bassi
ea7111333b actor: Document fields of ClutterActorPrivate
The private data structure members could do with more comments
documenting what they do.
2012-01-16 23:35:17 +00:00
Emmanuele Bassi
9eed2f58a6 actor: Add TransformInfo
ClutterTransformInfo is a (private) ancillary data structure that
contains all the decomposed transformation data, i.e. rotation angles
and centers, scale factors and centers, and anchor point. This data
structure is stored in the GData of the actor instance instead of the
actor's private data. This change gives us:

  • a smaller, cleaner private data structure;
  • no size penalty for untransformed actors;
  • static constant storage for the defaults, shared across all
    instances;
  • cache locality for all the decomposed transformation data,
    given that the structure size is smaller.

At the end of the day, the only authoritative piece of information for
actor transformation is the CoglMatrix that we initialize in
apply_transform() from all the decomposed parameters, and that can stay
inside the private data structure of ClutterActor.
2012-01-16 23:35:17 +00:00
Emmanuele Bassi
376bf4a990 actor: Tweak the underallocation warning
There are only two kinds of actors that allow underallocations,
according to the API contract:

  • ClutterStage, as it is a viewport and it doesn't have an implicit
    minimum size;

  • Actors using the CLUTTER_ACTOR_NO_LAYOUT escape hatch, which allows
    them to bail out from our layout management policies.

The warning about underallocations should take these two exceptions
under consideration.
2012-01-16 23:35:17 +00:00
Emmanuele Bassi
6d268fe5ca Deprecate ClutterRectangle
A ClutterActor with a background color set covers 99% of the use cases
for a Rectangle.
2012-01-16 23:35:17 +00:00
Emmanuele Bassi
6237eb7892 Deprecate ClutterGroup
The Group functionality is now provided by ClutterActor.

Sadly, we need to keep the ClutterGroup structure definition in the
non-deprecated header because ClutterStage inherits from Group - an API
wart that was never fixed during the 0.x cycles, and that we'll have to
keep around until we can break API.
2012-01-16 23:35:16 +00:00
Emmanuele Bassi
b4d269705e Deprecate ClutterBox
ClutterBox functionality has been implemented by ClutterActor, and
proxied by the Box subclass; with the removal of the abstract bit on
ClutterActor, we can safely deprecated ClutterBox.
2012-01-16 23:35:16 +00:00
Emmanuele Bassi
a6df0b6a53 cally: Do not use Group API
Avoids a deprecation warning.
2012-01-16 23:35:16 +00:00
Emmanuele Bassi
7fd35edd3f actor: Make Actor instantiatable
ClutterActor now has all the API and capabilities for being a concrete
class:

  - layout management, through delegation
  - container implementation and API
  - background color

This means that a simple scene can be built straight out of actors
without using subclasses except for the Stage.

This is the first step towards the deprecation of most of the Actor
subclasses provided by Clutter.
2012-01-16 23:35:16 +00:00
Emmanuele Bassi
8caee3e97e group: Proxy last few methods to Actor
At this point, ClutterGroup is basically just a shim layer on top of
ClutterActor.
2012-01-16 23:35:16 +00:00
Emmanuele Bassi
4acf8de8b4 actor: Provide more children methods
Add a getter for the number of children, as well as a method to retrieve
the child at a given index.
2012-01-16 23:35:16 +00:00
Emmanuele Bassi
b86cf3e2f3 group: Use the default get_paint_volume()
ClutterActor does everything we did, and more.
2012-01-16 23:35:16 +00:00
Emmanuele Bassi
e62536fad6 actor: Provide a better get_paint_volume() implementation
ClutterActor can do better by default than just giving up immediately.

An actor can check for the clip region, and for its children's paint
volume, for instance.

Just these two should give us a better default implementation for newly
written code.
2012-01-16 23:35:16 +00:00
Emmanuele Bassi
7195d0fccf flow-layout: Fix minimum size request
The minimum preferred size of a Flow layout manager is the size of a
column or a row, as the whole point of the layout policy enforced by
the Flow layout manager is to reflow when needed.
2012-01-16 23:35:16 +00:00
Emmanuele Bassi
ba093ed5e7 box: Proxy the Actor's background color properties
ClutterBox's color and color-set properties can be implemented as
proxies for the ClutterActor's newly added background-color and
background-color-set properties, respectively.

This also allows us to get rid of the paint() implementation inside
ClutterBox altogether.
2012-01-16 23:35:16 +00:00
Emmanuele Bassi
98a8feae64 actor: Background color
Each actor should have a background color property, disabled by default.

This property allows us to cover 99% of the use cases for
ClutterRectangle, and brings us one step closer to being able to
instantiate ClutterActor directly.
2012-01-16 23:35:15 +00:00
Emmanuele Bassi
7d88a70b78 actor: Cosmetic fixes to internal add/remove child
Avoid code duplication all over the place.
2012-01-16 23:35:15 +00:00
Emmanuele Bassi
3f877a3d71 group: Use the default paint() implementation
ClutterActor's paint implementation is perfectly fine for ClutterGroup:
it paints the actor's children, which is exactly what ClutteGroup does.
2012-01-16 23:35:15 +00:00
Emmanuele Bassi
798a2e5297 actor: Minor cosmetic fixes to the header 2012-01-16 23:35:15 +00:00
Emmanuele Bassi
b869019eb2 group: Do not override Container
Let ClutterActor do all the work.
2012-01-16 23:35:15 +00:00
Emmanuele Bassi
ef3dc2d1ba actor: Make Actor.add_child and Container.add_actor idempotent
And make sure that overriding Container and calling
clutter_actor_add_child() will result in the same sequence of operations
as the current set_parent()+queue_relayout()+signal_emit pattern.

Existing containers can continue using:

        clutter_actor_set_parent (child, CLUTTER_ACTOR (container));
        clutter_actor_queue_relayout (CLUTTER_ACTOR (container));
        g_signal_emit_by_name (container, "actor-added", child);

and newly written containers overriding Container.add() can simply call:

        clutter_actor_add_child (CLUTTER_ACTOR (container), child);

instead.
2012-01-16 23:35:15 +00:00
Emmanuele Bassi
2894587b22 actor: Do not leak the layout manager 2012-01-16 23:35:15 +00:00
Emmanuele Bassi
038aadfa72 box: Drop Container interface overrides
And defer as much as possible to ClutterActor's default implementation
for basically everything.
2012-01-16 23:35:15 +00:00
Emmanuele Bassi
b773785533 actor: Implement Container::sort_depth_order
There's no reason this vfunc should be left out.
2012-01-16 23:35:15 +00:00
Emmanuele Bassi
86ec629776 actor: Add child insertion methods
We should allow inserting children at given indices, and at given
stacking positions (relative or not to other children).
2012-01-16 23:35:14 +00:00
Emmanuele Bassi
37d46649ce actor: Adjust the preferred size too
Don't adjust just the allocation: we need to adjust the preferred size
of the actor to account for the margin.
2012-01-16 23:35:14 +00:00
Emmanuele Bassi
bf27575187 actor: Maintain invariants in add_child/remove_child
We need to queue a relayout when removing a visible child from a visible
parent.

We also need to insert the child at the right position (depending on the
depth) so that newly added actors will be painted on top.
2012-01-16 23:35:14 +00:00
Emmanuele Bassi
9d9e98968f actor: More cleanups to the Private data structure
Try to document it properly. We can also remove some things that are
properly encapsulated through functions, like the redraw clip volume.
2012-01-16 23:35:14 +00:00
Emmanuele Bassi
9132769767 actor: Store the fixed sizes into LayoutInfo
Remove four more floats from ClutterActorPrivate.

The fixed minimum and natural sizes should be stored inside the
ClutterLayoutInfo structure, along with the fixed position.
2012-01-16 23:35:14 +00:00
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
d5086da3fd box: Defer to ClutterActor
Use the default implementation inside ClutterActor instead of our own,
wherever possible.
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
Neil Roberts
0396d3e7e6 Remove use of CoglVector3
Cogl has removed the CoglVector3 type in favour of directly using an
array of 3 floats.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2012-01-16 21:06:19 +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
646cf236a5 backend: Remove ClutterBackend::redraw
The ::redraw virtual function was a throwback from olden times, and has
been thoroughly replaced by the equivalent vfunc on the StageWindow
interface. We can safely remove it, now, and simplify the flow of the
redraw code inside ClutterStage.
2012-01-12 13:35:09 +00:00
Emmanuele Bassi
0c365f9f4c gesture-action: Protect against NULL pointers 2012-01-12 10:49:16 +00:00
Emmanuele Bassi
3b9b69ef54 gesture-action: Use the event propagation macros 2012-01-12 10:49:02 +00:00
Emmanuele Bassi
99f7d627af text: Use the event and source symbolic macros
Instead of boolean values.
2012-01-12 10:40:38 +00:00
Emmanuele Bassi
21149adb12 drop-action: Use the event propagation macros 2012-01-12 10:39:59 +00:00
Emmanuele Bassi
81694d0dd9 drag-action: Use the new event propagation macros 2012-01-12 10:34:50 +00:00
Emmanuele Bassi
cce2e25ac7 deform-effect: Check against NULL pointers
Do not try to disconnect signal handlers from NULL pointers.
2012-01-12 10:34:26 +00:00
Emmanuele Bassi
20e63532a4 click-action: Use the new symbolic event propagation macros 2012-01-12 10:27:17 +00:00
Emmanuele Bassi
dbf3b607bf click-action: Be resilient against NULL pointers
Do not try to disconnect signal handlers from NULL pointers.
2012-01-12 10:26:47 +00:00
Rob Bradford
4afe793eed build: Add infrastructure for inserting Requires.private into pkg-config files 2012-01-11 12:23:46 +00:00
Rob Bradford
a9e6137f47 wayland: Attach cursor buffer to input device when it enters the surface
The Wayland semantics mean that we must attach a buffer to the input device
when the pointer enters the surface to provide a cursor.
2012-01-10 17:30:57 +00:00
Rob Bradford
e1434cebdb wayland: Load a buffer from well known location for the cursor
Semantic changes to Wayland means that we cannot rely on the compositor
setting a pointer buffer for us if set it to nil. The first part of fixing
this is to create an shm buffer containing the bytes for our cursor.

The best way to do this currently is to load the cursor from the well known
location where weston instals its cursor images. The code to implemente this
was derivedlifted from the Wayland backend in GTK+.
2012-01-10 17:29:32 +00:00
Emmanuele Bassi
d8e855e585 osx: Use Lucida Grande as the default font
Instead of falling back to the generic "Sans".
2012-01-07 10:42:09 +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
f5fffb355b Move Perspective and Fog definitions to clutter-types.h
Since we reference the types from multiple files.
2012-01-03 13:50:06 +00:00
Emmanuele Bassi
6184bf1b6e Add symbolic constants for event propagation
I always have to think twice before returning a value from an event
signal handler, and I've been writing them for the past 10 years, so
it's conceivable that application developers that start with Clutter
will find them confusing as well.

Simple symbolic names should be easier to use.
2012-01-03 12:05:10 +00:00
Emmanuele Bassi
e689d01800 stage: Deprecate :use-fog and :fog
The depth cueing through GL fog has been broken for a long while, now.

The fog-related API in Clutter is ridiculously limited, and harks back
to simpler times; the ClutterFog structure is not enough to express all
the GL fog machinery, and required application code to connect to the
Stage's paint implementation and drop into Cogl directly.

Additionally, the fixed pipeline fog machinery in GL simply does not
work with premultiplied alpha, unless you use a shader - and in that
case it would only work for textures. Let's deprecate it, and just
don't do anything if somebody has the brilliant idea of setting the
:use-fog property to TRUE.
2011-12-30 10:26:12 +00:00
Emmanuele Bassi
65889fa075 box: Remove the sentinel annotation
Sadly, we need to remove the G_GNUC_NULL_TERMINATED annotation from
ClutterBox packing API; the compiler will otherwise emit a warning
for perfectly legal statements like:

  clutter_box_pack (box, child, NULL);

because of the missing sentinel.

See also: g_object_new().
2011-12-30 09:51:36 +00:00
Emmanuele Bassi
7d4a9c6f1e Add diagnostic mode
GLib has a "diagnostic mode" switch that can be checked to enable debug
messages on deprecated properties and signals, as these are purely
run-time constructs, and as such cannot be caught by compiler warnings.
The diagnostic mode is toggled by a simple environment variable, and
can be used to ease porting of application code.

We can use something similar to mark deprecated virtual functions and
other run-time constructs; to avoid collisions, we should use our own
environment variable, CLUTTER_ENABLE_DIAGNOSTIC.
2011-12-28 09:37:53 +00:00
Jasper St. Pierre
b882fcd825 clutter-text: Fix memory leak 2011-12-19 09:46:44 -05:00
Chun-wei Fan
23960328d5 Update clutter.symbols...
...For the addition of queue_redraw_with_clip (commit f0a246cd)
2011-12-13 12:44:27 +08:00
Emmanuele Bassi
f0468cf828 wayland/surface: Use queue_redraw_with_clip()
Just like the X11 texture-pixmap actor.

https://bugzilla.gnome.org/show_bug.cgi?id=660997
2011-12-12 17:29:58 +00:00
Emmanuele Bassi
30c464e68f x11/texture-pixmap: Use ClutterActor.queue_redraw_with_clip()
Instead of using a PaintVolume for a 2D region, and an internal
function, use the newly added queue_redraw_with_clip() method.

This removes the last bit of internal API usage in the
ClutterX11TexturePixmap actor.

https://bugzilla.gnome.org/show_bug.cgi?id=660997
2011-12-12 17:29:58 +00:00
Emmanuele Bassi
749fe38fec x11/stage: Use ClutterActor.queue_redraw_with_clip()
Instead of using a paint volume for a 2D region, use the newly added
queue_redraw_with_clip() method.

https://bugzilla.gnome.org/show_bug.cgi?id=660997
2011-12-12 17:29:58 +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
79c04bd133 fixed-layout: Use a better quark name
The "fixed-container" name is far too generic, and it may very likely
lead to collisions with application code.
2011-12-09 16:24:04 +00:00
Rob Bradford
320356e97f wayland: Refine enter/leave event handling
The Wayland protocol now has events represent when a pointer enters the
surface and when it leaves again.

For leaves the surface is not set in the event, for enters the surface is set.
Simply use this to determine whether to emit CLUTTER_ENTER or CLUTTER_LEAVE.
2011-12-08 17:44:53 +00:00
Rob Bradford
34cc45dae5 wayland: Update to latest Wayland API (wl_shell_surface transition)
Previously the wl_shell object held the methods that allowed a client to
request changes to the shell's state associated with a surface. These methods
have now been moved to a wl_shell_surface object.

This change allows configure events to be handled inside the stage rather than
the backend.
2011-12-08 17:44:53 +00:00
Robert Bragg
3e85ad6b95 build: make internal option_xkb_* symbols static
This makes the option_xkb_* symbols declared for the evdev device manager
and the wayland device manager private so we don't get symbol collisions
if both of these backends are enabled.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-12-08 16:13:38 +00:00
Robert Bragg
fd8965a710 xkb-utils: Adds #ifdef guards for repeat includes
This adds #ifdef/#define repeat include guards for clutter-xkb-utils.h

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-12-08 16:13:38 +00:00
Robert Bragg
d8e76c3415 eglnative: fix building eglnative BE with evdev support
this fixes how clutter-device-manager-evdev.h is included to fix a build
problem caused by not being able to find the header.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-12-08 16:13:37 +00:00
Robert Bragg
602a89afa8 evdev: fixes evdev build issues + don't ref default stage
This updates the evdev input backend code to compile and also updates
the code to not refer to the default stage and instead check for a
stage to be associated with the input device. If no stage is currently
associated with a device generating events then the events are dropped
on the floor.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-12-08 16:13:37 +00:00
Robert Bragg
86f2aed570 input: adds internal _clutter_input_device_get_stage api
This adds internal api to be able to query the stage currently
associated with a given input device so input backends shouldn't need to
refer to the default stage.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-12-08 16:13:37 +00:00
Robert Bragg
16ed7677e0 Adds wayland-surface actor for wayland compositors
This adds a --enable-wayland-compositor configure option which will add
support for a ClutterWaylandSurface actor which can be used to aid in
writing Wayland compositors using Clutter by providing a ClutterActor to
represent Wayland client surfaces.

Notably this configure option isn't tied into any particular backend
since conceptually the compositor support can be used in conjunction
with any clutter backend that has corresponding Cogl support.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-12-08 16:13:37 +00:00
Robert Bragg
07c6f96cb4 wayland: Updates client side wayland support
This updates Wayland support in line with upstream changes to the Wayland
API and protocol.

This update means we no longer use the Cogl stub winsys so a lot of code
that had to manually interact with EGL and implement a swap_buffers
mechanism could be removed and instead we now depend on Cogl to handle
those things for us.

This update also adds an input device manager consistent with other
clutter backends.

Note: to use the client side "wayland" clutter backend you need to have
built Cogl with --enable-wayland-egl-platform. If Cogl has been built
with support for multiple winsys backends then you should run
applications with COGL_RENDERER=EGL in the environment.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-12-08 16:13:37 +00:00
Chun-wei Fan
6ad1afd803 clutter/Makefile.am: Update gen-enums.bat generation
It's $(srcdir)/win32/clutter-win32.h, not $(srcdir)/clutter-win32.h

Sorry!
2011-12-08 17:40:22 +08:00
Chun-wei Fan
7a70e1f08b clutter/Makefile.am-Create batch to gen enums (VS Support)
Generate a .bat file to generate the clutter-enum-types.[ch] for use
during the Visual C++ build process, which will greatly simplify the
maintenanace of the VS build files as public headers are added or removed
during the development process.
2011-12-08 17:04:46 +08:00
Emmanuele Bassi
158245fda3 backend: Fix em computation for non-absolute fonts
If a font description is not set to have an absolute size then we were
using the wrong transformation for points to device units.
2011-12-05 11:43:48 +00:00
Emmanuele Bassi
943a65b476 backend: Return the correct default resolution
If ClutterSettings:font-dpi is set to -1 then the default resolution
should be returned by ClutterBackend — i.e. 96.0.
2011-12-05 11:42:49 +00:00
Jasper St. Pierre
f7bb1e879e main: Fix keyboard event emission for non-reactive actors
This is an innocent copy-paste issue that ended up breaking a few things

https://bugzilla.gnome.org/show_bug.cgi?id=664582
2011-12-01 13:05:22 -05:00
Emmanuele Bassi
1dc7c45438 x11: Do not try to access private structures
ClutterInputDeviceX11 has been made private, so we cannot access it from
outside of clutter-input-device-core-x11.c. We should have simple
accessors for the min/max keycode, which is the only detail that we use.
2011-12-01 13:44:21 +00:00
Manuel Osdoba
67cdbbaf51 Currently Clutter only prints out a warning message in case some shader effects fail to compile
Clutter-WARNING **: Unable to compile the GLSL
shader: Fragment shader failed to compile with the following errors:

The attached patch (against current git) should print out more
information what makes it easier to answer user feedback.

https://bugzilla.gnome.org/show_bug.cgi?id=664252
2011-12-01 10:57:22 +00:00
Bastian Winkler
6336883da7 path: Fix introspection annotations
Add out annotations for clutter_path_get_node() and
clutter_path_get_position()

https://bugzilla.gnome.org/show_bug.cgi?id=664336
2011-12-01 10:55:13 +00:00
Emmanuele Bassi
dc77a5ef31 docs: Fix up the state.set_key() comment 2011-12-01 10:39:11 +00:00
Jeremy Moles
1e05e8ceaf Adds (allow-none) as source_target for clutter_state_set_key
While working through the Python3/pygobject bindings, I came across a missing
(allow-none) in clutter_state_set_key(). This allows the API to specify to None
as the source_target.

https://bugzilla.gnome.org/show_bug.cgi?id=664996
2011-12-01 10:36:38 +00:00
Neil Roberts
627a1b1977 effects: Use effect_queue_repaint instead of actor_queue_redraw
The builtin effects ClutterColorizeEffect, ClutterDesaturateEffect and
ClutterShaderEffect all have properties which only affect the
rendering of the final texture not the contents of it. When these
properties are updated we should queue a repaint of the effect not
the actor so that we don't waste time repainting the contents of the
offscreen buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=665052

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-11-28 18:30:18 +00:00
Neil Roberts
c687ece72d Fix building with profiling enabled
There was an #ifdef'd section of code for profiling that was using the
wrong variable name so it would not build.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-11-28 16:27:57 +00:00
Neil Roberts
a2774fb0dc offscreen-effect: Track the size of the actor separately
Previously the offscreen effect was keeping track of the size of the
texture so that it could detect when a different size is requested and
create a new texture. However this breaks if a subclass overrides
create_texture to make the texture bigger because in that case the
size of the texture will always be different from the calculated size
of the actor. This patch makes it also track the size of the fbo that
was requested before being passed through create_texture() and it
instead uses that to detect when a new FBO is needed.

https://bugzilla.gnome.org/show_bug.cgi?id=665040

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-11-28 15:42:35 +00:00
Emmanuele Bassi
24623c43a8 timeline: Add custom parser for "markers"
It should be possible to define markers in ClutterScript when
describing a ClutterTimeline.

The syntax is a trivial:

  "markers" : [
    { "name", <marker-name>, "time" : <msecs> }
  ]

While at it, we should document it inside the API reference, as well
as fleshing out the ClutterTimeline description.
2011-11-27 12:19:39 +00:00
Bastian Winkler
d82bf70d49 script: Don't skip introspection for connect_signals_full()
To allow language bindings to properly override Script.connect_signals()
they'll need access access to Script.connect_signals_full().

Thanks to Jeremy Moles for reporting.
2011-11-25 10:54:54 +01:00
Emmanuele Bassi
49355f3287 pc: Fix unexpanded variables
PkgConfig doesn't like those.
2011-11-23 17:30:13 +00:00
Emmanuele Bassi
a13b095dc2 build: Fix distcheck 2011-11-22 13:53:08 +00:00
Florian Müllner
02a020a7fd Add missing include
clutter-profile.h used to be included via clutter-debug.h, but no
more (8a4dc3c011) ...
2011-11-18 22:06:30 +01:00
Emmanuele Bassi
6e15fd930a debug: Simple whitespace cleanups 2011-11-18 17:54:19 +00:00
Emmanuele Bassi
8a4dc3c011 debug: Clean up profile/debug symbols
Since we have a _clutter_debug_message() function compiled in
unconditionally we have no further need for the equivalent conditional
version defined in clutter-profile.[ch]: we can simply do the work in
one function.
2011-11-18 17:44:42 +00:00
Emmanuele Bassi
92585be4d8 debug: Remove CLUTTER_GLERR
The macro hasn't been used in a long while, as Cogl had its own version
of it; and Clutter hasn't been using pure GL for some time now.
2011-11-18 17:32:01 +00:00
Emmanuele Bassi
2d76407016 debug: Remove CLUTTER_MARK
The debug macro is seldom used, and it's a bit lame at that.
2011-11-18 17:30:39 +00:00
Emmanuele Bassi
90f37d5636 cairo-texture: Skip ::draw emission for 0x0 surfaces
This also avoids an assertion failure.
2011-11-18 17:23:56 +00:00
Chun-wei Fan
d3a9bf201b Merge branch 'master' into msvc-support-master 2011-11-16 09:15:16 +08:00
Emmanuele Bassi
bf9339b8f4 Deprecate some more old, useless API
We still ship clutter_get_show_fps() and clutter_get_debug_enabled() as
public entry points. Yet another case of missing API review prior to the
1.0 release, so really the bucket stops around my desk.

Let's deprecate these two useless functions, and reduce the API
footprint of Clutter.
2011-11-15 17:58:25 +00:00
Emmanuele Bassi
66d46fd55e Deprecate clutter_get_timestamp()
This function should have never been made public in the first place; its
output depends on a configuration option of Clutter, and it's basically
useful only for internal debugging.
2011-11-15 17:47:00 +00:00
Emmanuele Bassi
59f395d856 Rework debug output
Make it consistent across the various build options (with or without
profiling enabled), and add a timestamp using the monotonic clock to
every debug message.
2011-11-15 17:39:49 +00:00
Emmanuele Bassi
c6e487a5c1 Remove CLUTTER_TIMESTAMP debug macro
It's pretty much unused, and it doesn't print out really informative
messages. We should make CLUTTER_NOTE print out a decent timestamp
instead.
2011-11-15 16:07:13 +00:00
Emmanuele Bassi
8b2df7ced9 Remove the GTimer used by clutter_get_timestamp()
Use g_get_monotonic_time() instead, which does the right thing.
2011-11-15 15:34:51 +00:00
Emmanuele Bassi
f63891f030 texture: Do not use clutter_get_timestamp()
The clutter_get_timestamp() output depends on whether Clutter was
compiled with debugging support — it's meant to be used only by the
debugging notes, and it should not be used for anything else.
2011-11-15 14:59:50 +00:00
Neil Roberts
58b6ad787b deform-effect: Use CoglPipeline instead of setting legacy state
Instead of calling cogl_set_depth_test_enabled and
cogl_set_backface_culling_enabled ClutterDeformEffect now uses the
experimental CoglPipeline API. Those global state functions will soon
be deprecated in Cogl and they are implemented by flushing a temporary
override pipline which isn't ideal.

Using the new culling API we can also avoid having a separate buffer
of indices for the back of the texture by just changing the culling
mode to cull front baces instead of the back.

https://bugzilla.gnome.org/show_bug.cgi?id=663636
2011-11-15 11:15:00 +00:00
Neil Roberts
8a752d674b deform-effect: Use CoglPrimitives instead of CoglVertexBuffers
This changes ClutterDeformEffect to use a CoglAttributeBuffer with a
CoglPrimitive instead of the old CoglVertexBuffer. The old vertex
buffer code is now implemented in terms of the attribute buffer code
and it will eventually be deprecated. Using CoglPrimitives should be
slightly more efficient.

This also changes the struct we store the vertices to be
CoglVertexP3T2C4 instead of CoglTextureVertex. The latter is
technically not compatible with neither vertex buffers nor attribute
buffers because it contains a CoglColor and the internal members of
that are private so it is not valid to assume it contains 4 bytes and
use that as an attribute. Also it contains padding so it ends up
redundantly creating a larger buffer. CoglTextureVertex is in the
public API for the deform_vertex virtual so we still have to maintain
that. Instead of directly manipulating the array to upload, the
application is now passed a stack allocated temporary struct which
gets converted to a CoglVertexP3T2C4. This also means that we can map
the buffer as write only and still let the application read-write the
vertex.

The paint debug code to draw line strips for the deform mesh was
previously trying to set a red source material. However this wasn't
working because the material color was being overwritten by the color
attribute in the vertex buffer. This patch fixes that by creating a
seperate primitive for the lines and not adding the color
attribute. The lines code was also drawing both the front and back
indices. I don't think that entirely makes sense so I've just changed
it to draw only the front indices. Maybe painting both would make more
sense if backface culling was still enabled.

https://bugzilla.gnome.org/show_bug.cgi?id=663636
2011-11-15 11:14:59 +00:00
Chun-wei Fan
8d0c68347a Merge branch 'master' into msvc-support-master 2011-11-15 14:20:22 +08:00
Emmanuele Bassi
b281f2090a Store the master clock pointer in the main context
Let's try and move all singletons into ClutterMainContext.
2011-11-14 17:16:27 +00:00
Emmanuele Bassi
f1ebfe30ce stage-manager: Store the stage manager into the main context
Use the main context to store the stage manager singleton, instead of a
static pointer inside clutter-stage-manager.c.
2011-11-14 15:43:20 +00:00
Chun-wei Fan
96d4e527ea Merge branch 'master' into msvc-support-master 2011-11-14 22:57:50 +08:00