Commit Graph

4914 Commits

Author SHA1 Message Date
Emmanuele Bassi
f4e971a7e5 cairo-texture: Use an internal function for create_region()
Avoid double argument checking, and a deprecation warning when
implementing create() as a wrapper around create_region(), by using
a simple internal function.
2011-11-02 13:00:46 +00:00
Emmanuele Bassi
b19c919645 actor: Move deprecated symbols into separate headers
The clutter-actor.h header is already pretty big, so let's try to keep
the deprecated symbols out of it.
2011-11-02 13:00:46 +00:00
Emmanuele Bassi
40d703a005 backend: Move deprecated symbols to a separate header 2011-11-02 13:00:46 +00:00
Emmanuele Bassi
a39be454cf main: Move deprecated symbols to a separate header
The number of deprecations in clutter-main.h makes the header harder to
parse, and more confusing. We can use a separate header under the
deprecated subdirectory to hold all the deprecated symbols.
2011-11-02 13:00:46 +00:00
Robert Bragg
6e28121ff3 cogl: include <cogl/cogl-xlib.h> for xlib specific symbols
Since Xlib.h is such a terrible citizen when it comes to symbol
namespacing it's not desirable to include Xlib.h if it is not absolutely
required. Cogl now has a standalone cogl-xlib.h that should be included
whenever any xlib specific symbols are required.

This patch updates clutter to include <cogl/cogl-xlib.h> wherever
clutter needs to use xlib specific cogl apis.

Acked-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-11-01 16:24:00 +00:00
Emmanuele Bassi
0bfda78615 profile: Disable deprecation warnings
We use an atexit() handler to print out the profile report coming from
Uprof. The g_atexit() call has been deprecated by GLib, but since this
use case is pretty specific and it's not meant to be turned on by
default (or distributed) then we can safely disable the deprecation
warnings inside clutter-profile.c.
2011-10-31 10:39:46 +00:00
Emmanuele Bassi
09de87b0e5 backend: Remove atexit handlers
The g_atexit() function has been deprecated in GLib as it is a fairly
bad idea in basically all cases.

We could probably use a GCC destructor if we didn't care about
portability, but for the time being we just remove the atexit() handler
that disposed the backend.
2011-10-31 10:33:46 +00:00
Emmanuele Bassi
d97a8c431b cairo-texture: Drop the half pixel rounding
Calling ceilf() should be enough.

https://bugzilla.gnome.org/show_bug.cgi?id=661887
2011-10-31 10:33:46 +00:00
Chun-wei Fan
0406e235bf Merge branch 'master' into msvc-support-master 2011-10-26 12:55:05 +08:00
Emmanuele Bassi
81a82867e1 docs: Clarify CLUTTER_ACTOR_IS_MAPPED
There are a couple of gotchas in the 'mapped' flag that are not properly
documented, or are documented only in the actor_invariants.txt file; we
should have a proper description in the API reference as well, to avoid
confusion.
2011-10-25 11:35:04 +01:00
Chun-wei Fan
8c196c9403 Bug 662071-[Win32]-Don't init the Big Clutter Lock
Since the Windows GUI system is assuming multithreadedness, initializing
locks after entering the GUI portion on Windows is likely to cause
problems[1][2], which results many Clutter programs to crash due to
releasing resources that they did not own.

[1]: Multi-threaded use of GTK+ on Win32 in README.win32 of GTK+
     source package
[2]: Explanation of Windows GUI system regarding its multithreadness
     assumptions-
     http://mail.gnome.org/archives/gtk-list/2011-June/msg00005.html
2011-10-25 01:27:51 +08:00
Chun-wei Fan
7c6038d77b Bug 662071-[Win32]-Don't init the Big Clutter Lock
Since the Windows GUI system is assuming multithreadedness, initializing
locks after entering the GUI portion on Windows is likely to cause
problems[1][2], which results many Clutter programs to crash due to
releasing resources that they did not own.

[1]: Multi-threaded use of GTK+ on Win32 in README.win32 of GTK+
     source package
[2]: Explanation of Windows GUI system regarding its multithreadness
     assumptions-
     http://mail.gnome.org/archives/gtk-list/2011-June/msg00005.html
2011-10-25 00:13:53 +08:00
Chun-wei Fan
0f9eded1c3 Revert "Don't init the Big Clutter Lock on Win32"
This reverts commit f6acae9f3d.
2011-10-25 00:01:24 +08:00
Chun-wei Fan
f6acae9f3d Don't init the Big Clutter Lock on Win32
Since the Windows GUI system is assuming multithreadedness, initializing
locks after entering the GUI portion on Windows is likely to cause
problems[1][2], which results many Clutter programs to crash due to
releasing resources that they did not own.

[1]: Multi-threaded use of GTK+ on Win32 in README.win32 of GTK+ source package
[2]: Explanation of Windows GUI system regarding its multithreadness
     assumtopns-http://lists-archives.org/gtk/12724-compiling-a-gtk-application-on-windows.html
2011-10-24 17:17:39 +08:00
Emmanuele Bassi
5540e6bd9c docs: Document the behaviour in case of init failure
Or, better, the fact that the behaviour of any Clutter function will be
undefined in case the initialization fails.

