Commit Graph

2972 Commits

Author SHA1 Message Date
Emmanuele Bassi
54504b7ac4 glx: Remove unnecessary call to create_stage()
If we are in the stage realization sequence we already have a GLX
context set in the backend; there is no need to call create_backend().
2010-03-17 17:41:52 +00:00
Emmanuele Bassi
bf7e6ae587 Add error reporting for create_context() failures
We kind of assume that stuff will break well before during the
ClutterBackend::create_context() implementation if we fail to create a
GL context. We do, however, have error reporting in place inside the
Backend API to catch those cases. Unfortunately, since we switched to
lazy initialization of the Stage, there can be a case of GL context
creation failure that still leads to a successful initialization - and a
segmentation fault later on. This is clearly Not Good™.

Let's try to catch a failure in all the places calling create_context()
and report back to the user the error in a meaningful way, before
crashing and burning.
2010-03-17 17:40:34 +00:00
Emmanuele Bassi
d735ac4807 model: Let get_n_columns() return a sane value
If you call get_n_columns() during the instance initialization phase but
before set_name()/set_types() have been called, you'll get a (guint) -1.
This is less than ideal.

If columns haven't been initialized we should just return 0, which was
the intent of the API since the beginning.

Based on a patch by: Bastian Winkler <buz@netbuz.org>

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-03-17 17:14:08 +00:00
Emmanuele Bassi
0a6497a3b6 model: Add a comment on the n_columns field type
To avoid another bug report like:

  http://bugzilla.openedhand.com/show_bug.cgi?id=2017

with a patch that gets applied without a proper review, resulting in a
bug like:

  http://bugzilla.openedhand.com/show_bug.cgi?id=2032

I should probably add a comment on why on earth we're using an integer
as the n_columns member of the ClutterModelPrivate structure, and why it
is important that it is initialized as -1.
2010-03-16 18:57:28 +00:00
Emmanuele Bassi
de4abfac95 Revert "model: Use guint for the n_columns field"
The int storage, and the initial value of -1, is used as a guard when
subclassing ClutterListModel to allow the sub-class to call
clutter_model_set_names() and clutter_model_set_types().

This reverts commit c274118a8f.
2010-03-16 18:53:24 +00:00
Colin Walters
60d8369a1a Return and warn if a handle's refcount is <= 0
This makes it more likely consumers notice invalid unreferences.
GObject has the same assertion.

http://bugzilla.openedhand.com/show_bug.cgi?id=2029

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-03-15 16:22:20 +00:00
Bastian Winkler
c274118a8f model: Use guint for the n_columns field
clutter_model_get_n_columns is supposed to return a guint, so the
n_columns field needs to be a guint with the initial value set to 0.

http://bugzilla.openedhand.com/show_bug.cgi?id=2017

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-03-15 16:22:20 +00:00
Neil Roberts
c2faaa4f39 cogl-texture-2d: Determine format before checking texture support
When entering cogl_texture_2d_new_from_bitmap the internal format can
be COGL_PIXEL_FORMAT_ANY. This was causing _cogl_texture_2d_can_create
to use an invalid GL format type. Mesa apparently ignores this but it
was causing errors when Cogl is compiled with debugging under NVidia.

http://bugzilla.openedhand.com/show_bug.cgi?id=2026
2010-03-15 16:09:52 +00:00
Owen W. Taylor
a25885edf2 Fix checks for out-of-bounds coordinates and repeats
Add a return result from CoglTexture.transform_quad_coords_to_gl(),
so that we can properly determine the nature of repeats in
the face of GL_TEXTURE_RECTANGLE_ARB, where the returned
coordinates are not normalized.

The comment "We also work out whether any of the texture
coordinates are outside the range [0.0,1.0]. We need to do
this after calling transform_coords_to_gl in case the texture
backend is munging the coordinates (such as in the sub texture
backend)." is disregarded and removed, since it's actually
the virtual coordinates that determine whether we repeat,
not the GL coordinates.

Warnings about disregarded layers are used in all cases where
applicable, including for subtextures.

http://bugzilla.openedhand.com/show_bug.cgi?id=2016

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2010-03-15 16:09:41 +00:00
José Dapena Paz
6bd1846d6c Fix argb initialisation.
Fix clutter initialisation if argb visuals are enabled, setting a border
color on creating the dummy window. This should avoid BadMatch happening
when the depth of the root window visual is not the same of the depth
of the argb visual.

http://bugzilla.openedhand.com/show_bug.cgi?id=2011

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-03-10 00:13:37 +00:00
Emmanuele Bassi
3d2d932835 actor: Remove some double indirection
Use an intermediate variable to avoid a double indirection when accessing
the instance private data structure.
2010-03-07 23:46:59 +00:00
Emmanuele Bassi
9ad1197cb2 json: Improve strictness of the JSON parser
Backport of the upstream JSON-GLib commit that improved the strictness
of JsonParser.

The original upstream commit is:

  29881f03468db08bfb404cfcd5b61b4cdc419a87
