Commit Graph

2589 Commits

Author SHA1 Message Date
Emmanuele Bassi
571df43b6d text: Invalidate caches and sizes in set_text_internal()
The change in commit 3bbc96e17e moved the
:text property setter to use set_text_internal(); this function does not
invalidate the Layout cache and does not queue a relayout, thus breaking
the behaviour of ClutterText when setting the contents of the actor using
the property.

http://bugzilla.openedhand.com/show_bug.cgi?id=1851
2009-10-20 22:09:21 +01:00
Robert Bragg
91c38f877f [group] Fix copy & paste error from 857b0239e (Use FixedLayout inside Group)
clutter_group_get_preferred_height was calling
clutter_layout_manager_get_preferred_width which e.g.  broke
test-actor-clone.
2009-10-20 16:18:53 +01:00
Robert Bragg
74f2122b68 [gles2] remove lots of redundant matrix stack code
Since we no longer depend on the GL matrix API in Cogl we can remove a lot
of wrapper code from the GLES 2 backend.  This is particularly nice given
that there was no code shared between the cogl-matrix-stack API and gles2
wrappers so we had a lot of duplicated logic.
2009-10-20 12:32:51 +01:00
Robert Bragg
5e5d94dfbe [cogl] Removes the cogl-current-matrix abstraction
The indirection through this API isn't necessary since we no longer
arbitrate between the OpenGL matrix API and Cogl's client side API.  Also it
doesn't help to maintain an OpenGL style matrix mode API for internal use
since it's awkward to keep restoring the MODELVIEW mode and easy enough to
directly work with the matrix stacks of interest.

This replaces use of the _cogl_current_matrix API with direct use of the
_cogl_matrix_stack API.  All the unused cogl_current_matrix API is removed
and the matrix utility code left in cogl-current-matrix.c was moved to
cogl.c.
2009-10-20 12:32:50 +01:00
Robert Bragg
9f7bf9fb4d [matrix-stack] Adds ctx->flushed_matrix_mode to cache the gl matrix mode
This cache of the gl matrix mode lets us avoid repeat calls to glMatrixMode
in _cogl_matrix_stack_flush_to_gl when we have lots of sequential modelview
matrix modifications.
2009-10-20 12:32:50 +01:00
Robert Bragg
b1f9f0a97d matrix-stack: more optimization for load_identity case
This goes a bit further than the previous patch, and as a special case
we now simply represent identity matrices using a boolean, and only
lazily initialize them when they need to be modified.
2009-10-20 12:32:50 +01:00
Robert Bragg
460025d603 [matrix-stack] avoid redundant clearing of matrix when using load_identity
The journal always uses an identity matrix since it uses software
transformation.  Currently it manually uses glLoadMatrix since previous
experimentation showed that the cogl-matrix-stack gave bad performance, but
it would be nice to fix performance so we only have to care about one path
for loading matrices.

For the common case where we do:
cogl_matrix_stack_push()
cogl_matrix_stack_load_identity()
we were effectively initializing the matrix 3 times. Once due to use of
g_slice_new0, then we had a cogl_matrix_init_identity in
_cogl_matrix_state_new for good measure, and then finally in
cogl_matrix_stack_load_identity we did another cogl_matrix_init_identity.

We don't use g_slice_new0 anymore, _cogl_matrix_state_new is documented as
not initializing the matrix (instead _cogl_matrix_stack_top_mutable now
takes a boolean to choose if new stack entries should be initialised) and so
we now only initialize once in cogl_matrix_stack_load_identity.
2009-10-20 12:32:49 +01:00
Robert Bragg
2656b569b9 [current-matrix] Adds texture matrix stacks + removes GL matrix API usage
This relates back to an earlier commitment to stop using the OpenGL matrix
API which is considered deprecated. (ref 54159f5a1d)

The new texture matrix stacks are hung from a list of (internal only)
CoglTextureUnit structures which the CoglMaterial code internally references
via _cogl_get_texure_unit ().

So we would be left with only the cogl-matrix-stack code being responsible
for glMatrixMode, glLoadMatrix and glLoadIdentity this commit updates the
journal code so it now uses the matrix-stack API instead of GL directly.
2009-10-20 12:32:45 +01:00
Emmanuele Bassi
473f7ee31e text: Take pre-edit cursor position into account
When determining the cursor position we also need to take into account
the pre-edit cursor position as set by the set_preedit_string()
function.
2009-10-19 15:31:29 +01:00
Emmanuele Bassi
23cd0b7925 docs: Documentation fixes
• Fix list_stages() and peek_stages() documentation

 • Fix clutter_text_set_preedit_string() arguments in the header
   to match source and documentation

 • Add clutter_units_cm() to the private section for Units

 • Rename the LayoutManager section

 • Add FlowLayout:homogeneous accessors
2009-10-19 12:01:38 +01:00
Emmanuele Bassi
ba25571c8e 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
  ...
