Commit Graph

4616 Commits

Author SHA1 Message Date
Robert Bragg
d2763fd8a4 stage-cogl: pass top-left relative swap_region coords
All 2D coordinate spaces in Cogl have their origin at the top-left so we
shouldn't be flipping the coordinates we pass to
cogl_framebuffer_swap_region to be relative to the bottom of the
framebuffer.

This bumps the Cogl version requirement to 1.7.5 since we've had to fix
a bug in the semantics of cogl_framebuffer_swap_region.

Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-08-12 15:42:42 +01:00
Alejo Pacin
694649e50c a11y: Notify ATK_STATE_SHOWING state change
https://bugzilla.gnome.org/show_bug.cgi?id=648633
2011-08-04 12:59:50 +02:00
Neil Roberts
91ace65cae clutter-stage-win32: Fix name cogl_win32_onscreen_set_foreign_window
Since commit 38b67e2884 of Cogl the naming scheme for winsys-specific
API has changed to be cogl_win32_onscreen_* instead of
cogl_onscreen_win32_* so it wouldn't build on Windows.
2011-07-31 18:00:51 +01:00
Kirk A. Baker
01fd673505 osx: Avoid leaks in Stage::realize
clutter_stage_osx_realize() can now be called multiple times without
leaking views and windows.

https://bugzilla.gnome.org/show_bug.cgi?id=655307
2011-07-29 13:58:06 +01:00
Kirk A. Baker
e144378f5a osx: Implement windowDidResignKey
Added isHiding field to _ClutterStageOSX to allow windowDidResignKey
delegate to not order full screen window back whilst the full screen
window was being hidden.  This caused other application windows to be
hidden.  Also added code to keep hidden stage windows from being listed
in the application's Windows menu.

https://bugzilla.gnome.org/show_bug.cgi?id=655311
2011-07-29 13:58:01 +01:00
Kirk A. Baker
6f6b27fac5 osx: Add windowDidChangeScreen delegate
Added -windowDidChangeScreen: delegate to handle condition where moving
host window to a different screen would cause pick errors to be output.
The delegate just causes the stage to be redrawn which re-creates the
pick buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=655306
2011-07-29 13:57:13 +01:00
Emmanuele Bassi
7139ada809 model: Remove an unused variable 2011-07-29 13:17:11 +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
fe66575a2c docs: Update with the newly added Animatable symbol 2011-07-29 11:53:16 +01:00
Emmanuele Bassi
f28c1d2d2a state: Use the Animatable interface
The Animatable interface allows object classes to provide and animate
properties outside of the usual GObject property introspection API.

This change allows ClutterState to defer to the animatable objects the
property introspection and animation, just like ClutterAnimation does.
2011-07-29 11:44:28 +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
677df44975 animation: Use Animatable.interpolate_value()
And stop using the deprecated animate_property() method.
2011-07-29 11:36:18 +01:00
Emmanuele Bassi
8b861cea8f animatable: Deprecate and replace animate_property()
The animate_property() method of the Animatable interface is far less
than optimal:

  • it has a direct reference to ClutterAnimation;
  • it has an interval decomposed as two values.

These issues tie the Animatable interface with the Animation object,
even though it's neither necessary nor future-proof.

Let's introduce a new method, interpolate_value(), which does not
reference ClutterAnimation and uses a ClutterInterval to express the
initial and final states.
2011-07-29 11:36:18 +01:00
Emmanuele Bassi
473f3817d4 model: Clean up ModelIter vfunc wrappers
All ClutterModelIter virtual functions have a default implementation,
and G_TYPE_INSTANCE_GET_CLASS cannot return NULL unless in case of a
catastrophic event in the type system - which will most likely blow up
any application code way before you could call a ModelIter method.

Thus, the idiom:

  klass = CLUTTER_MODEL_ITER_GET_CLASS (instance);
  if (klass && klass->vfunc)
    klass->vfunc (instance);

is utterly useless complication, and it can be perfectly replaced by:

  CLUTTER_MODEL_ITER_GET_CLASS (instance)->vfunc (instance);

without any loss of safety.
2011-07-29 11:29:51 +01:00
Emmanuele Bassi
e470fd7d82 model: Make sure to emit ::row-changed
Currently, only clutter_model_iter_set_valist() is in charge of emitting
the ClutterModel::row-changed signal. Both the set() and the
set_valist() functions can be called with multiple columns, so we
coalesce the signal emission at the end of the set_valist(), to have a
single ::row-changed emission per change.