2010-03-07 20:54:33 +00:00
Emmanuele Bassi
ac074bc0f0 eglnative: Connect StageWindow.show and .hide
The show() and hide() methods of the StageWindow interface are
implemented but not assigned when initializing the interface
vtable.
2010-03-05 08:48:52 +00:00
Owen W. Taylor
f13a42793a CoglTexture2DSliced: Handle TEXTURE_RECTANGLE_ARB
In _cogl_texture_2d_sliced_foreach_sub_texture_in_region(), don't
assert that the target is GL_TEXTURE_2D; instead conditionalize
normalization on the target.

http://bugzilla.openedhand.com/show_bug.cgi?id=2015
2010-03-04 12:57:53 +00:00
Neil Roberts
40b43fd64a eglnative: Don't create a context if there already is one
If the EGL context is already created then we shouldn't try to create
another one. This was causing problems where one context would be
created from calling _clutter_feature_init and the other was created
from _clutter_backend_get_features. Cogl would set up its state using
the first context and then assume the state was still valid when the
second context became used so blending was not working correctly.

http://bugzilla.openedhand.com/show_bug.cgi?id=2020
2010-03-04 10:28:15 +00:00
Emmanuele Bassi
169ce1508b x11-texture-pixmap: Move signal handler override
The signal handling override for the ::queue-damage-redraw should be
done in the class initialization function, not in the instance one.
2010-03-03 17:46:53 +00:00
Emmanuele Bassi
1b57800208 Update stb_image.c
Upstream "released" 1.18.
2010-03-03 17:02:51 +00:00
Øyvind Kolås
b19332a0be animator: compare floating point values with an epsilon
Direct comparisons with doubles are error prone.
2010-03-03 15:53:07 +00:00
Øyvind Kolås
4168b216a3 animator: fix a crash in clutter_animator_compute_value
Fix a crasher when there is only one key in the animator.
2010-03-03 15:51:30 +00:00
Emmanuele Bassi
824cd9a7ff eglnative: Compilation fixes
We should include <errno.h>, if we plan to use errno.

Why, yes: I am that stupid.
2010-03-03 15:31:01 +00:00
Emmanuele Bassi
52f8cd30ce docs: Fix gtk-doc annotation for ClutterStageManageClass
Remove the semi-colon and use a colon for declaring the type.
2010-03-03 10:49:34 +00:00
Emmanuele Bassi
a2f444ccbe box: Fix allow-none annotation
The syntax for allowing NULL is "allow-none", not "allow none".
2010-03-03 10:47:42 +00:00
Neil Roberts
048fcea988 clutter-actor: Initialize with the identity matrix in get_transform
The documentation and name of the get_transformation_matrix function
implies that 'matrix' is purely an out parameter. However it wasn't
initializing the matrix before calling the 'apply_transform' virtual
so it was basically just a wrapper for the virtual. The virtual
assumes the matrix parameter is in/out and applies the actor's
transformation on top of any existing transformations. This causes
unexpected semantics that are inconsistent with the documentation.
2010-03-02 18:43:22 +00:00
Robert Bragg
38a2414498 glx tfp: make clutter_glx_texture_pixmap_update_area cheap
This changes clutter_glx_texture_pixmap_update_area so it defers the
call to glXBindTexImageEXT until our pre "paint" signal handler which
makes clutter_glx_texture_pixmap_update_area cheap to call.

The hope is that mutter can switch to reporting raw damage updates to
ClutterGLXTexturePixmap and we can use these to queue clipped redraws.
2010-03-02 17:19:11 +00:00
Robert Bragg
c0d5af5de5 Adds initial clipped redraw support to Clutter
A new (internal only currently) API, _clutter_actor_queue_clipped_redraw
can be used to queue a redraw along with a clip rectangle in actor
coordinates. This clip rectangle propagates up to the stage and clutter
backend which may optionally use the information to optimize stage
redraws. The GLX backend in particular may scissor the next redraw to
the clip rectangle and use GLX_MESA_copy_sub_buffer to present the stage
subregion.

The intention is that any actors that can naturally determine the bounds
of updates should queue clipped redraws to reduce the cost of updating
small regions of the screen.

Notes:
» If GLX_MESA_copy_sub_buffer isn't available then the GLX backend
  ignores any clip rectangles.

» queuing multiple clipped redraws will result in the bounding box of
  each clip rectangle being used.

» If a clipped redraw has a height > 300 pixels then it's promoted into
  a full stage redraw, so that the GPU doesn't end up blocking too long
  waiting for the vsync to reach the optimal position to avoid tearing.

  » Note: no empirical data was used to come up with this threshold so
    we may need to tune this.

» Currently only ClutterX11TexturePixmap makes use of this new API. This
  is done via a new "queue-damage-redraw" signal that is emitted when
  the pixmap is updated. The default handler queues a clipped redraw
  with the assumption that the pixmap is being painted as a rectangle
  covering the actors transformed allocation. If you subclass
  ClutterX11TexturePixmap and change how it's painted you now also
  need to override the signal handler and queue your own redraw.

  Technically this is a semantic break, but it's assumed that no one
  is currently doing this.