2009-10-19 11:45:15 +01:00
Emmanuele Bassi
8ce8b91383 docs: Reword a link 2009-10-19 11:44:29 +01:00
Emmanuele Bassi
cd3c85f7ba 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.
2009-10-19 11:00:23 +01:00
Emmanuele Bassi
936779fd96 build: Add back QUIET_GEN to the GIR generation 2009-10-18 17:49:00 +01:00
Emmanuele Bassi
ab376d961f 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.
2009-10-18 17:12:12 +01:00
Emmanuele Bassi
5c162d904b build: Use QUIET_GEN when building ClutterJson GIR 2009-10-18 17:11:42 +01:00
Emmanuele Bassi
8f11b3ca48 build: Fix up the GIR generation rules
The rules for generating Clutter's introspection data are
still referencing the old COGL layout.
2009-10-18 17:00:24 +01:00
Emmanuele Bassi
ad5c0af639 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.
2009-10-17 00:32:41 +01:00
Robert Bragg
ef9ea9e237 [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.
2009-10-16 18:58:52 +01:00
Robert Bragg
2f628b1a8a [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.
2009-10-16 18:58:52 +01:00
Vladimir Nadvornik
568d684187 [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.
2009-10-16 18:58:51 +01:00
Robert Bragg
9da26fc1ca [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.
2009-10-16 18:58:51 +01:00
Robert Bragg
52cecd50ec [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>
2009-10-16 18:58:51 +01:00
Robert Bragg
95a869dab1 [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.
2009-10-16 18:58:51 +01:00
Robert Bragg
43efab46bc 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.
2009-10-16 18:58:50 +01:00
Robert Bragg
2eea83de75 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
2009-10-16 18:58:49 +01:00
Robert Bragg
157eb437ba 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
2009-10-16 18:58:49 +01:00
Robert Bragg
fe01ec6323 [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.
2009-10-16 18:58:49 +01:00
Robert Bragg
3187e19642 [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.
2009-10-16 18:58:48 +01:00
Robert Bragg
63414ab233 [glx backend] white space fixes
Simply removes lots of trailing white spaces
2009-10-16 18:58:48 +01:00
Robert Bragg
45a668bef8 [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.
2009-10-16 18:58:48 +01:00
Robert Bragg
15d7a86621 [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.
2009-10-16 18:58:47 +01:00
Robert Bragg
35f11d863c [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
2009-10-16 18:46:44 +01:00
Emmanuele Bassi
f1acc91f37 Simple coding style fix for commit c5551184 2009-10-16 15:57:21 +01:00
Emmanuele Bassi
a9d2c0f690 Merge branch 'bug-1846'
* bug-1846:
  Fix warning message in the ParamSpec validation
2009-10-16 15:55:05 +01:00
Emmanuele Bassi
b5adbf89b8 Merge branch 'bug-1845'
* bug-1845:
  Add a warning when ClutterInterval can't compute progress
2009-10-16 15:55:04 +01:00
Damien Lespiau
70c8128457 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
2009-10-16 15:54:24 +01:00
Damien Lespiau
c5551184b0 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
2009-10-16 15:53:46 +01:00
Damien Lespiau
ee9f8c3bdf 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
2009-10-16 15:52:40 +01:00
Emmanuele Bassi
83b4ec7a12 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
2009-10-16 15:25:37 +01:00
Emmanuele Bassi
2ff31dfbaa text: Notify :position when it changes
The :position property is not notified when changed.

http://bugzilla.openedhand.com/show_bug.cgi?id=1830
2009-10-16 14:24:07 +01:00
Emmanuele Bassi
bc424fb56c [text] NULL-ify strings to avoid double-frees 2009-10-16 12:45:38 +01:00
Emmanuele Bassi
6f43f4b805 [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.
2009-10-16 12:45:38 +01:00
Emmanuele Bassi
2883728387 [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.
2009-10-16 12:45:29 +01:00
Emmanuele Bassi
87f0b94df7 layout, docs: Fix description of Bin properties
The BinLayer and BinLayout properties name and blurb for introspection
should be slightly more descriptive.
2009-10-15 14:20:44 +01:00
Emmanuele Bassi
852abbb138 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).
2009-10-15 14:12:37 +01:00
Emmanuele Bassi
308c930f37 layout, docs: Add long description for FlowLayout
Add the full description of the layout policy
2009-10-15 14:11:36 +01:00
Emmanuele Bassi
4d153e4507 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.
2009-10-15 12:15:49 +01:00
Emmanuele Bassi
adca939101 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.
2009-10-15 12:04:50 +01:00
Emmanuele Bassi
b526b76593 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.
2009-10-14 11:31:48 +01:00
Emmanuele Bassi
c4b2d4ce79 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.
2009-10-14 11:31:35 +01:00
Emmanuele Bassi
0876575a95 layout: Use the get_request_mode() getter in BinLayout
Instead of using g_object_get(child, "request-mode", ...).
2009-10-14 11:31:31 +01:00
Emmanuele Bassi
eb40e856e1 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.
2009-10-14 11:31:31 +01:00
Emmanuele Bassi
b5895335ab 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.
2009-10-14 11:31:30 +01:00
Emmanuele Bassi
19317520b5 [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.
2009-10-14 11:31:30 +01:00
Emmanuele Bassi
4ea57bc685 [layout] Skip invisible children in FlowLayout
Skip hidden actors when computing the preferred size and when
allocating.
2009-10-14 11:31:30 +01:00
Emmanuele Bassi
b1bae4d66a [layout] Clean up and document FlowLayout 2009-10-14 11:31:30 +01:00
Emmanuele Bassi
db3ef97170 [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.
2009-10-14 11:31:30 +01:00
Emmanuele Bassi
e5a074fd9e [layout] Add :homogeneous to FlowLayout 2009-10-14 11:31:30 +01:00
Emmanuele Bassi
5737cf869f [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.
2009-10-14 11:31:30 +01:00
Emmanuele Bassi
857b0239e9 [layout] Use FixedLayout inside Group
The Group actor should use the FixedLayout layout manager object
to avoid duplicating code.
2009-10-14 11:31:30 +01:00
Emmanuele Bassi
62db72cf41 [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.
2009-10-14 11:31:30 +01:00
Emmanuele Bassi
4663552a00 [layout] Typo and whitespace fixes 2009-10-14 11:31:30 +01:00
Emmanuele Bassi
c98388bb01 [layout, box] Add Box:color
Allow setting the background color of a ClutterBox
2009-10-14 11:31:29 +01:00
Emmanuele Bassi
df6ca3d171 [layout, docs] Clean up BinLayout documentation
Documentation and code style fixes for BinLayout.
2009-10-14 11:31:29 +01:00
Emmanuele Bassi
431a63d04a [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.
2009-10-14 11:31:29 +01:00
Emmanuele Bassi
755896664f [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.
2009-10-14 11:31:29 +01:00
Emmanuele Bassi
22bb243ec2 [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.
2009-10-14 11:31:29 +01:00
Emmanuele Bassi
9117ee2056 [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.
2009-10-14 11:31:29 +01:00
Emmanuele Bassi
f58bdbad15 [layout] Rename Box::add to Box::pack
Since ClutterBox is a ClutterContainer we should avoid naming
collisions between methods.
2009-10-14 11:31:29 +01:00
Emmanuele Bassi
c6f67bf872 [layout, docs] Document FixedLayout 2009-10-14 11:31:29 +01:00
Emmanuele Bassi
aaae60e178 [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.
2009-10-14 11:31:29 +01:00
Emmanuele Bassi
a2086f1178 [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.
2009-10-14 11:31:26 +01:00
Emmanuele Bassi
899db6f226 [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.
2009-10-14 11:30:43 +01:00
Emmanuele Bassi
9cccff504a [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.
2009-10-14 11:27:29 +01:00
Emmanuele Bassi
98474076a1 [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.
2009-10-14 11:27:29 +01:00
Emmanuele Bassi
7051fe275d [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.
2009-10-14 11:27:29 +01:00
Emmanuele Bassi
83a4e96267 [layout] Document BinLayout 2009-10-14 11:27:29 +01:00
Emmanuele Bassi
b06a3293fe [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.
2009-10-14 11:27:29 +01:00
Emmanuele Bassi
4e8d8bbc15 [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
2009-10-14 11:27:29 +01:00
Emmanuele Bassi
d096a3c791 [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.
2009-10-14 11:27:29 +01:00
Emmanuele Bassi
1061ebeac9 [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
2009-10-14 11:27:19 +01:00
Emmanuele Bassi
6d4cc13f7c [layout] Add Fixed layout manager
The FixedLayout layout manager object implements the same layout
policy of ClutterGroup.
2009-10-14 11:27:18 +01:00
Emmanuele Bassi
141a155690 [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.
2009-10-14 11:27:18 +01:00
Emmanuele Bassi
0340f65634 [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.
2009-10-14 11:27:18 +01:00
Emmanuele Bassi
d6183e95e5 [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.
2009-10-14 11:27:18 +01:00
Emmanuele Bassi
4f2bfc003a build: Clean up main Makefile.am 2009-10-14 09:07:11 +01:00
Emmanuele Bassi
46b736f42e 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.
2009-10-14 09:07:11 +01:00
Emmanuele Bassi
c3d056533c 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.
2009-10-14 09:07:11 +01:00
Emmanuele Bassi
74eaa29413 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.
2009-10-14 09:07:11 +01:00
Damien Lespiau
a7ff5385a5 [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>
2009-10-12 17:40:46 +01:00
Emmanuele Bassi
3bbc96e17e 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.
2009-10-07 21:55:54 +01:00
Damien Lespiau
19c6879960 [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>
2009-10-07 16:06:26 +01:00
Damien Lespiau
8605073edb [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>
2009-10-07 16:06:26 +01:00
Damien Lespiau
96859959bd [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>
2009-10-07 16:06:26 +01:00
Emmanuele Bassi
4d481e03f3 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.
2009-10-07 13:00:57 +01:00
Thomas Wood
c7d50083ec [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.
2009-10-07 12:56:01 +01:00
Neil Roberts
13ac1fe75b [clutter-id-pool] Also warn if the ID refers to a deleted actor
We should also warn if the glReadPixels happens to generate an ID that
is within the range of the ID array but no longer points to an
existing actor.
2009-10-07 12:53:19 +01:00
Neil Roberts
a4ff4d37a4 [clutter-id-pool] Fix the check for out-of-range IDs
If id == the length of the array then it is also invalid and could
cause a crash.
2009-10-07 12:53:19 +01:00
Thomas Wood
142f886518 Revert "[color] allow alpha to omitted when converting from strings"
This reverts commit eb8daac4b0.

The original commit was incorrect and pushed accidentally.
2009-10-07 12:15:26 +01:00
Thomas Wood
bdf7499207 [color] add a note to the documentation to specify the values of the alpha
The alpha channel is fully opaque at 255 and fully transparent at 0.
2009-10-07 11:40:41 +01:00
Thomas Wood
eb8daac4b0 [color] allow alpha to omitted when converting from strings
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.
2009-10-07 11:38:08 +01:00
Damien Lespiau
9e03d92316 [path] MOVE_TO and LINE_TO only use a pair of coordinates
The documentation of ClutterPathNode had a small typo and stated that
they use 2 pairs of coordinates.
2009-10-06 10:43:41 +01:00
Robert Bragg
dd8e4dcd62 [debug] Guard the use of gdk_pixbuf for pick debugging by #ifdef USE_GDKPIXBUF
gdk is an optional clutter dependency, so the pick buffer debugging option
needs some guards so we don't break, for example, the OSX builds.  This also
adds a comment for the bit fiddling done on the pick colors used to ensure
the pick colors are more distinguished while debugging.  (we swap the
nibbles of each color component so that pick buffers don't just look black.)
2009-10-05 17:35:46 +01:00
Emmanuele Bassi
f7c0264245 [sdl] Update the SDL backend to the new StageWindow API
The SDL backend remains experimental and not meant for public
consumption, but at least it compiles and runs successfully.
2009-10-05 15:57:14 +01:00
Emmanuele Bassi
3fee43560d [eglx] Create a StageWindow, not an Actor
The Backend should create a StageWindow instance, not an Actor.
2009-10-05 15:57:14 +01:00
Neil Roberts
40222e891b [ClutterGroup] Don't take into account the left edges when calculating the size
ClutterGroup previously calculated the size as the distance from the
left edge of the leftmost child to the right edge of the rightmost
child except if there were any chidren left of the origin then the
left edge would be zero.

However the group is always allocated its size relative to its
origin so if all of the children are to the right of the origin then
the preferred size would not be large enough to reach the rightmost
child.

    origin
    ┼──────────┐
    │Group     │
    │ ┌────────┼─┐
    │ │Child   │ │
    │ │        │ │
    └─┼────────┘ │
      │          │
      └──────────┘
       group size
      ╟──────────╢

This patch makes it so the size is always just the rightmost edge.

    origin
    ┼────────────┐
    │Group       │
    │ ┌──────────┤
    │ │Child     │
    │ │          │
    │ │          │
    │ │          │
    └─┴──────────┘
      group size
    ╟────────────╢

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1825
2009-10-05 15:34:00 +01:00
Emmanuele Bassi
14e12ae4fd [eglx] Update the EGLX Stage to the new StageWindow API
Move the ::realize and ::unrealize implementations over to the
StageWindow instead of using Actor.
2009-10-05 15:05:24 +01:00
Damien Lespiau
a799f6ccec Fix string parsing when no unit is given
The check should really be on the character pointed by str. Added the
corresponding test case.
2009-10-05 13:08:16 +01:00
Damien Lespiau
4d7b8c9d42 clutter_value_get_unit() has not be renamed
Since the Great Rework of ClutterUnits, functions have been using
'units' not 'unit' in their name. clutter_value_get_unit() is a left
over from a dark age, its declaration and documentation have been
updated but not the symbol itself.
2009-10-05 13:08:13 +01:00
Emmanuele Bassi
72243081b5 Merge branch 'stage-window-object'
* stage-window-object:
  [x11] Fix Stage user-initiated resize
  [x11] Remove a useless forced paint
  [stage] Rework the Stage implementation class
2009-10-05 12:37:08 +01:00
Emmanuele Bassi
ad83caaed1 Clarify the IdPool warning
Instead of having an assertion failure with a message of dubious
usefulness, we should probably use a more verbose warning explaining
what is the problem and what might be the cause.
2009-10-05 12:34:48 +01:00
Emmanuele Bassi
111512a2a0 [x11] Fix Stage user-initiated resize
The user-initiated resize is conflicting with the allocated size. This
happens because we change the size of the stage's X Window behind the
back of the size allocation machinery.

Instead, we should change the size of the actor whenever we receive a
ConfigureNotify event to reflect the new size of the actor.
2009-10-05 12:24:19 +01:00
Emmanuele Bassi
e3c2ed0009 [x11] Remove a useless forced paint
We force the redraw before mapping, in the hope that when a composited
window manager maps the window it will have its contents ready; that is
not going to work: the solution for this problem requires the implementation
of a protocol for compositors, and not a hack.

Moreover, painting before mapping will cause a paint with the wrong
GL viewport size, which is the wrong thing to do on GLX.
2009-10-05 12:21:02 +01:00
Robert Bragg
ab76d64df0 [cogl-debug] avoid warnings when using COGL_NOTE with unbraced else clauses
When not building a debug build the compiler was warning about empty
else clauses with no braces due to code like:
  if (blah)
	do_foo();
  else
	COGL_NOTE (DRAW, "a-wibble");

This simply ensures that even for non debug builds COGL_NOTE will expand to
a single statement.
2009-09-24 21:41:50 +01:00
Robert Bragg
904c495c6d [cogl-vertex-buffer] fix n_components validation for GL's builtin attributes
glVertexPointer expects positions with 2, 3 or 4 components, glColorPointer
expects colors with 3 or 4 components and glNormalPointer expects normals
with three components so when adding vertex buffer atributes with the names
"gl_Vertex", "gl_Color" or "gl_Normal" we assert these constraints and print
an explanation to the developer if not met.

This also fixes the previosly incorrect constraint that gl_Normal attributes
must have n_components == 1; thanks to Cat Sidhe for reporting this:

Bug: http://bugzilla.openedhand.com/show_bug.cgi?id=1819
2009-09-24 21:41:50 +01:00
Robert Bragg
dae569b468 [debug] Adds a dump-pick-buffers CLUTTER_DEBUG option
Now if you export CLUTTER_DEBUG=dump-pick-buffers clutter will write out a
png, e.g.  pick-buffer-00000.png, each time _clutter_to_pick() is called.
It's a rather crude way to debug the picking (realtime visualization in a
second stage would probably be nicer) but it we've used this approach
successfully numerous times when debugging Clutter picking issues so it
makes sense to have a debug option for it.
2009-09-24 21:41:49 +01:00
Neil Roberts
27ae9722de [container] Remove the unused 'object' variable in destroy_child_meta
Since commit b2f958a61 this variable is no longer used so it was
causing compiler warnings.
2009-09-22 17:55:04 +01:00
Robert Bragg
b710ed0eea [backend-egl] fix clutter_backend_egl_get_visual_info to not use Xalloc
It looks like the intention was to duplicate an XVisualInfo in such a way
that the pointer could be returned and then later freed using XFree.  But
Xalloc isn't an Xlib counterpart to XFree; Xlib doesn't provide a general
purpose malloc wrapper afik.  By shuffling things about a bit, it was
possible to avoid the need for this hack.
2009-09-21 23:06:44 +01:00
Damien Lespiau
6e50e26c86 Add a few annotations on Cogl primitives functions
By default, float * is considered as an out argument by gobject
introspection which is wrong for quite a few Cogl symbols. Start adding
annotations to fix that for the ones in the "Primitives" gtk-doc
section.
2009-09-21 18:40:20 +01:00
Robert Bragg
1b37cb6cb7 [container] cast actor to gobject before calling g_object_set_qdata
A minor compiler warning fix: in destroy_child_meta we weren't casting the
first argument to g_object_set_qdata to a gobject.
2009-09-21 18:17:12 +01:00
Øyvind Kolås
b2f958a618 [container] unset the child meta qdata on the child, not the container
In the default implementation of container::destroy_child_meta Set child
meta qdata to NULL on the child and not the container, since the child
is the object that owns the data.
2009-09-21 15:55:58 +01:00
Thomas Wood
d4e46bb893 [container] set the child meta qdata on the child, not the container
Set child meta qdata on the child and not the container, since the child is
the object that owns the data.
2009-09-21 15:40:53 +01:00
Neil Roberts
1c3d5a0e87 [cogl] Remove CoglContext->journal_vbo{,_len}
The lifetime of the journal VBO is entirely within the scope of the
cogl_journal_flush function so there is no need to store it globally
in the Cogl context. Instead, upload_vertices_to_vbo just returns the
new VBO. cogl_journal_flush stores this in a local variable and
destroys it before returning.

This also fixes an assertion when using the GLES backend which was
caused by nothing initialising the journal_vbo variable.
2009-09-17 18:30:55 +01:00
Emmanuele Bassi
ecfa0c4f92 [build] Split out the custom silent rules
The silent rules we use for custom targets should be moved into a
separate Makefile.am that gets included from all the others.
2009-09-16 17:47:59 +01:00
Emmanuele Bassi
9dc012c07d [timeline] Account for clock roll backs between frames
If the system clock rolls back between two frames then we need
to account for the change, to avoid stopping the timeline.

The best option, since a roll back can be any arbitrary amount
of milliseconds, is to skip a frame.

Fixes bug:

  http://bugzilla.moblin.org/show_bug.cgi?id=3839
2009-09-16 11:57:57 +01:00
Robert Bragg
0d08f6e070 [cogl-fbo] Disable mipmap filters before calling glCheckFramebufferStatusEXT
The framebuffer_object spec isn't clear in defining whether attaching a
texture as a renderbuffer with mipmap filtering enabled while the mipmaps
have not been uploaded should result in an incomplete framebuffer object.
(different drivers make different decisions)

To avoid an error with drivers that do consider this a problem we explicitly
set non mipmapped filters before calling glCheckFramebufferStatusEXT.  The
filters will later be reset when the texture is actually used for rendering
according to the filters set on the corresponding CoglMaterial.
2009-09-15 17:54:07 +01:00
Emmanuele Bassi
abbe2ebf8b [container] Use a 1:1 mapping between child and ChildMeta
Since an actor can only be parented to one container we don't need
the extra complications of maintaining a list of ChildMeta objects
attached to an actor in the default implementation of the Container
interface.
2009-09-15 11:27:43 +01:00
Damien Lespiau
6e3afa4ebe [docs] Clutter's model implementation is called ClutterListModel
It was renamed from ClutterModelDefault to ClutterListModel a while
back. Update the reference to this class in ClutterModel documentation.
2009-09-10 13:28:54 +01:00
Øyvind Kolås
3cc56b2b13 [text] implement get_property for "use-markup" 2009-09-08 14:15:18 +01:00
Emmanuele Bassi
6988744db7 [stage] Rework the Stage implementation class
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.
2009-09-08 10:52:58 +01:00
Emmanuele Bassi
742cc4d95b [docs] Small annotation fixes 2009-09-08 10:21:46 +01:00
Neil Roberts
c69209a253 [animation] Move the check for the 'signal::' prefix into a separate function
The old code checked whether the property began with 'signal-' and
then checked for 'signal-swapped' and 'signal-after'. This prevented
you from animating a property called for example 'signal-strength'.

The check for the prefix is now in a separate function which also adds
a 'signal-swapped-after' prefix for completeness.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1798
2009-09-07 12:44:06 +01:00
Samuel Degrande
763f5a9d01 DOT3_RGB[A] cannot be used in a Blend String
The blend string compiler checks that the syntax of a function name is
[A-Za-z_]*, preventing the use of DOT3_RGB[A].

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-09-02 16:27:22 +01:00
Emmanuele Bassi
a5e081dc9c [model] Do not attempt to free empty column names
The column names are optional - ClutterModel will use the GType name
if there is no user-specified column name. Hence, the ::finalize vfunc
should not try to free an empty column names vector.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1790
2009-09-02 15:30:45 +01:00
Neil Roberts
db6b0a91e0 Take a reference to the material in clutter_texture_set_cogl_material
The material is unref'd in clutter_texture_finalize and the
documentation explicitly states that the function will take a ref so
it really should.
2009-08-26 18:28:35 +01:00
Neil Roberts
bad7782ab4 Fix the documentation for clutter_texture_set_cogl_material
The documentation was a copy of the docs for set_cogl_texture so it
was somewhat broken.
2009-08-26 18:25:10 +01:00
Emmanuele Bassi
bb17dc1ce5 [script] Clean up the ad hoc parsing code in Actor
The old parsing code still assumed we had integers for pixels
and floating point values for percentages; this is not the case
anymore.
2009-08-26 16:49:45 +01:00
Emmanuele Bassi
2ffebad3d9 [script] Convert double to float when parsing
The default floating point type for JSON is double precision; this means
that we need to conver to single precision when setting a property with
type G_TYPE_FLOAT.
2009-08-26 16:48:32 +01:00
Øyvind Kolås
f1d5881207 [group] Use floating point in sort_z_order 2009-08-25 17:40:17 +01:00
Emmanuele Bassi
95a6e1c925 Fix the warnings for Animation::update_interval()
The bindings for update_interval() were copied from bind().
2009-08-25 12:18:32 +01:00
Emmanuele Bassi
899f051cd9 [animation] Add Animation::update()
Currently, to update a property inside an animation you have to
get the interval for that property and then call the set_final_value()
method.

We can provide a simpler, bind()-like method for the convenience of
the developers that just validates everything and then calls the
Interval.set_final_value().
2009-08-25 12:16:41 +01:00
Neil Roberts
4ca375e8fe [cogl-texture] Set GL_PACK_ROW_LENGTH when downloading texture data
Otherwise the rowstride passed in from an application is not used
correctly so you can not download to an area with a much larger
rowstride.
2009-08-24 12:50:57 +01:00
Emmanuele Bassi
172074fd29 [glx] Perform more checks before calling glXMakeCurrent
Right now we just check for a NULL stage before calling glXMakeCurrent().

We can, though, get a valid stage without an implementation attached to
it while we are disposing a stage after a CLUTTER_DELETE event, since the
events processing is performed on a vblank-locked basis.
2009-08-21 12:05:52 +01:00
Owen W. Taylor
93e1d8e7a3 Add ::queue-relayout signal to ClutterActor for ClutterClone
ClutterClone bases its preferred size on the preferred size of
the source actor, so it needs to invalid its cached preferred
size when the preferred size of the source actor changes.

In order for this to work, we need to have notification when
the size of the source actor changes, so add a ::queue-relayout
signal to ClutterActor.

Then connect to this from ClutterClone and queue a relayout
on the clone when a relayout is queued on the source.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-08-20 14:12:54 +01:00
Robert Bragg
56daae9d7b Revert "[cogl] Allow Cogl to create NPOT textures for GLES2"
This reverts commit 3c47a3beb5.

Of course I remembered just after pushing the patch why we hadn't done
this before :-) If you look in the glsl spec:
http://www.khronos.org/registry/gles/specs/2.0/es_full_spec_2.0.24.pdf
Section 3.7.10 Texture Completeness and Non-Power-Of-Two Textures
you can see GLES 2.0 doesn't support mipmaps for npot textures.

There is possibly some way we could support this in Cogl but at least
it's not as simple as or-ing in the feature flag, sadly.
2009-08-20 12:53:32 +01:00
Robert Bragg
3c47a3beb5 [cogl] Allow Cogl to create NPOT textures for GLES2
The core GLES2 API supports NPOT textures, i.e. there is no extension as for
OpenGL, so we now add COGL_FEATURE_TEXTURE_NPOT to the feature flags in
_cogl_features_init.

Thanks to Gordon Williams for spotting this.
2009-08-20 12:17:56 +01:00
Robert Bragg
a5fe4ae4ec [cogl] %.c: %.glsl codegen: use BUILT_SOURCES var + fix stringify.sh
Don't let stringify.sh write to the $srcdir + use the BUILT_SOURCES var in
Makefile.am so as to ensure all .c.  and .h files get generated from their
corresponding .glsl files before building other targets.
2009-08-19 15:43:20 +01:00
Jonas Bonn
3761e9cd47 Check timeline direction when forcing final state
If the timeline is running backwards, the completed signal handler should
set the final state from the interval's initial value.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-08-19 14:57:07 +01:00
Emmanuele Bassi
373b165b3f Use AM_SILENT_RULES if automake >= 1.11 is installed
Fixes bug:

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

Based on a patch by: Javier Jardón <javierjc1982@gmail.com>
2009-08-19 13:42:36 +01:00
Neil Roberts
6a9130f10f [pango-display-list] Don't premultiply the colour twice
When rendering a glyph run from a texture we were premultiplying the
colour once in display_list_render() and then again in
display_list_render_texture(). This was causing the color to come out
wrong. This fixes bug #1775.

Thanks to Pierre-Luc Beaudoin for reporting.
2009-08-19 10:28:51 +01:00
Robert Bragg
9befb055d0 [cogl-material] Fix some brackets in _layer_flush_gl_sampler_state
The wrong part of an expression was bracketed in the test to determine
when a new texture matrix needed to be loaded which resulted in the
first pass through _cogl_material_layer_flush_gl_sampler_state
not uploading any user matrix.
2009-08-18 16:57:38 +01:00
Emmanuele Bassi
366e0725ce [docs] texture_polygon() is called polygon()
Remove the mentions to the old name of cogl_polygon().
2009-08-18 11:11:29 +01:00
Emmanuele Bassi
f655b28e66 [build] Nothing can be prepended to QUIET_* rules
Move the LD_LIBRARY_PATH override after the QUIET_GEN rule and
unbreak the typelib compilation.
2009-08-17 23:27:22 +01:00
Jussi Kukkonen
8c00d705c0 [text] move_word_backward/forward fixes
clutter_text_move_word_backward/forward() calls did not use the
start argument consistently. Also, clutter_text_move_word_forward()
bound check checked the wrong end.

Fixes #1765

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-08-17 22:53:36 +01:00
Neil Roberts
99437c4761 [text] Don't interpret the unicode value when the control modifier is on
When a letter key is pressed with the control key held down one of
three things will happen :-

a) If the stage is embedded within a GtkClutterEmbed the unicode value
   will be filled from gdk_keyval_to_unicode. This will be the same
   value as if control was not pressed (so Ctrl+V will be 'v').

b) If the stage is not in a GtkClutterEmbed and Clutter is running on
   the X11 backend then it will try to fill in the unicode value from
   XLookupString. This *will* take into account the control so the
   unicode value will represent a control character (Ctrl+V will be
   '\x16').

c) Most other backends will not bother to fill in the unicode
   value. Therefore clutter_keysym_to_unicode will be used which also
   does not take into account the control key (so Ctrl+V will be 'v').

For cut and paste to work in Nbtk, the control keys need to bubble up
to the parent NbtkEntry container. This works fine for 'b' but not 'a'
and 'c'.

This patch makes ClutterText always allow the event to bubble if the
key is not handled by the binding pool and the control modifier is
down.

Ideally ClutterText would always get a unicode value that takes into
account the modifiers but this is probably best left up to the input
methods.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-08-17 22:50:23 +01:00
Owen W. Taylor
5d7c2e7c44 Set LD_LIBRARY_PATH when running g-ir-compiler
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
2009-08-17 22:39:12 +01:00
Owen W. Taylor
4c1248c5e9 Full fix for the G-I support in Clutter
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>
2009-08-17 15:42:33 +01:00
Götz Waschk
68f8a98cfb Specify the shared library for g-ir-compile
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>
2009-08-17 14:21:42 +01:00
Götz Waschk
366e0f9cd7 Update Clutter to use G-I 0.6.4
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>
2009-08-17 14:14:18 +01:00
Emmanuele Bassi
90d8f31831 [units] Do not be locale-dependant on string conversion
When dumping a ClutterUnits structure to a string we are using a bare
g_strdup_printf(), which unfortunately is locale dependant. So, for
instance, a type of CLUTTER_UNIT_EM and a value of 42 are stringified
as:

        C:      42.00 em
        en_GB   42.00 em
        it_IT   42,00 em
        fr_FR   42,00 em

This would not be a problem -- clutter_units_from_string() allows both
'.' and ',' as fractionary part delimiters. The test suite, on the
other hand, does not know that, and it checks for exact matches with
the C locale.

Calling setlocale(LC_ALL,"C") at the beginning of the conformance test
suite is not a good idea, because it would prevent external testing; and
it's a lame cop out from doing exactly what we have to do -- pick a format
and stick with it.

Like other platforms, languages and frameworks before us, we opt to
be less liberal in what we create; so, we choose to always stringify
ClutterUnits with fractionary parts using '.' as the delimiter.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1763
2009-08-14 16:05:33 +01:00
Emmanuele Bassi
5274b4e4c4 [build] Clean up the eglnative and fruity Makefile.am
* Do not use CLUTTER_MAJORMINOR

* Use per-target compiler flags and libraries
2009-08-14 13:08:17 +01:00
Xu Li
f7edc97d8d Add new Atom atom_NET_WM_PID to set pid info
Clutter advertises itself on X11 as implementing the _NET_WM_PING protocol,
which is needed to be able to detect frozen applications; this allows us to
stop the destruction of the stage by blocking the CLUTTER_DELETE event and
wait for user feedback without the Window Manager thinking that the app has
gone unresponsive.

In order to implement the _NET_WM_PING protocol properly, though, we need
to add the _NET_WM_PID property on the Stage window, since the EWMH states:

  [_NET_WM_PID] MAY be used by the Window Manager to kill windows which
  do not respond to the _NET_WM_PING protocol.

Meaning that an unresponsive Clutter application might not be killable by
the window manager.

Fixes bug:

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-08-14 12:41:01 +01:00
Emmanuele Bassi
3abf393b87 [build] Clean up cogl-pango Makefile
* Do _not_ use CLUTTER_MAJORMINOR to define the installation path
  for the headers; we must use CLUTTER_API_VERSION for that.

* Do not put the C compiler flags in the INCLUDES directive.

Bases on a patch by: Gary Ching-Pang Lin <glin@novell.com>
2009-08-14 11:30:16 +01:00
Emmanuele Bassi
5c8ae6d2dc [json] Fix compilation of the internal JSON-GLib
Define the symbols needed to pass the single include policy when
compiling the static object.
2009-08-13 18:05:38 +01:00
Emmanuele Bassi
8a794a8533 [docs] Fix the examples for animate()
Update the examples to reference to existing easing modes and to
make sure to use floating point values for floating point properties.
2009-08-13 16:13:55 +01:00
Emmanuele Bassi
f25cdf066c [actor] Allow unsetting width and height separately
It is possible to unset the size of an actor specified with set_width()
and set_height() by using:

  clutter_actor_set_size (actor, -1, -1);

Which works by unsetting the :min-*-set and the :natural-*-set properties.

Calling set_width(-1) and set_height(-1) separately, though, doesn't work
thus implicitly breaking the assumption that set_size() is nothing more
than set_width()+set_height(). This was obviously due to the face that
pre-1.0 set_width() and set_height() took an unsigned integer as an
argument.
2009-08-13 16:13:07 +01:00
Colin Walters
d3e06bc1e5 Add (allow-none) for clutter_stage_set_key_focus()
The @actor argument can be NULL to unset the key focus.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-08-13 10:49:39 +01:00
Emmanuele Bassi
9766fb1300 [script] Fix Actor's ad-hoc parser
ClutterActor parses positional and dimensional properties with a
custom deserializer. We need to:

  - handle G_TYPE_INT64, the default integer type for JSON-GLib
  - use G_TYPE_FLOAT for properties, since Actor switched to it
    for the pixel-based ones

This makes ClutterScript work again.
2009-08-12 16:02:23 +01:00
Emmanuele Bassi
cfbbacb807 [script] Fix the default deserialization
Properties parsed from ClutterScript should now use G_TYPE_INT64
and automatically convert between G_TYPE_INT and G_TYPE_INT64.
2009-08-12 16:01:25 +01:00
Emmanuele Bassi
4d52245637 [json] Update the internal copy of JSON-GLib
JSON-GLib switch to 64 bit integers upstream, to avoid the undefined
integer size of the JSON RFC. All integers are automatically promoted
to gint64.
2009-08-12 16:00:13 +01:00
Emmanuele Bassi
2b70b0d4ed Include clutter-json.h, not json-types.h
The json-types.h header is found by the mere fact of it being
in the project; if we are compiling against the system JSON-GLib
this could be horribly out of date.

We need to use clutter-json.h, which will include the right
header for us.
2009-08-12 15:57:25 +01:00
Emmanuele Bassi
cc6aa6e4d5 Clutter GIR depends on ClutterJson GIR conditionally
If we're building Clutter with a system JSON-GLib we need to skip
the typelib compilation of ClutterJson since we depend on Json-1.0.gir
directly.
2009-08-12 15:32:18 +01:00
Emmanuele Bassi
6fcf5c1820 [json] Include only json-glib.h
JSON-GLib moved to a single include scheme, so we should only include
json-glib.h. If we use the internal copy it doesn't matter, since the
header does the right thing.
2009-08-12 15:31:16 +01:00
Emmanuele Bassi
8c49e22753 Add copyright and license notice
The clutter-script-parser.c does not have a copyright and license
notices; even though the LGPL is a per-project license and not a
per-file license, having those notices in every source file is a
good idea.
2009-08-12 10:30:11 +01:00
zhou jiangwei
13e055a351 [eglx] Update the EGLX backend
The EGLX backend needs to be updated to the new ClutterBackendX11
code.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-08-11 14:19:24 +01:00
zhou jiangwei
2ab9bef587 [cogl] Fix the GLES 2.0 backend
Update the GLES 2.0 backend to the new COGL API after the breakage
introduced by the journal.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-08-11 14:19:24 +01:00
Robert Bragg
dbfd3f0f44 [cogl_clear] Also pass the alpha component of the CoglColor to glClearColor
Previously we were passing a constant of 0.0 for the alpha component which
wasn't as flexible.
2009-08-11 14:15:44 +01:00
Emmanuele Bassi
f0cb337d92 [build] Fix LDADD -> LIBADD usage 2009-08-11 13:27:25 +01:00
Emmanuele Bassi
dfc32b60c4 [osx] Clean up Makefile.am
The OS X backend Makefile.am was missing a line concatenation, and
so the -xobjective-c directive was always ignored.

Instead of dumping everything into INCLUDES and LDADD we should follow
what the rest of the backends do, and use per-target CFLAGS and LDADD,
and reserve the INCLUDES to -D and -I directives.

Thanks to: Christian Hergert <chris@dronelabs.com>
2009-08-11 13:11:34 +01:00
Emmanuele Bassi
d0748b3b9b Merge branch 'system-json-glib'
* system-json-glib:
  [script] Simplify the parser code
  Update JSON-GLib dependency
2009-08-10 17:21:20 +01:00
Emmanuele Bassi
d263e7a78b [build] Install JSON headers inside the right directory
Don't install inside the clutter-MAJOR_MINOR/ directory, but use
the API_VERSION (1.0).

Otherwise we'd have the Clutter headers for 1.x inside:

        $includedir/clutter-1.0/clutter

And the JSON-related headers inside:

        $includedir/clutter-1.<minor>/clutter
2009-08-10 17:19:04 +01:00
Emmanuele Bassi
420ed353b5 [x11] Do not ask to destroy an empty Window
The fix for bug 1750 inside commit b190448e made Clutter-GTK spew
BadWindow errors. The reason for that is that we call XDestroyWindow()
without checking if the old Window is None; this happens if we call
clutter_x11_set_stage_foreign() on a new ClutterStage before it has
been realized.

Since Clutter-GTK does not need to realize the Stage it is going to
embed anymore (the only reason for that was to obtain a proper Visual
but now there's ClutterBackendX11 API for that), the set_stage_foreign()
call is effectively setting the StageX11 Window for the first time.
2009-08-07 08:26:18 +01:00
Emmanuele Bassi
335fb07ab0 [actor] Add missing return_if_fail()
The queue_relayout() method was missing the argument check.

Thanks to: Neil Patel <njpatel@gmail.com>
2009-08-05 17:50:31 +01:00
Neil Roberts
1434d72134 Small doc fix to clutter_text_get_color
Bug reported by Rob Bradford.
2009-08-05 15:51:49 +01:00
Emmanuele Bassi
b190448ed4 [x11] Destroy the Window we own when setting a foreign one
When we replace the stage Window using a foreign one we also need to
destroy the Window we created, if needed, to avoid leaking resources
all around.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1750
2009-08-04 16:59:15 +01:00
Emmanuele Bassi
79288b46ed [docs] Fix a missing parameter 2009-08-04 11:38:48 +01:00
Emmanuele Bassi
9cda8d130f [actor] Be more explicit when warning about invariants
The "catch all" warning for a the mapped invariant violation is too
generic: it doesn't tell you why the invariant was broken in case
we are trying to map an unparented actor - e.g. through a Clone.
2009-08-04 11:15:05 +01:00
Emmanuele Bassi
f8a964b422 [cogl] Expose cogl_is_vertex_buffer()
The function is public and available in the shared object, but
it's not present in the header, so this is not an API/ABI change.
2009-08-04 11:15:05 +01:00
Damien Lespiau
c9c87543e8 [debug] CLUTTER_{NOTE,MARK,DBG,GLERR,TIMESTAMP} should always be statements
In case someone tries to do:
	if (foo)
		CLUTTER_NOTE(DOMAIN, "%s", blah);

CLUTTER_NOTE () should always be a statement
2009-08-03 14:25:09 +01:00
Damien Lespiau
cd35f3b384 [debug] Fix __GNUC__ typo
The right gcc define is __GNUC__ not __GNUC_. This typo had the side
effect that we were using the non gcc specific debug macros leading to
a less optmised CLUTTER_NOTE () than one could have dreamed of.
2009-08-03 14:25:09 +01:00
Damien Lespiau
94b35a4a5e [build] GCC_FLAGS is no more, MAINTAINER_CFLAGS is the One.
CC_FLAGS was a left over from the 0.8.x age. Killed it and use the
newer MAINTAINER_CFLAGS variable instead.
2009-08-03 14:25:08 +01:00
Emmanuele Bassi
b2ab2b9535 [actor] Use the right vertex
The vertex that should be used by the apply_relative_transform
is the one passed in as const, and the result should be placed
inside the non-const ClutterVertext. Currently, we are using
the latter, and thus the function is completely useless.
2009-08-02 18:34:17 +01:00
Emmanuele Bassi
ae2a861a0b [x11] Force a redraw before mapping the stage
Does as it says on the tin: run a paint cycle before calling
XMapWindow().
2009-07-31 10:29:33 +01:00
Emmanuele Bassi
77fdd7494e Fix compiler warnings when COGL debug level=minimum 2009-07-28 13:57:46 +01:00
Emmanuele Bassi
a5d6b23308 [units] Add binding-friendly initializers
We should follow the convention for boxed types initializers of:

  <type_name>_from_<another_type> (boxed, value)

For ClutterUnits as well; so:

  clutter_units_pixels -> clutter_units_from_pixels
  clutter_units_em     -> clutter_units_from_em
  ...

We should still keep the short-hand version as a macro, though.
2009-07-28 13:46:11 +01:00
Emmanuele Bassi
57baa2f0bc [animation] Fix variable use
Instead of using the proper typed variables we were overwriting
the gpointer for the Interval's final value.
2009-07-28 13:21:57 +01:00
Neil Roberts
f4ad3761c4 [win32] Remove the call to clutter_redraw in clutter_stage_win32_show
Since commit 7b811f8b this is done in clutter_stage_show so there is
no need for it in the backends.
2009-07-28 12:13:44 +01:00
Neil Roberts
df586eb507 [win32] Move the show/hide to be implementations of the interface
This makes clutter_stage_win32_show/hide be implementations of
ClutterStageWindowIface rather than overriding the methods in
ClutterActor. This reflects the changes in e4ff24bc for the X11
backend.
2009-07-28 12:13:44 +01:00
Ole André Vadla Ravnås
a1cef026c5 Avoid near/far identifier names.
Leads to conflict with system headers on Windows, where macros named
"near" and "far" are defined.
2009-07-28 12:13:44 +01:00
Ole André Vadla Ravnås
05883af1f6 Remove unused variable to fix compiler warning. 2009-07-28 12:13:44 +01:00
Ole André Vadla Ravnås
0157851270 Call glClientActiveTexture() through COGL context.
Fixes build issues on systems with OpenGL header older than 1.3.
2009-07-28 12:13:43 +01:00
Ole André Vadla Ravnås
f61f66c6fe Avoid C99 to fix compilation with compilers like MSVC. 2009-07-28 12:13:43 +01:00
Ole André Vadla Ravnås
ab5a10768c Initialize pixel data before glReadPixels(). 2009-07-28 12:13:43 +01:00
Haakon Sporsheim
e4eed92177 Reposition variable declarations to avoid C99. 2009-07-28 12:13:42 +01:00
Emmanuele Bassi
fa3728126f [animation] Force the final state inside ::completed
In case we are skipping too many frames, we should force the animation
instance to apply the final state of the animated interval inside the
::completed signal handler.
2009-07-28 11:43:05 +01:00
Emmanuele Bassi
42ea471e33 Remove explicit size of the Vertex arrays
The Vertex arrays passed to some ClutterActor methods should not
have the size. Albeit being technically correct, it's not a good
practice.
2009-07-27 16:10:07 +01:00
Emmanuele Bassi
fe0e7f9f74 [stage] Add a warning for :offscreen usage
The Stage:offscreen property hasn't been tested for ages, and it
should really just use a FBO, not indirect rendering on a X Pixmap
only on X11. There are better ways anyway to get the current
contents of ClutterStage as a buffer anyway.

We might remove it at any later date, or actually make it work
properly.
2009-07-27 15:42:31 +01:00
Emmanuele Bassi
6e6d0a5ea6 [glx] Explicitly set the depth size for GLX visuals
When requesting a GLX visual from the X server we should explicitly
set the GL_DEPTH_SIZE and the GL_ALPHA_SIZE bits, otherwise some
functionality might just not work, or work unreliably.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1723
2009-07-27 15:08:03 +01:00
Emmanuele Bassi
88e77b25df Convert gint to GLints in the Shader types wrapper
The GValue wrappers for ClutterShader types should always store
values using GL types (GLfloat, GLint) internally, but give and
take generic C types (float, int) to the Clutter side.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1359
2009-07-27 15:01:52 +01:00
Emmanuele Bassi
ad7dcc9896 [color] Fix HLS to RGB colorspace conversion
The HLS to RGB conversion in case the S value is zero is:

  R = G = B = luminance

ClutterColor uses a byte (0 to 255) for the R, G and B channels
encoding, while luminance is expressed using a floating point value
in the closed interval [0, 1]; thus the case above becomes:

  R = G = B = (luminance * 255)

The clutter_color_from_hls() code is missing the final step of
de-normalizing the luminance value, and so it breaks the roundtrip
colorspace conversion between RGB and HLS.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1695
2009-07-27 12:04:40 +01:00
Owen W. Taylor
894fe4ba93 Always create the Damage object for ClutterX11TexturePixmap auto updates
If clutter_x11_texture_set_window() was called after
clutter_x11_texture_pixmap_set_automatic(), then the Damage object would
not be properly created so updates to the window were ignored.

Refactor creation of the damage object to a separate function, and
call it from clutter_x11_texture_set_window() and clutter_x11_texture_set_pixmap()
as appropriate. Addition and removal of the filter function is made
conditional on priv->damage to make free_damage_resources() cleanly
idempotent.

See: http://bugzilla.gnome.org/show_bug.cgi?id=587189 for the original
bug report.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-07-27 10:49:38 +01:00
Michael Mortensen
2c2f31b1be [osx] Update events to floating point coordinates
The event translation code should be using the float type for
coordinates.

Fixes bug:

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-07-27 10:45:26 +01:00
Emmanuele Bassi
13f32cb3b9 [osx] Implement StageWindow::show/::hide
Instead of using the Actor class ::show and ::hide virtual function,
use the StageWindow interface API.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1724
2009-07-26 20:10:42 +01:00
Emmanuele Bassi
e860d939f9 [text] Allow key navigation by word
When pressing Ctrl with the left and right arrow keys we should
skip to (or select until) the previous and next word, respectively.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1713
2009-07-23 19:04:27 +01:00
Geoff Gustafson
6a1506bd5f [text] Queue a redraw when the selection is cleared
If you select all the text in a ClutterText, there is an invisible
cursor position either at the beginning or end. If it's at the beginning,
the bug is that left arrow won't clear the selection. If it's at the end,
the bug is that the right arrow won't.

Here are the ways to reproduce it:

a. Ctrl-A selects all and moves the hidden cursor position to the left.
b. For single line: End, Shift-Home does the same.
c. Or manually moving to the end and doing Shift-Left Arrow to the
   beginning.

These all put it in the state where right arrow will properly clear
selection and move to cursor position 1, but left arrow fails to clear
the selection.

For b and c above, the opposite will give you the end case where right
arrow doesn't work.

Anyway, it turns out clear_selection is getting called, it just doesn't
show up because it's not doing a queue_redraw. So the attached patch
seems to fix things.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-07-23 18:26:16 +01:00
Emmanuele Bassi
fdfd208c04 Fix copy-and-paste errors in the deprecation macros
Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1704
2009-07-21 09:22:38 +01:00
Emmanuele Bassi
eff857bc7f [docs] Improve the Units to and from string conversion
Make sure to document the conversion to and from strings for ClutterUnits,
with negative examples and with the behaviour for fractionary bits.
2009-07-20 20:59:18 +01:00
Emmanuele Bassi
b1d98c25f4 [doc] Miscellaneous documentation fixes
Remove private symbols, and add missing public ones.
2009-07-20 12:49:35 +01:00
Emmanuele Bassi
cdb239756b [cogl] Make the blend string error domain public
The error domain and codes must present in a publicly installed header
otherwise they won't be usable to match a GError.
2009-07-20 12:47:53 +01:00
Emmanuele Bassi
56ef6727b5 Allow disabling motion event throttling
It might be desirable for some applications and/or platforms to get
every motion event that was delivered to Clutter from the windowing
backend. By adding a per-stage flag we can bypass the throttling
done when processing the events.

  http://bugzilla.openedhand.com/show_bug.cgi?id=1665
2009-07-20 11:44:52 +01:00
Robert Bragg
da37e1e27d [doc] Remove references to cogl_vertex_buffer_delete_indices
These referencese were left over from before indices got CoglHandles to
uniquely identify them.  cogl_handle_unref can be used to delete indices
now.
2009-07-19 10:23:00 +01:00
Emmanuele Bassi
dc0b1cddf5 [cogl/gles] Fix missing symbols in CoglContext
Keep the CoglContext in sync between GL and GLES backends. We ought
to find a way to have a generic context, though, and have backend
specific sections.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1698
2009-07-18 16:59:54 +01:00
Owen W. Taylor
a11b912dea Fix parallel build of introspection
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>
2009-07-18 16:53:08 +01:00
Owen W. Taylor
7654ef10ab Fix building introspection when dolt is not in use
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>
2009-07-18 16:52:57 +01:00
Neil Roberts
7b811f8be4 [stage] Force an allocation before showing the stage
A lot of applications change the size of the stage from the default
before the stage is initially shown. The size change won't take affect
until the first allocation run. However we want the window to be at
the correct size when we first map it so we should force an allocation
run before showing the stage.

There was an explicit call to XResizeWindow in
clutter_stage_x11_show. This is not needed anymore because
XResizeWindow will already have been called by the allocate method.
2009-07-17 12:43:52 +01:00
Marcos
8f9f6aaf41 [win32] Compilation fixes
Remove the usage of the old CLUTTER_UNITS_* macros and put back a
missing ';'.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-07-13 17:04:05 +01:00
Emmanuele Bassi
7a8895944b [osx] Enable motion event dispatch
By default NSWindow does not listen to mousemoved events and hence the
default behaviour for Actors using the "motion-event" signal  differs
from backend to backend.

Using setAcceptsMouseMovedEvents seems to fix it; unfortunately, I
cannot verify it, but since nobody is currently working on the Quartz
backend I guess it cannot get more broken than how currently is.

Thanks to: Michael <michael@f3k.org>

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1687
2009-07-13 16:56:47 +01:00
Emmanuele Bassi
d59b9333a1 [osx] Remove old units macros
Remove the usage of CLUTTER_UNITS_* macros and at least get the
chance to make the OSX backend compile.

Hopefully, since I can't currently test it.
2009-07-13 16:53:06 +01:00
Emmanuele Bassi
af5e432ba9 [actor] Allow querying whether we are painted by a Clone
It would be useful inside a custom actor's paint function to be able to
tell if this is a primary paint call, or if we are in fact painting on
behalf of a clone.

In Mutter we have an optimization not to paint occluded windows; this is
desirable for the windows per se, to conserve bandwith to the card, but
if something like an application switcher is using clones of these windows,
they will not get painted either; currently we have no way of
differentiating between the two.

Fixes bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1685
2009-07-13 16:18:27 +01:00
Emmanuele Bassi
43d394ebae Remove unused TEXTURE_IN_CLONE_PAINT private flag
The CLUTTER_TEXTURE_IN_CLONE_PAINT was used with the old CloneTexture
actor; now that we have ClutterClone nothing sets the private flag
anymore, and the flag itself is not needed.
2009-07-13 16:16:38 +01:00
Xu Li
13f31d8319 [x11] update_wm_hints after unsetting WITHDRAWN
Updating the WM hints on the stage window shortcircuits if the stage
is in WITHDRAWN state, so we need to move the update_wm_hints() call
after the flag has been unset.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-07-13 15:33:21 +01:00
Emmanuele Bassi
07453a5861 [glx] Make the wait_for_vblank function private
Nobody should be using the function to wait for the vblank outside
of the GLX backend.
2009-07-13 15:31:38 +01:00
Owen W. Taylor
5425a6e311 Call glFinish() before manually waiting for VBLANK
If we manually wait for the VBLANK with:

  - SGI_video_sync
  - Direct usage of the DRM ioctl

Then we should call glFinish() first, or otherwise the swap-buffers
may be delayed by pending drawing and cause a tear.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-07-13 15:18:12 +01:00
Evan Martin
ea56a5e7a8 [docs] Fix typos and remove mentions of SVN
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-07-12 01:38:40 +01:00
Jakub Higersberger
efc16a4d90 Use correct signal detail
The Animation should connect to the notify::alpha signal, not to
the non-existing notify::value signal.

Fixes bugs:

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-07-12 01:32:24 +01:00
Emmanuele Bassi
5a554bf063 Small code clean up
Make ClutterTexture slightly more similar to the rest of the code base.
2009-07-12 01:27:31 +01:00
Robert Bragg
1920b03381 [cogl] Fix more brokeness with _cogl_material_equal
commit e2c4a2a9f8 fixed one thing but broke many others things :-/
hopfully this fixes that.

It turned out that the journal was mistakenly setting the OVERRIDE_LAYER0
flush option for all entries, but some other logic errors were also
uncovered in _cogl_material_equal.
2009-07-10 19:00:16 +01:00
pippin
8fb3a48ae2 serialize upload of asyncronously loaded textures
Rate limit the uploading of textures to stop if it uses more than 5ms
during one master clock iteration.
2009-07-10 11:38:59 +01:00
Robert Bragg
211bf79854 ensure next iteration
Added an internal clutter function, _clutter_master_clock_ensure_next_iteration
that ensures another iteration of the master clock, can be called from repaint
functions as well as other threads.
2009-07-10 11:38:42 +01:00
Robert Bragg
e2c4a2a9f8 [cogl] Fix drawing with sliced textures using material layer0 overrides
To help us handle sliced textures; When flushing materials there is an
override option that can be given to replace the texture name for layer0
so we may iterate the slices without needing to modify the material
in use.

Since improving the journal's ability to batch state changes we added a
_cogl_material_equals function that is used by the journal to compare
materials and identify when a state change is required, but this wasn't
correctly considering the layer0 override resulting in false positives that
meant the journal wouldn't update the GL state and the first texture name
was used for all slices.
2009-07-07 10:34:37 +01:00
Robert Bragg
df4429462f [cogl matrix stack] Create a client side matrix stack for the projection matrix
The cost of glGetFloatv with Mesa is still representing a majority of our
time in OpenGL for some applications, and the last thing left using this is
the current-matrix API when getting the projection matrix.

This adds a matrix stack for the projection matrix, so all getting, setting
and modification of the projection matrix is now managed by Cogl and it's only
when we come to draw that we flush changes to the matrix to OpenGL.

This also brings us closer to being able to drop internal use of the
deprecated OpenGL matrix functions, re: commit 54159f5a1d
2009-07-07 10:32:56 +01:00
Emmanuele Bassi
c3cc553c49 Add more (allow-none) annotations 2009-07-02 14:21:16 +01:00
Colin Walters
f1044a279c Use the (allow-none) annotation for clutter_init*
We accept NULL for some parameters in the initialization functions.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-07-02 13:15:42 +01:00
Emmanuele Bassi
45c85c4213 [actor] Remove the unused get_allocation_coords()
The clutter_actor_get_allocation_coords() is not used, and since
the switch to floats in the Actor's API, it returns exactly what
the get_allocation_box() returns.
2009-07-01 15:30:21 +01:00
Emmanuele Bassi
37bd35f592 [actor] Allow changing the transformations matrix
Currently, the transformation matrix for an actor is constructed
from scenegraph-related accessors. An actor, though, can call COGL
API to add new transformations inside the paint() implementation,
for instance:

  static void
  my_foo_paint (ClutterActor *a)
  {
    ...
    cogl_translate (-scroll_x, -scroll_y, 0);
    ...
  }

Unfortunately these transformations will be completely ignored by
the scenegraph machinery; for instance, getting the actor-relative
coordinates from event coordinates is going to break badly because
of this.

In order to make the scenegraph aware of the potential of additional
transformations, we need a ::apply_transform() virtual function. This
vfunc will pass a CoglMatrix which can be used to apply additional
operations:

  static void
  my_foo_apply_transform (ClutterActor *a, CoglMatrix *m)
  {
    CLUTTER_ACTOR_CLASS (my_foo_parent_class)->apply_transform (a, m);
    ...
    cogl_matrix_translate (m, -scroll_x, -scroll_y, 0);
    ...
  }

The ::paint() implementation will be called with the actor already
using the newly applied transformation matrix, as expected:

  static void
  my_foo_paint (ClutterActor *a)
  {
    ...
  }

The ::apply_transform() implementations *must* chain up, so that the
various transformations of each class are preserved. The default
implementation inside ClutterActor applies all the transformations
defined by the scenegraph-related accessors.

Actors performing transformations inside the paint() function will
continue to work as previously.
2009-07-01 15:30:21 +01:00
Emmanuele Bassi
0414daf0fb Split the typdef to avoid confusing scanners
Scanners like gtk-doc and g-ir-scanner get confused by:

  typedef struct _Foo {
    ...
  } Foo;

And expect instead:

  typedef struct _Foo Foo;

  struct _Foo {
    ...
  };

CoglMatrix definition should be changed to avoid the former type.
2009-07-01 15:30:21 +01:00
Emmanuele Bassi
250b775926 [x11] Fix the race between resize and glViewport calls
The race we were experiencing in the X11 backends is apparently
back after the fix in commit 00a3c698.

This time, just delaying the setting of the SYNC_MATRICES flag
is not enough, so we can resume the use of a STAGE_IN_RESIZE
private flag.

This should also fix bug:

  http://bugzilla.openedhand.com/show_bug.cgi?id=1668
2009-07-01 15:30:21 +01:00
Emmanuele Bassi
3726213291 Add debug notes for calls to glViewport()
In order to validate the sequence of:

        XResizeWindow
        ConfigureNotify
        glViewport

that should happen on X11 we need to add debug annotations to the
calls to glViewport() done through COGL.
2009-07-01 15:30:18 +01:00
Robert Bragg
3bab787103 [cogl] cache the viewport width and height
This avoids some calls to glGetFloatv, which have at least proven to be very
in-efficient in mesa at this point in time, since it always updates all derived
state even when it may not relate to the state being requested.
2009-07-01 15:23:10 +01:00