The clutter_model_iter_set_value() function is just a thin wrapper
around the set_value() virtual function, but since it's called
internally we cannot add the signal emission there as well, as we'd
break the signal coalescing.

For this reason, we need some code refactoring inside the various set()
variants of ClutterModelIter:

  - we only use the internal va_arg variant for both the set() and
    set_valist() public functions, to avoid multiple type checks;
  - the internal set_valist() calls an internal set_value() method
    which calls the virtual function from the iterator vtable;
  - a new internal emit_row_changed() method is needed to retrieve
    the ClutterModel from the iterator, and emit the signal;

Now, all three variants of the value setter will call an internal
ClutterModelIter::set_value() wrapper, and emit the ::row-changed
signal.

To check that the intended behaviour has been implemented, and it's not
going to be broken, the test suite has grown a new unit which populates
a model and changes a random row.
2011-07-28 15:00:18 +01:00
Alejandro Piñeiro
468f121f59 a11y: Use existing clutter_actor_get_paint_visibility
Cally was initially created with Clutter 0.6 in mind. To check
recursively the visibility of a actor a custom method was added.
Since 0.8.4 clutter_actor_get_pain_visibility provides
the same functionality.

Also removed a dummy method. Lets add methods that provide a real
functionality.
2011-07-26 16:24:49 +02:00
Emmanuele Bassi
7f8838d7cc cairo-texture: Add the :auto-resize property
Keeping the backing Cairo surface of a CairoTexture canvas in sync with
the actor's allocation is tedious and prone to mistakes. We can
definitely do better by simply exposing a property that does the surface
resize and invalidation automagically on ::allocate.
2011-07-26 14:55:19 +01:00
Emmanuele Bassi
0f8e3ab4aa bin-layout: Fix a leak
https://bugzilla.gnome.org/show_bug.cgi?id=655342
2011-07-26 13:55:24 +01:00
Emmanuele Bassi
78049c38bf docs: Fixes for building the API reference 2011-07-26 13:44:12 +01:00
Emmanuele Bassi
278daca61c cairo-texture: Deprecate create()/create_region()
The recommended way of drawing on a ClutterCairoTexture is the ::draw
signal.
2011-07-26 12:53:22 +01:00
Emmanuele Bassi
2f445682b1 cairo-texture: Use signal-based drawing
The current "create context/draw/destroy context" pattern presents
various problems. The first issue is that it defers memory management to
the caller of the create() or create_region() methods, which makes
bookkeeping of the cairo_t* harder for language bindings and third party
libraries. The second issue is that, while it's easier for
draw-and-forget texturs, this API is needlessly complicated for contents
that have to change programmatically - and it introduces constraints
like calling the drawing code explicitly after a surface resize (e.g.
inside an allocate() implementation).

By using a signal-based approach we can make the CairoTexture actor
behave like other actors, and like other libraries using Cairo as their
2D drawing API.

The semantics of the newly-introduced ::draw signal are the same as the
one used by GTK+:

  - the signal is emitted on invalidation;
  - the cairo_t* context is owned by the actor;
  - it is safe to have multiple callbacks attached to the same
    signal, to allow composition;
  - the cairo_t* is already clipped to the invalidated area, so
    that Cairo can discard geometry immediately before we upload
    the texture data.

There are possible future improvements, like coalescing multiple
invalidations inside regions, and performing clipped draws during
the paint cycle; we could even perform clipped redraws if we know the
extent of the invalidated area.
2011-07-26 12:40:52 +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
123bd41e6c texture: Clean up error reporting
ClutterTexture relies too much on GError, even for things that are
clearly programmer errors. Also, no error message passed to GError
is marked for translation as it should.