The value returned by clutter_init() and friends has to be handled
properly.
2011-10-21 21:19:27 +01:00
Chun-wei Fan
fedca055e9 Revert "Revert "Deprecate clutter_threads_init()""
This reverts commit 5419c11c99.

This is another part to attempt to investigate on error 0xC0000264
on Windows
2011-10-21 17:44:27 +08:00
Chun-wei Fan
e0ad11a193 Revert "clutter-main.c: Fix multiple declarations"
This reverts commit 3d74552684.

This is a part to attempt to further investigate about the 0xC0000264 error
on Windows
2011-10-21 17:43:21 +08:00
Chun-wei Fan
3d74552684 clutter-main.c: Fix multiple declarations
clutter_threads_impl_lock/clutter_threads_impl_unlock was accidently
defined 2 times during the revert-fix that.
2011-10-20 15:42:55 +08:00
Chun-wei Fan
d6af2e54c8 Merge branch 'master' into msvc-support-master 2011-10-20 15:41:46 +08:00
Chun-wei Fan
5419c11c99 Revert "Deprecate clutter_threads_init()"
This reverts commit 7e3a75c66b.

Conflicts:

	clutter/clutter-main.c
	clutter/clutter-main.h
2011-10-20 15:17:25 +08:00
Robert Bragg
63cc5ab698 blur: don't accumulate texture padding twice
This removes the create_texture implementation for ClutterBlurEffect
because we already account for padding in the get_paint_volume
implementation so we were creating textures larger than necessary.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-10-19 15:27:03 +01:00
Emmanuele Bassi
a18a8a3ae2 Avoid the shadowing of 'clone'
The clone() call can creep into the build environment, so it's a good
thing to avoid using 'clone' as a variable name.
2011-10-19 15:23:55 +01:00
Chun-wei Fan
e33a6219d8 Merge branch 'master' into msvc-support-master 2011-10-18 15:48:17 +08:00
Emmanuele Bassi
8083dd5178 docs: Improve documentation of LayoutManager
Especially with regards to layout properties and their usage inside a
ClutterScript UI definition.
2011-10-17 11:48:47 +01:00
Chun-wei Fan
8b5d255a2b Update clutter.symbols
_clutter_shader_release_all is removed...
2011-10-17 18:37:32 +08:00
Emmanuele Bassi
be4007ef53 Remove mentions of clutter_redraw() 2011-10-17 10:25:07 +01:00
Emmanuele Bassi
146e15297f debug: Clean up debugging notes 2011-10-17 10:24:25 +01:00
Chun-wei Fan
b1780711f7 Merge branch 'master' into msvc-support-master 2011-10-17 15:52:57 +08:00
Emmanuele Bassi
1e51961f7a align-constraint: Add CLUTTER_ALIGN_BOTH
Just like ClutterBindConstraint has two shorthand enumerations for binding
position and size and avoid using multiple instances, ClutterAlignConstraint
should have a way to align an actor with the same alignment factor on both
axis at the same time; this is especially useful for centering actors.
2011-10-15 18:36:27 +01:00
Emmanuele Bassi
7f3363e1db Tag all deprecated symbols using CLUTTER_DEPRECATED
This requires some minor surgery in the build to disable the deprecation
warnings in the deprecated classes.
2011-10-14 11:34:38 +01:00
Emmanuele Bassi
a063f09611 debug: Move paint-deform-tiles to CLUTTER_PAINT
The CLUTTER_DEBUG class of debugging flags is meant for debugging notes,
while the CLUTTER_PAINT debugging flags are for changing the output of
the paint cycle. Painting the DeformEffect tiles should go in the latter.
2011-10-13 11:38:27 +01:00
Emmanuele Bassi
ef1a3a5477 docs: Include test-threads.c in the API reference
We can use the test-threads.c interactive test as part of the documentation
on how to use threads with Clutter.
2011-10-13 10:42:30 +01:00
Emmanuele Bassi
e0283993f4 Avoid using deprecated API internally
Use the proper API to implement deprecated functions.
2011-10-12 16:44:55 +01:00
Emmanuele Bassi
72da6f808e texture: Disable deprecation warnings
Sadly, ClutterTexture is still using internally deprecated API, like
clutter_actor_get_shader().
2011-10-12 12:36:41 +01:00
Chun-wei Fan
0ee89f1788 clutter-backend-win32.c: Include clutter-shader.h
This is needed for _clutter_shader_release_all to avoid C4013
errors/warnings (a.k.a implicit declaration of ...)
2011-10-12 17:50:32 +08:00
Emmanuele Bassi
53d9e88135 Remove _clutter_shader_release_all()
This function is called when the backend is being disposed - as a way
of releasing all ClutterShader. This doesn't take into account three
things:

  - ClutterShader is deprecated
  - the Backend is *never* disposed
  - once the process terminates, all its resources are automatically
    released by the OS

