1
0
Fork 0
Commit graph

2555 commits

Author SHA1 Message Date
Emmanuele Bassi
60a6bff313 Merge branch 'no-layout-flag' into ebassi-next
* no-layout-flag:
  actor: Add a NO_LAYOUT flag for actors
2009-12-09 23:32:41 +00:00
Emmanuele Bassi
dc47550bc8 Merge branch 'size-cache' into ebassi-next
* size-cache:
  tests: Clean up the BoxLayout interactive test
  actor: Add debugging notes for size cache
  Add a cache of size requests
2009-12-09 23:32:18 +00:00
Emmanuele Bassi
86ce92eec1 x11: Emulate XKB's detectable key auto-repeat
Old-style X11 terminals require that even modern X11 send KeyPress
and KeyRelease pairs when auto-repeating. For this reason modern(-ish)
API like XKB has a way to detect auto-repeat and do a single KeyRelease
at the end of a KeyPress sequence.

The newly added check emulates XKB's detectable auto-repeat by peeking
the next event after a KeyRelease and checking if it's a KeyPress for
the same key and timestamp - and then ignoring the KeyRelease if it
matches.
2009-12-09 18:46:25 +00:00
Emmanuele Bassi
1ffd2ccb87 stage: Deprecate default stage size macros
The macros for getting the size of the default stage are a relic of the
past and they should be deprecated.
2009-12-09 17:19:32 +00:00
Emmanuele Bassi
e957e277b8 x11: Do not manage a foreign window
If a Stage has been set to use a foreign Window then Clutter should not
be managing it; calling XWithdrawWindow and XMapWindow should be
reserved to the windows we manage ourselves.
2009-12-08 18:24:30 +00:00
Emmanuele Bassi
28cb2cdab5 Remove clutter_set_default_text_direction()
Setting the default text direction programmatically is wrong: it is a
value dependent on the locale or by the environment.
2009-12-07 19:00:55 +00:00
Emmanuele Bassi
3b9575baf8 Queue a relayout when the default text direction changes
We need a relayout cycle if the default direction for the text changes
while the main loop is running.
2009-12-07 18:41:15 +00:00
Emmanuele Bassi
c4f27b1556 actor: Add a NO_LAYOUT flag for actors
Some actor implementation might avoid imposing any layout on their
children. The Actor base class usually assumes some sort of layout
management is in place, so it will queue relayouts when, for instance,
an actor is shown or is hidden. If the parent of the actor does not
impose any layout, though, showing or hiding one of its children will
not affect the layout of the others.

An example of this kind of container is ClutterGroup.

By adding a new Actor flag, CLUTTER_ACTOR_NO_LAYOUT, and by making
the Group actor set it on itself, the Actor base class can now decide
whether or not to queue a relayout. The flag is not meant to be used
by application code, and should only be set when implementing a new
container.

http://bugzilla.openedhand.com/show_bug.cgi?id=1838
2009-12-07 14:14:35 +00:00
Emmanuele Bassi
cf62b8fe4a actor: Add debugging notes for size cache
Add a note for cache hits, and another one for cache misses.
2009-12-04 17:38:26 +00:00
Emmanuele Bassi
9ccdf2eb02 box: Add relative packing methods
ClutterBox should provide some convenience functions to pack a new child
at a given position, either an absolute index or relative to a sibling.
2009-12-04 16:54:22 +00:00
Johan Bilien
c9b7efec96 Add a cache of size requests
clutter_actor_get_preferred_width/height currently caches only one size
requests, for a given height / width.

It's common for a layout manager to call get_preferred_width with 2
different heights during the same allocation cycle. Typically once in
the size request, once in the allocation. If
clutter_actor_get_preferred_width is called
alternatively with 2 different for_height, the cache is totally
inefficient, and we end up always querying the actor size even
when the actor does not need a re-allocation.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-12-03 18:19:50 +00:00
Bastian Winkler
18860eb16f flow-layout: Use the natural size
Fix a copy-and-paste thinko where the cell size was computed using the
minimum size instead of the natural size. For actors with a minimum size
of zero, like Textures, this implied always a zero allocation.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-12-03 15:38:05 +00:00
Neil Roberts
7f58c14dcd cogl: Use #ifdef GL around GL_TEXTURE_RECTANGLE_ARB
Commit 558b17ee1e added support for rectangle textures to the
framebuffer code. Under GLES there is no GL_TEXTURE_RECTANGLE_ARB
definition so this was breaking the build. The rest of Cogl uses
ifdef's around that constant so we should do the same here.
2009-12-02 21:59:58 +00:00
Emmanuele Bassi
59d84f7806 build: Fix CPP and LD flags
• The debug flags are pre-processor ones, so they should be listed
  inside AM_CPPFLAGS.