This still leaves a few unsolved issues with regards to optimizing sub
stage redraws that need to be addressed in further work so this can only
be considered a stepping stone a this point:

» Because we have no reliable way to determine if the painting of any
  given actor is being modified any optimizations implemented using
  _clutter_actor_queue_redraw_with_clip must be overridable by a
  subclass, and technically must be opt-in for existing classes to avoid
  a change in semantics. E.g. consider that a user connects to the paint
  signal for ClutterTexture and paints a circle instead of a rectangle.
  In this case any original logic to queue clipped redraws would be
  incorrect.

» Currently only the implementation of an actor has enough information
  with which to queue clipped redraws. E.g. It is not possible for
  generic code in clutter-actor.c to queue a clipped redraw when hiding
  an actor because actors have no way to report a "paint box". (remember
  actors can draw outside their allocation and actors with depth may
  also be projected outside of their allocation)

  » The current plan is to add a actor_class->get_paint_cuboid()
    virtual so actors can report a bounding cube for everything they
    would draw in their current state and use that to queue clipped
    redraws against the stage by projecting the paint cube into stage
    coordinates.

» Our heuristics for promoting clipped redraws into full redraws to
  avoid blocking the GPU while we wait for the vsync need improving:

  » vsync issues aren't relevant for redirected/composited applications
    so they should use different heuristics. In this case we instead
    need to trade off the cost of blitting when using glXCopySubBuffer
    vs promoting to a full redraw and flipping instead.
2010-03-02 17:19:11 +00:00
Øyvind Kolås
09d8460a5c animator: s/clutter_animator_run/clutter_animator_start/
This is consistent with choice of words in clutter_timeline_start and
makes the API less surprising.
2010-03-02 17:03:03 +00:00
Robert Bragg
9d1ea81dc5 cogl debug: Adds missing guards around debug cogl_args[]
commit 511e5ceb51 accidentally removed the #ifdef COGL_ENABLE_DEBUG
guards around the "cogl-debug" and "cogl-no-debug" cogl_args[] which
this patch restores.
2010-03-02 16:15:39 +00:00
Emmanuele Bassi
aba6c5acc7 flow-layout: Provide a preferred size
The FlowLayout fails to provide a preferred size in case no sizing is
specified on one axis. It should, instead, have the preferred size of
the sum of its children, depending on the orientation property.

http://bugzilla.openedhand.com/show_bug.cgi?id=2013
2010-03-02 15:11:27 +00:00
Øyvind Kolås
9a55ddc7c3 animator: restore accidentally removed break
In 505e5966 a break statement was removed by accident, causing the
animator to enter infinite loops if no initial key is present.
2010-03-02 12:38:51 +00:00
Emmanuele Bassi
3a84af0106 Merge branch 'eglnative-update'
* eglnative-update:
  eglnative: Add CLUTTER_FB_DEVICE
  eglnative: Update implementation
2010-03-02 12:25:45 +00:00
Emmanuele Bassi
a2573ad2ad eglnative: Add CLUTTER_FB_DEVICE
Some EGL drivers for embedded devices require a specific framebuffer
device to be opened and passed to eglCreateWindowSurface(). Since it's
optional, we can provide an environment variabled called
CLUTTER_FB_DEVICE that can be used to specify the path of the device
to be opened.

http://bugzilla.openedhand.com/show_bug.cgi?id=1997
2010-03-02 11:50:31 +00:00
Emmanuele Bassi
b4e9f40394 eglnative: Update implementation
Update the EGL native framebuffer backend to be 1.2-ready:

  » create the EGL context and the surface inside the create_context()
    implementation so that a context is always available

  » simplify the StageWindow implementation

  » clean up old code

http://bugzilla.openedhand.com/show_bug.cgi?id=1997
2010-03-02 11:50:31 +00:00
Owen W. Taylor
0baeabc2aa Fall back in _cogl_texture_2d_new_from_bitmap()
Just like _cogl_texture_2d_new_with_size(),
_cogl_texture_2d_new_from_bitmap() needs to check if an unsliced
texture can be created at the given size, or if hardware
limitations prevent this.

http://bugzilla.openedhand.com/show_bug.cgi?id=2014

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2010-03-02 11:48:15 +00:00
Emmanuele Bassi
74a27bbb1c docs: Documentation fixes
Let's see if we can get a 100% coverage for Clutter too.
2010-03-02 11:12:32 +00:00
Neil Roberts
c0a553163b cogl: Support any format in cogl_read_pixels
cogl_read_pixels() no longer asserts that the format passed in is
RGBA_8888 but instead accepts any format. The appropriate GL enums for
the format are passed to glReadPixels so OpenGL should be perform a
conversion if neccessary.

It currently assumes glReadPixels will always give us premultiplied
data. This will usually be correct because the result of the default
blending operations for Cogl ends up with premultiplied data in the
framebuffer. However it is possible for the framebuffer to be in
whatever format depending on what CoglMaterial is used to render to
it. Eventually we may want to add a way for an application to inform
Cogl that the framebuffer is not premultiplied in case it is being
used for some special purpose.