So the _clutter_shader_release_all() function is a pointless exercise
in futility.
2011-10-12 10:36:17 +01:00
Chun-wei Fan
a2bd2afb93 clutter/Makefile.am
The previous update on clutter-timeout-interval.[ch] is wrong, so correct
that and add $(deprecated_c_priv) to the VS sources list.  Sorry.
2011-10-12 17:33:33 +08:00
Chun-wei Fan
15cafc4c77 clutter/Makefile.am: Update formatting from last commit 2011-10-12 17:30:08 +08:00
Chun-wei Fan
830d6887cd clutter/Makefile.am: Made up for missed sources
The clutter/deprecated/clutter-timeout-interval.c is missed from the
deprecated_c sources list...
2011-10-12 17:26:31 +08:00
Chun-wei Fan
e0de326b2a clutter/clutter-keysyms-table.c: Fix function name
The function name is clutter_unicode_to_keysym, not
clutter_unicode_to_keyval
2011-10-12 17:25:37 +08:00
Chun-wei Fan
cb98da4a9d Update clutter.symbols 2011-10-12 17:24:36 +08:00
Chun-wei Fan
762a4350d1 Update VS support
-clutter/Makefile.am: Include the deprecated sources as well
-clutter.vc(x)projin: Add clutter/deprecated into the "Additional Include
 Directories"
2011-10-12 17:02:08 +08:00
Chun-wei Fan
72bedbc4e9 Update clutter.symbols
For deprecation of APIs, in commits
522b8be3 (clutter_get_input_device_for_id())
6ef09dd1 (clutter_clear_glyph_cache())
01080dc5 (clutter_[sg]et_font_flags())
2011-10-12 16:17:27 +08:00
Chun-wei Fan
bd991e625b Merge branch 'master' into msvc-support-master 2011-10-12 14:37:19 +08:00
Emmanuele Bassi
193b345786 Remove some compiler warnings
Some issues found using clang as the compiler.
2011-10-11 23:42:23 +01:00
Emmanuele Bassi
2ede853ea3 Fix included header 2011-10-11 23:11:56 +01:00
Emmanuele Bassi
af7afc29a7 Add a Clutter-specific deprecation macro for symbols
Just like GLIB_DEPRECATED and GLIB_DEPRECATED_FOR, Clutter should have
its own wrappers for G_DEPRECATED and G_DEPRECATED_FOR, to allow opting
out of deprecation warnings.

Deprecation warnings are enabled by default, now, even when building
Clutter.
2011-10-11 23:03:09 +01:00
Emmanuele Bassi
b34e89e0c5 Fix duplicate typedef of ClutterAlpha
Caught on OS X but not on my Fedora machine. Weird.
2011-10-11 23:02:17 +01:00
Emmanuele Bassi
7bd5659962 Do not leak strings from GKeyFile
The string getters always copy, so we need to free the returned
values.
2011-10-11 22:45:14 +01:00
Emmanuele Bassi
809298b5a2 Move more typedefs into clutter-types.h 2011-10-11 17:59:50 +01:00
Emmanuele Bassi
d28e04be72 Move all enumerations to a separate file
This should allow sharing types, and we can avoid glib-mkenums thrawling
the whole repository for enumerations.
2011-10-11 17:59:46 +01:00
Emmanuele Bassi
a21f1d1580 Move clutter-fixed.[ch] to the deprecated section 2011-10-11 17:58:40 +01:00
Emmanuele Bassi
62d72b8690 Move ClutterBehaviour to the deprecated section 2011-10-11 17:58:40 +01:00
Emmanuele Bassi
e268201221 Minor header surgery to ClutterBehaviour
This moves a couple of definitions to the common types header, and makes
sure that ClutterBehaviour subclasses include clutter-behaviour.h first,
so that their types can be fully expanded without necessarily have the
ClutterBehaviour header header included by their public headers. This is
the necessary prelude to have clutter-behaviour.[ch] moved to the
deprecated section.
2011-10-11 17:58:40 +01:00
Emmanuele Bassi
bcd7845d91 Move ClutterBehaviour subclasses to the deprecated section
Moving ClutterBehaviour itself will require some minor header surgery,
so we'll do that next.
2011-10-11 17:58:40 +01:00
Emmanuele Bassi
e57f8c26f6 Move ClutterShader to the deprecated section 2011-10-11 17:58:40 +01:00
Emmanuele Bassi
4b33a9c5f4 Move ClutterScore to the deprecated section 2011-10-11 17:58:39 +01:00
Emmanuele Bassi
4b748f4334 Move timeout pool to the deprecated section 2011-10-11 17:58:39 +01:00
Emmanuele Bassi
50cda9fed1 build: Move deprecated code into its own prefix
The code that has been deprecated should live into its own directory,
both in the repository and when installed. This should make it clear
which functionality is actually maintained and which is not.

We start with an oldie: the frame source API.
2011-10-11 17:58:35 +01:00
Emmanuele Bassi
372b39fd63 Add more sections to the Clutter configuration file
On top of the existing "Settings" group in the settings.ini file we
should have two more groups:

  Environment   - contains all the configuration possible through
                  environment variables
  Debug         - contains all the possible debug variables
