* 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
...
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.
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.
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
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.
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.
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
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.
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.
Instead of using ClutterActor for the base class of the Stage
implementation we should extend the StageWindow interface with
the required bits (geometry, realization) and use a simple object
class.
This require a wee bit of changes across Backend, Stage and
StageWindow, even though it's mostly re-shuffling.
First of all, StageWindow should get new virtual functions:
* geometry:
- resize()
- get_geometry()
* realization
- realize()
- unrealize()
This covers all the bits that we use from ClutterActor currently
inside the stage implementations.
The ClutterBackend::create_stage() virtual function should create
a StageWindow, and not an Actor (it should always have been; the
fact that it returned an Actor was a leak of the black magic going
on underneath). Since we never guaranteed ABI compatibility for
the Backend class, this is not a problem.
Internally to ClutterStage we can finally drop the shenanigans of
setting/unsetting actor flags on the implementation: if the realization
succeeds, for instance, we set the REALIZED flag on the Stage and
we're done.
As an initial proof of concept, the X11 and GLX stage implementations
have been ported to the New World Order(tm) and show no regressions.
g-ir-compiler currently opens the library for the .gir it is compiling;
to make that work we need to set LD_LIBRARY_PATH before running
g-ir-compiler to include .libs.
(I think this may have been working earlier because there was a
hack that substituted .so with .la and tried opening that; that
works for the incorrect libclutter-glx-1.0.so but not for the
correct libclutter-glx-1.0.so.0)
http://bugzilla.openedhand.com/show_bug.cgi?id=1771
Update the sed hack for the shared library to be more robust.
Remove the --shared-library command line argument from g-ir-scanner,
as no distribution will ever ship the .la files. This effectively
reverts commit 68f8a98cfb.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Use the --shared-library option to specify the shared object to link
against when compiling the typelib from the GIR data.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Following bug #1762, the syntax of g-ir-scanner was changed in
gobject-introspection, so Clutter does not build anymore with 0.6.4.
See the bugzilla bug:
http://bugzilla.gnome.org/show_bug.cgi?id=591669
GObject-Introspection now uses a different mechanism to extract the
SONAME when building the gir file and it needs the libtool archive as
option.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
We need to explicitly force order so that ClutterJson.gir and Cogl.gir
are present in the parent directory before we try to build Clutter.typelib.
http://bugzilla.openedhand.com/show_bug.cgi?id=1700
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
On some platforms (anything but Linux, and on obscure Linux
architectures) dolt isn't used, so $(top_builddir)/doltlibtool
won't exist. $(top_builddir)/libtool will always be generated
even if dolt is used, so just use that unconditionally. We don't
need the extra speed when linking the single program for
introspection.
http://bugzilla.openedhand.com/show_bug.cgi?id=1699
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Currently, Clutter depends on the internal copy of JSON-GLib for
the ClutterScript parser. This is done to allow building Clutter
on platforms that do not have the library installed on the system.
Just like we use the internal PNG/JPEG loader as a fallback in
case we don't have GdkPixbuf or CoreGraphics available, we should
use the internal copy of JSON-GLib only in case the system copy
is not present.
The change is simply to move the default for the --with-json
configure switch from "internal" to "check".
In order to allow stricter compliance, a third setting should
be present: "system", which fails if the system copy is not
available.
We should also change the introspection generation to avoid
breaking in case we require the installed Json-1.0.gir instead
of the generated ClutterJson.gir
In order to be ready for the next major version of GLib we need to
disable single header inclusion by using the G_DISABLE_SINGLE_INCLUDES
define in the build process.
Since we build the Cogl GIR inside /clutter/cogl we should be looking
there when building the Clutter GIR. Otherwise g-ir-scanner will look
inside the gir directory -- and if you never built Clutter before it
will error out.
Fixes bug:
http://bugzilla.openedhand.com/show_bug.cgi?id=1638
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
The GIR file for Clutter still contains symbols from COGL, even
though we provide a Cogl GIR as well. The Clutter GIR should
depend on the Cogl GIR instead.
Passing:
--library=clutter-@CLUTTER_FLAVOUR@-@CLUTTER_API_VERSION@
to g-ir-scanner, when building Cogl was causing g-ir-scanner to
link the introspection program against the installed clutter library,
if it existed or fail otherwise. Instead copy the handling from
the json/ directory where we link against the convenience library
to scan, and do the generation of the typelib later in the
main clutter/directory.
Fixes bug:
http://bugzilla.openedhand.com/show_bug.cgi?id=1594
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
Currently, all timelines install a timeout inside the TimeoutPool
they share. Every time the main loop spins, all the timeouts are
updated. This, in turn, will usually lead to redraws being queued
on the stages.
This behaviour leads to the potential starvation of timelines and
to excessive redraws.
One lesson learned from the games developers is that the scenegraph
should be prepared in its entirety before the GL paint sequence is
initiated. This means making sure that every ::new-frame signal
handler is called before clutter_redraw() is invoked.
In order to do so a TimeoutPool is not enough: we need a master
clock. The clock will be responsible for advancing all the active
timelines created inside a scene, but only when the stage is
being redrawn.
The sequence is:
+ queue_redraw() is invoked on an actor and bubbles up
to the stage
+ if no redraw() has already been scheduled, install an
idle handler with a known priority
+ inside the idle handler:
- advance the master clock, which will in turn advance
every playing timeline by the amount of milliseconds
elapsed since the last redraw; this will make every
playing timeline emit the ::new-frame signal
- queue a relayout
- call the redraw() method of the backend
This way we trade multiple timeouts with a single frame source
that only runs if a timeline is playing and queues redraws on
the various stages.
Bug 1495 - Timelines run 4% short
Previously the timelines were timed by calculating the interval
between each frame stored as an integer number of milliseconds so some
precision is lost. For example, requesting 60 frames per second gets
converted to 16 ms per frame which is actually 62.5 frames per
second. This makes the timeline shorter by 4%.
This patch merges the common code for timing from the timeout pools
and frame sources into an internal clutter-timeout-interval file. This
stores the interval directly as the FPS and counts the number of
frames that have been reached instead of the elapsed time.
$(builddir) isn't always defined in earlier versions of Automake
(although I can't track down exactly which version it appeared
in). According to the autoconf docs it is "rigorously equal to `.'" so
we might as well not use it.
Commit a383929 added the $(srcdir) prefix to all of the source files
but some files are generated by the configure script and other make
rules so they actually live in $(builddir). Out-of-tree builds
therefore broke.
The generation of the GObject introspection data has broken
the distcheck phase.
The location of the header and source files should always be
depending on the $(top_srcdir) and $(srcdir) variables,
respectively; the special handling of the COGL API inside the
GIR generation should also take those two variables into
account.
The INCLUDES directive should only contain pre-processor flags, since
we're passing it also to the introspection scanner.
Using AM_CFLAGS for compiler flags, like debug flags and maintainer
flags, is more indicated.
configure.ac: Check for gobject-introspection
build/introspection.m4: Include the file that defines the
GOBJECT_CHECK_INTROSPECTION m4 macro in case we want to disable
the introspection data generation.
clutter/json/Makefile.am: Build the .gir for "ClutterJson"
(json-glib as part of the Clutter library)
clutter/Makefile.am: Build the .gir for clutter, compile the
Clutter and ClutterJson girs into typelibs, and install them.
Also move GCC_FLAGS from $(INCLUDES) to $(AM_CFLAGS) since it includes
non-preprocessor flag like -Wall.
See also:
http://bugzilla.openedhand.com/show_bug.cgi?id=1450
Based on a patch by: Owen W. Taylor <otaylor@fishsoup.net>
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
The call to "cmp" to compare a built file with its current version
should use the -s (silent) command line switch. This avoids a ugly
message on the console when building Clutter the first time.