If the requested format is not premultiplied then Cogl will convert
it. The tests have been changed to read the data as premultiplied so
that they won't be affected by the conversion. Picking in Clutter has
been changed to use COGL_PIXEL_FORMAT_RGB_888 because it doesn't need
the alpha component. clutter_stage_read_pixels is left unchanged
because the application can't specify a format for that so it seems to
make most sense to store unpremultiplied values.

http://bugzilla.openedhand.com/show_bug.cgi?id=1959
2010-03-02 11:01:35 +00:00
Øyvind Kolås
505e5966e4 Do not overwrite the initial key, making ease-in work as expected.
Fixes bug #2008, where a property with ease-in would jump instead of
start at the properties initial value.
2010-03-01 18:39:24 +00:00
Bastian Winkler
7d0ad7ac1b animator: Remove redundant declaration in header file
clutter_animator_property_set_interpolation was declared twice in
clutter-animator.h

http://bugzilla.openedhand.com/show_bug.cgi?id=2012
2010-03-01 17:49:58 +00:00
Emmanuele Bassi
1d9ddad9a3 docs: Fix syntax error in Model's documentation
A missing opening quote sign is breaking gtk-doc for ClutterModel.
2010-03-01 17:45:00 +00:00
Emmanuele Bassi
1777a69f2f Merge branch 'stage-min-size-rework'
* stage-min-size-rework:
  docs: Update minimum size accessors
  actor: Use the TOPLEVEL flag instead of a type check
  [stage] Use min-width/height props for min size
2010-03-01 15:37:12 +00:00
Robert Bragg
8146d8d08d profile: avoid segfault generating reports with no stats
The clutter-profile.c print_report() code would crash if no stats had
been gathered because uprof would return NULL for the "Redrawing" timer
which we then dereferenced.

This changes the code to start by checking for the "Mainloop",
"Redrawing" and "Do Pick" timers and if none are present it returns
immediately without generating any report.
2010-03-01 15:25:45 +00:00
Robert Bragg
b9a91594f4 build: Fixes out of tree builds
When building the gobject introspection data the build wasn't able to
find clutter/clutter-json.h so this adds $(top_builddir) to INCLUDES.
2010-03-01 15:25:45 +00:00
Emmanuele Bassi
79acb088e7 Remove mentions of the FSF address
Since using addresses that might change is something that finally
the FSF acknowledge as a plausible scenario (after changing address
twice), the license blurb in the source files should use the URI
for getting the license in case the library did not come with it.

Not that URIs cannot possibly change, but at least it's easier to
set up a redirection at the same place.

As a side note: this commit closes the oldes bug in Clutter's bug
report tool.

http://bugzilla.openedhand.com/show_bug.cgi?id=521
2010-03-01 12:56:10 +00:00
Emmanuele Bassi
23867875a1 build: Remove unused checks on platform functions
There is no need for us to check for low-level functions and header
files, especially since we haven't been checking the results until
now. This makes cross-compiling slightly more bearable.
2010-03-01 11:12:16 +00:00
Emmanuele Bassi
ce6a24eb2b actor: Call unparent() in destroy
If the actor is an internal child of another actor then we should call
unparent() when destroying it, like clutter_actor_reparent() does;
otherwise we'll leak the actor, since the parent holds a reference to
it.

http://bugzilla.openedhand.com/show_bug.cgi?id=2009
2010-02-28 10:59:29 +00:00
Emmanuele Bassi
7ffb62eab9 docs: Update minimum size accessors
Expand the documentation for set_minimum_size() and get_minimum_size(),
and add introspection annotations for get_minimum_size().
2010-02-27 18:56:34 +00:00
Emmanuele Bassi
52ba9a1800 actor: Use the TOPLEVEL flag instead of a type check
We can use the internal private CLUTTER_ACTOR_IS_TOPLEVEL flag, which is
set only on Stages.
2010-02-27 18:24:17 +00:00
Chris Lord
cd62dfbd14 [stage] Use min-width/height props for min size
Instead of shadowing these properties with different properties with the
same names on stage, actually use them. Behaviour should be identical,
except the minimum stage size can now be enforced by setting the
min-width/height properties as well as using the set_minimum_size
function.
2010-02-26 18:36:38 +00:00
Emmanuele Bassi
e0f04efa41 device: When changing the stage, unset the pointer actor
If we do not unset the Stage we will have stale data, and the Crossing
event when re-entering a Stage will not be emitted, as the actor under
the pointer might be the same as before.
2010-02-26 11:19:26 +00:00
Neil Roberts
5d83468295 cogl-vertex-buffer: Add support for unsigned int indices
This adds a COGL_INDICES_TYPE_UNSIGNED_INT enum value so that unsigned
ints can be used with cogl_vertex_buffer_indices_new.  Unsigned ints
are not supported in core on GLES so a feature flag has also been
added to advertise this. GLES only sets the feature if the
GL_OES_element_index_uint extension is available. It is an error to
call indices_new() with unsigned ints unless the feature is
advertised.