2011-10-11 17:52:17 +01:00
Emmanuele Bassi
f5eee5aec7 Add a configuration file for ClutterSettings
ClutterSettings should be able to load its initial state by using
configuration files in SYSCONFDIR and XDG_CONFIG_HOME. This allows
Clutter to have a system (and user) configuration on platforms that
do not have XSETTINGS bridges.
2011-10-11 17:20:20 +01:00
Emmanuele Bassi
01080dc5f3 Deprecate clutter_[sg]et_font_flags()
We already have two mechanisms for controlling the font rendering
quality on a per-application basis:

  • ClutterSettings properties
  • clutter_backend_set_font_options()

The font flags were always a stop-gap solution, and one that tried to
simplify a fairly complex issue beyond the point of actually being
useful.

https://bugzilla.gnome.org/show_bug.cgi?id=660786
2011-10-11 17:19:42 +01:00
Emmanuele Bassi
6ef09dd15b Deprecate clutter_clear_glyph_cache()
This is a wrapper function for API that has long since been public.
2011-10-11 17:19:08 +01:00
Emmanuele Bassi
522b8be306 Deprecate clutter_get_input_device_for_id()
We have the ClutterDeviceManager methods for that.
2011-10-11 17:19:08 +01:00
Emmanuele Bassi
b6dd306998 Clean up grab implementation
The grab API is a relic of Clutter 0.6, and hasn't been through proper
vetting in a *long* time — mostly due to the fact that we don't really
like grabs, and point to the ::captured-event as a way to implement
"soft grabs" in toolkits and applications.

The implementation of full and device grabs uses weak references on
actors instead of using the ::destroy signal, which is meant exactly for
the case of releasing pointers to actors when they are disposed.

The API naming scheme is also fairly broken, especially for
device-related grabs.

Finally, keyboard device grabs are just not implemented.

We can, in one go, clean up this mess and deprecate a bunch of badly
named API by introducing generic device grab/ungrab methods on
ClutterInputDevice, and re-implement the current API on top of them.
2011-10-11 17:15:34 +01:00
Chun-wei Fan
93f2b3d60d Update clutter.symbols
Due to an added API in commits 25b7b30c (clutter_unicode_to_keysym)
2011-10-11 17:24:58 +08:00
Chun-wei Fan
1cf7128540 Merge branch 'master' into msvc-support-master 2011-10-11 17:19:45 +08:00
Emmanuele Bassi
33846dcf4d Deprecate clutter_redraw()
It's just a badly named proxy to clutter_stage_ensure_redraw().
2011-10-10 15:48:43 +01:00
Emmanuele Bassi
51ca20e81e Cosmetic fixes 2011-10-10 15:42:36 +01:00
Emmanuele Bassi
b5109e852a animation: Use the timeline's new-frame signal
Instead of using the ClutterAlpha's notify::alpha. This makes the code
less dependent on GObject's property notification.
2011-10-07 16:56:21 +01:00
Emmanuele Bassi
7e3a75c66b Deprecate clutter_threads_init()
GLib deprecated g_thread_init(), and threading support is initialized
by GObject, so Clutter already runs with threading support enabled. We
can drop the clutter_threads_init() call requirement, and initialize the
Big Clutter Lock™ on clutter_init(). This reduces the things that have
to be done when dealing with threads with Clutter, and the things that
can possibly go wrong.
2011-10-07 15:57:32 +01:00
Emmanuele Bassi
32b8217027 Use a static mutex for the default Clutter lock
The Big Clutter Lock™ can now be a static GMutex, since GLib supports
them. We can also drop a bunch of checks given the recent changes in
GLib threading API.
2011-10-07 15:10:37 +01:00
Emmanuele Bassi
389d247278 texture: Drop G_MUTEX_INIT
The static initializer for GMutex has been removed from GLib.

The g_thread_supported() call can also be removed: threading is always
enabled in GLib ≥ 2.31.
2011-10-07 15:09:47 +01:00
Marc-André Lureau
6d974f278e Mark clutter_state_set_key() source_state_name as nullable
https://bugzilla.gnome.org/show_bug.cgi?id=661022
2011-10-07 12:11:52 +01:00
Zan Dobersek
25b7b30ccc Add clutter_unicode_to_keyval function
This commit introduces a unicode-to-keyval conversion function that
performs identical action as the gdk version of that function. Also
added is the necessary table holding all the conversion values.

https://bugzilla.gnome.org/show_bug.cgi?id=661015
2011-10-07 12:11:20 +01:00
Sunjin Yang
5dbc00e625 box-layout: Plug memory leaks
https://bugzilla.gnome.org/show_bug.cgi?id=660985
2011-10-07 11:53:02 +01:00
Chun-wei Fan
d86a6d8df4 Update clutter.symbols
...Due to the addtion of clutter_actor_has_actions,
   clutter_actor_has_contraints and clutter_actor_has_effects APIs
2011-10-06 12:53:41 +08:00
Chun-wei Fan
b55656b698 Merge branch 'master' into msvc-support-master 2011-10-06 12:04:30 +08:00
Emmanuele Bassi
938fcc60f0 Deprecate the GParamSpec for CoglFixed
The fixed-point API is not used anywhere, and it's pretty much useless
to have a fixed-point type for properties.
2011-10-04 10:32:27 +01:00
Håkon Løvdal
839b939d36 spelling fix: timeour -> timeout 2011-10-03 15:58:42 +01:00
Adel Gadllah
d331e92742 clutter-actor-meta: Fix _clutter_meta_group_has_metas_no_internal
This function is backwards i.e it is supposed to check for metas that
are *not* internal, hence the name.