• Clutter's publicly exported symbols match the following regular
  expression:

    ^(clutter|cogl|json)_*

  The old one also listed "pango" as a possible prefix, but the
  Pango API is now under the Cogl namespace.
2009-12-02 16:03:55 +00:00
Emmanuele Bassi
17e3b526d5 docs: Document Clutter's threading model
Be explicit on how to deal with threads and Clutter.
2009-12-02 14:15:43 +00:00
Emmanuele Bassi
fc7bbf1abf docs: Fix docbook syntax
The <variablename> tag is really called <varname> in DocBook.
2009-12-02 14:15:19 +00:00
Emmanuele Bassi
3c08c411d2 docs: Annotate StageManager
The ClutterStageManager instance structure is private, so we need a
"floating" annotation.
2009-12-02 11:38:04 +00:00
Emmanuele Bassi
7a33b706a4 Remove a gtk-doc annotation
The Mesa matrix code still has a comment that looks like a gtk-doc
annotation.
2009-12-02 11:37:13 +00:00
Emmanuele Bassi
0270313121 layout: Add padding to LayoutMeta
Add some padding to the LayoutMeta and LayoutMetaClass structures.
2009-12-02 11:36:25 +00:00
Emmanuele Bassi
02398c0cf1 Remove unused variable 'lang'
Fix a compiler warning.
2009-12-01 18:16:48 +00:00
Rob Bradford
cdba8cc220 flow-layout: Include the first line when calculating number of lines
This ensures that the preferred height / width height takes into consideration
the correct amount of padding
2009-12-01 17:46:12 +00:00
Rob Bradford
c564303601 flow-layout: Respect row-spacing/col-spacine in horizontal/vertical flows
We need to add the row-spacing value when calculating the y position for lines
of actors in horizontal flowing layouts.

Similarly we need to add the col-spacing value when calculating the x posution
for actors in vertical flowing layouts.
2009-12-01 17:46:11 +00:00
Emmanuele Bassi
b43e804c07 actor: Fix a pre-condition check in set_text_direction()
The check is failing because the condition should be:

  text_dir != CLUTTER_TEXT_DIRECTION_DEFAULT
2009-12-01 16:06:57 +00:00
Emmanuele Bassi
586750751a Merge branch 'text-direction'
* text-direction:
  docs: Add text-direction accessors
  Set the default language on the Pango context
  actor: Set text direction on parenting
  tests: Display the index inside text-box-layout
  box-layout: Honour :text-direction
  text: Dirty layout cache on text direction changes
  actor: Add :text-direction property
  Use the newly added ClutterTextDirection enumeration
  Add ClutterTextDirection enumeration
2009-12-01 14:55:19 +00:00
Emmanuele Bassi
15a04a1dd3 layout-manager: Create LayoutMeta on demand
The ClutterLayoutMeta instances should be created on demand, whenever
the layout manager needs them - if the layout manager supports layout
properties.

This removes the requirement to call add_child_meta() and
remove_child_meta() on add and remove respectively; it also simplifies
the implementation of LayoutManager sub-classes since we can add
fallback code in the base abstract class.

Eventually, this will also lead to an easier to implement ClutterScript
parser for layout properties.

With the new scheme, the ClutterLayoutMeta instance is created whenever
the layout manager tries to access it; if there isn't an instance
already attached to the container's child, one is created -- assuming
that the LayoutManager sub-class has overridden the
get_child_meta_type() virtual function and it's returning a valid GType.

We can also provide a default implementation for create_child_meta(),
by getting the GType and instantiating a ClutterLayoutMeta with all the
fields already set. If the layout manager requires more work then it can
obviously override the default implementation (and even chain up to it).