http://bugzilla.openedhand.com/show_bug.cgi?id=1998
2010-02-26 10:56:35 +00:00
Emmanuele Bassi
67d9d92814 docs: Document the "columns" syntax for ClutterModel
Like we do for other classes implementing custom properties, we should
document the syntax of the "columns" scriptable property of ClutterModel.
2010-02-25 23:23:53 +00:00
Bastian Winkler
96c31bbf0e model: Implement ClutterScriptable interface
Allow a ClutterModel to be constructed through the ClutterScript API.
Currently this allows a model to be generated like like this:

{
  "id" : "test-model",
  "type" : "ClutterListModel",
  "columns" : [
    [ "text-column", "gchararray" ],
    [ "int-column", "gint" ],
    [ "actor-column", "ClutterRectangle" ]
  ]
}

where 'columns' is an array containing arrays of column-name,
column-type pairs.

http://bugzilla.openedhand.com/show_bug.cgi?id=2007
2010-02-25 23:09:11 +00:00
Emmanuele Bassi
63279f827e docs: gtk-doc fixes for Animator
Fix the syntax for:

  → enumeration values
  → return values
  → @since tags

Also, fix the introspection annotations.
2010-02-25 22:50:38 +00:00
Emmanuele Bassi
9db135c4ef glx: Clean up sync-to-vblank mechanism discovery
The code has gotten really complicated to follow.

As soon as we have a sync-to-vblank mechanism we should just bail out.

Also, __GL_SYNC_TO_VBLANK (which is used by nVidia) should be assumed
equivalent to a CLUTTER_VBLANK_GLX_SWAP.
2010-02-25 18:56:39 +00:00
Emmanuele Bassi
655cb966c0 docs: Add visual cue for Animator's key frames
We should explain what a "key frame" is for ClutterAnimator, possibly
with some sort of visual cue.

This allows me to demonstrate my poor skills at using Inkscape, as well
as my overall bad taste for graphics design.
2010-02-25 17:09:55 +00:00
Emmanuele Bassi
d3d05261e6 script-parser: Remove top-level types list
The top-level types list was comically out of date, and it was only
determining whether the type we were constructing was initially unowned
or a full object. We can safely replace it with a simple type check.
2010-02-25 14:22:08 +00:00
Emmanuele Bassi
c0be19eff6 script-parser: Be more strict with "children" members
The "children" member for Container definitions should only reference
actors, and warn about any other type.
2010-02-25 14:20:05 +00:00
Emmanuele Bassi
c291d5a660 animator: Add a :timeline property
It would be useful to be able to share the Timeline across different
animator instances, or with different animation constructs. Also this
allows sharing definitions of Timelines in ClutterScript.
2010-02-25 14:08:57 +00:00
Emmanuele Bassi
6415825339 animator: Remove NULL check in remove_key()
The arguments for remove_key() can be NULL, but there is an extraneous
assertion that fails if they are. The pre-conditions should match the
documentation, in this case.
2010-02-25 14:02:29 +00:00
Emmanuele Bassi
4bc4c604e9 box: Let pack_at() create the ChildMeta, if any
A sub-class of ClutterBox might add ChildMeta support, and since
pack_at() does not go through clutter_container_add_actor(), we
need to manually call the create_child_meta() ourselves.
2010-02-25 12:55:12 +00:00
Emmanuele Bassi
543e2d3f06 container: Expose create and destroy ChildMeta methods
It is conceivable that Container implementations might add children
outside of the Container::add() implementation - e.g. for packing at
a specific index. Since the addition (and removal) might happen outside
the common path we need to expose all the API that is implicitly called
by ClutterContainer when adding and removing a child - namely the
ChildMeta creation and destruction.
2010-02-25 12:55:12 +00:00
Neil Roberts
14999bec5e gles2: Remove the special wrapper for glBindTexture
Previously the GLES2 backend needed a special wrapper for
glBindTexture because it needed to know the internal GL format of the
texture in order to correctly implement the GL_MODULATE texture env
mode. When GL_MODULATE is used then the RGB values are taken from the
previous texture layer rather than being fetched from the
texture. However since the material API was added Cogl no longer uses
the GL_MODULATE texture env mode but instead always uses GL_COMBINE.

Compiling the GLES2 backend broke since the more-texture-backends
branch merge because the cogl_get_internal_gl_format function was
removed and there was one place in GLES2 specific code that was using
this to bind the texture.
2010-02-25 12:50:52 +00:00
Neil Roberts
eba07020c5 cogl-gles2-wrapper: Add support for the layer combine operations
The texture layer combine functions are now hard coded to GL_COMBINE
instead of GL_MODULATE. The combine function can be customized with
all the parameters of GL_COMBINE. A shader is generated to implement
the given parameters.