https://bugzilla.gnome.org/show_bug.cgi?id=660623
2011-10-01 12:40:11 +02:00
Emmanuele Bassi
6377d3646b paint-volume: Don't try to complete a completed volume
If we do project() → get_bounding_box(), we'll try to complete the
volume twice, which whacks out all the lazily computed vertices.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-09-30 17:05:15 +01:00
Neil Roberts
8b995a9457 clutter-shader-effect: Add a get_static_shader_source virtual
This is used as an alternative to calling
clutter_shader_effect_set_shader_source. A ClutterShaderEffect
subclass is now expected to implement this method to return the source
for the effect that will be used for all instances of this
subclass. It is only called once regardless of the number of instances
created. That way Clutter can avoid recompiling the shader source for
every new instance of the effect.

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

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-09-30 11:51:37 +01:00
Adel Gadllah
e8ec7ebed0 ClutterActor: Add clutter_actor_has_actions
Adds an efficent way to query whether an actor has any
applied actions.

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

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

https://bugzilla.gnome.org/show_bug.cgi?id=660471
2011-09-29 19:34:24 +02:00
Chun-wei Fan
f0dfd8ab07 Merge branch 'master' into msvc-support-master
Conflicts:
	tests/interactive/Makefile.am
2011-09-29 16:33:02 +08:00
Emmanuele Bassi
b1fbbe23b4 Revert "Add lightness, brightness, and contrast effects"
Discussed a bit with Neil, and I might have jumped the gun a little.
We might want a different API for 1.10. See comment 12 on:

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

This reverts commit 4829ae1c79.
2011-09-28 15:54:32 +01:00
Joseph Scheuhammer
4829ae1c79 Add lightness, brightness, and contrast effects
Added three classes for new clutter effects:  inverse lightness,
modify brightness, and modify contrast.

https://bugzilla.gnome.org/show_bug.cgi?id=656156
2011-09-28 10:32:15 -04:00
Emmanuele Bassi
56c7d9b0b3 texture: Simplify asynchronous loading code
The asynchronous loading code could do with some modernization.

First of all, we should drop the internal GMutex held when manipulating
the boolean flags: it's far too expensive for its role, and modern GLib
provides us with bitlocks that are quite a lot faster.

Then we should consolidate most of the implementation into something
smaller and more manageable.
2011-09-28 13:52:53 +01:00
Emmanuele Bassi
11c585c420 texture: Remove GStaticMutex
It's now possible to statically initialize a GMutex.
2011-09-28 13:52:53 +01:00
Tomeu Vizoso
39db46123e Add paint-deform-tiles option to CLUTTER_DEBUG
To make easier to visualize the triangles in a ClutterDeformEffect

https://bugzilla.gnome.org/show_bug.cgi?id=660354
2011-09-28 14:28:04 +02:00
Chun-wei Fan
9e822d9ae4 Merge branch 'master' into msvc-support-master 2011-09-27 14:35:26 +08:00
Emmanuele Bassi
1776ac8ed5 Remove internal usage of ClutterGeometry in StageWindow
The ClutterGeometry type is a poor substitute of cairo_rectangle_int_t,
with unsigned integers for width and height to complicate matters.

Let's remove the internal usage of ClutterGeometry and switch to the
rectangle type from Cairo.

https://bugzilla.gnome.org/show_bug.cgi?id=656663
2011-09-26 12:05:55 +01:00
Colin Walters
d3bafc4b09 clutter-main: Reword translator comment for default:LTR
This makes it much clearer, and fixes some typos in the original.

https://bugzilla.gnome.org/show_bug.cgi?id=659893
2011-09-23 17:48:34 +01:00
Alexandre Franke
a23e59bd66 Mark forgotten string as translatable
https://bugzilla.gnome.org/show_bug.cgi?id=659928
2011-09-23 17:48:34 +01:00
Neil Roberts
f8d808f140 Add a CLUTTER_PAINT debug option to enable continous redrawing
When testing the performance of an application, it's often useful to
force it to continuously redraw instead of going idle to help measure
the frame rate. This just adds a CLUTTER_PAINT=continuous-redraw which
causes the master clock to queue a redraw on all of the stages
just before it prepares its source.

Reviewed-by: Robert Bragg <robert@linux.intel.com>
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-09-23 15:31:50 +01:00
Neil Roberts
c67d3e5b52 clutter-offscreen-effect: Apply matrix expansion to proj not mv
When the viewport gets expanded because the actor extends off the edge
of the screen, instead of applying the transformation to the root of
the modelview transformation it is now applied to the end of the
projection transformation. This should end up with the same
transformation. This fixes a problem when the offscreen effects are
nested and the inner effect would try to pick up the current modelview
transformation to rescale it to fit the new viewport size. In this
case the modelview would have already been scaled for the size of the
outer viewport so it would end up wrong.

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

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
Reviewed-by: Robert Bragg <robert@linux.intel.com>
2011-09-22 12:28:59 +01:00
Emmanuele Bassi
8051c47664 Fix typo in ClutterSettings:password-hint-time blurb 2011-09-19 23:14:04 +01:00
Emmanuele Bassi
93ece6dd7b text: Implement password hint
A ClutterText in password mode should have the ability to show the last
input character. This feature allows easier password entry on platforms
with unreliable keyboards, such as touchscreens or small devices.

