Emmanuele Bassi [Mon, 19 Oct 2009 10:45:15 +0000 (11:45 +0100)]
Merge branch 'layout-manager'
* layout-manager: (50 commits)
docs: Reword a link
layout, docs: Add more documentation to LayoutManager
layout, docs: Fix description of Bin properties
layout, bin: Use ceilf() instead of casting to int
layout, docs: Add long description for FlowLayout
layout, box: Clean up
layout, box: Write long description for Box
layout, docs: Remove unused functions
layout: Document BoxLayout
layout: Add BoxLayout, a single line layout manager
layout: Report the correct size of FlowLayout
layout: Resizing the stage resizes the FlowLayout box
layout: Use the get_request_mode() getter in BinLayout
layout: Change the request-mode along with the orientation
actor: Add set_request_mode() method
[layout] Remove FlowLayout:wrap
[layout] Rename BinLayout and FlowLayout interactive tests
[layout] Skip invisible children in FlowLayout
[layout] Clean up and document FlowLayout
[layout] Snap children of FlowLayout to column/row
...
Emmanuele Bassi [Mon, 19 Oct 2009 10:44:29 +0000 (11:44 +0100)]
docs: Reword a link
Emmanuele Bassi [Mon, 19 Oct 2009 10:00:23 +0000 (11:00 +0100)]
layout, docs: Add more documentation to LayoutManager
The layout manager reference should have some documentation on how
to use a LayoutManager object inside a container and how to implement
a LayoutManager sub-class correctly.
Emmanuele Bassi [Sun, 18 Oct 2009 16:49:00 +0000 (17:49 +0100)]
build: Add back QUIET_GEN to the GIR generation
Emmanuele Bassi [Sun, 18 Oct 2009 16:15:04 +0000 (17:15 +0100)]
Update ignore file
Emmanuele Bassi [Sun, 18 Oct 2009 16:12:12 +0000 (17:12 +0100)]
build: De-nest the JSON from the introspection rules
The JSON conditional rules can be moved outside the introspection
conditional ones to avoid a nested check, as all the JSON rules do
is setting up variables that may or may not be used.
Emmanuele Bassi [Sun, 18 Oct 2009 16:11:42 +0000 (17:11 +0100)]
build: Use QUIET_GEN when building ClutterJson GIR
Emmanuele Bassi [Sun, 18 Oct 2009 16:00:24 +0000 (17:00 +0100)]
build: Fix up the GIR generation rules
The rules for generating Clutter's introspection data are
still referencing the old COGL layout.
Emmanuele Bassi [Fri, 16 Oct 2009 23:30:37 +0000 (00:30 +0100)]
build: Add CPPFLAGS for the g-ir-scanner command line
When I moved all CPP flags to AM_CPPFLAGS from the INCLUDES directive
I forgot that g-ir-scanner needs those defines as well.
Robert Bragg [Wed, 16 Sep 2009 13:01:57 +0000 (14:01 +0100)]
[cogl-primitives] Split the journal out from cogl-primitives.c
The Journal can be considered a standalone component, so even though
it's currently only used to log quads, it seems better to split it
out into its own file.
Robert Bragg [Sun, 6 Sep 2009 20:47:46 +0000 (21:47 +0100)]
[test-backface-culling] Check that inverted tex coords don't affect culling
The additional check draws another front facing rectangle but this time with
the texture coords flipped on the x axis. The code that handles sliced
textures in cogl-primitives.c makes some suspicious changes to the geometry
when the texture coords are inverted.
Robert Bragg [Wed, 23 Sep 2009 14:11:55 +0000 (15:11 +0100)]
[cogl-spans] split out cogl-spans code from cogl-texture-2d-sliced
When we implement atlas textures we will probably want to use the spans API
to handle texture repeating so it doesn't make sense to leave the code in
cogl-texture-2d-sliced.c. Since it's a standalone set of data structures
and algorithms it also seems reasonable to split out from cogl-texture.
Vladimir Nadvornik [Sun, 30 Aug 2009 10:36:11 +0000 (12:36 +0200)]
[cogl-texture] Split CoglTexture into an abstract class + CoglTexture2dSliced
cogl-texture-2d-sliced provides an implementation of CoglTexture and this
seperation lays the foundation for potentially supporting atlas textures,
pixmap textures (as in GLX_EXT_texture_from_pixmap) and fast-path
GL_TEXTURE_{1D,2D,3D,RECTANGLE} textures in a maintainable fashion.
Robert Bragg [Wed, 16 Sep 2009 10:56:17 +0000 (11:56 +0100)]
[cogl-texture] Seal CoglTexture internals from cogl-primitives.c
cogl-primitives.c was previously digging right into CoglTextures so it could
manually iterate the texture slices for texturing quads and polygons and
because we were missing some state getters we were lazily just poking into
the structures directly.
This adds some extra state getter functions, and adds a higher level
_cogl_texture_foreach_slice () API that hopefully simplifies the way in
which sliced textures may be used to render primitives. This lets you
specify a rectangle in "virtual" texture coords and it will call a given
callback for each slice that intersects that rectangle giving the virtual
coords of the current slice and corresponding "real" texture coordinates for
the underlying gl texture.
At the same time a noteable bug in how we previously iterated sliced
textures was fixed, whereby we weren't correctly handling inverted texture
coordinates. E.g. with the previous code if you supplied texture coords of
tx1=100,ty1=0,tx2=0,ty2=100 (inverted along y axis) that would result in a
back-facing quad, which could be discarded if using back-face culling.
Robert Bragg [Thu, 30 Jul 2009 11:06:02 +0000 (12:06 +0100)]
[docs] switch gl_handle+gl_target docs for cogl_texture_new_from_foreign
The descriptions for gl_handle and gl_target were inverted.
Thanks to Young-Ho Cha for spotting that.
Signed-off-by: Robert Bragg <robert@linux.intel.com>
Robert Bragg [Wed, 29 Jul 2009 16:21:07 +0000 (17:21 +0100)]
[cogl] move clutter/pango to clutter/cogl/pango
As part of the re-organisation of Cogl; move clutter/pango to be part of the
cogl sub-project.
Robert Bragg [Tue, 28 Jul 2009 01:02:02 +0000 (02:02 +0100)]
Intial Re-layout of the Cogl source code and introduction of a Cogl Winsys
As part of an incremental process to have Cogl be a standalone project we
want to re-consider how we organise the Cogl source code.
Currently this is the structure I'm aiming for:
cogl/
cogl/
<put common source here>
winsys/
cogl-glx.c
cogl-wgl.c
driver/
gl/
gles/
os/ ?
utils/
cogl-fixed
cogl-matrix-stack?
cogl-journal?
cogl-primitives?
pango/
The new winsys component is a starting point for migrating window system
code (i.e. x11,glx,wgl,osx,egl etc) from Clutter to Cogl.
The utils/ and pango/ directories aren't added by this commit, but they are
noted because I plan to add them soon.
Overview of the planned structure:
* The winsys/ API is the API that binds OpenGL to a specific window system,
be that X11 or win32 etc. Example are glx, wgl and egl. Much of the logic
under clutter/{glx,osx,win32 etc} should migrate here.
* Note there is also the idea of a winsys-base that may represent a window
system for which there are multiple winsys APIs. An example of this is
x11, since glx and egl may both be used with x11. (currently only Clutter
has the idea of a winsys-base)
* The driver/ represents a specific varient of OpenGL. Currently we have "gl"
representing OpenGL 1.4-2.1 (mostly fixed function) and "gles" representing
GLES 1.1 (fixed funciton) and 2.0 (fully shader based)
* Everything under cogl/ should fundamentally be supporting access to the
GPU. Essentially Cogl's most basic requirement is to provide a nice GPU
Graphics API and drawing a line between this and the utility functionality
we add to support Clutter should help keep this lean and maintainable.
* Code under utils/ as suggested builds on cogl/ adding more convenient
APIs or mechanism to optimize special cases. Broadly speaking you can
compare cogl/ to OpenGL and utils/ to GLU.
* clutter/pango will be moved to clutter/cogl/pango
How some of the internal configure.ac/pkg-config terminology has changed:
backendextra -> CLUTTER_WINSYS_BASE # e.g. "x11"
backendextralib -> CLUTTER_WINSYS_BASE_LIB # e.g. "x11/libclutter-x11.la"
clutterbackend -> {CLUTTER,COGL}_WINSYS # e.g. "glx"
CLUTTER_FLAVOUR -> {CLUTTER,COGL}_WINSYS
clutterbackendlib -> CLUTTER_WINSYS_LIB
CLUTTER_COGL -> COGL_DRIVER # e.g. "gl"
Note: The CLUTTER_FLAVOUR and CLUTTER_COGL defines are kept for apps
As the first thing to take advantage of the new winsys component in Cogl;
cogl_get_proc_address() has been moved from cogl/{gl,gles}/cogl.c into
cogl/common/cogl.c and this common implementation first trys
_cogl_winsys_get_proc_address() but if that fails then it falls back to
gmodule.
Robert Bragg [Tue, 28 Jul 2009 00:34:33 +0000 (01:34 +0100)]
Make the CoglContext structure a bit more maintainable
This moves most of cogl-context.{c.h} to cogl/common with some driver
specific members now living in a CoglContextDriver struct. Driver specific
context initialization and typedefs now live in
cogl/{gl,gles}/cogl-context-driver.{c,h}
Driver specific members can be found under ctx->drv.stuff
Robert Bragg [Mon, 27 Jul 2009 23:37:11 +0000 (00:37 +0100)]
Improve cogl-texture maintainability by moving 90% into cogl/common
This splits the limited components that differed between
cogl/{gl,gles}/cogl-texture.c into new {gl,gles}/cogl-texture-driver.c files
and the rest that can now be shared into cogl/common/cogl-texture.c
Robert Bragg [Thu, 20 Aug 2009 10:54:41 +0000 (11:54 +0100)]
[stage-egl] support fallbacks in clutter_stage_egl_realize
Most of clutter_stage_egl_realize was renamed to
_clutter_stage_egl_try_realize which now takes a cookie indicating which
fallback number should tried next. clutter_stage_egl_realize now keeps
trying to realize with successive fallback numbers until it succeeds or runs
out of fallbacks.
The only fallback supported for now is for hardware with no stencil buffer
support.
Robert Bragg [Mon, 3 Aug 2009 13:50:10 +0000 (14:50 +0100)]
[x11 backend] remove data duplicated between backends and stages
Make backends the canonical point of reference for the xdisplay, the xscreen
number, the x root window and the xvisinfo for creating foreign stages.
Robert Bragg [Fri, 31 Jul 2009 19:39:28 +0000 (20:39 +0100)]
[glx backend] white space fixes
Simply removes lots of trailing white spaces
Robert Bragg [Fri, 31 Jul 2009 16:07:10 +0000 (17:07 +0100)]
[glx backend] use FBConfigs instead of Visuals for GL context creation
This replaces calls to the old (glx 1.2) functions glXChooseVisual,
glXCreateContext, glXMakeCurrent with the 1.3+ fbconfig varients
glXChooseFBConfig, glXCreateNewContext, glXMakeContextCurrent.
Robert Bragg [Fri, 31 Jul 2009 17:34:51 +0000 (18:34 +0100)]
[backends] Remove the idea of offscreen stages from all backends
The only backend that tried to implement offscreen stages was the GLX backend
and even this has apparently be broken for some time without anyone noticing.
The property still remains and since the property already clearly states that
it may not work I don't expect anyone to notice.
This simplifies quite a bit of the GLX code which is very desireable from the
POV that we want to start migrating window system code down to Cogl and the
simpler the code is the more straight forward this work will be.
In the future when Cogl has a nicely designed API for framebuffer objects then
re-implementing offscreen stages cleanly for *all* backends should be quite
straightforward.
Robert Bragg [Fri, 16 Oct 2009 16:15:47 +0000 (17:15 +0100)]
[build] more Makefile.am.{enums,marshal} fixes for out of tree builds
for the marshal files $(srcdir) was getting prefixed twice since my last
commit (
2cc88f1140) since it was already being prefixed including
Makefile.am. The problem with prefixing it in the includer file though is
that the Make variable substitutions like :.list=.h mean we end up
generating into the $(srcdir). This removes the prefix added in
clutter/Makefile.am
We were also missing a $(srcdir) prefix when setting EXTRA_DIST
Emmanuele Bassi [Fri, 16 Oct 2009 14:57:21 +0000 (15:57 +0100)]
Simple coding style fix for commit
c5551184
Emmanuele Bassi [Fri, 16 Oct 2009 14:55:05 +0000 (15:55 +0100)]
Merge branch 'bug-1846'
* bug-1846:
Fix warning message in the ParamSpec validation
Emmanuele Bassi [Fri, 16 Oct 2009 14:55:04 +0000 (15:55 +0100)]
Merge branch 'bug-1845'
* bug-1845:
Add a warning when ClutterInterval can't compute progress
Damien Lespiau [Mon, 12 Oct 2009 16:05:05 +0000 (17:05 +0100)]
Fix warning message in the ParamSpec validation
When validating a new GValue against the ClutterParamSpecUnits, we issue
a warning when the units do not match with both the new value and the
unit we expect to have. Unfortunately we were printing the unit of the
new value twice and not the unit of the ParamSpec.
http://bugzilla.openedhand.com/show_bug.cgi?id=1846
Damien Lespiau [Mon, 12 Oct 2009 15:45:39 +0000 (16:45 +0100)]
Add a warning when ClutterInterval can't compute progress
This is really useful when trying to animate GTypes that haven't
registered any progress function. Instead of silently not working it
will warn the developer.
http://bugzilla.openedhand.com/show_bug.cgi?id=1845
Damien Lespiau [Mon, 12 Oct 2009 15:28:10 +0000 (16:28 +0100)]
Add ClutterInterval integration
To be able to animate CLUTTER_TYPE_UNITS properties we need to register
the GType and its progress function against the ClutterInterval code.
The two ClutterUnits defining the interval can use different units, the
resulting unit will always be in pixels, so calculating a progress
between 10px and 4cm is valid.
http://bugzilla.openedhand.com/show_bug.cgi?id=1844
Emmanuele Bassi [Fri, 16 Oct 2009 14:25:37 +0000 (15:25 +0100)]
units: Cache the pixels value inside Units
When computing the pixels value of a ClutterUnits value we should
be caching the value to avoid recomputing for every call of
clutter_units_to_pixels(). We already have a flag telling us to
return the cached value, but we miss the mechanism to evict the
cache whenever the Backend settings affecting the conversion, that
is default font and resolution, change.
In order to implement the eviction we can use a "serial"; the
Backend will have an internal serial field which we retrieve and
put inside the ClutterUnits structure (we split one of the two
64 bit padding fields into two 32 bit fields to maintain ABI); every
time we call clutter_units_to_pixels() we compare the units serial
with that of the Backend; if they match and pixels_set is set to
TRUE then we just return the stored pixels value. If the serials
do not match then we unset the pixels_set flag and recompute the
pixels value.
We can verify this by adding a simple test unit checking that
by changing the resolution of ClutterBackend we get different
pixel values for 1 em.
http://bugzilla.openedhand.com/show_bug.cgi?id=1843
Emmanuele Bassi [Fri, 16 Oct 2009 13:22:15 +0000 (14:22 +0100)]
text: Notify :position when it changes
The :position property is not notified when changed.
http://bugzilla.openedhand.com/show_bug.cgi?id=1830
Emmanuele Bassi [Sat, 19 Sep 2009 08:19:06 +0000 (09:19 +0100)]
[text] NULL-ify strings to avoid double-frees
Emmanuele Bassi [Sat, 19 Sep 2009 08:18:06 +0000 (09:18 +0100)]
[text] Do not apply unset preedit attributes
The pre-edit attributes are optional and thus should only be applied
if they have been set to avoid assertion failures.
Emmanuele Bassi [Wed, 9 Sep 2009 11:15:23 +0000 (12:15 +0100)]
[text] Add pre-edit string to ClutterText
Input Methods require to be able to set a "pre-edit string", that is
a string that it's just displayed into the Text actor without being
committed to the actor's buffer. The string might require custom Pango
attributes, and an update of the cursor position.
Robert Bragg [Thu, 15 Oct 2009 18:12:34 +0000 (19:12 +0100)]
[build] fix Makefile.am.{enums,marshal} to support out of tree builds
Out of tree builds were broken in commit
46b736f42e1165 since we didn't
explicitly use $(srcdir) to find the input files for glib-mkenums and
glib-genmarshal.
Emmanuele Bassi [Thu, 15 Oct 2009 13:20:44 +0000 (14:20 +0100)]
layout, docs: Fix description of Bin properties
The BinLayer and BinLayout properties name and blurb for introspection
should be slightly more descriptive.
Emmanuele Bassi [Thu, 15 Oct 2009 13:12:37 +0000 (14:12 +0100)]
layout, bin: Use ceilf() instead of casting to int
Casting a float to int to truncate it before assigning the value
to a float again is wrong. We should use ceilf() instead which
does what we want to achieve (rounding up the size to avoid
sub-pixel positioning of children).
Emmanuele Bassi [Thu, 15 Oct 2009 13:11:36 +0000 (14:11 +0100)]
layout, docs: Add long description for FlowLayout
Add the full description of the layout policy
Emmanuele Bassi [Thu, 15 Oct 2009 11:15:49 +0000 (12:15 +0100)]
layout, box: Clean up
* Use g_list_foreach() instead of iterating over the list inside
the destruction sequence, since we are causing the widgets to be
implicitly removed from the list via the destroy() call.
* Use g_signal_connect_swapped() and spare us from a callback.
Emmanuele Bassi [Thu, 15 Oct 2009 11:04:50 +0000 (12:04 +0100)]
layout, box: Write long description for Box
Also have an example of how to create a Box with a layout manager
and how to use the pack() method.
Emmanuele Bassi [Tue, 13 Oct 2009 15:52:57 +0000 (16:52 +0100)]
layout, docs: Remove unused functions
The :wrap property and its accessor functions were removed from
ClutterFlowLayout.
Emmanuele Bassi [Tue, 13 Oct 2009 11:15:25 +0000 (12:15 +0100)]
layout: Document BoxLayout
Add BoxLayout to the API reference.
Emmanuele Bassi [Tue, 13 Oct 2009 11:14:05 +0000 (12:14 +0100)]
layout: Add BoxLayout, a single line layout manager
The BoxLayout layout manager implements a layout policy for arranging
children on a single line, either alongside the X axis or alongside the
Y axis.
Emmanuele Bassi [Thu, 8 Oct 2009 14:45:29 +0000 (15:45 +0100)]
layout: Report the correct size of FlowLayout
FlowLayout should compute the correct height for the assigned width when
in horizontal flow, and the correct width for the assigned height when
in vertical flow. This means pre-computing the number of lines inside
the get_preferred_width() and get_preferred_height(). We can then cache
the computed column width and row height, cache them inside the layout
and then use them when allocating the children.
Emmanuele Bassi [Wed, 7 Oct 2009 14:30:29 +0000 (15:30 +0100)]
layout: Resizing the stage resizes the FlowLayout box
Add some user interaction to verify the dynamic reflowing.
Emmanuele Bassi [Wed, 7 Oct 2009 14:29:47 +0000 (15:29 +0100)]
layout: Use the get_request_mode() getter in BinLayout
Instead of using g_object_get(child, "request-mode", ...).
Emmanuele Bassi [Wed, 7 Oct 2009 14:28:01 +0000 (15:28 +0100)]
layout: Change the request-mode along with the orientation
When changing the orientation of a FlowLayout, the associated
container should also change its request mode. A horizontally
flowing layout has a height depending on the width, since it
will reflow vertically; similarly, a vertically reflowing layout
will have a width depending on the height.
Emmanuele Bassi [Wed, 7 Oct 2009 14:15:02 +0000 (15:15 +0100)]
actor: Add set_request_mode() method
We should not require the use g_object_set()/_get() for accessing
the :request-mode property. A proper accessors pair should be
preferred.
Emmanuele Bassi [Wed, 7 Oct 2009 11:35:39 +0000 (12:35 +0100)]
[layout] Remove FlowLayout:wrap
The :wrap property is not implemented, and mostly useless: the
FlowLayout is a reflowing grid. This means that if it receives
less than the preferred width or height in the flow direction
then it should always reflow.
Emmanuele Bassi [Wed, 7 Oct 2009 10:42:09 +0000 (11:42 +0100)]
[layout] Rename BinLayout and FlowLayout interactive tests
The BinLayout and FlowLayout interactive tests should be named more
explicitly.
Emmanuele Bassi [Wed, 7 Oct 2009 10:39:18 +0000 (11:39 +0100)]
[layout] Skip invisible children in FlowLayout
Skip hidden actors when computing the preferred size and when
allocating.
Emmanuele Bassi [Wed, 7 Oct 2009 10:08:51 +0000 (11:08 +0100)]
[layout] Clean up and document FlowLayout
Emmanuele Bassi [Tue, 6 Oct 2009 16:30:49 +0000 (17:30 +0100)]
[layout] Snap children of FlowLayout to column/row
Use the column and row size to align each child; with :homogeneous
set to TRUE, or with children with the same size, the FlowLayout
will behave like a reflowing grid.
Emmanuele Bassi [Tue, 6 Oct 2009 15:17:16 +0000 (16:17 +0100)]
[layout] Add :homogeneous to FlowLayout
Emmanuele Bassi [Fri, 18 Sep 2009 16:28:02 +0000 (17:28 +0100)]
[layout] Initial implementation of FlowLayout
FlowLayout is a layout manager that arranges its children in a
reflowing line; the orientation controls the major axis for the
layout: horizontal, for reflow on the Y axis, and vertical, for
reflow on the X axis.
Emmanuele Bassi [Mon, 5 Oct 2009 16:21:41 +0000 (17:21 +0100)]
[layout] Use FixedLayout inside Group
The Group actor should use the FixedLayout layout manager object
to avoid duplicating code.
Emmanuele Bassi [Mon, 5 Oct 2009 16:09:04 +0000 (17:09 +0100)]
[layout] Update FixedLayout
The behaviour of ClutterGroup has been fixed with regards to the
preferred size request; the fixed layout manager should use the
same behaviour.
Emmanuele Bassi [Fri, 18 Sep 2009 14:29:09 +0000 (15:29 +0100)]
[layout] Typo and whitespace fixes
Emmanuele Bassi [Thu, 17 Sep 2009 17:21:51 +0000 (18:21 +0100)]
[layout, box] Add Box:color
Allow setting the background color of a ClutterBox
Emmanuele Bassi [Thu, 17 Sep 2009 10:38:43 +0000 (11:38 +0100)]
[layout, docs] Clean up BinLayout documentation
Documentation and code style fixes for BinLayout.
Emmanuele Bassi [Wed, 16 Sep 2009 14:55:30 +0000 (15:55 +0100)]
[layout, tests] Use variants for child packing in Box
There are three potential variants to add a child inside a Box
with a BinLayout:
- clutter_box_pack(), a variadic argument function which
allows passing arbitrary LayoutMeta properties and values;
- clutter_bin_layout_add(), which uses the backpointer to
the container from the LayoutManager and sets the layout
properties directly without GValue (de)marshalling
- clutter_container_add_actor() and
clutter_bin_layout_set_alignment(), similar to the
clutter_bin_layout_add() function above, but split in two
The test-box interactive test should exercise all three variants.
Emmanuele Bassi [Wed, 16 Sep 2009 14:51:13 +0000 (15:51 +0100)]
[layout] Store and use the container inside BinLayout
The BinLayout should store a pointer to the Container that it is
using it as the layout manager.
This allows us to fix the API and drop the additional Container
arguments from set_alignment() and get_alignment().
This also allows us to add a ClutterBinLayout::add() method which
adds an actor and sets the alignment policies without dealing with
variadic arguments functions and GValue (de)marshalling.
Emmanuele Bassi [Wed, 16 Sep 2009 14:48:28 +0000 (15:48 +0100)]
[layout] Set a back pointer to Box inside the layout
Use the LayoutManager API to set a back pointer to the Box actor
inside the LayoutManager used by the box.
This also allows us to replace the LayoutManager on a Box, since
the LayoutManager will be able to replace all the metadata if
needed.
Emmanuele Bassi [Wed, 16 Sep 2009 14:47:26 +0000 (15:47 +0100)]
[layout] Replace stale LayoutMeta
If a LayoutMeta references a different container and/or layout manager
then we should simply replace it and discard the previous one.
Emmanuele Bassi [Wed, 16 Sep 2009 13:58:30 +0000 (14:58 +0100)]
[layout] Allow taking a back pointer to the Container
The LayoutManager implementation might opt to take a back pointer
to the Container that is using the layout instance; this allows
direct access to the container itself from within the implementation.
Emmanuele Bassi [Wed, 16 Sep 2009 10:10:45 +0000 (11:10 +0100)]
[layout] Rename Box::add to Box::pack
Since ClutterBox is a ClutterContainer we should avoid naming
collisions between methods.
Emmanuele Bassi [Wed, 16 Sep 2009 10:10:38 +0000 (11:10 +0100)]
[layout, docs] Document FixedLayout
Emmanuele Bassi [Tue, 15 Sep 2009 22:20:51 +0000 (23:20 +0100)]
[layout] Implement ClutterBox::add
The ClutterBox::add method is a simple wrapper around the Container
add_actor() method and the LayoutManager layout properties API. It
allows adding an actor to a Box and setting the layout properties in
one call.
If the LayoutManager used by the Box does not support layout properties
then the add() method short-circuits out.
Along with the varargs version of the method there's also a vector-based
variant, for language bindings to use.
Emmanuele Bassi [Tue, 15 Sep 2009 16:37:11 +0000 (17:37 +0100)]
[layout] Add LayoutMeta
Instead of overloading ClutterChildMeta with both container and layout
metadata and delegate to every LayoutManager implementation to keep a
backpointer to the layout manager instance, we can simply subclass
ChildMeta into LayoutMeta and presto! everything works out pretty well
for everyone.
Emmanuele Bassi [Tue, 15 Sep 2009 15:24:47 +0000 (16:24 +0100)]
[layout, docs] Add layout managers sections
Add LayoutManager and its subclasses, and the Box actor to the
gtk-doc machinery needed to generate the API reference.
Emmanuele Bassi [Mon, 14 Sep 2009 20:51:49 +0000 (21:51 +0100)]
[layout] Add layers to BinLayout
Each actor managed by a BinLayout policy should reside inside its
own "layer", with horizontal and vertical alignment. The :x-align
and :y-align properties of the BinLayout are the default alignment
policies, which are copied to each new "layer" when it is created.
The set_alignment() and get_alignment() methods of BinLayout can
be changed to operate on a specific "layer".
The whole machinery uses the new ChildMeta support inside the
LayoutManager base abstract class.
Emmanuele Bassi [Mon, 14 Sep 2009 20:50:20 +0000 (21:50 +0100)]
[layout] Bind the layout ChildMeta inside Box
The ClutterBox container actor should add and remove ChildMeta to
each actor that has been added and removed to the list of children,
respectively.
Emmanuele Bassi [Mon, 14 Sep 2009 20:48:06 +0000 (21:48 +0100)]
[layout] Bind ChildMeta to LayoutManager
The ChildMeta object is a storage for child-container properties,
that is properties that exist only when an actor is inside a specific
container. The LayoutManager delegate class should also have
layout-specific properties -- so, for this job, we can "recycle"
ChildMeta as the storage.
Emmanuele Bassi [Mon, 14 Sep 2009 11:04:42 +0000 (12:04 +0100)]
[layout] Document BinLayout
Emmanuele Bassi [Mon, 14 Sep 2009 11:03:38 +0000 (12:03 +0100)]
[layout] Notify of alignment changes in BinLayout
Emit the ::layout-changed when the BinLayout alignment policies change.
This will result in a queue_relayout() on the containers using the
BinLayout layout manager.
Emmanuele Bassi [Mon, 14 Sep 2009 10:28:34 +0000 (11:28 +0100)]
[layout] Update Box
* Use ::layout-changed to queue a relayout when the layout changes
* Destroy the Box children when destroying the Box
* Allow getting the layout manager from the Box
Emmanuele Bassi [Mon, 14 Sep 2009 10:04:11 +0000 (11:04 +0100)]
[layout] Add LayoutManager::layout-changed signal
If a sub-class of LayoutManager wishes to implement a parametrized
layout policy it also needs a way to notify the container using the
layout manager that the layout has changed. We cannot do it directly
and automatically from the LayoutManager because a) it has no back
link to the actor that it is using it and b) it can be attached to
multiple actors.
This is a job for <cue raising dramatic music> signals!
By adding ClutterLayoutManager::layout-changed (and its relative
emitted function) we can notify actors using the layout manager that
the layout parameters have been changed, and thus they should queue
a relayout.
Emmanuele Bassi [Fri, 11 Sep 2009 14:34:13 +0000 (15:34 +0100)]
[tests] Add a Box interactive test
Emmanuele Bassi [Fri, 11 Sep 2009 12:51:23 +0000 (13:51 +0100)]
[layout] Add BinLayout
A BinLayout is a simple layout manager that allocates a single cell,
providing alignment on both the horizontal and vertical axis.
If the container associated to the BinLayout has more than one child,
the preferred size returned by the layout manager will be as big as
the maximum of the children preferred sizes; the allocation will be
applied to all children - but it will still depend on each child
preferred size and the BinLayout horizontal and vertical alignment
properties.
The supported alignment properties are:
* center: align the child by centering it
* start: align the child at the top or left border of the layout
* end: align the child at the bottom or right border of the layout
* fill: expand the child to fill the size of the layout
* fixed: let the child position itself
Emmanuele Bassi [Wed, 2 Sep 2009 11:37:16 +0000 (12:37 +0100)]
[layout] Add Fixed layout manager
The FixedLayout layout manager object implements the same layout
policy of ClutterGroup.
Emmanuele Bassi [Wed, 2 Sep 2009 10:55:22 +0000 (11:55 +0100)]
[layout] Make LayoutManager a floating object
A layout manager instance makes only sense if it's owned by a
container. For this reason, it should have a floating reference
instead of a full reference on construction; this allows constructing
Boxes like:
box = clutter_box_new (clutter_fixed_layout_new ());
without leaking the layout manager instance.
Emmanuele Bassi [Tue, 1 Sep 2009 16:42:50 +0000 (17:42 +0100)]
[box] Add ClutterBox
ClutterBox is an actor with no layout management. It relies on
a ClutterLayoutManager to perform size requisition and allocation
of its children.
Emmanuele Bassi [Tue, 1 Sep 2009 15:34:28 +0000 (16:34 +0100)]
[layout] Add initial implementation of LayoutManager
The LayoutManager class is an abstract proxy for the size requesition
and size allocation process in ClutterActor.
A ClutterLayoutManager sub-class must implement get_preferred_width(),
get_preferred_height() and allocate(); a ClutterContainer using the
LayoutManager API will then proxy the corresponding Actor virtual
functions to the LayoutManager instance. This allows having a generic
"blank" ClutterActor sub-class, implementing the ClutterContainer
interface, which leaves only the layout management implementation to
the application developers.
Emmanuele Bassi [Tue, 13 Oct 2009 18:27:03 +0000 (19:27 +0100)]
build: Clean up main Makefile.am
Emmanuele Bassi [Tue, 13 Oct 2009 16:27:19 +0000 (17:27 +0100)]
build: Move marshallers and enum types rules out
The rules to create signal marshallers and enumeration GTypes are
usually copied and pasted all over different projects, though they
are pretty generic and, given a little bit of parametrization, can
be put in separate Makefile.am files and included whenever needed.
Emmanuele Bassi [Tue, 13 Oct 2009 16:00:15 +0000 (17:00 +0100)]
docs: Allow XInclude fallback for the annotation glossary
Emmanuele Bassi [Sat, 10 Oct 2009 12:52:46 +0000 (13:52 +0100)]
docs: Make StageManager a public class
The StageManager API is useful to track the stages of an application.
It will also be useful when we land the modules API.
Emmanuele Bassi [Sat, 10 Oct 2009 12:51:47 +0000 (13:51 +0100)]
stage/manager: Set :default-stage as read-only
The StageManager:default-stage property should be read-only, since
the default stage is owned by Clutter itself.
Emmanuele Bassi [Sat, 10 Oct 2009 12:50:25 +0000 (13:50 +0100)]
stage/manager: Deprecate set_default_stage()
The set_default_stage() method of StageManager should not be used
by application code; technically, nothing in Clutter uses it, and
StageManager's API is not considered public anyway.
Damien Lespiau [Fri, 9 Oct 2009 16:18:34 +0000 (17:18 +0100)]
[actor] Unset the IN_DESTRUCTION flag when leaving ::destroy()
The IN_DESTRUCTION flag is set around the unrealization and disposal of
the actor in clutter_actor_destroy() but is never unset (it's set twice
instead).
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
Emmanuele Bassi [Wed, 7 Oct 2009 20:44:17 +0000 (21:44 +0100)]
text: Make the :text property not set the :use-markup one
Currently, setting the :text property has the side-effect of
setting the :use-markup property to FALSE. This prevents
constructing a Text actor, or setting its properties, like:
g_object_set (text,
"use-markup", TRUE,
"text", some_string,
NULL);
as the ordering becomes important. Unfortunately, the ordering
of the properties cannot be enforced with ClutterScript or
with language bindings.
The documentation of the clutter_text_set_text() method should
be expanded to properly specify that the set_text() method will
change the :use-markup property to FALSE as a side effect.
Emmanuele Bassi [Wed, 7 Oct 2009 16:35:11 +0000 (17:35 +0100)]
docs: Add the "clipping" section to the COGL API reference
All the clip-related API in COGL is missing from the API reference
because the cogl-clipping section is not included inside the main
index file.
Damien Lespiau [Wed, 7 Oct 2009 16:09:41 +0000 (17:09 +0100)]
[units] Ensure we don't have ponies
The documentation states we should not parse ponies. Even with those
with exclamation marks.
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
Damien Lespiau [Mon, 5 Oct 2009 23:49:40 +0000 (00:49 +0100)]
[path] Add GValue transform functions from and to G_TYPE_STRING
Transform functions allow the use of g_value_transform() to cast
GValues. It's very handy to have casts to and from G_TYPE_STRING as it
allows generic serialization and parsing of GTypes.
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
Damien Lespiau [Tue, 6 Oct 2009 16:47:34 +0000 (17:47 +0100)]
[units] Add support for centimeters
The only tricky part of the patch is to remember that 1cm is 10mm.
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
Damien Lespiau [Tue, 6 Oct 2009 11:02:15 +0000 (12:02 +0100)]
[units] Be more strict in the grammar we are parsing
Current parsing of units has a number of shortcomings:
* a number followed by trailing space (without any unit specified) was
not recognized,
* "5 emeralds" was parsed as 5em,
* the way we parse the digits after the separator makes us lose
precision for no good reason (5.0 is parsed as 5.
00010014...f which
makes g_assert_cmpfloat() fail)
Let's define a stricter grammar we can recognize and try to do so. The
description is in EBNF form, removing the optional <> which is a pain
when having to write DocBook, and using '' for the terminal symbols.
Last step, add more ClutterUnits unit test to get a better coverage of
the grammar we want to parse.
Reviewed-by: Emmanuele Bassi <ebassi@linux.intel.com>
Emmanuele Bassi [Wed, 7 Oct 2009 12:00:57 +0000 (13:00 +0100)]
color: Measure the string just once when parsing
Instead of measuring the color hexadecimal string for each case, just
measure it once and then use a switch() to go to the right case.
Thomas Wood [Wed, 7 Oct 2009 11:27:38 +0000 (12:27 +0100)]
[color] allow alpha to be omitted when converting to color from string
Parse #rgb and #rrggbb in addition to forms with the alpha channel
specified. This allows conversion of colour strings from documents such as
CSS where the alpha channel is not specified when using '#' notation.
This patch also adds the relevant conformance test.