Currently it will try to generate code for the constant color but it
will use a uniform which does not exist.
2010-02-25 12:50:52 +00:00
Neil Roberts
02b952394a gles2: Implement a wrapper for glGetIntegerv(GL_MAX_TEXTURE_UNITS)
The GLES2 backend for Cogl is failing to compile because
GL_MAX_TEXTURE_UNITS is not defined. Let's define it and provide a
wrapper which uses GL_MAX_TEXTURE_IMAGE_UNITS or
COGL_GLES2_MAX_TEXTURE_UNITS, whichever is the smallest.
2010-02-25 12:50:52 +00:00
Øyvind Kolås
3bc0672fef animator: handle no initial key
Fixing the crasher reported in bug #1995.
2010-02-25 12:35:19 +00:00
Øyvind Kolås
d2db512788 animator: added clutter_animator_compute_value
Allow querying the computed values of properties managed by a
ClutterAnimator.
2010-02-25 12:35:06 +00:00
Øyvind Kolås
e8d32fd153 animator: removed bogus arg in keys interpolation accessor
A bogus ClutterInterpolation argument had been carried from
clutter_animator_set_interpolation to clutter_animator_get_interpolation
in copy and paste.
2010-02-25 12:35:05 +00:00
Emmanuele Bassi
be8f53f229 animation: Fix a typo
This will teach me to check before compiling a version-dependent branch
that I'm actually using my jhbuild environment and not the system
libraries.
2010-02-25 12:01:03 +00:00
Emmanuele Bassi
26e22b2ede Conditionally use G_VALUE_COLLECT_INIT() macro
GLib 2.24 (but starting from the 2.23.2 unstable release) added a new
macro for collecting GValues from a va_list.

The newly added G_VALUE_COLLECT_INIT() macro should be used in place
of initializing the GValue and calling G_VALUE_COLLECT(), and improves
the collection performances by avoiding multiple checks, free and
initialization calls.
2010-02-25 10:22:36 +00:00
Bastian Winkler
59fd7e4a81 animator: Append parsed animator keys to previously parsed ones
Reuse the GSList of the previously parsed property when building a
ClutterAnimator from script, otherwise only the last used property will
be used

http://bugzilla.openedhand.com/show_bug.cgi?id=2003
2010-02-24 16:33:19 +00:00
Emmanuele Bassi
ec0c7fcd9b build: Use the right headers when enumerating them
The installed _HEADERS should be the public ones and the enumeration
types; repeating clutter-x11-texture-pixmap.h breaks with automake 1.11
and doesn't strictly make any sense.

http://bugzilla.openedhand.com/show_bug.cgi?id=2002
2010-02-24 14:23:58 +00:00
Emmanuele Bassi
d1ca0e1b8f fixed layout: Store a back pointer to the Container
When set_container() is called with a NULL container we cannot use the
passed pointer to unset the CLUTTER_ACTOR_NO_LAYOUT flag. We should
store a back pointer to the container as object data (there's no need
to add a Private data structure in this case) and unset the flag on the
back pointer instead.
2010-02-24 12:25:53 +00:00
Emmanuele Bassi
aa8c812705 box: Do not short-circuit size negotiation for empty Boxes
The LayoutManager used might decide to have a default allocation or a
default preferred size when empty.
2010-02-24 12:10:23 +00:00
Robert Bragg
523bab0868 layout: allow wider use of the CLUTTER_ACTOR_NO_LAYOUT flag
Previously only ClutterGroup was able to set the CLUTTER_ACTOR_NO_LAYOUT
flag which allows clutter-actor.c to avoid a relayout when showing or
hiding fixed layout containers. Instead of it being the responsibility
of the container to set this flag this patch makes the layout manager
itself decide in the ::set_container method. This way both ClutterBox
and ClutterGroup can take advantage of the optimization.
2010-02-24 12:07:23 +00:00
Emmanuele Bassi
f21e649c80 docs: Detail replacement for cogl_check_extension()
The cogl_check_extension() function has been deprecated, but it's easily
replaceable with a simple strstr() call.
2010-02-24 11:28:44 +00:00
Emmanuele Bassi
d54af2363d build: Use template for ClutterX11 enumerationt types
Clutter and Cogl use the template Makefile.am.enums for building the
enumeration GTypes from public headers, but ClutterX11 is not.
2010-02-24 10:20:10 +00:00
Neil Roberts
eb35c446b1 clutter-box: Layer new actors on top of all others at the same depth
g_list_insert_sorted inserts the new actor before all others that
compare equal so for the normal case when all actors have depth==0
this has the surprising behaviour of layering the actors in reverse
order. To fix this it now manually inserts the actor in the right
place by searching until it finds an actor at a higher depth and
inserting before that.

http://bugzilla.openedhand.com/show_bug.cgi?id=1988
2010-02-24 10:03:43 +00:00
Neil Roberts
da0315e4d6 box: Revert "Tweak the depth sorting function"
This reverts commit 939e56e2b1.

Changing the depth sort function to have inconsistent behaviour for
nodes that compare equal breaks the stability of g_list_sort. It ends
up so that every time clutter_container_sort_depth_order is called the
order of all actors with the same depth is reversed.