https://bugzilla.gnome.org/show_bug.cgi?id=652588
2011-09-19 20:26:37 +01:00
Emmanuele Bassi
07912a147d settings: Add password-hint-time property
Add a setting that controls whether ClutterText actors in password mode
should display the last input character for a defined time. This helps
on touch-based interfaces.

https://bugzilla.gnome.org/show_bug.cgi?id=652588
2011-09-19 20:26:37 +01:00
Tomeu Vizoso
4396bec330 Queue a redraw when removing an effect by name
https://bugzilla.gnome.org/show_bug.cgi?id=659501
2011-09-19 20:01:32 +01:00
Craig R. Hughes
fcc2ab7be5 Fix calculation of duration for ClutterState default transitions
https://bugzilla.gnome.org/show_bug.cgi?id=659200
2011-09-19 18:29:39 +01:00
Robert Bragg
96866804f0 actor: consider empty pv ok in set_default_paint_volume
In _clutter_actor_set_default_paint_volume we were returning FALSE if an
actor has an empty allocation because we were claiming it doesn't have a
paint-volume. Actually an empty/degenerate pv is valid and has different
semantics to returning FALSE because FALSE means the pv is unknown and
so Clutter will have to assume the worst - that the pv is basically
un-bounded.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-09-19 14:52:46 +01:00
Robert Bragg
239fc43c5f stage: implicitly clip to stage window bounds
This implicitly intersects any clip for redrawing with the stage window
bounds. Without this we were sometimes trying to set huge off screen
scissors leading to undefined clipping results.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-09-19 14:48:31 +01:00
Robert Bragg
662d12aeff actor: add oob-transform opt to catch out-of-band transforms
Out-of-band transforms are considered to be all actor transforms done
directly with the Cogl API instead of via ClutterActor::apply_transform.

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

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

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-09-19 14:48:06 +01:00
Chun-wei Fan
9f12ec534e msvc-support: Recover wrecked branch
Recover the branch! :|
2011-09-16 17:25:47 +08:00
Rui Matos
41bd15226f text: We still have to paint the actor if the cursor is visible
https://bugzilla.gnome.org/show_bug.cgi?id=659116
2011-09-15 10:43:04 +01:00
Jasper St. Pierre
1883ee13f9 text: Take out a nonsense fallback
Invisible text is the best surprise for an update!

https://bugzilla.gnome.org/show_bug.cgi?id=659069
2011-09-14 21:49:45 -04:00
Emmanuele Bassi
a9a104e109 docs: Fixes for cross-references 2011-09-12 13:12:14 +01:00
Emmanuele Bassi
7ace3c2fdd docs: Fix clutter_box_packv() link 2011-09-12 12:36:31 +01:00
Emmanuele Bassi
27502af591 actor: Pack bitfields in ClutterActorPrivate
Bitfields should go at the end, to avoid holes in the middle of the
struct.
2011-09-12 11:33:18 +01:00
Matthias Clasen
5781beb22d cally: Fix up event listener registration minimally
For god-knows-what reason, at-spi is trying various formats
of strings when registering listeners, triggering an ugly

(gnome-shell:4411): Clutter-WARNING **: invalid object type create

warning in .xsession-errors. Stop doing that.

Also don't leak temporary string arrays that are a side-effect
of passing parameters around as formatted strings.

https://bugzilla.gnome.org/show_bug.cgi?id=658721
2011-09-11 10:57:25 -04:00
Emmanuele Bassi
c5ba998d64 stage: Protect call to unrealize() in dispose
Do not call ClutterStageWindow::unrealize() if the Stage has already
been unrealized.
2011-09-09 13:53:33 +01:00
Emmanuele Bassi
598e7a4a7e cogl/stage: Protect against multiple invocation of unrealize() 2011-09-09 13:52:55 +01:00
Emmanuele Bassi
bcd37e2e3d script: Hide private symbols
A bunch of private functions we use when parsing got exposed accidentaly
to the list of public symbols by virtue of not having the leading '_'
that we use to filter them out of the shared object — all the while the
header that declares them is a private, non installed one.

Let's rectify this situation with a bit of minor surgery on the code.
2011-09-07 16:14:10 +01:00
Emmanuele Bassi
9f70ea8dee text: Pack all bitfields at the end of the private structure
Don't leave them in the middle, to avoid holes.
2011-09-07 15:37:09 +01:00
Emmanuele Bassi
0c22246bea text: Clear up priv->text checks
The priv->text field cannot ever be NULL, so we don't need to check for
that in a series of places. We also need to assert() that pre-condition
in the couple of places where we set the contents of the ClutterText
actor, namely in set_text_internal() and set_markup_internal().