We should move the programmer errors, like passing the wrong bpp
value with regards to the presence of the alpha channel, to real
warnings; we should also try and harmonize all the error messages,
and not mention Cogl — especially in the ones marked for translation.
2011-07-18 18:06:57 +01:00
Robert Bragg
672bc337ba build: don't explicitly include and egl or gl headers
This avoids explicitly including gl or egl headers in
clutter-egl-headers.h. We were getting build failures when building
clutter against a libcogl that has runtime support for GL and GLES
because cogl-defines.h was including gl.h and then clutter-egl-headers.h
was later including GLES2/gl.h with typedef conflicts. Clutter relies on
Cogl to abstract GL and GLES and the winsys APIs like EGL and GLX so
Clutter should just rely on cogl.h to include the appropriate egl.h in
clutter-egl-headers.h.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
Reviewed-by: Neil Roberts <neil@linux.intel.com>
2011-07-18 17:07:40 +01:00
Damien Lespiau
a4b9eaf3ec alpha: Don't use the GClosure to compute the alpha when possible
Setting up the call and calling the GClosure was showing up in profiles
and seemed an easy one to remove.

Instead of calling the closure, let's remember the alpha func and the
user_data when possible (ie set_mode() and set_func()) and use it in
get_alpha().

https://bugzilla.gnome.org/show_bug.cgi?id=654727
2011-07-18 15:17:15 +01:00
Damien Lespiau
4d58534fbb text: Fix the default value of "editable"
The "editable" property is documented to default to TRUE, but is
initialized to FALSE in the _init() function.

Third party code would be affected if we changed the default to be
TRUE, so we have to change the default value in the GParamSpec.

https://bugzilla.gnome.org/show_bug.cgi?id=654726
2011-07-18 13:57:44 +01:00
Emmanuele Bassi
e25e48efb3 Do not use return with void functions
https://bugzilla.gnome.org/show_bug.cgi?id=654718
2011-07-18 13:53:16 +01:00
Emmanuele Bassi
1402c05112 timeline: Cast elapsed time before emitting ::new-frame
When emitting a new-frame signal, priv->elapsed_time is passed as a
parameter. This is a gint64. The closure marshal uses an INT. On some
platforms, this is not received correctly by signal handlers (they
receive 0). One solution is to cast priv->elapsed_time to a gint when
emitting the signal.

We cannot change the signature of the signal without breaking ABI.

https://bugzilla.gnome.org/show_bug.cgi?id=654066
2011-07-18 13:45:55 +01:00
Bastian Winkler
c9cbe58343 snap-constraint: Fix allocation for CLUTTER_SNAP_EDGE_RIGHT
Use source_with instead of source_height to calculate the the x1/x2
positions for CLUTTER_SNAP_EDGE_RIGHT

https://bugzilla.gnome.org/show_bug.cgi?id=654024
2011-07-18 13:43:29 +01:00
Emmanuele Bassi
bc1c3e003d x11/event: Avoid compiler warnings with HAVE_XGE undefined 2011-07-15 16:08:38 +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
Carlos Garnacho
075a4ed86c x11: Improve XGenericEventCookie data allocation
https://bugzilla.gnome.org/show_bug.cgi?id=654656

Clutter may be used together with GTK+, which indirectly may use
XInput2 too, so the cookie data must persist when both are handling
events.

What happens now in a nutshell is, Clutter is only guaranteed to allocate
the cookie itself after XNextEvent(), and only frees the cookie if its
XGetEventData() call allocated the cookie data.

The X[Get|Free]EventData() calls happen now in clutter-event-x11.c as
hypothetically different event translators could also handle other set
of X Generic Events, or other libraries handling events for that matter.
2011-07-15 13:46:33 +02:00
Robert Bragg
c6a0427c69 pick: Use Cogl API not GL API to disable dithering
When picking we need to disable dithering to be sure that the hardware
will not modify the colors we use as actor identifiers. Clutter was
manually calling glEnable/Disable GL_DITHER to handle this, but that was
a layering violation since Cogl is intended to handle all interactions
with OpenGL. Since we are now striving for GL vs GLES to be a runtime
choice we need to remove this last direct usage of GL from Clutter so it
doesn't have to be linked with GL at build time.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2011-07-14 13:54:16 +01:00
Robert Bragg
3183240fef Provide stable paint-boxes for fixed sized actors
This updates _clutter_paint_volume_get_stage_paint_box to try and
calculate more stable paint-box sizes for fixed sized paint-volumes by
not basing the size on the volume's sub-pixel position.

So the aim is that for a given rectangle defined with floating point
coordinates we want to determine a stable quantized size in pixels that
doesn't vary due to the original box's sub-pixel position.