http://bugzilla.openedhand.com/show_bug.cgi?id=1988
2010-02-24 10:03:41 +00:00
Robert Bragg
1c65f2ee1e cogl debug: Adds glViewport call tracing
To aid in the debugging of Clutter stage resize issues this adds a
COGL_DEBUG=opengl option that will trace "some select OpenGL calls"
(currently just glViewport calls)
2010-02-23 22:09:07 +00:00
Robert Bragg
fa3830ff20 cogl debug: hint that all debugging paths are G_UNLIKELY
Most Cogl debugging code conditions are marked as G_UNLIKELY with the
intention of having the CPU branch prediction always assume the
path is disabled so having debugging support in release binaries has
negligible overhead.

This patch simply fixes a few cases where we weren't using G_UNLIKELY.
2010-02-23 22:09:07 +00:00
Robert Bragg
511e5ceb51 cogl debug: Makes COGL_DEBUG=all|verbose|help more useful
COGL_DEBUG=all wasn't previously useful as there are several options
that change the behaviour of Cogl and all together wouldn't help anyone
debug anything.

This patch makes it so COGL_DEBUG=all|verbose now only enables options
that don't change the behaviour of Cogl, i.e. they only affect the
amount of noise we'll print to a terminal.

In addition to that this patch also improves the output from
COGL_DEBUG=help so we now print a table of options including one liner
descriptions of what each option enables.
2010-02-23 22:09:06 +00:00
Emmanuele Bassi
939e56e2b1 box: Tweak the depth sorting function
By changing the depth sorting function we can achieve the same effect as
ClutterGroup but without the costly append+sort.

http://bugzilla.openedhand.com/show_bug.cgi?id=1988
2010-02-23 17:59:09 +00:00
Emmanuele Bassi
95960ab902 cogl: Add deprecation annotation to CoglMaterial ref/unref
The G_GNUC_DEPRECATED annotation was missing from the material ref and
unref functions.
2010-02-23 16:51:26 +00:00
Emmanuele Bassi
a9941e9499 debug: Split debugging notes from behavioural modifiers
Some of the ClutterDebugFlags are not meant as a logging facility: they
actually change Clutter's behaviour at run-time.

It would be useful to have this distinction ratified, and thus split
ClutterDebugFlags into two: one DebugFlags for logging facilities and
another set of flags for behavioural changes.

This split is warranted because:

  • it should be possible to do "CLUTTER_DEBUG=all" and only have
    log messages on the output

  • it should be possible to use behavioural modifiers even on a
    Clutter that has been compiled without debugging messages
    support

The commit adds two new debugging flags:

  ClutterPickDebugFlags - controlled by the CLUTTER_PICK environment
                          variable

  ClutterPaintDebugFlags - controlled by the CLUTTER_PAINT environment
                           variable

The PickDebugFlags are:

  nop-picking
  dump-pick-buffers

While the PaintDebugFlags is:

  disable-swap-events

The mechanism is equivalent to the CLUTTER_DEBUG environment variable,
but it does not depend on the debug level selected when configuring and
compiling Clutter. The picking and painting debugging flags are
initialized at clutter_init() time.

http://bugzilla.openedhand.com/show_bug.cgi?id=1991
2010-02-23 14:39:23 +00:00
Neil Roberts
a9c307ff5d cogl-vertex-buffer: Fix the malloc fallback for indices
The size of the malloc'd buffer for indices when VBOs are not
available was too small so memory corruption would result if it was
used.

http://bugzilla.o-hand.com/show_bug.cgi?id=1996
2010-02-23 14:01:11 +00:00
Emmanuele Bassi
1466965773 device: Motion events compression should honour the device
The motion event compression should be affected by the device field of
the event; that is: we should compress motion events coming from the
same device.
2010-02-22 11:34:04 +00:00
Emmanuele Bassi
5ed4732737 device: Force ENTER on Stage with overlapping Actors
If an actor is on the boundary of a Stage and the pointer for a device
enters the Stage over that actor, the sequence of events currently is:

  ➔ ENTER (source: actor, related: NULL)
  ➔ MOTION

Thus the Stage never gets an ENTER event. This is a regression from
Clutter 1.0.

The correct sequence is:

  ➔ ENTER (source: stage, related: NULL)
  ➔ ENTER (source: actor, related: stage)
  ➔ MOTION

This also maps to the sequence of events sythesized by Clutter when
leaving the Stage through an actor overlapping the Stage boundary.

http://bugzilla.moblin.org/show_bug.cgi?id=9781
2010-02-22 11:30:14 +00:00
Emmanuele Bassi
ee33357fd5 stage: Only clutter_stage_get_default() creates the default stage
The introduction of the StageManager in 0.8 implied that the first Stage
instance to be created was automatically assigned the status of "default
stage". This was all well and good, since the default stage was created
behind the curtains by the initialization sequence.

Now that the initialization sequence does not create a default stage any
longer, it means that the first stage created using clutter_stage_new()
gets to be the default, and all special and warm and fuzzy - which also
means that the first stage created by clutter_stage_new() cannot be
destroyed or handled as any other stage. Whoopsie.