Based on a patch by: Dan Winship <danw@gnome.org>

http://bugzilla.clutter-project.org/show_bug.cgi?id=2629
2011-09-07 15:37:09 +01:00
Emmanuele Bassi
320bdeac03 text: Consistently protect against NULL strings
When calling clutter_text_set_text_internal() or
clutter_text_set_markup_internal() we need to make sure to pass a
non-NULL string.
2011-09-07 15:37:09 +01:00
Emmanuele Bassi
2af7ac4c13 actor: Fix annotations for out Vertex parameters 2011-09-07 13:00:35 +01:00
Emmanuele Bassi
0bd1e47b22 text: Make :use-markup set idempotent
Setting :use-markup and :text is currently not idempotent, and it
depends on the ordering, e.g.:

  g_object_set (actor, "use-markup", TRUE, "text", value, NULL);

does not yield the same results as:

  g_object_set (actor, "text", value, "use-markup", TRUE, NULL);

This is particularly jarring when using ClutterText from ClutterScript,
but in general GObject properties should not rely on the order when used
from g_object_set().

The fix is to store the contents of the ClutterText as a separate string
from the displayed text, and use the contents, instead of the displayed
text, when toggling the :use-markup property.

Let's also add a unit test for good measure, to try and catch
regressions.

https://bugzilla.gnome.org/show_bug.cgi?id=651940
2011-09-07 13:00:35 +01:00
Emmanuele Bassi
967bd3ac58 docs: Update test-easing and xinclude it into ClutterAnimation
The easing test is a nice example of what ClutterAnimation and
clutter_actor_animate() can do. The "tween ball to the pointer
event coordinates" is a bit of a staple in animation libraries
and their documentation.
2011-09-05 17:22:15 +01:00
Emmanuele Bassi
7024f1cd02 static-colors: Simplify the defines
Use a "private" macro to simplify the defined static colors.
2011-09-05 17:22:14 +01:00
Emmanuele Bassi
359ed2b29f text: Make :line-wrap actually work
When we paint a ClutterText we ask the actor for a PangoLayout that fits
inside the actor's allocation - both width and height.

Sadly, whenever a height is set on a PangoLayout, Pango will wrap its
contents - regardless of whether the layout should actually wrap or not.

This means that in certain easy to exploit cases, Clutter will paint a
Text actor with its contents wrapping even if the :wrap property is set
to FALSE.

In order to fix this we need to encode some more cases inside the
::paint implementation of ClutterText, and ask the cache for a layout
that is sized as the allocation's width, but not as its height; we also
need to perform a clip if we detect that the PangoLayout's logical size
is going to overflow the allocated size. This clip might cause some
performance issue, given that clipping breaks batching in the Cogl
journal; hopefully all clips for text are going to be screen-aligned, so
at the end of the batch it'll just scissor them out.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2339
2011-09-05 17:22:14 +01:00
Dan Winship
73d3026dd1 clutter-flow-layout: fix non-0,0 offset allocation
https://bugzilla.gnome.org/show_bug.cgi?id=649631
2011-09-05 12:21:18 -04:00
Emmanuele Bassi
a676ae67f7 docs: Fix up deprecation notice for BehaviourScale 2011-09-02 15:51:56 +01:00
Emmanuele Bassi
4255a75940 docs: Fix the ClutterTimeline:auto-reverse link 2011-09-02 15:49:05 +01:00
Emmanuele Bassi
79e152b7a0 docs: Inline test-constraints.c inside BindConstraint's description 2011-09-02 15:48:27 +01:00
Emmanuele Bassi
0d6208f36e docs: Inline test-drop.c into DropAction's description
Also, mention that DropAction only works with DragAction.
2011-09-02 15:22:08 +01:00
Emmanuele Bassi
8775642e82 docs: Include test-drag as the DragAction example 2011-09-02 14:53:56 +01:00
Emmanuele Bassi
66607dec4d bind: Check that the source is not contained inside the actor
Like commit d0439cfb586ca14282c89035119a4acbc0295df7 for
AlignConstraint, let's check that the BindConstraint source is not
a child or a grandchild of the actor attached to the Constraint.
2011-09-02 14:53:55 +01:00
Emmanuele Bassi
e6dbdb444d align: Check that source is not contained inside the actor
AlignConstraint won't work if the source is a child or a grandchild of
the ClutterActorMeta:actor to which it has been attached to: the
allocation flows from the parent to its children, not the other way
around; in order to avoid weirdness, we better document and check
that when we set the actor and when we set the source.
2011-09-02 14:53:55 +01:00
Emmanuele Bassi
83060b30d1 docs: Remove mentions of "frames" in Timeline
We still have some really old naming lying around.
2011-09-02 13:54:57 +01:00
Emmanuele Bassi
63a05fca9d Lock the main context when modifying the repaint functions list
The repaint functions list can (and should) be manipulated from
different threads, but it currently doesn't prevent multiple threads
from accessing it concurrently. We should have a simple lock and take it
when adding and removing elements from the list; the invocation is still
performed under the Big Clutter Lock™, so it doesn't require special
handling.
2011-09-01 17:12:46 +01:00
Robert Bragg
0aacbd47b7 actor: make offscreen_redirect prop take flags + default off
Because we have had several reports about significant performance
regressions since we enabled offscreen redirection by default for
handling correct opacity we are now turning this feature off by default.

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

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

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