The reason this is important is because effects will use this API to
determine the size of offscreen framebuffers and so for a fixed-size
object that may be animated across the screen we want to make sure that
the stage paint-box has an equally stable size so that effects aren't
made to continuously re-allocate a corresponding fbo.

The other thing we consider is that the calculation of this box is
subject to floating point precision issues that might be slightly
different to the precision issues involved with actually painting the
actor, which might result in painting slightly leaking outside the
user's calculated paint-volume. This patch now adds padding to consider
this too.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-07-14 13:54:12 +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
Robert Bragg
32487af55b Adds a CLUTTER_NEARBYINT macro for float rounding
This is a replacement for the nearbyint function which always rounds to
the nearest integer. nearbyint is a C99 function so it might not always
be available but also it seems in glibc it is defined as a function call
so this macro could end up faster anyway. We can't just add 0.5 because
it will break for negative numbers.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-07-14 13:54:05 +01:00
Robert Bragg
ad234b303c paint-volume: don't round paint-volume from allocation
The implementation of _clutter_actor_set_default_paint_volume which
simply uses the actor's allocation to determine a paint-volume was
needlessly using the allocation rounded to integers by internally using
clutter_actor_get_allocation_geometry instead of
clutter_actor_get_allocation_box. This was introducing a lot of
instability into the paint-volume due to the way rounding was done.

The code has now been updated to use clutter_actor_get_allocation_box
so we are dealing with the floating point allocation instead.

Signed-off-by: Neil Roberts <neil@linux.intel.com>
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-07-14 13:54:01 +01:00
Tomeu Vizoso
01cf70594d Make sure the gesture is cancelled even if we miss the release event 2011-07-14 13:11:12 +02:00
Tomeu Vizoso
439c7e6ee7 Remove unneeded class closure 2011-07-14 11:46:12 +02:00
Emmanuele Bassi
18b3da95ef osx: Code style cleanups 2011-07-13 19:33:11 +01:00
Tomeu Vizoso
c8e3db105c Add default closures for the signals in ClutterGestureAction
Also make sure we cancel the gesture as soon as we know we have to
2011-07-13 19:15:20 +02:00
Dinh Bowman
48426c28bf Fixed typo of bidng to bind
https://bugzilla.gnome.org/show_bug.cgi?id=654103
2011-07-13 15:19:22 +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
a72237b876 clutter-stage: Add clutter_stage_get_redraw_clip_bounds
This adds a public function to get the bounds of the current clipped
redraw on a stage. This should only be called while the stage is being
painted. The function diverts to a virtual function on the
ClutterStageWindow implementation. If the function isn't implemented
or it returns FALSE then the entire stage is reported. The clip bounds
are in integer pixel coordinates in the stage's coordinate space.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2421
2011-07-13 13:54:50 +01:00
Damien Lespiau
25a7435a86 uprof: Add the units in the name of the "Per Frame" timer attribute
So it shows up in the profile report. Take the opportunity to write a
better long description for the attribute.

https://bugzilla.gnome.org/show_bug.cgi?id=654363
2011-07-12 10:57:18 +01:00
Robert Bragg
ab6be41ea0 build: update cogl_onscreen_x11 syms to cogl_x11_onscreen
Cogl recently renamed symbols with the form
cogl_onscreen_<platform>_blah to be consistent with other platform
specific APIs so they are now named like cogl_<platform>_onscreen_blah.
This makes the corresponding change to clutter.
2011-07-11 16:59:26 +01:00
Robert Bragg
d182d5a171 backend-cogl: update _get_egl_context symbol name
Cogl changed has changed the name of cogl_context_egl_get_egl_context to
cogl_egl_context_get_egl_context to be consistent with other platform
specific symbols.
2011-07-11 16:59:26 +01:00
Robert Bragg
71d0872b76 don't call cogl_set_default_context since it's been removed
cogl_set_default_context has been removed from Cogl so this updates
Clutter in-line with that change.
2011-07-11 16:59:26 +01:00
Damien Lespiau
c17ddfd6a9 uprof: Rename timers to remove the EGL specific bits
Cogl abstracts the winsys, Remove the egl prefix from the timer names.

https://bugzilla.gnome.org/show_bug.cgi?id=654361
2011-07-11 01:53:53 +01:00