The ClutterBox actor has been updated, as well as the ClutterBoxLayout
layout manager, to take advantage of the changes of LayoutManager.
2009-11-30 19:11:00 +00:00
Neil Roberts
c3e640e6e3 Use the correct colour when clearing the stage for picking
The colour test for the stage in _clutter_do_pick checks for white to
determine whether the stage was picked but since 47db7af4d we were
setting the colur to black. This usually worked because the id of the
default stage ends up being 0 which equates to black. However if a
second stage is created then it will always end up picking the first
stage.
2009-11-30 19:09:05 +00:00
Neil Roberts
1bb034fbd7 cogl: Enable blending if a lighting colour is semi-transparent
We currently enable blending if the material colour has
transparency. This patch makes it also enable blending if any of the
lighting colours have transparency. Arguably this isn't neccessary
because we don't expose any API to enable lighting so there is no
bug. However it is currently possible to enable lighting with a direct
call to glEnable and this otherwise works so it is a shame not to have
it.

http://bugzilla.openedhand.com/show_bug.cgi?id=1907
2009-11-30 19:08:38 +00:00
Emmanuele Bassi
3cb974ee8b Set the default language on the Pango context
When creating the Pango context we should also set the language
to be the default Pango language.
2009-11-30 16:15:19 +00:00
Emmanuele Bassi
daeb3b2fec actor: Set text direction on parenting
When setting the parent on an actor we should set the text direction to
be the same as the parent's.
2009-11-30 16:14:09 +00:00
Robert Bragg
934eb5d251 primitives: Don't use dynamic arrays since VS2008 can't cope with them :-(
This changes _cogl_path_fill_nodes_scanlines to use g_alloca instead of
using a variable to declare an array length.
2009-11-27 15:24:09 +00:00
Robert Bragg
47db7af4d3 picking: avoid redundant picking geometry for the stage.
The stage's pick id can be written to the framebuffer when we call
cogl_clear so there's no need for the stage to also chain up in it's pick
function resulting in clutter-actor.c also emitting a rectangle for the
stage.
2009-11-27 00:43:57 +00:00
Robert Bragg
439f8c62b0 cogl: deprecate cogl_draw_buffer API and replace with a cogl_framebuffer API
cogl_push_draw_buffer, cogl_set_draw_buffer and cogl_pop_draw_buffer are now
deprecated and new code should use the new cogl_framebuffer_* API instead.

Code that previously did:
    cogl_push_draw_buffer ();
    cogl_set_draw_buffer (COGL_OFFSCREEN_BUFFER, buffer);
    /* draw */
    cogl_pop_draw_buffer ();
should now be re-written as:
    cogl_push_framebuffer (buffer);
    /* draw */
    cogl_pop_framebuffer ();

As can be seen from the example above the rename has been used as an
opportunity to remove the redundant target argument from
cogl_set_draw_buffer; it now only takes one call to redirect to an offscreen
buffer, and finally the term framebuffer may be a bit more familiar to
anyone coming from an OpenGL background.
2009-11-26 19:33:14 +00:00
Robert Bragg
b598210e01 cogl_offscreen: deprecate cogl_offscreen_ref/unref.
New code should use cogl_handle_ref/unref
2009-11-26 19:33:13 +00:00
Neil Roberts
e12a691187 cogl: Use a vtable for the texture backends instead of a type and switch
Instead of storing an enum with the backend type for each texture and
then using a switch statement to decide which function to call, we
should store pointers to all of the functions in a struct and have
each texture point to that struct. This is potentially slightly faster
when there are more backends and it makes implementing new backends
easier because it's more obvious which functions have to be
implemented.
2009-11-25 13:47:28 +00:00
Robert Bragg
558b17ee1e offscreen: cogl_offscreen_new_to_texture now supports GL_TEXTURE_RECTANGLE_ARB
cogl_offscreen_new_to_texture previously bailed out if the given texture's
GL target was anything but GL_TEXTURE_2D, but it now also allows
foreign GL_TEXTURE_RECTANGLE_ARB textures.

Thanks to Owen for reporting this issue, ref:
https://bugzilla.gnome.org/show_bug.cgi?id=601032
2009-11-25 02:56:25 +00:00
Robert Bragg
d3a01e0c96 debug: remove the COGL_DEBUG=client-side-matrices option
Cogl only supports client side matrices so this debug option is no longer
useful.
2009-11-25 02:55:56 +00:00
Robert Bragg
b38c6b420f [cogl-material] Adds cogl_material_copy() API
cogl_material_copy can be used to create a new CoglHandle referencing a copy
of some given material.

From now on we will advise that developers always aim to use this function
instead of cogl_material_new() when creating a material that is in any way
derived from another.

By using cogl_material_copy, Cogl can maintain an ancestry for each material
and keep track of "similar" materials.  The plan is that Cogl will use this
information to minimize the cost of GPU state transitions.
2009-11-24 17:58:22 +00:00
Robert Bragg
70ca3bfe41 [cogl] remove unused gles/cogl-utils.[c,h]
The only function in gles/cogl-utils.c was cogl_util_next_p2() and it's
redundant since we also have a cogl/cogl-utils.[c,h]
2009-11-24 17:58:22 +00:00
Robert Bragg
4a63af0c63 docs: Don't document cogl_flush_gl_state as public API
This function was #if 0'd before we released Clutter 1.0 so there's no
implementation of it.  At some point we thought it might assist with
developers breaking out into raw OpenGL.  Breaking out to raw GL is a
difficult problem though so we decided instead we will wait for a specific
use case to arrise before trying to support it.
2009-11-24 17:58:22 +00:00
Emmanuele Bassi
328ce370e7 animation: Keep a weak reference on actors
Actors, unlike objects, can effectively go away whilst being
animated - usually because of an explicit destoy().

The Animation created by clutter_actor_animate() and friends
should keep a weak reference on the actor and eventually
get rid of the animation itself in case the actor goes away
whilst being animated.
2009-11-24 16:59:24 +00:00
Neil Roberts
1107fa8797 Minor fix to cogl material
_cogl_material_get_layer expects a CoglMaterial* pointer but it was
being called with a CoglHandle. This doesn't matter because the
CoglHandle is actually just the CoglMaterial* pointer anyway but it
breaks the ability to change the _cogl_material_pointer_from_handle
macro.
2009-11-23 18:36:59 +00:00
Emmanuele Bassi
8d64c4641d docs: Increase consistency in Cogl documentation 2009-11-19 14:19:59 +00:00
Emmanuele Bassi
550c14449e docs: Documentation fixes for CoglMatrix
Clean up the references, the docbook tags, and the style to fit in
with the rest of the API references for Cogl and Clutter.
2009-11-19 13:56:47 +00:00
Emmanuele Bassi
056cfcffc3 Whitespace fix for cogl-color.h 2009-11-19 13:56:47 +00:00
Emmanuele Bassi
851d628cf8 docs: Documentation fixes for CoglMaterial
Clean up the references, the docbook tags, and the style to fit in
with the rest of the API references for Cogl and Clutter.
2009-11-19 13:56:47 +00:00
Emmanuele Bassi
fe804f1d02 docs: Documentation fixes for CoglBitmap
• Use the same style for the Cogl API reference as the one used for
  the Clutter API reference.

• Fix the introspection annotations for cogl_bitmap_get_size_from_file()
2009-11-19 13:56:47 +00:00
Emmanuele Bassi
05a5a7e759 docs: Remove non-gtk-doc annotations
The imported Mesa matrix code has some documentation annotations
that make gtk-doc very angry. Since it's all private anyway we
can safely make gtk-doc ignore the offending stuff.
2009-11-19 13:55:46 +00:00
Neil Roberts
7a011af974 docs: Fix the 'Since' annotation for some functions
The 'Since' annotation needs to have a colon after it or gtk-doc won't
pick it up.
2009-11-19 11:51:21 +00:00
Neil Roberts
8ef57898ad cogl: Use APIENTRY for GL function pointer declarations
This matters for platforms such as Windows that use a different
calling covention from the default for GL functions.
2009-11-18 19:24:09 +00:00
Neil Roberts
be58e5261f build: Fix out-of-tree builds for cogl-defines.h
$(COGL_DRIVER)/cogl-defines.h is generated in the configure script so
it ends up in the build directory. Therefore the build rule for
cogl/cogl-defines.h should depend on the file in $(builddir) not
$(srcdir).
2009-11-18 19:24:09 +00:00