The default value if actor::redirect_offscreen is now 0 which
effectively means don't ever redirect the actor offscreen.
2011-08-30 16:20:16 +01:00
Emmanuele Bassi
d847d43f70 actions/drag: Be more reliable when destroying the drag handle
Whenever the drag handle gets destroyed mid-drag we need to cancel any
current drag operation and reset the state of the DragAction.

https://bugzilla.gnome.org/show_bug.cgi?id=657681
2011-08-30 13:33:20 +01:00
Alejandro Piñeiro
f1a7cd7c0f Merge branch 'atkwindow' 2011-08-30 12:26:35 +02:00
Emmanuele Bassi
368c916c7f layout-managers: Take into account the allocations's origin
If an actor using a LayoutManager has attributes like margin or padding
then it'll have to shave them from the available allocation before
passing it to the LayoutManager::allocate() implementation. Layout
managers should, thus, not assume that the origin of the allocation is
in (0, 0), but take into account that the passed ActorBox might have a
different origin.

https://bugzilla.gnome.org/show_bug.cgi?id=649631
2011-08-29 22:43:42 +01:00
Emmanuele Bassi
3314385119 box: Munge the allocation passed to the layout manager
The actor is in charge of providing to the LayoutManager the available
allocation. ClutterBox should not just pass the box it got from its
parent: it should, instead, provide a normalized box, with an origin in
(0, 0) and the available size.

https://bugzilla.gnome.org/show_bug.cgi?id=649631
2011-08-29 22:39:14 +01:00
Emmanuele Bassi
96810e1d4d build: Add -lm to clutter's LIBADD rule
We need to explicitly link against libm when building Clutter, since we
use libm API.

https://bugzilla.gnome.org/show_bug.cgi?id=657529
2011-08-29 22:17:53 +01:00
Robert Bragg
2f18855659 Adds experimental clutter_backend_get_cogl_context API
This adds experimental API to be able to get the CoglContext associated
with the ClutterBackend. The CoglContext is required to use some of the
experimental 2.0 Cogl API.

Note: Since CoglContext is itself experimental API this API should
considered experimental too. This patch introduces a
CLUTTER_ENABLE_EXPERIMENTAL_API #ifdef guard which anyone wanting to use
this API must define so it's explicitly clear to developers that they
are playing with experimental API.

Note: This API is not yet supported on OSX because OSX still uses the
stub Cogl winsys and the Clutter backend doesn't explicitly create a
CoglContext.

Note: even though this is experimental API we still promise that it
wont be changed during a stable release cycle. This means for example
that you can depend on this for the lifetime of the clutter-1.8 stable
release cycle.
2011-08-24 16:24:39 +01:00
Alejandro Piñeiro
7635cb6f17 a11y: We don't need to explicitly manage window events 2011-08-23 17:22:17 +02:00
Alejandro Piñeiro
a9690a4a5e a11y: Using AtkWindow on cally-stage 2011-08-23 17:22:11 +02:00
Emmanuele Bassi
2559fb1d0d actor: Add a comment on the unmapping order
Let's add a comment to avoid reshuffling the unmap() implementation and
end up triggering these bugs:

  http://bugzilla.clutter-project.org/show_bug.cgi?id=2621
  https://bugzilla.gnome.org/show_bug.cgi?id=652036
2011-08-23 10:58:09 +01:00
Emmanuele Bassi
d691c9cbe3 x11/settings: Add Fontconfig/Timestamp key
The XSETTINGS key that matches the :fontconfig-timestamp property on
ClutterSettings.
2011-08-18 15:36:20 +01:00
Emmanuele Bassi
7d4f371ee9 settings: Add ClutterSettings:fontconfig-timestamp
The :fontconfig-timestamp is a write-only property that will get updated
by the underlying platform whenever the fontconfig configuration has
been changed — i.e. when the fontconfig caches should be rebuilt after
the user has installed a new font.
2011-08-18 15:33:39 +01:00
Robert Bragg
397fe1b5b6 text: Implement Scriptable interface for font-description
This makes ClutterText implement the Scriptable interface so that we can
have a custom property parser and setter for the font-description
property. This works by simply passing the string description through
to clutter_text_set_font_name.

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-08-16 18:06:44 +01:00
Robert Bragg
ccb740f167 actor: Don't update last-paint-volume during picking
Actually this change has two notable effects; firstly we no longer
perform culling during picking and secondly we avoid updating the
last-paint-volume of an actor when picking.

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

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

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

Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
2011-08-15 18:25:43 +01:00
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
Emmanuele Bassi
5d10a7141c text: Make sure that the selection box is big enough
Do not use integers to store the result of the PANGO_UNITS scaling to
avoid rounding issues with the default C rules. We should use cielf()
instead.
2011-07-10 10:24:40 +01:00
Emmanuele Bassi
f6cdeb9858 osx: Fix a compiler warning
No declaration after statement.
2011-07-10 10:12:08 +01:00