Let's go back to the old semantics: the stage created by the first
invocation of clutter_stage_get_default() is the default stage, and
nothing else can be set as default. One day we'll be able to break the
API and the whole default stage business will be a thing of the past.
2010-02-18 17:01:57 +00:00
Emmanuele Bassi
9a6de8757f docs: Document the InputDevice update method
Embedding toolkits should benefit from a proper documentation of
clutter_input_device_update_from_event(): its meaning, its use and
the caveats for the "update_stage" argument.
2010-02-18 11:40:49 +00:00
Neil Roberts
a2afc9d7ba win32: Fixup compilation errors from b398292089
That commit added some Win32 code which breaks compilation.

Thanks to Samuel Degrande for help with this.
2010-02-18 11:36:15 +00:00
Robert Bragg
5de743de70 cogl_texture_new_from_foreign: improve docs
Improve the explanation of what the x_pot_waste and y_pot_waste
arguments can be used for.
2010-02-17 20:36:51 +00:00
Robert Bragg
9c06c94374 cogl-texture: for foreign textures; always trust user geom
We now never query the width and height of the given texture object
from OpenGL. The problem is that the user may be creating a Cogl
texture from a texture_from_pixmap object where glTexImage2D was
never called and the texture_from_pixmap spec doesn't clarify that
it's reliable to query the width from OpenGL.

This should address:
http://bugzilla.openedhand.com/show_bug.cgi?id=1502

Thanks to Johan Bilien for reporting
2010-02-17 20:36:50 +00:00
Emmanuele Bassi
8b040cac4d docs: Fixes for DeviceManager 2010-02-17 19:02:43 +00:00
Emmanuele Bassi
51a3e49c82 device: Allow updating devices from embedding toolkits
Embedding toolkits most likely will disable the event handling, so all
the input device code will not be executed. Unfortunately, the newly
added synthetic event generation of ENTER and LEAVE event pairs depends
on having input devices.

In order to unbreak things without reintroducing the madness of the
previous code we should allow embedding toolkits to just update the
state of an InputDevice by using the data contained inside the
ClutterEvent. This strategy has two obvious reasons:

  • the embedding toolkit is creating a ClutterEvent by translating
    a toolkit-native event anyway

  • this is exactly what ClutterStage does when processing events

We are, essentially, deferring input device handling to the embedding
toolkits, just like we're deferring event handling to them.
2010-02-17 18:21:50 +00:00
Emmanuele Bassi
b398292089 device: Impose per-backend DeviceManager
The DeviceManager class should be abstract in Clutter, and implemented
by each backend, as different backends will have different ways to
detect, initialize and list devices; the X11 backend alone has *two*
ways of dealing with devices.

This commit makes DeviceManager an abstract class and delegates the
device initialization and enumeration to per-backend sub-classes.

The responsible for creating the device manager is, obviously, the
backend singleton.

The X11 and Win32 backends have been updated to the new layout; the
Win32 backend has been updated blindly, so it might require additional
testing.
2010-02-17 17:46:48 +00:00
Chris Lord
0bf6d57ab1 [event-x11] Don't relayout on window move
ConfigureNotify is delivered on window movements too, but there is no
need to queue a relayout on these as the viewport hasn't changed size.
Check for the window actually changing size on ConfigureNotify before
queueing a relayout.

This fixes laggy window movement when moving a window in response to
Clutter mouse motion events.
2010-02-17 16:56:30 +00:00
Neil Roberts
05054bed87 cogl-clip-stack: Round the coords when clipping to a window rect
The size and position of the window rectangle for clipping in
try_pushing_rect_as_window_rect is calculated by projecting the
rectangle coordinates. Due to rounding errors, this can end up with
slightly off numbers like 34.999999. These were then being cast
directly to an integer so it could end up off by one.

This uses a new macro called COGL_UTIL_NEARBYINT which is a
replacement for the C99 nearbyint function.
2010-02-17 16:12:47 +00:00
Emmanuele Bassi
fbcaf1e0b3 Improve LEAVE events for border actors
If an actor is lying on the border of the Stage it might miss the LEAVE
event when the pointer of a device leaves the Stage window. Since the
backend is unsetting the Stage back pointer on the InputDevice we can
queue the emission of a LEAVE event on the pointer actor as well.

http://bugzilla.moblin.org/show_bug.cgi?id=9677
2010-02-17 10:48:18 +00:00
Chris Lord
719e314b8e [stage-x11] Fix a warning due to a missing cast
I stupidly forgot to cast a ClutterStage to a ClutterActor and somehow
missed or didn't get the compiler warning. Fix.
2010-02-16 18:25:46 +00:00
Chris Lord
f9f03894a6 [stage-x11] Fix resizing for foreign windows
As well as manually setting the geometry size, we needed to queue a
relayout. This is what the ConfigureNotify handler would normally do,
but we don't get this event when using a foreign window (obviously).

This should fix resizing in things like gtk-clutter.
2010-02-16 18:17:55 +00:00
Chris Lord
df6e7aee73 [stage-x11] Set the geometry size for foreign wins
If we get into the resize function and it's a foreign window, set the
geometry size so that the allocate will set the backend size and call
glViewport.
2010-02-16 17:53:05 +00:00