The dispose sequence will keep the object alive, and we need to release
the last reference held by the StageManager before releasing control to
GObject.
The build should not add deprecated/ into the default INCLUDE paths, so
that deprecated headers are clearly separated; this will make it easier
to get rid of them when we branch out for 2.0.
Copy and paste of the implementation done at Gtk+ based on pango. This
should be moved to a common library, like the old GailTextUtil. Ideally
on pango itself.
https://bugzilla.gnome.org/show_bug.cgi?id=677221
It is possible that we get a DeviceChanged event for a device
that is not in the hash table yet. E.g. I've seen this when
using xrandr to change screen resolution. Prevent a crash in
this case.
https://bugzilla.gnome.org/review?bug=678439
* clutter/clutter-cairo-texture.c (clutter_cairo_texture_emit_draw):
Always update the Cogl texture after emitting ::draw, since we control
the dynamic extent in which drawing should happen on the cairo_t.
Fixes#677966.
If the Interval used has a different type than the property we are
animating through a PropertyTransition then we should transform the
interpolated value before applying it, to avoid warnings down the
line.
The compute() method will cache the result, to avoid multiple
allocations and copies; this means, though, that we need to unset the
GValue when destroying the Interval.
Now that the interval can transform the initial and final values to the
type declared when constructing it, there is no need to check for the
value type inside set_initial_value() and set_final_value().
It's possible that GValues passed to a ClutterInterval setter are not
of the same type as the interval - for instance, if they come from
language bindings, or from untrusted sources; we can use the same
transformation functions we already use inside ClutterTransition to
ensure that the ClutterInterval always stores values of the same type
used to create the interval itself.
The ::stopped signal should be emitted at the end of the Timeline, after
the last ::completed signal emission, in order to have a proper
chronological progress of signal emissions:
started → new-frame → [ ... ] → completed → stopped
This way, ::stopped can perform a proper teardown of the state set up
during ::started, without interfering with the potential cyclical
emission of ::completed.
Calling clutter_point_free(clutter_point_zero()) or calling
clutter_rect_free(clutter_rect_zero()) should be safe, exactly like it's
safe to call those functions with a NULL argument.
The implicit animations only apply to properties that are documented as
'animatable'; the explicit animations apply to any property defined
through GObject or ClutterAnimatable.
For 1.x, we still have a duration of 0 msecs, but we have a valid easing
state, so we can change the easing parameters without calling save and
restore.
By checking if the interval is valid inside compute_value() we can catch
the cases where the interval values of a PropertyTransition are set
after the transition has been added to an Animatable instance - i.e. the
following code:
let transition = new Clutter.PropertyTransition();
transition.set_property_name('opacity');
actor.add_transition('opacityAnim', transition);
transition.set_to_value(0);
should be equivalent to:
let transition = new Clutter.PropertyTransition();
transition.set_property_name('opacity');
transition.set_to_value(0);
actor.add_transition('opacityAnim', transition);
instead of emitting a warning.
Once a ClutterPropertyTransition is attached to a ClutterAnimatable, if
no interval is set we can simply use the current state of the property
to define the from and to values. This allows the creation of property
transitions from the current state of the Animatable instance without
excessive verbosity.
ClutterContent implementations may allow repeating their contents when
painting; we should provide the repeat policy on the actor, like we do
for scaling filters and content gravity.
ClutterActor's x-align and y-align properties should be used to control
the alignment of the PangoLayout when painting it within a larger
allocation, and the ClutterText has the x-expand or the y-expand flags
set.
Fixed positions are defined to be initialized at 0,0 whenever
enabled, by setting fixed_position_enabled to true, or by setting
just one of x/y. This normally happens in the defaults, but we need
to make sure it also happens if a fixed position was once set but
then disabled. We do this by always resetting it back to 0,0 when
fixed_position_set is unset.
Instead of showing the full timestamp for debugging messages that happen
within a second, showing the delta from the previous full timestamp can
be more useful when debugging; this allows immediately seeing the time
difference, instead of doing the math in our heads.
Only for debug builds, the debug name should include a) actor name, b)
type name, and c) pointer address.
For non-debug builds we can live with the actor/type name.
ClutterGridLayout is port of GtkGrid to a Clutter layout manager. All
the logic is taken from gtkgrid.c, so all the credits should go to
Matthias Clasen for writing this nice piece of code.
ClutterGridLayout supports adding children with it's own methods
GridLayout.attach() and GridLayout.attach_next_to() as well as
Actor.add_child() and friends. The latter adds children in a similar
fashion to ClutterBoxLayout
https://bugzilla.gnome.org/show_bug.cgi?id=677372
The plain C bytes array, while convenient from a C perspective, is not
well handled by language bindings: the length of the array is not
specified, and it's only just implied by the image data size, rowstride,
and pixel format.
GBytes is a read-only bytes buffer that has an implicit length; we can
use it as the storage medium so that language bindings can actually
function correctly.
This will ensure that we have a CoglContext, albeit the stub winsys one,
on Mac.
Tested-by: Roland Peffer <gdevel@clixxun.com>
Tested-by: Laszlo Pandy <laszlok2@gmail.com>
The ::stopped signal is emitted when the timeline has been completely
exhausted or when the timeline has been programmatically stopped by
using clutter_timeline_stop(); the notification at the end of the
timeline run allows to write handlers without having to check whether
the current repeat is the last one, like we are forced to do when using
the ::completed signal.
Based on the patch by: Jasper St. Pierre <jstpierre@mecheye.net>
https://bugzilla.gnome.org/show_bug.cgi?id=676854
Ensure that resizing transitions smoothly when switching between major
axis; the allocation aspect ratio is not important: it's the size of the
allocation that dictates the major axis.
It's similar to to the implicit animation API of ClutterActor and
compatible to deprecated API of ClutterBoxLayout and
ClutterTableLayout.
It adds :use-animations, :easing-mode, :easing-duration and
:easing-delay properties to control animations when allocation of a
child has changed. Layout manager implementers should call
use_animations = clutter_layout_manager_get_easing_state (manager,
&mode,
&duration,
&delay);
from the allocate() virtual function to access these values.
https://bugzilla.gnome.org/show_bug.cgi?id=676827
The z coordinate of the origin should be checked against the same
coordinate of the vertex behind it. Given that most actors are flat
surfaces, this check should always succeed.
https://bugzilla.gnome.org/show_bug.cgi?id=675396
Instead of going through clutter_event_get_state() and checking if the
modifier mask is set, we can provide simple convenience functions to do
it for us.
When creating a FlowLayout container, setting a specific size on it, and
adding a child to it, as per the attached testcase, it crashes. The line
on the backtrace doesn't really make sense, but from looking over it, it
appears that it's probably because priv->line_natural is NULL. The
attached patch makes it so in this case, priv->line_natural is
allocated.
https://bugzilla.gnome.org/show_bug.cgi?id=676068
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
-Don't include unistd.h and stdint.h unconditionally as not all Windows
compilers have them around.
-Only include cogl/cogl-xlib.h when it is really supported by Cogl and GDK.
-sys/ioctl.h is not available on Windows (MinGW/MSVC).
-Correct the call to cogl_renderer_set_winsys_id:
(backend_cogl->cogl_renderer, COGL_WINSYS_ID_WGL) ->
(renderer, COGL_WINSYS_ID_WGL)
The property uses an array with the following CSS style syntax
[ top, right, bottom, left ] or
[ top, left/right, bottom ] or
[ top/bottom, left/right ] or
[ top/right/bottom/left ]
https://bugzilla.gnome.org/show_bug.cgi?id=676367
Passing a NULL buffer to clutter_text_set_text() does not behave the same
way as passing an empty string "" (as specified in the documentation).
This was working as expected previously, but somehow the behaviour changed
at some point and created 2 new issues:
- Passing a NULL pointer will not reset the string
- If the ClutterText is editable, it will segfault in strcmp
Validations have been added to prevent this.
https://bugzilla.gnome.org/show_bug.cgi?id=675890
This fixes drop_action_unregister() to not call g_object_get_data()
on priv->stage if not yet resolved. This can happen if the action's
actor was destroyed before ever being mapped.
When the transition was removed from the scroll-actor manually,
to cancel a not-finished animation, the transition struct member
wasn't reset to NULL.
This fixes this problem, and removes the need for the struct member
to be reset manually when animation has completed.
https://bugzilla.gnome.org/show_bug.cgi?id=676334
When setting up the transition manually by calling
clutter_keyframe_transition_set_key_frame (transition, n, keys);
clutter_keyframe_transition_set_values (transition, n, values);
clutter_keyframe_transition_set_modes (transition, n, modes);
the frame doesn't have a valid interval when calling set_keys(), so we
need to check its existence and create it if necessary.
https://bugzilla.gnome.org/show_bug.cgi?id=676031
Chaining up to the parent's implementation of pick() is not enough: we
need to paint our children explicitly because of the compatibility mode
checks we use to avoid breaking custom containers.
https://bugzilla.gnome.org/show_bug.cgi?id=676088
We need to clip the children during picking as well as we do when
painting, to avoid reactive children outside of the visible area
receiving events.
This also allows us to refactor some common code into proper functions.
-Add configuration in Clutter projects to add option to build Clutter with
the GDK3 backend in addition to the Win32 backend
-Add another preconfigured clutter-config.h.win32_GDK which contains
backend configs for both GDK3 and Win32 windowing and input.
When asking for the preferred width and height of an actor, in case
only one of either the minimum or the natural width is set, the margin
offsets should also be applied.
When getting touch events, the device manager would try
to pass an invalid device to translate_axes().
clutter_event_set_device() will only update event->touch.device
for touch events, not event->motion.device, as used.
Fixes Totem crashing on mouse motion/button press when using
a touchpad.
https://bugzilla.gnome.org/show_bug.cgi?id=675371
The drop-cancel signal allows the drop action to cleanup its
state if the can-drop signal is refused. This is especially
useful if the drop action (or its target actor) is managing
any drop target animations.
https://bugzilla.gnome.org/show_bug.cgi?id=675336
The example code that is meant to be XIncluded into the API reference
should not be part of the interactive test suite: it's code that it is
meant to be used as a reference implementation - whereas the interactive
test suite should be allowed to be lean and test behaviour even in nasty
ways. In short: the test suite should not be the place where we show off
idiomatic code for educational purposes.
The introspection scanner has become slightly more annoying, in the hope
that people start fixing their annotations. As it turns out, it was the
right move.
It's time. Now that we have clutter_actor_allocate() respecting the
easing state of an actor, and that the LayoutManager animation virtual
functions have been deprecated, we can put ClutterAlpha on the chopping
block, and be done with it, once and for all.
So long, ClutterAlpha; and thanks for all the fish.
This semi-aborted API was broken for various reasons:
- it strongly depended on ClutterAlpha, a class we're trying to
deprecate;
- it requires a lot of boilerplate and copy-and-paste code;
- it requires a full relayout of the actor tree for something
that ought to be automatically handled by ClutterActor.
Now that clutter_actor_allocate() handles transitions using the easing
state of the actor, we can deprecate the LayoutManager API for the 1.x
series, and remove it for the 2.x series.
BoxLayout will use the easing state of the children it's allocating; the
current API is re-implemented in terms of an implicit easing state
forced on each child prior to allocating it.
Calling clutter_actor_allocate() should transition between the current
allocation and the new allocation, by using the defined implementation
of the easing state.
This means that:
clutter_actor_save_easing_state (actor);
clutter_actor_allocate (actor, &new_alloc, flags);
clutter_actor_restore_easing_state (actor);
will cause "actor" to transition between the current allocation and the
desired new allocation.
The trick is to ensure that this happens without invalidating the
entire actor tree, but only the portion of the tree that has the
transitioned actor as the local root. For this reason, we just call the
allocate() implementation from within the transition frame advancement,
without invalidating flags: the actor, after all, *has* a valid
allocation for the duration of the transition.
The :x-expand and :y-expand flags on ClutterActor are used to signal
that an actor should expand horizontally and/or vertically - i.e. that
its parent's layout management policy should try to assign extra space
to the actor when allocating it.
The expand flags are automatic: when set on a leaf node in the actor
tree, they will bubble up through the parent and grandparents up to the
top level actor; during allocation, the actors with children will lazily
compute whether their children needs to expand.
The TransitionGroup class is a logical container for running multiple
transitions.
TransitionGroup is not a Score: it is a Transition that advances each
Transition it contains using the delta between frames, and ensures that
all transitions are in a consistent state; these transitions are not
advanced by the master clock.
There are cases when we want to advance a timeline from another time
source. We cannot use _clutter_timeline_do_tick() directly, as that
assumes that the timeline is already playing, so we'll need to create a
wrapper that toggles the playing flag around it.
Given that we can create a ClutterInterval without an initial and final
values using g_object_new(), it stands to reason that we ought to be
able to create an instance when passing NULL GValue pointers to the
new_with_values() constructor as well.
We tend to use float comparison for structured data types like Vertex,
Point, and Size; we should take into consideration fluctuations in the
floating point representation as well.
Instead of a single new() constructor that both allocates and
initializes, split the allocation and initialization into two separate
functions for types that are typically used on the stack, and rarely
allocated on the heap, like ClutterPoint and friends.
This is also applied retroactively to ClutterActorBox and ClutterVertex,
given that the same considerations on usage apply to them as well; we
can add a return value to clutter_actor_box_init() and
clutter_vertex_init() in an ABI-compatible way, so that
clutter_actor_box_new() and clutter_vertex_new() can be effectively
reimplemented as "init (alloc ())".
Using a compound type property for position and size has various
advantages: it reduces the amount of checks; it reduces the amount
of notify signals to connect to; it reduces the amount of transitions
generated.
The ClutterCanvas content implementation should be used instead, to
avoid stringing along the ClutterTexture API and implementation.
This change requires some minor surgery, as the deprecated section
already contains an header for the previously deprecated methods; plus,
we don't want to deprecate clutter_cairo_set_source_color(). This means
creating a new header to be used for Cairo-related API.
The get_distance() API uses machine integers to compute the distance;
this means that on 32bit we can overflow the integer size. This gets
hidden by the fact that get_distance() returns an unsigned integer as
well.
In reality, ClutterPath is an unmitigated mess, and the only way to
actually fix it is to break API.
https://bugzilla.gnome.org/show_bug.cgi?id=652521
This commit adds a further conditional check for calling
clutter_actor_show() when adding a child to an actor. We cannot
unconditionally change the value of the show-on-set-parent property like
the original solution of commit 81b19a78f5
as that breaks the document invariant that show-on-set-parent will be
changed iff an actor is without a parent.
The new ADD_CHILD_SHOW_ON_SET_PARENT flag is part of the default and
legacy flags, thus retaining the default behaviour when adding a child;
the flag is not passed when reordering the list of children, which means
we ignore the state of the show-on-set-parent property.
The conformance test suite fully passes, including the newly added test
to verify that changing the paint order does not trigger visibility.
https://bugzilla.gnome.org/show_bug.cgi?id=674510
This reverts commit 81b19a78f5.
The commit breaks the conformance test unit for the invariants we
guarantee for the 1.x API:
ERROR:actor-invariants.c:307:actor_show_on_set_parent: assertion failed: (show_on_set_parent)
It's possible to run Clutter with the 'null' input backend, which means
that clutter_device_manager_get_default() may return NULL. In the future
we may add a default dummy device manager, but right now it's safer to
just add a simple NULL check in the places where we ask for the device
manager.
I can't think of any reason why it would do this and there's no
comment explaining it so let's just remove it. The global fog state
has been removed in Cogl 2.0 so it will cause problems later.
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
CoglVertexBuffer is deprecated so here is a fairly simple replacement
to use the experimental CoglPrimitive API.
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
Drop a bunch of variables that are not meant to be used by Cally; also,
drop the wrong library name from the Libs key: Clutter has a single
shared library, now.
https://bugzilla.gnome.org/show_bug.cgi?id=674105
The interface looked like a good idea around the time Clutter 0.2 was
out, but in reality we never had a proper, and supported implementation
outside of clutter-gst - thus, ClutterMedia was acting like a wrapper
around GStreamer, leading to hilarious issues of impedence mismatch
between API and all sorts of indirection issues typical of wrong
abstractions.
In theory, ClutterMedia should have been deprecated and removed before
we hit 1.0, but we kept flip-flopping on the issue.
For 2.0, it's time to take it out.
And shoot it in the face.
It's been a year and change, and two stable releases, since we
introduced the paint volume mechanism to allow actors to paint outside
their allocation safely in environments that support clipped redraws.
The time has come to flip the switch, and return a valid paint volume,
matching the actor's allocation, by default - at least for Actor
instances from classes that do not override paint() and
get_paint_volume().
If an actor has a paint signal handler then it's the user responsability
not to paint outside the allocation - and to suffer the consequences of
doing so; in an ideal world, paint() would not be a signal in the first
place anyway. Plus, the idea that painting can happen at any time and
still have a valid surface greatly conflicts with the design goal of
making Clutter's rendering operations fully retained into a render tree.
We can still revert this commit before spinning 1.12, if need be.
When removing the last Action, Constraint, or Effect, we should also be
clearing the corresponding MetaGroup: code inside ClutterActor relies on
NULL checks, and changing them all to check for NULL && n_items == 0
would not be fun.
configure.ac defines XINPUT_2_2 if XI 2.2 support was found. The code
expects XINPUT_2_2 in the device manager, but HAVE_XINPUT_2_2 in the x11
backend.
On newer X servers, the latter causes a BadValue when XIQueryDevice sends a
different major/minor than gdk's device manager (gnome-control-center).
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
https://bugzilla.gnome.org/show_bug.cgi?id=673961
We need to remove the transition only if the current repeat is equal to
the number of repeats, and if the transition was marked as remove on
complete. Otherwise, the transition has to remain where it is.
The opacity internal setter will do it for us, and it will take into
consideration any eventual flatten effect applied to the actor.
This unbreaks the actor-offscreen-redirect conformance test.
The get_geometry() implementation is broken on multi-head systems; the
only solution is to use XRandR to get the size of the CRTC that contains
the stage.
In XInput 2, the proximity events of XInput 1 have been replaced by an
axis on a valuator class. This means that, on devices that support
proximity information, for instance pens of a tablet, you will start
receiving events with the distance as an axis value - similarly to how
the pressure and tilt are presented in the API.
We were using g_list_foreach() prior to the first Apocalypse, and that
function is resilient against changes to the list while iterating it;
since we are not using a GList any more, we need handle this case
ourselves.
This also avoids the warning
Cogl-WARNING **: ./cogl-buffer.c:215: GL error (1285): Out of memory
generated by cogl_buffer_map when the CoglBuffer has zero length.
When the easing state has a duration of zero milliseconds we can skip
the entire create_transition() call inside set_width() and set_height(),
to avoid what may be a costly call to get_preferred_*.
If we update a transition that is currently playing, we need to check
the current easing state, and look at the eventual duration, in case
the user wants to cancel the transition.
Instead of checking the duration of the current easing state we should
check if there's a transition in progress, and update it
unconditionally.
If there is no easing state, or the easing state has a duration of zero
milliseconds, then create_transition() should bail out early and set the
requested final state.
This allows us to write:
clutter_actor_save_easing_state (actor);
clutter_actor_set_x (actor, 200);
clutter_actor_restore_easing_state (actor);
[...]
clutter_actor_set_x (actor, 100);
and have the second set_x() update the easing in progress, instead of
being ignored.
https://bugzilla.gnome.org/show_bug.cgi?id=672945
Commit 80626e7584 removed an
IN_DESTRUCTION check from within the add_child_internal() method,
outlining an option for bringing it back. It was too late for the 1.10
cycle to do it, and eventually pick up the pieces, but now that we're
at the beginning of the 1.11 cycle we can restore it, and add checks
elsewhere to balance it.
This patch fixes clutter to not crash when multiple animations share
the same timeline and the actors are explicitly destroyed before
the timeline completes (bug 672890)
Some of the Clutter code was using GL types for the primitive types
such as GLint and GLubyte and then passing these to Cogl. This doesn't
make much sense because the Cogl functions directly take native C
types. This patch just replaces them with either a native C type or a
glib type.
Some of the cogl conformance tests are trying to directly call GL for
example to test creating a foreign texture. These tests have been
changed to manually define the GL enum values instead of relying on a
GL header to define them.
This is necessary because Cogl may soon stop including a GL header
from its public headers.
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
The disjunction operator was misspelt as -O which tests whether the
following file is owned by the calling user. This doesn't take enough
arguments so bash was showing an error and the test was always
failing. This meant that NEED_XKB_UTILS was always false which should
have broken the build but the Makefile was mistakenly including
clutter-xkb-utils.c again if SUPPORT_WAYLAND is defined.
See 1b77565e for reference.
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
The commit 90e5088 added some extra compiler warning options that were
triggering warnings when enabling the wayland build due to missing
header includes. This adds those header includes in.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
Because the wayland-server-protocol.h header includes symbols that
collide with wayland-client-protocol.h Cogl now provides top level
<cogl/cogl-wayland-server.h> and <cogl/cogl-wayland-client.h> headers so
that applications can ensure they only include one of the wayland
protocol headers in a particular compilation unit. This updates clutter
accordingly to include those headers.
Reviewed-by: Neil Roberts <neil@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
Should not have been there in the first place: the animatable will be
set either using ClutterTransition API, or when adding the transition
to a ClutterActor.
When adding a transition to a ClutterActor, the actor should hold a
reference on it, and release it only when we remove it. This makes
transitions just like other objects held by ClutterActor.
The ::completed signal emission is part of the current cycle; repeating,
like the automatic reverse of the timeline's direction, happens after
the ::completed chain of handlers has been called.
We still use XKeycodeToKeysym() in a fallback path in case we're not
running on a decent enough system; XKeycodeToKeysym() is deprecated as
of version 1.12 of the X server, but since I don't want to copy a bunch
of code from GDK or, god forbid, from Xlib, for a fallback path, it's
probably more reasonable to just silence the compiler warnings - at
least until we can drop all the X compatibility crap, and just use
modern, or semi-modern, API.
Some events may contain precise scrolling information coming from
devices like trackpads and touchscreens. ClutterEvent should allow
setting and getting this information.
While you can get a per-transition notification of completion, it can be
convenient to also have a way to notify that all the transitions
involving an actor are complete. A simple signal triggered by the
removal of the last transition fits the bill pretty neatly.
When handling Configure events from the X server we update the
internal copy of the window size. Unfortunately we may be updating the
wrong stage implementation because we use the one related to the event
translator (which is the first created stage).
This patch fix flickering/redrawning issues with multi-stage by
looking for the right stage implementation associated with an XEvent.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
If restore_easing_state() is called on the last easing state on the
stack, clean up the stack, so that we don't leave stale pointers
around to later segfault on.
When setting the easing mode, duration, or delay without having ever
called clutter_actor_save_easing_state(). It's confusing, and not
really nice.
In the future, we'll have a default easing state implicitly created by
the actor itself, but for the time being explicitly opting in is
preferrable.
If the pointer is inside the window frame when it's shown then we need
to synthesize and emit a NSMouseEnterEvent ourselves, as Quartz won't
do it for us.
This is a bit of a blind commit - but it's taken from an equivalent
patch that has been verified to work in GDK.
Yes, it's not really the proper GL name for a linear-on-every-axis of a
texture plus linear-between-mipmap-levels minification filter, but it
has three redeeming qualities as a name:
- LINEAR_MIPMAP_LINEAR sucks, as it introduces GL concepts like
mipmaps in the API naming, while we're trying to avoid that;
- people using GL already know what 'trilinear' means in this context
without going all Khronos on their asses;
- we're using 2D textures anyway, so 'linear on two axes and linear
between mipmap levels' can be effectively approximated to
'trilinear'.
I mean, if even the OpenGL official wiki says:
Unfortunately, what most people think of as "trilinear" is not linear
filtering of a 3D texture, but what in OpenGL terms is GL_LINEAR mag
filter and GL_LINEAR_MIPMAP_LINEAR in the min filter in a 2D texture.
That is, it is bilinear filtering of each appropriate mipmap level,
and doing a third linear filter between the adjacent mipmap levels.
Hence the term "trilinear".
-- http://www.opengl.org/wiki/Texture
then the horse has already been flogged to death, and I don't intend to
be accused of necrophilia and sadism by flogging it some more.
Prior art: every single GL tutorial in the history of ever;
CoreAnimation's scaling filter enumerations.
If people want to start using 1D or 3D textures they they are probably
going to be using Cogl API directly, and that has the GL naming scheme
for minification and magnification filters anyway.
At least for the time being, we only expose the parts of the API that we
want to use internally and for new, out-of-tree Content implementations.
The full PaintNode tree API will be made public in 1.12 once we branch
master.
It's a bit late in the game for changing the emission of the paint
signal with actors that use paint nodes - mostly because we have both
implicit paint nodes (background color, content) and explicit paint
nodes (the paint_node virtual).
When we branch for 1.12 we can revert this change.
It's safer, and consistent with the rest of Clutter, to make sure that
the template pipeline we use for ClutterTextureNode has its wrap mode
set to clamp-to-edge.
Both ClutterCanvas and ClutterImage should use the minification and
magnification filters set on the actor, just like the use the content
box and the paint opacity.
The ::paint signal is the old way to paint an actor; the paint_node()
virtual function is the new way. It's still not possible to traverse the
whole scene graph and build a render tree of PaintNode instances, but
with this change we simultaneously cut out the ::paint signal emission
from the critical path for actors that are using the new PaintNode-based
API, and we retain backward compatibility in the interim period between
1.10 and 2.0.
Instead of our homegrown string building; this at least ensures that
we're generating proper data, instead of random strings. Plus, using
JsonNode and JsonBuilder, we can ask the PaintNode subclasses to
serialize themselves in a sensible way.
ClutterContent is an interface for creating delegate objects that handle
what an actor is going to paint.
Since they are a newly added type, they only hook into the new PaintNode
based API.
The position and size of the content is controlled in part by the
content's own preferred size, and by the ClutterContentGravity
enumeration.
The ::paint-node virtual inside ClutterActor is what we want people to
use when painting their actors.
Right now, it's a new code path, that gets called while painting; the
paint_node() implementation should only paint the actor itself, and not
its children — they will get their own paint_node() called when needed.
Internally, ClutterActor will automatically create a dummy PaintNode and
paint the background color; then control will be handed out to the
implementation on the class. This is required to maintain compatibility
with the old ::paint signal emission.
Once we are able to get rid of the paint (and pick) sequences, we'll
switch to a fully retained render tree.
Now that we have a proper scene graph API, we should split out the
rendering part from the logical and event handling part.
ClutterPaintNode is a lightweight fundamental type that encodes only the
paint operations: pipeline state and geometry. At its most simple, is a
way to structure setting up the programmable pipeline using a
CoglPipeline, and submitting Cogl primitives. The important take away
from this API is that you are not allowed to call Cogl API like
cogl_set_source() or cogl_primitive_draw() directly.
The interesting approach to this is that, in the future, we should be
able to move to a purely retained mode: we will decide which actors need
to be painted, they will update their own branch of the render graph,
and we'll take the render graph and build all the rendering commands
from that.
For the 1.x API, we will have to maintain invariants and the existing
behaviour, but as soon as we can break API, the old paint signal will
just go away, and Actors will only be allowed to manipulate the render
tree.
As it turns out, we do end up recursing inside the ::paint signal
emission - especially inside the conformance test suite.
This thoroughly sucks - and we'll only be able to fix it properly
when we bump API for 2.0.
ClutterActor should be able to hold all transitions, even the ones that
have been explicitly created.
This will allow to add new transitions types in the future, like the
keyframe-based one, or the transition group.
It should be possible to ask a timeline what is its duration, taking
into account eventual repeats, and which repeat is the one currently
in progress.
These two functions allow writing animations that depend on the current
state of another timeline.
It should be possible to set up the delay of a transition, but since
we start the Transition instance before returning control to the caller,
we cannot use clutter_actor_get_transition() to do it without something
extra-awkward, like:
transition = clutter_actor_get_transition (actor, "width");
clutter_timeline_stop (transition);
clutter_timeline_set_delay (transition, 1000);
clutter_timeline_start (transition);
for each property involved. It's much easier to add a delay to the
easing state of an actor.
Clutter is meant to be, and I quote from the README, a toolkit:
for creating fast, compelling, portable, and dynamic graphical
user interfaces
and yet the default mode of operation for setting an actor's state on
the scene graph (position, size, opacity, rotation, scaling, depth,
etc.) is *not* dynamic. We assume a static UI, and then animate it.
This is the wrong way to design an API for a toolkit meant to be used to
create animated user interfaces. The default mode of operation should be
to implicitly animate every state transition, and only allow skipping
the animation if the user consciously decides to do so — i.e. the design
tenet of the API should be to make The Right Thing™ by default, and make
it really hard (or even impossible) to do The Wrong Thing™.
So we should identify "animatable" properties, i.e. those properties
that should be implicitly animated by ClutterActor, and use the
animation framework we provide to tween the transitions between the
current state and the desired state; the implicit animation should
happen when setting these properties using the public accessors, and not
through some added functionality. For instance, the following:
clutter_actor_set_position (actor, newX, newY);
should not make the actor jump to the (newX, newY) point; it should
tween the actor's position between the current point and the desired
point.
Since we have to maintain backward compatibility with existing
applications, we still need to mark the transitions explicitly, but we
can be smart about it, and treat transition states as a stack that can
be pushed and popped, e.g.:
clutter_actor_save_easing_state (actor);
clutter_actor_set_easing_duration (actor, 500);
clutter_actor_set_position (actor, newX, newY);
clutter_actor_set_opacity (actor, newOpacity);
clutter_actor_restore_easing_state (actor);
And we can even start stacking animations, e.g.:
clutter_actor_save_easing_state (actor);
clutter_actor_set_easing_duration (actor, 500);
clutter_actor_set_position (actor, newX, newY);
clutter_actor_save_easing_state (actor);
clutter_actor_set_easing_duration (actor, 500);
clutter_actor_set_easing_mode (actor, CLUTTER_LINEAR);
clutter_actor_set_opacity (actor, newOpacity);
clutter_actor_set_depth (actor, newDepth);
clutter_actor_restore_easing_state (actor);
clutter_actor_restore_easing_state (actor);
And so on, and so forth.
The implementation takes advantage of the newly added Transition API,
which uses only ClutterTimeline sub-classes and ClutterInterval, to cut
down the amount of signal emissions and memory management of object
instances; as well of using the ClutterAnimatable interface for custom
properties and interpolation of values.
As a convenience for the C API.
Language bindings should already be using the GValue variants.
This commit also moves the custom progress functions out of the
clutter-interval.c, as they are meant to be generic interpolation
functions and not ClutterInterval-specific.
The ::paint, ::queue-redraw, and ::queue-relayout signals should be
marked as no-recurse and no-hooks; these signals are emitted *a lot*
during each frame, and since GLib has a bunch of optimizations for
signals with no closures, we should try and squeeze every single CPU
cycle we can.