1
0
Fork 0
Commit graph

1602 commits

Author SHA1 Message Date
Emmanuele Bassi
1876785d12 Fix the format for a floating point value
The debug annotation was still expecting an integer after
we switched the angle to float.
2009-01-22 11:46:23 +00:00
Emmanuele Bassi
355555c1bf Store the units-per-em inside the Backend
Instead of recomputing the number of units needed to fit in
an em each time clutter_units_em() is called, we can store this
value into the default Backend along with the resolution and
font name. The value should also be updated each time the
resolution and font are changed, to keep it up to date.
2009-01-22 11:42:11 +00:00
Emmanuele Bassi
c5aca39c69 [docs] Specify the coordinate space of ButtonEvent
The coordinates of each ButtonEvent are relative to the stage that
received the event, so we should document this in the structure
annotation.

It should also be mentioned that the coordinates can be transformed
into actor-relative coordinates by using transform_stage_point().
2009-01-21 22:03:31 +00:00
Emmanuele Bassi
ee883f30d4 Add units-from-em conversion
An em is a unit of measurement in typography, equal to the point
size of the current font.

It should be possible to convert a value expressed in em to
ClutterUnits by using the current font and the current DPI as
stored by the default backend.
2009-01-21 17:35:47 +00:00
Emmanuele Bassi
93a0454c09 Remove the single-stage units converters
The stage-with/height-percentage converters had been broken by
the multiple-stages support of Clutter 0.8. They are also made
useless by the fact that Units are now floating point values.

The millimeters and typographic points converters also depended
on the default stage, but they can be reworked to use the default
DPI coming from the default Backend instead.
2009-01-21 17:10:36 +00:00
Emmanuele Bassi
0be613109e [docs] Remove sources of warnings in API references 2009-01-21 16:41:18 +00:00
Emmanuele Bassi
c9739e6aef Change the COGL texture constructor to use flags
Boolean arguments for functions are pretty evil and usually
lead to combinatorial explosion of parameters in case multiple
settings are added.

In the case of the COGL texture constructors we have a boolean
argument for enabling the auto-mipmapping; it is conceivable that
we might want to add more settings for a COGL texture without
breaking API or ABI compatibility, so the boolean argument should
become a bitmask.

The internals have not been changed: instead of checking for
a non-zero value, we check for a bitmask being set.
2009-01-21 10:14:29 +00:00
Emmanuele Bassi
5a4f9c5050 Bug 1404 - ClutterMedia issues
ClutterMedia was a rough cut at a simple media API; it needs some
re-evaluation before 1.0 in order to keep it simple to use, and
simple to implement.

- ClutterMedia:position

  The position property accessors collide with the corresponding
  ClutterActor methods, which make it impossible to bind them in
  high-level languages:

    video_texture.set_position()
    video_texture.get_position()

  In order to resolve the collision, we have to go through the
  GObject properties API:

    video_texture.set('position', value)
    value = video_texture.get('position')

  A :position in seconds is also a GStreamer-ism, and should rather
  be converted to a :progress property, with a normalized value
  between 0 and 1. the current position in seconds would then simply
  be progress*duration. For non-seekable streams, 0.0 would always
  be returned. This makes it easier to use the progress inside
  animations, Timelines or ClutterPath instances.

- ClutterMedia:volume should be renamed to :audio-volume and normalized
  as well, instead of being a floating point value between 0 and 100.

- ClutterMedia:buffer-percent should just be :buffer-fill and normalized
  between 0.0 and 1.0
2009-01-20 23:40:25 +00:00
Robert Bragg
e338245827 Renames the mesh api to the "vertex buffer api".
This better reflects the fact that the api manages sets of vertex attributes,
and the attributes really have no implied form. It is only when you use the
attributes to draw that they become mesh like; when you specify how they should
be interpreted, e.g. as triangle lists or fans etc. This rename frees up the
term "mesh", which can later be applied to a concept slightly more fitting.
E.g. at some point it would be nice to have a higher level abstraction that
sits on top of cogl vertex buffers that adds the concept of faces. (Somthing
like Blender's mesh objects.) There have also been some discussions over
particle engines, and these can be defined in terms of emitter faces; so some
other kind of mesh abstraction might be usefull here.
2009-01-20 22:29:35 +00:00
Robert Bragg
3014d4ff8a Merge branch 'cogl-float'
Okey; to summarise the changes...

We have converted Clutter and Cogl over to using floating point internally
instead of 16.16 fixed, but we have maintained the cogl-fixed API as a
utility to applications in case they want to implement their own optimizations.

The Clutter API has not changed (though ClutterFixed and ClutterUnit are now
internally floats) but all Cogl entry points have been changed to accept floats
now instead of CoglFixed.

To summarise the rationale...

There have been a number of issues with using fixed point though out Clutter
and Cogl including: lack of precision, lack of range, excessive format
conversion (GPUs tend to work nativly with IEEE floats) and maintainability.
One of the main arguments for fixed point - performance - hasn't shown
itself to be serious in practice so far since we seem to be more limited
by GPU performance and making improvements regarding how we submit data to
OpenGL[ES]/the GPU has had a more significant impact.

Ref: The recent multiple rectangle queuing changes + the
cogl-texture-agressive-batching branch which show significant performance
gains, and that recent tests on the ipodtouch (ARM + MBX) also showed no
loss of performance running with floats.

So finally; please forgive the inevitable fallout, this is a far reaching
change. There are still a few known issues with the fixed to float
conversion but enough works for all our conformance tests to pass, and the
remaining issues hopefully wont be too tricky to solve. For reference two
tags will be available either side of this change: "cogl-fixed-end" and
"cogl-float-start"
2009-01-20 18:47:50 +00:00
Emmanuele Bassi
ac1a0d568e [script] Parse easing modes by name
The easing modes for a ClutterAlpha can either be parsed by using
the enumeration "nickname" (the shorthand form of the enumeration
value) or by using the common naming policy used in other
animation frameworks, like:

        easeInCubic
        easeOutElastic
        easeInOutBounce
2009-01-20 18:24:58 +00:00
Emmanuele Bassi
268abcd786 [docs] Update the easing modes documentation
The ClutterAlpha API reference page should also list the
easing modes Clutter provides by default, by showing the
curves used by each entry in the AnimationMode enumeration.

We can also remove the incomplete graph showing the old
alpha functions.
2009-01-20 18:13:36 +00:00
Emmanuele Bassi
ec3b1a7b90 [animation] Implement new easing functions
Instead of using our own homegrown alpha functions, we should
use the easing functions also shared by other animation frameworks,
like jQuery and Tween, in the interests of code portability.

The easing functions have been defined by Robert Penner and
are divided into three categories:

        In    Out     InOut

Each category has a particular curve:

        Quadratic
        Cubic
        Quartic
        Quintic
        Sinusoidal
        Exponential
        Circular

In addition, there are "physical" curves:

        Elastic
        Back (overshooting cubic)
        Bounce (exponentially decaying parabolic)

Finally, the Linear curve is also provided as a reference.

The functions are private, and are meant to be used only
through their logical id as provided by the AnimationMode
enumeration.

The tests should be updated as well to match the new
easing functions.
2009-01-20 17:57:30 +00:00
Emmanuele Bassi
7d7372af43 [animation] Move the alpha value to floating point
The current Alpha value is an unsigned integer that can be used
implicitly as a fixed point value. This makes writing an alpha
function overshooting below and above the current range basically
impossible without complicating an already complex code, and
creating weird corner cases.

For this reason, the Alpha value should be defined as a floating
point normalized value, spanning a range between 0.0 and 1.0; in
order to allow overshooting, the valid range is extended one unit
below and one unit above, thus making it -1.0 .. 2.0.

This commit updates the various users of the ClutterAlpha API
and the tests cases.

This commit also removes all the current alpha functions exposed
in the public API.
2009-01-20 16:42:49 +00:00
Robert Bragg
c29a3b4dee [Automatic fixed-to-float.sh change] Hand coded changes for clutter-{fixed,units}
To avoid clashing with all the scripted changes, clutter-fixed.h and
clutter-units.h were manually converted to internally use floats instead of
16.16 fixed numbers.

Note: again no API changes were made in Clutter.
2009-01-20 16:20:55 +00:00
Robert Bragg
a2cf7e4a19 [Automatic fixed-to-float.sh change] Applies a number fixed to float patches
To deal with all the corner cases that couldn't be scripted a number of patches
were written for the remaining 10% of the effort.

Note: again no API changes were made in Clutter, only in Cogl.
2009-01-20 16:20:54 +00:00
Robert Bragg
e82f656590 [Automatic fixed-to-float.sh change] Applies all scripted changes
This is the result of running a number of sed and perl scripts over the code to
do 90% of the work in converting from 16.16 fixed to single precision floating
point.

Note: A pristine cogl-fixed.c has been maintained as a standalone utility API
      so that applications may still take advantage of fixed point if they
      desire for certain optimisations where lower precision may be acceptable.

Note: no API changes were made in Clutter, only in Cogl.

Overview of changes:
- Within clutter/* all usage of the COGL_FIXED_ macros have been changed to use
the CLUTTER_FIXED_ macros.

- Within cogl/* all usage of the COGL_FIXED_ macros have been completly stripped
and expanded into code that works with single precision floats instead.

- Uses of cogl_fixed_* have been replaced with single precision math.h
alternatives.

- Uses of COGL_ANGLE_* and cogl_angle_* have been replaced so we use a float for
angles and math.h replacements.
2009-01-20 16:20:54 +00:00
Robert Bragg
8b39bfec7f Improves the unit test to verify more awkward scaling and some corresponding fixes
This simplifies the mucking about with the model-view matrix that was previously
done which improves its efficiency when scaling is necessary.

Notably: There should now be no performance advantage to using
ClutterCloneTexture as a special case clone actor since this method is just as
efficient.

The unit test was renamed to test-actor-clone.
2009-01-20 11:03:50 +00:00
Robert Bragg
df7480090d Implements a generic ClutterActorClone that doesn't need fbos.
Many use cases for clonning an actor don't require running a shader on the
resulting clone image and so requiring FBOs in these cases is overkill and
in-efficient as it requires kicking and synchronizing a render for each clone.

This approach basically just uses the paint function of another actor to
implement the painting for the clone actor with some fiddling of the model-
view matrix to scale according to the different allocation box sizes of
each of the actors.

A simple unit test called test-actors2 was added for testing.
2009-01-19 16:23:49 +00:00
Owen W. Taylor
6d4cd416ec Change default tile-waste from 64 to 63
It's more sensible to use 2^n-1 for a max tile-waste value rather
than 2^n, so change the value default from 64 to 63. Example:
191 and 192 will both be sliced to 128+64 rather than having
191=>128+64, 192=>256.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-01-16 23:45:36 +00:00
Owen W. Taylor
b716d32000 Fix properties that have X11 types to be 'long'
While X11 Pixmap and Window types only have 32-bits of data, they
are actually 'unsigned long'. Change the "window" and "pixmap"
property of ClutterX11TexturePixmaps to be ulong.

This fixes 64-bit bugs where ClutterGLXTexturePixmap passed a
reference to Pixmap to g_object_get("pixmap", &pixmap, ...);

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-01-16 23:44:32 +00:00
Emmanuele Bassi
10f1f6587e [eglnative] Set the SYNC_MATRICES on stage realization
Since the stage in the EGL native backend only has one size, and it
is determined at realization, we can simply set the SYNC_MATRICES
private flag and let _clutter_stage_maybe_setup_viewport() set up
the GL viewport at the first redraw.
2009-01-16 22:13:44 +00:00
Emmanuele Bassi
7c93565902 [docs] Clarify what API registers a global alpha function
Both clutter_alpha_new_with_func() and clutter_alpha_set_func()
will not register a global alpha function, so we need to update
the documentation to explicitly say so.
2009-01-16 14:53:42 +00:00
Emmanuele Bassi
c096f41e70 [doc] Clarify the animation mode meaning
The animation mode parameters and properties are now slightly
anonymous unsigned longs, so we need to clarify in the documentation
that the user should either pass a ClutterAnimationMode value or
the result of registering an alpha function.
2009-01-16 14:37:42 +00:00
Emmanuele Bassi
d02819949d Remove AnimationMode from the Animation API
The animation mode symbolic id might come from the AnimationMode
enumeration or from the clutter_alpha_register_*() family of
functions. For this reason, we should use a gulong instead of
ClutterAnimationMode whenever we have an "animation mode" parameter
or property.
2009-01-16 14:37:42 +00:00
Emmanuele Bassi
74213e0ee3 [alpha] Allow registering alpha functions
In order to unify alpha functions and animation modes in ClutterAlpha
we should be able to register alpha functions and get a logical id
for them; the logical id will then be available to be used by
clutter_alpha_set_mode().

The registration requires API changes in ClutterAlpha constructors
and methods. It also provides the chance to shift ClutterAlpha
towards the use of animations modes only, and to alpha functions
as a convenience API for language bindings alone.
2009-01-16 14:37:35 +00:00
Neil Roberts
52d7b7be73 [fixed-to-float-patches] Move the changes to gles2-wrapper.h into the patch
It looks like the changes to cogl-gles2-wrapper.h were accidentally
committed to the actual file instead of the patch in commit
de27da0e. This commit moves the changes back into the patch so
cogl-gles2-wrapper.h is reverted back to master.
2009-01-16 10:50:53 +00:00
Neil Roberts
4e94500a2a Merge branch 'master' into cogl-float
The patches have been updated to apply cleanly.

The patches for the g_warnings in clutter-actor.c have been removed
because master now uses CLUTTER_UNITS_FORMAT so they aren't
necessary. The clutter-units.h patch now sets CLUTTER_UNITS_FORMAT to
'f'.
2009-01-15 18:26:22 +00:00
Neil Roberts
9339334a43 Fix GLES backends after merging the async-textures branch
The changes from the GL version of cogl-texture.c have been mirrored
in the GLES version. This adds the cogl_texture_new_from_bitmap
function and fixes the build errors.
2009-01-15 18:09:54 +00:00
Emmanuele Bassi
22183c7a8f Bug 1380 - Return booleans from CLUTTER_ACTOR_IS_* macros
If you try to use the CLUTTER_ACTOR_IS_* macros defined in ClutterActor
like this:

  typedef struct { unsigned int reactive : 1; } foo_t;

  foo_t f; f.reactive = CLUTTER_ACTOR_IS_REACTIVE (actor);

It will blow up because while the macros evaluate to 0 they can also
evaluate to non-zero values. Since most of the boolean flags in
Clutter and Clutter-based code are going to be stored like in the
example above, we should change the macros and let them evaluate
stricly either to 0 or to 1.
2009-01-14 18:18:20 +00:00
Emmanuele Bassi
41386a5f72 Remove the Effects API
The Effects API and all related symbols have been superceded by
the newly added Animation API and clutter_actor_animate().

This commit removes the Effects implementation, the documentation
and the interactive test/example code.
2009-01-14 16:56:21 +00:00
Emmanuele Bassi
5d346cca57 Emit ::load-finished for every texture load
The ::load-finished signal is emitted only when loading a texture
using clutter_texture_set_from_file(). Since this breaks user
expectations and consistency, we should also emit ::load-finished
when loading a texture from image data.
2009-01-14 15:38:04 +00:00
Emmanuele Bassi
110489ee58 Merge branch 'async-textures'
* async-textures:
  Whitespace fixes in ClutterTexture
  [async-loading] Do not force the texture size on async load
  [async-loading] Update asynchronous image loading
  Add API for extracting image size from a file
  Update/clean and apply the async-texture patch from bug #1144
2009-01-14 15:16:41 +00:00
Neil Roberts
d454bfcc87 [ClutterStageX11] Remove the handling_configure flag
Since Clutter changed to using a layout scheme the handling_configure
flag no longer works because the allocate method is not invoked
immediately during the call to set_size from the ConfigureNotify
handler. However it is also no longer neccessary because the resizes
are effectively batched up until a relayout is run so it won't cause
an infinite loop of resize and notify events anyway.
2009-01-14 15:10:50 +00:00
Emmanuele Bassi
df62a037b0 Fix compile warning for a possible uninitialized variable 2009-01-14 15:04:28 +00:00
Emmanuele Bassi
0e1bbcdc02 Add declaration of clutter_binding_pool_get_type()
The function is automagically created by G_DEFINE_TYPE(), but
it should also be declared in the header.
2009-01-14 15:03:30 +00:00
Emmanuele Bassi
a074106ded Merge branch 'animation-improvements'
* animation-improvements:
  [docs] Add ClutterAnimatable to the API reference
  Add license notice to ClutterAnimation files
  [docs] Update the ClutterAnimation section
  [animation] Extend ClutterAnimation support to all objects
  [animation] Use ClutterAnimatable inside Animation
  [animation] Add ClutterAnimatable
  [animation] Allow registering custom progress function
  [animation] Interval::compute_value should return a boolean
  Animate ClutterColor properties
2009-01-14 15:00:44 +00:00
Neil Roberts
ffc15e0962 [clutter-text] Fix x-position of cursor when moving up or down
ClutterText already has code to try to preserve the x position when
moving up or down. A target x-position is stored and the cursor is
positioned at the nearest point to that in the appropriate line when
up or down is pressed. However the target position was never cleared
so it would always target the x-position of the cursor from the first
time you pressed up or down.

To fix this the patch clears the target position in set_position and
then sets it after the call in real_move_up/down. That way pressing
up or down sets the target position and any other movement will clear
it.

To get an index for the pixel position in the line
pango_layout_line_x_to_index is used. However when x is greater than
the length of the line then the index before the last grapheme is
returned which was causing it to jump to the penultimate
character. The patch makes it add on the trailing value so that it
will jump to the last character.
2009-01-14 11:12:02 +00:00
Neil Roberts
b57c7e12d4 [clutter-text] Fix offset_to_bytes to work when pos == 0
The old function ended up returning the length of the string when pos
was zero. This caused it to insert characters at the end when the
cursor was at the beginning of the string.
2009-01-13 18:42:50 +00:00
Neil Roberts
e93c266647 [clutter-text] Don't allow control characters to be inserted
If an unbound control key is pressed (such as Ctrl+R) it would insert
a rectangle into the text.

Also zero is considered a valid unicode character by
g_unichar_validate so pressing a key such as shift would cause the
current selection to be deleted. The character isn't actually inserted
because insert_unichar disallows zeroes.
2009-01-13 18:17:17 +00:00
Neil Roberts
de114dead7 Fix GLES 2 after the multiple-texture-rectangle branch merge
The GLES 2 wrapper needs to set up some state before each
draw. Previously this was acheived by wrapping glDrawArrays. Since the
multiple-texture-rectangle branch merge, glDrawElements is used
instead so we also need a wrapper for that.

It was also directly calling glBindTexture. GLES 2 uses a wrapper for
this function so that it can cope with GL_ALPHA format textures. The
format of the current texture needs to be stored as well as the target
and object number for this to work.
2009-01-13 16:52:39 +00:00
Neil Roberts
453697fcad Update gtk-doc 'Since' field for cogl_texture_multiple_rectangles
The function has been backported to the 0.8 branch so it will also be
available in Clutter 0.8.6
2009-01-13 16:44:31 +00:00
Robert Bragg
616c082a7c Merge commit 'origin/master' into cogl-material
Conflicts:

	clutter/clutter-texture.c
	clutter/cogl/cogl-texture.h
	clutter/cogl/gles/cogl-context.c
	clutter/cogl/gles/cogl-context.h
2009-01-13 13:37:38 +00:00
Emmanuele Bassi
a9ae1c65c3 Add ClutterBindingPool:name
The BindingPool constructor should only check for duplicate pools
and then set the :name constructor-only property. If a BindingPool
is created without a name we also make a fuss about it.

It is also possible to simply dispose of a binding pool using
g_object_unref(), as long as it has been created by using
clutter_binding_pool_new() or directly with g_object_new(). Only
BindingPools attached to a class are not owned by the user.
2009-01-13 12:51:03 +00:00
Emmanuele Bassi
a4c8a70c83 Turn ClutterBindingPool a GObject
ClutterBindingPool is already "problematic" in terms of memory
management for language bindings and gobject-introspection. It
also lacks a GType.

Turning ClutterBindingPool into a GBoxed would not make much
sense, since it does not adhere to the copy/free semantics. It
could be referenced/unreferenced, but in that case we can just
as well use GObject as a base class instead of reimplemeting
a ref-counted object and then boxing it.

ClutterBindingPool is obviously a terminal class, so we just
hide the instance and class structures.
2009-01-13 12:34:59 +00:00
Robert Bragg
de27da0e5b [cogl/gles] Fixes for building for GLES 1 using floats
* This adds GLfixed -> GLfloat conversion
* redefines cogl_wrap_glBlahx macros as glBlahf
* Other misc fixes (mostly corresponding to cogl/gl equivalents)
2009-01-12 17:21:09 +00:00
Emmanuele Bassi
e730cd70b1 Whitespace fixes in ClutterTexture
Small whitespace fixes patch; ClutterTexture requires much more
love than I can provide at the moment.
2009-01-12 17:12:24 +00:00
Emmanuele Bassi
5ed62aaf76 [async-loading] Do not force the texture size on async load
The size of the texture as retrieved by the filename should
be set as the image size, not as the actor size, in order to
respect the :sync-size property.

When the asynchronous loading process terminates, we queue
a relayout so that the scene is updated.
2009-01-12 17:09:47 +00:00
Emmanuele Bassi
168d558bcf [async-loading] Update asynchronous image loading
Provide a main loop-based fallback to the asynchronous loading in
case the GLib threading support hasn't been enabled. This also
allows us to clean up the asynchronous loading machinery and have
it behave consistently across different scenarios.

Emit the ::load-finished even if the asynchronous loading from
disk was not enabled.

Finally, block clutter_texture_set_from_file() until we have an
image width and height, so that querying the texture actor size
after set_from_file() will still yield the correct result even
when asynchronous loading is set.
2009-01-12 17:00:06 +00:00
Emmanuele Bassi
1c114be31a Add API for extracting image size from a file
For the asynchronous loading we need a function call that parses
a file, given its path, and retrieves the image width and height.

This commit adds cogl_bitmap_get_size_from_file() to the CoglBitmap
API.
2009-01-12 16:52:20 +00:00
Emmanuele Bassi
946c075a2a Merge branch 'master' into async-textures 2009-01-12 14:43:53 +00:00
Havoc Pennington
be462b2ea8 Bug 1087 - virtualize stage_queue_redraw
Add a ClutterStage::queue-redraw signal.

The purpose of this signal is to allow combining the Clutter redraw
idle with another redraw idle such as gtk's (or any other one really;
this is desirable anytime Clutter is not the only thing drawing to
a toplevel window).

To override the default, you would connect to ::queue-redraw and then
stop the signal emission.
2009-01-12 14:28:39 +00:00
Robert Bragg
f09b221ade [ClutterGLXTexturePixmap] Use an RGB texture (not ARGB) for 24bpp pixmaps
By creating an ARGB texture for 24bpp pixmaps we were exposing an undefined
alpha channel to the blending and texture combine stages which resulted in
nasty artefacts. (This issue was seen on i945 + DRI2)
2009-01-12 13:15:32 +00:00
Emmanuele Bassi
ed991fe3c5 Declare G_LOG_DOMAIN for COGL
In order to get properly namespaced debug and warning messages
inside COGL code we need to define the G_LOG_DOMAIN macro.
2009-01-12 11:21:06 +00:00
Emmanuele Bassi
f911a3a7a1 Allow ensuring that a stage viewport is updated
Since we only update the GL viewport when we receive a ConfigureNotify
event on X11, we also need a function to allow other toolkits to tell
a stage that the viewport should be updated.

This commit adds clutter_stage_ensure_viewport(), a function that simply
sets the private SYNC_MATRICES flag on the stage and then queues a
redraw.

This function should be called by libraries integrating Clutter with
other toolkits, like clutter-gtk or clutter-qt.
2009-01-12 11:18:11 +00:00
Emmanuele Bassi
4f6cc0b25f [x11] Proper fix for the ClutterStage resize race
Continuation of the fix in commit 00a3c69868.

Instead of using a separate flag for the resize process, just
delay the setting of the CLUTTER_ACTOR_SYNC_MATRICES flag on the
stage to the point when we receive a ConfigureNotify event from
X11.

This commit will break the stage embedding into other toolkits.
2009-01-12 11:15:41 +00:00
Emmanuele Bassi
2693ea3ddc [docs] Documentation warnings
Fix the various warnings issued by gtk-doc when enabling the API
reference generation for both COGL and Clutter.
2009-01-09 14:26:35 +00:00
Emmanuele Bassi
00a3c69868 [x11] Fix a race condition when resizing a stage
There is a race condition when we resize a stage before showing
it on X11.

The race goes like this:

  - clutter_init() creates the default stage and realize it, which
    will cause a 640x480 Window to be created
  - call set_size(800, 600) on the stage will cause the Window to be
    resized to 800x600
  - call show() on the stage for the first time will cause COGL
    to set up an 800 by 600 GL viewport
  - the Window will be mapped, which will cause X to notify the
    window manager that the Window should be resized to 800x600
  - the window manager will approve the resize
  - X resizes the drawable to 800x600

To fix the race, we need to defer COGL from setting up the viewport
until we receive a ConfigureNotify event and the X server has resized
the Drawable.

In order to defer the call to cogl_setup_viewport() we add a new
private flag, CLUTTER_STAGE_IN_RESIZE; the flag is checked whenever
we need to change the viewport size along with the SYNC_MATRICES
private flag. Thus, cogl_setup_viewport() will be called only if
SYNC_MATRICES is set and IN_RESIZE is not set.
2009-01-09 12:06:46 +00:00
Emmanuele Bassi
efd7ad7e55 [text] Fix GObject properties in ClutterText
Some of the read-write properties of ClutterText were missing
an implementation in clutter_text_get_property(), as well as
the :position and :selection-bound properties being wrongly
converted from fixed point to integer, passing through floating
point values.
2009-01-08 17:06:04 +00:00
Emmanuele Bassi
e9ee7f049d Fix last improper usage of ClutterUnits
ClutterUnits should not be used interchangeably as, or with
ClutterFixed values. ClutterUnits should also not be assumed
to be integers.

This commit fixes the last few improper usages of ClutterUnit
values, and adds a CLUTTER_UNITS_FORMAT macro for safely printing
ClutterUnit values with printf().
2009-01-08 16:00:47 +00:00
Emmanuele Bassi
db3d2e9568 Merge branch 'animatable-iface' into animation-improvements
* animatable-iface:
  [docs] Add ClutterAnimatable to the API reference
  Add license notice to ClutterAnimation files
  [animation] Use ClutterAnimatable inside Animation
  [animation] Add ClutterAnimatable
2009-01-08 13:38:51 +00:00
Emmanuele Bassi
d340de8e00 Add license notice to ClutterAnimation files 2009-01-08 13:18:00 +00:00
Emmanuele Bassi
068ba1caf0 [animation] Extend ClutterAnimation support to all objects
Instead of limiting the use of ClutterAnimation to ClutterActor
instances, relax the constraint to include all GObject classes.

ClutterAnimation is not using actor-specific API, since it is
only using properties.

The only actor-based API is the clutter_actor_animate() family
of functions.
2009-01-08 13:13:39 +00:00
Emmanuele Bassi
60cfa5edb2 [animation] Use ClutterAnimatable inside Animation
ClutterAnimation should check if the object is implementing the
Animatable interface, and if so delegate to it the computation
of the value along the interval initial and final value, depending
on the progress.
2009-01-08 12:59:16 +00:00
Emmanuele Bassi
24808e20b3 [animation] Add ClutterAnimatable
The ClutterAnimatable interface is meant to be used by GObject
classes to override the value computation for an animatable
property within the boundaries of an interval.

It is composed of a single virtual function, animate_property();
its implementation will receive the ClutterAnimation used to
animate the object; the property name; the initial and final
interval values; and the progress factor as retrieved by the
Alpha object bound to the Animation instance.
2009-01-08 12:56:46 +00:00
Emmanuele Bassi
28b0f432b7 [animation] Allow registering custom progress function
A ClutterInterval can change the way the progress is computed
by subclassing and overriding the ::compute_value() virtual function.

It should also be possible to register a custom progress function
in the same way it is possible to register a custom transformation
function between two GValues.

This commit adds an internal, global hash table that maintains a
GType <-> progress function association; each ClutterInterval
will check if there is a progress function registered for the
GType of the initial and final values of the interval and, if
it has been found, it will call it to compute the value of the
interval depending on the progress factor.
2009-01-08 11:15:09 +00:00
Emmanuele Bassi
ff48c3ef7c [animation] Interval::compute_value should return a boolean
If the computation of the interval value depending on the progress
was not successful, ClutterInterval::compute_value() should return
this information to the caller.
2009-01-07 18:18:59 +00:00
Chris Lord
2cea22e6a0 Update/clean and apply the async-texture patch from bug #1144 2009-01-07 17:02:43 +00:00
Emmanuele Bassi
5d5b93bd2a Rename a variable masking index()
The maintainer CFLAGS found another masking of the index() function
by an helpless variable.
2009-01-07 16:41:17 +00:00
Neil Roberts
805b88d4c0 Merge branch multiple-texture-rectangle into master
Bug 1289 - Draw multiple glyphs at once

The multiple-texture-rectangle branch adds a new Cogl texture function
called cogl_texture_multiple_rectangles which is used to draw multiple
rectangles out of a texture using a single GL call. This is
significantly faster than drawing the rectangles with individual calls
on some platforms. The Pango renderer now uses this to speed up
rendering.

The conflicts are just due to the whitespace fixes in cb569a5.

Conflicts:

	clutter/cogl/gl/cogl-context.c
	clutter/cogl/gl/cogl-context.h
	clutter/cogl/gl/cogl-texture.c
2009-01-07 16:25:26 +00:00
Emmanuele Bassi
0d9c07f824 [docs] Documentation fixes
Remove the causes of warnings from the Clutter gtk-doc API reference
generation process.
2009-01-07 14:53:54 +00:00
Emmanuele Bassi
c1c7131199 [text] Do not use markup on an editable Text
An editable ClutterText should not use pango_layout_set_markup(),
as the contents of the text actor will not match the text.

Only read-only text actors should parse the contents for Pango
markup.
2009-01-07 13:48:45 +00:00
Emmanuele Bassi
368df450b2 [text] Do not ensure the cursor if not needed
If the Text actor is neither editable nor has its cursor set
to visible, then we should not be ensuring the cursor position.

This fixes a failure in the conformance test unit for the
layout cache.
2009-01-07 13:16:11 +00:00
Emmanuele Bassi
c54bd99097 Merge the ClutterText actor
Merge branch 'text-actor'

* text-actor: (108 commits)
  Re-align ClutterText header file
  [text] Fix cursor sizing
  Comments and whitespace fixes to ClutterText
  [docs] Add newly added :single-line-mode accessors
  Update the ignore file
  [tests] Add text field interactive test
  [text] Add single-line-mode to ClutterText
  [text] Fix the deletion actions
  [text] Use cached length when possible
  [tests] Add unit for the ClutterText:password-char property
  [docs] Update the Text section
  [text] Coalesce text visibility and password character
  Allow localizations to change the text direction
  Clean up the update_pango_context() function
  Pass the PangoContext, not the MainContext
  Revert the logic of the PangoContext check
  Remove the binding pool entry from the list
  Remove BindingPool::list_actions()
  Add ClutterActor::create_pango_context()
  Rename the PangoContext creation functions
  ...
2009-01-07 12:06:33 +00:00
Emmanuele Bassi
ad7d1b54bc Re-align ClutterText header file
The addition of the single line mode accessor methods caused the
re-alignment of the entire file.
2009-01-07 11:46:22 +00:00
Emmanuele Bassi
328534fc95 [text] Fix cursor sizing
The cursor should be slightly smaller than the height of the actor, to
allow for painting a border. Let's pad it by 1 pixel on the top and 1
on the bottom.

Also, we should use the cursor size everywhere and not use hardcoded
magic numbers.
2009-01-07 11:44:54 +00:00
Emmanuele Bassi
f3142a70dc Comments and whitespace fixes to ClutterText 2009-01-07 00:43:24 +00:00
Emmanuele Bassi
43f82332dd [text] Add single-line-mode to ClutterText
Allow using ClutterText as a single line text field. This is useful for
text fields that accept just a single line of contents by default, and
respond to the Enter key press to execute some action.

The :single-line-mode property enables this behaviour inside ClutterText
by clipping and scrolling the contents of the PangoLayout if they do
not fit the allocated width of the Text actor.
2009-01-07 00:25:24 +00:00
Emmanuele Bassi
8182b354b1 [text] Fix the deletion actions
When using the delete-prev action from the end of the text we end
up either missing the first glyph we have to delete or falling
through the last one in the text.

This commit fixes both issues.
2009-01-06 20:54:20 +00:00
Emmanuele Bassi
3d32d464e9 [text] Use cached length when possible
Since clutter_text_set_text() measures the length of the text
each time, we should use the cached length instead of recomputing
the text length each time. This should save us some time when
dealing with long, multi-byte texts.
2009-01-06 20:52:03 +00:00
Neil Roberts
12ea2933bd [cogl-material] Restore the GL_TEXTURE_ENV_MODE after material_rectangle
The rest of Cogl expects the texture mode to be GL_MODULATE so it
needs to be restored after calling cogl_material_rectangle. Otherwise
cogl_texture_rectangle will fail to blend with the Cogl color properly
and all of the labels will be black.
2009-01-06 18:24:57 +00:00
Neil Roberts
606d34f2aa [cogl-material] Make the user_tex_coords parameter of _rectangle const
The array is only used for input so it should be const.
2009-01-06 16:09:55 +00:00
Neil Roberts
f5288b1918 Add cogl-material.h and cogl-matrix.h to libclutterinclude_HEADERS
Otherwise they won't get installed
2009-01-06 15:53:35 +00:00
Emmanuele Bassi
979b6794bb [text] Coalesce text visibility and password character
Using two properties to set a password entry can be construed as
both cumbersome and a gtk-ism. And rightly so on both counts.

The :text-visible property has also conflicting semantics with the
:cursor-visible one: while the latter hides the cursor, the former
changes the display of the contents of the Text actor. It is, thus,
not a matter of "visibility" but of "rendering".

Instead of setting the :text-visible and :invisible-char properties
to have a password text field, the Text actor should just have a
single :password-char property holding a Unicode character. If the
value of the :password-char is non-zero, the Text actor will use the
Unicode character to render the contents of the text entry.

This commit removes the following methods:

  clutter_text_set_text_visible()
  clutter_text_get_text_visible()
  clutter_text_set_invisible_char()
  clutter_text_get_invisible_char()

And the following properties:

  ClutterText:text-visible
  ClutterText:invisible-char

In favour of:

  clutter_text_set_password_char()
  clutter_text_get_password_char()

And:

  ClutterText:password-char

Thus making obvious what use the property and accessor methods are
for and simplifying the process of creating a simple password text
field to:

  text = clutter_text_new ();
  clutter_text_set_password_char (CLUTTER_TEXT (text), '*');
2009-01-06 15:22:31 +00:00
Emmanuele Bassi
854cf5d499 Animate ClutterColor properties
We can animate a ClutterColor-based property between an interval
of two colors by simply applying the factor to each color component.
2009-01-06 12:53:30 +00:00
Emmanuele Bassi
1892f8cb1d Allow localizations to change the text direction
The locale translators of Clutter are also the ones that should set
the default direction of the text in a Clutter user interface.

This commit adds a translatable string that defines the direction
of the text; the translation authors will change it to the correct
value and that will determine the default direction.

The default text direction can be overridden by using the
CLUTTER_TEXT_DIRECTION environment variable, or by using the
--clutter-text-direction command line switch. In any other case,
the locale will determine the text direction, as it should.
2009-01-06 12:35:19 +00:00
Neil Roberts
e4272fba69 Fix off-by-one error in clutter_stage_read_pixels
It was always reading one pixel lower than requested. If y was 0 then
it would try to read below the lowest line.

Thanks to Geoff Gustafson for spotting.
2009-01-06 12:27:13 +00:00
Takao Fujiwara
8e6423a1b6 Bug 1397 - Allow localizing the command line help
Clutter has a set of command line options that are added to every
application by means of clutter_init() or by obtaining the Clutter
GOptionGroup and using g_option_context_parse(). Thus, every Clutter
application will automatically have an --help command line switch
showing the list of options and their description.

At the moment, Clutter does not enable localization of the help,
thus making it less than useful on non-English locales.

This patch enables the machinery to create a localization file and
load it when initializing Clutter, by means of the GLib macros and
locale.h API we already use.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-01-06 12:15:02 +00:00
Emmanuele Bassi
1187004099 Clean up the update_pango_context() function
Logically split the various operations with whitespace so that
it's clear what does what.
2009-01-05 16:48:46 +00:00
Emmanuele Bassi
a5f9c72694 Pass the PangoContext, not the MainContext
When updating the PangoContext with the current options (font name,
options, resolution) pass the PangoContext instead of the Clutter
MainContext structure pointer.
2009-01-05 16:45:59 +00:00
Emmanuele Bassi
c79112bd3c Revert the logic of the PangoContext check
The branch that creates the global PangoContext should only run
if there is no global PangoContext already.
2009-01-05 16:44:52 +00:00
Emmanuele Bassi
700b34148b Remove the binding pool entry from the list
When removing a binding entry from the binding pool we should not
only remove it from the hash table, but also from the linked list
we use to iterate over inside the block/unblock_action() pair.
2009-01-05 16:29:49 +00:00
Emmanuele Bassi
c988b7b736 Remove BindingPool::list_actions()
The clutter_binding_pool_list_actions() was not implemented. The
utility of a call listing all the action names is also debatable:
all the functions related to the key bindings take the key symbol
and modifiers -- except the block_action() and unblock_action()
pair.
2009-01-05 16:25:50 +00:00
Emmanuele Bassi
982a678053 Add ClutterActor::create_pango_context()
Sometimes an actor needs to set specific font rendering options on
the PangoContext without changing settings for every other text-rendering
actor.

In order to do this, we need a new public method to create a Pango
context object -- preset with all the default settings -- owned by the
developer and not shared with the rest of Clutter.

This new method is called clutter_actor_create_pango_context(); while
it does not strictly depend on a ClutterActor, it is a good idea to
have it inside the ClutterActor API to map the current get_pango_context()
method and in case we start storing screen-specific data to the Actor
itself during the 1.x API cycle.
2009-01-05 15:29:10 +00:00
Emmanuele Bassi
d622a4dd89 Rename the PangoContext creation functions
The _clutter_context_create_pango_context() should create a new
context; the function returning the PangoContext stored inside the
MainContext structure should be named _get_pango_context() instead.
2009-01-05 15:27:33 +00:00
Emmanuele Bassi
33459f63d6 Whitespace fixes 2009-01-05 15:26:57 +00:00
Neil Roberts
ff73fe3e1f Fix some animation_set_* functions so they cope if the value is the same
The following functions are fixed:

clutter_animation_set_actor
clutter_animation_set_timeline
clutter_animation_set_alpha

This is related to bug 1392 which discusses the problem for
behaviour_set_alpha.
2009-01-05 13:19:40 +00:00
Neil Roberts
39f4848b93 Fix some *_set functions so they work if the object is the same value
Bug 1392 - behaviour_set_alpha set same alpha twice lead to warning
and destroy the input alpha

The following functions are fixed:

clutter_actor_set_shader
clutter_alpha_set_timeline
clutter_behaviour_set_alpha
clutter_clone_texture_set_parent_texture

They either now reference the new value before destroying the old
value, or just return immediately if the values are the same.
2009-01-05 13:19:40 +00:00
Neil Roberts
62cfc6487f Fix setting the mode on a ClutterAlpha created with animation_set_alpha(NULL)
It previously attempted to set the mode on the alpha using
clutter_animation_set_mode_internal, but this was setting the mode on
priv->alpha. At that point in the code priv->alpha is always NULL.

clutter_animation_set_mode_internal now takes a parameter to specify
which alpha to modify.
2009-01-05 12:52:46 +00:00
Emmanuele Bassi
e56fe478ef Allow overriding actions inside a BindingPool
As of now, a key binding installed into a BindingPool is always there
and cannot be changed.

This is problematic for sub-classes trying to override the callback
or the action for a given key binding.

This commit adds the ability to override the closure for an existing
key binding inside a binding pool -- assumed the caller knows the
key symbol and modifiers used to install the key binding in the first
place.
2009-01-05 12:49:01 +00:00
Neil Roberts
2ed60a5270 In clutter_alpha_set_mode, set priv->mode after setting the func
Otherwise the call to clutter_alpha_set_func sets the mode back to
CLUTTER_CUSTOM_MODE so clutter_alpha_get_mode won't get back the same
value that was set.
2009-01-05 12:47:10 +00:00
Emmanuele Bassi
55a22d5750 [text] Add select-all binding
Bind Ctrl+A to the "select all" action.
2009-01-05 12:27:45 +00:00
Emmanuele Bassi
fd2d78918b Merge branch 'units-rework'
* units-rework:
  [texture] Do not mix fixed point and units values
  [tests] Fix the actor detection
  [units] Do not use fixed point and units interchangeably
2009-01-05 11:11:10 +00:00
Robert Bragg
377f114046 [cogl-material] improvements for cogl_material_rectangle
The API has been changed to take an explicit length for the number of
texture coordinates passed, and it's now documented that if there are
more layers to the current material than the number of texture coords
passed, then default coordinates will be generated for the other
layers.

cogl_material_rectangle should now handle the case where a single
sliced texture is supplied as a material layer by falling back to
cogl_texture_rectangle. We are nearly at the point that
cogl_texture_rectangle could be deprecated. A few issues remain
though, such as not considering waste in cogl_material_rectangle.
2008-12-24 01:35:33 +00:00
Robert Bragg
e77a784714 [cogl-material] Adds a cogl_material_set_color function
The other colors of a material; such as the ambient and diffuse color are
only relevent when we can enable lighting. This adds a basic unlit
color property.

Later cogl_set_source_color can be integrated to either modify the color
of the current source material, or maintain a special singlton CoglMaterial
that is modified by calls to cogl_set_source_color and implicitly made
current.
2008-12-24 01:35:02 +00:00
Robert Bragg
462c45da3c [cogl-material] Some improvements for how we sync CoglMaterial state with OpenGL
This flattens the three functions: cogl_material_flush_gl_material_state,
.._flush_gl_alpha_func and .._flush_gl_blend_func into one:
cogl_flush_material_gl_state which doesn't takes a material handle. (the handle
is instead taken from the context.)

This has allows us to avoid re-submitting some state to OpenGL when the
material has not been replaced.

Note: Avoiding redundant state changes for material layers isn't dealt with
in this patch.
2008-12-24 01:33:23 +00:00
Robert Bragg
4e57972bd6 [cogl-material] Converts clutter-texture/clutter-clone-texture to the material API
This converts clutter-texture to use the new CoglMaterial API instead of
cogl_texture_rectangle.

This change does not add multi-texturing support to Clutter, it's more about
aiming to deprecate cogl_texture_rectangle, and moving everything over to the
cogl_set_source(material); cogl_draw_somthing(); coding pattern.

With this patch, the code can be built with/without CoglMaterial support so we
can do comparisons of the old/new code for a transient period. (look for the
USE_COGL_MATERIAL define)

Note: The FBO paths haven't currently been tested, so they may need some
tweaks.
2008-12-24 01:31:00 +00:00
Robert Bragg
bb938ac4ff Merge branch 'master' into cogl-material
Conflicts:

	clutter/cogl/gl/cogl-context.c
	clutter/cogl/gl/cogl-context.h
2008-12-24 00:59:13 +00:00
Robert Bragg
cb569a5443 White space clean up across a number of files (only removing trailing spaces)
Removed trailing white space from the following files:
- clutter-clone-texture.c
- clutter-texture.c
- clutter-texture.h
- cogl/cogl-texture.h
- cogl/gl/cogl-context.c
- cogl/gl/cogl-texture.c
- cogl/gl/cogl-context.h
2008-12-24 00:48:32 +00:00
Emmanuele Bassi
c9cdf1ef0a Fix an empty block
Remove a stray ';' that prevented the get_bounds() method of the
ClutterBehaviourRotate to correctly return the start angle value.
2008-12-23 20:55:35 +00:00
Emmanuele Bassi
f777bc629a [docs] Document the newly added functions
Document the ClutterBackend font name accessors, and the
clutter_actor_get_pango_context() getter method.
2008-12-23 16:59:14 +00:00
Emmanuele Bassi
9389d9755d Add the ability to set the text direction
The direction of the text depends on the locale, and it is the
basic setting needed to enable internationalization of user
interfaces.

This commit allows setting the direction of the PangoContext instance
used by Clutter by using the CLUTTER_TEXT_DIRECTION environment
variable, or by passing the --clutter-text-direction command line
argument. Valid values are:

        ltr     - for left-to-right locales
        rtl     - for right-to-left locales

The default is LTR.

Ideally, this should be a value set by the localization teams on the
PO file, but this step requires some build system surgery to allow
the translation of the Clutter strings.
2008-12-23 16:40:26 +00:00
Emmanuele Bassi
b4a3944b2b Return the default font name if no font name is set
When calling clutter_backend_get_font_name(), if no default font
name has previously been set, we just set the default and return
a pointer to it - like we do for the font options.
2008-12-23 16:27:54 +00:00
Emmanuele Bassi
e3785f4f45 Use the default font from the Backend
Instead of storing the default font name and size as a pre-processor
macro, use the newly added ClutterBackend API to retrieve the current
default font from the backend.
2008-12-23 15:05:16 +00:00
Emmanuele Bassi
7262542155 Store the default font name inside ClutterBackend
The default backend stores some of the global defaults, like the
font options, text resolution, double click settings. It should also
store the default font name, to allow various text-based actors to
share the same settings.

When the font name changes, the ::font-changed signal is emitted,
to allow actors to pick up the change.
2008-12-23 15:03:11 +00:00
Emmanuele Bassi
977bdcf89b Update the PangoContext on backend changes
When the ClutterBackend notifies of changes in the resolution or
font options, update the PangoContext stored by Clutter's main
context. This allows changing the backend font-related settings at
runtime.
2008-12-23 14:34:16 +00:00
Emmanuele Bassi
213d8f0e4e Store the PangoContext inside the main context
The PangoContext should be stored once, and inside the main
Clutter context. Each actor for which clutter_actor_get_pango_context()
has been called will hold a reference on the Pango context as well.

This makes it possible to update the text rendering for Clutter
by using only public API.
2008-12-23 14:27:41 +00:00
Emmanuele Bassi
61d47ee301 Do not leak the PangoContext
We hold a reference on the PangoContext we use for an actor, so
we should remove the reference inside the dispose implementation.
2008-12-23 14:15:10 +00:00
Emmanuele Bassi
a865a5d4ea Create the PangoContext of the Text actor
Instead of creating a single, private PangoContext for every
Text actor, use the newly added clutter_actor_get_pango_context()
function.
2008-12-23 14:11:27 +00:00
Emmanuele Bassi
78628edf2f Add a per-actor PangoContext
Rendering text inside an actor is pretty much impossible without
using internal API to create the various pieces like the PangoContext
and the font map.

Each actor should have the ability to create a PangoContext, which
is the only object needed to generate layouts and change the various
Pango settings.

This commit adds a clutter_actor_get_pango_context() function that
creates a PangoContext inside the ClutterActor private data and allows
the creation of PangoLayouts when needed. If the actor already
has a PangoContext, the same instance is returned.

The PangoContext is created only on demand.
2008-12-23 14:06:55 +00:00
Emmanuele Bassi
b8b8b155c4 Add signals for Backend options
The ClutterBackend instance at the moment lacks the ability to
notify runtime changes of the font options and the resolution.

For this reason, this commit adds a ::resolution-changed and a
::font-changed signals to the Backend class.

The ::resolution-changed signal is emitted when set_resolution()
is called with a different DPI; ::font-changed is emitted when the
cairo_font_options_t* changes from the default.
2008-12-23 13:55:51 +00:00
Robert Bragg
aee2589cc6 [doc] Hooks up cogl-material reference documentation
Adds some more gtk-doc comments to cogl-material.h, and adds a new section to
cogl-sections.txt
2008-12-22 16:35:52 +00:00
Robert Bragg
eb3b48e9ff Updates previous GLES multi-texturing code to use CoglMaterial
test-cogl-material now runs on GLES 1 using the PVR GLES1 SDK (though since
only 2 texture units are supported the third rotating light map doesn't show)

Note: It currently doesn't build for GLES 2.0
2008-12-22 16:35:52 +00:00
Robert Bragg
40b0bb4e95 Adds a CoglMaterial abstraction, which includes support for multi-texturing
My previous work to provide muti-texturing support has been extended into
a CoglMaterial abstraction that adds control over the texture combine
functions (controlling how multiple texture layers are blended together),
the gl blend function (used for blending the final primitive with the
framebuffer), the alpha function (used to discard fragments based on
their alpha channel), describing attributes such as a diffuse, ambient and
specular color (for use with the standard OpenGL lighting model), and
per layer rotations. (utilizing the new CoglMatrix utility API)

For now the only way this abstraction is exposed is via a new
cogl_material_rectangle function, that is similar to cogl_texture_rectangle
but doesn't take a texture handle (the source material is pulled from
the context), and the array of texture coordinates is extended to be able
to supply coordinates for each layer.

Note: this function doesn't support sliced textures; supporting sliced
textures is a non trivial problem, considering the ability to rotate layers.
Note: cogl_material_rectangle, has quite a few workarounds, for a number of
other limitations within Cogl a.t.m.
Note: The GLES1/2 multi-texturing support has yet to be updated to use
the material abstraction.
2008-12-22 16:35:52 +00:00
Robert Bragg
63047e1907 [doc] Hooks up cogl-matrix reference documentation
Adds a few more gtk-doc notes to cogl-matrix.h, and adds a new section to
cogl-sections.txt
2008-12-22 16:35:52 +00:00
Robert Bragg
fa8d6dc69b Adds CoglMatrix utility code 2008-12-22 16:35:52 +00:00
Robert Bragg
ea643ca0f8 [multi-texturing] This adds a new cogl_multi_texture API for GL,GLES1 + GLES2
Multitexturing allows blending multiple layers of texture data when texturing
some geometry. A common use is for pre-baked light maps which can give nice
lighting effects relativly cheaply. Another is for dot-3 bump mapping, and
another is applying alpha channel masks.

The dot-3 bump mapping would be really nice one day, but currently cogl doesn't
support lighting so that's not dealt with in this patch.

notable limitations:
- It can only texture rectangles a.t.m - and like cogl_texture_rectangle there
is no support for rotated texturing.
- Sliced textures are not supported. I think I've figured out how to handle
layers with different slice sizes at least for rectangular geometry, but I'm
not sure how complex it becomes once rotations are possible and texturing
arbitrary cogl_polygons.
- Except for this new API, cogl still doesn't know about more than one texture
unit, and so has no way of caching any enables related to other units. So that
things don't break it's currently necessary to disable anything to do with
additional units as soon as we are done with them which isn't ideal.
- No clutter API yet.
2008-12-22 16:35:51 +00:00
Emmanuele Bassi
b021f518c1 Use "" as the default value for the :text property
This follows the convention of GtkLabel/GtkEntry in GTK+ and the old
ClutterEntry.

It makes it easier to use strlen/strcmp etc on the output, since we can
assume that it is always a string.

This commit also updates the test unit for ClutterText to verify that
the clutter_text_get_text() function also returns an empty string when
a ClutterText actor has been created.
2008-12-22 13:43:41 +00:00
Emmanuele Bassi
4a934c363c Do not include cogl-pango.h multiple times
The clutter-private.h header already includes cogl-pango.h with
the correct inclusion path, because the main context stores a
pointer to the font map.

There is no need for clutter-text.c to include cogl-pango.h
again since it already includes clutter-private.h.
2008-12-22 13:24:52 +00:00
Owen Taylor
6a980793c6 Return something reasonable from clutter_x11_handle_event()
Instead of returning CLUTTER_X11_FILTER_CONTINUE always from
clutter_x11_handle_event() return CLUTTER_X11_FILTER_REMOVE if
the event was on a stage and translated to a ClutterEvent.

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2008-12-22 13:11:59 +00:00
Robert Bragg
3a6ffe3b7d [build] Replaces use of #include <cairo/cairo.h> with #include <cairo.h>
The cairo pkg-config is crafted such that #include <cairo.h> should be used.
If building with a private build of cairo installed to a custom prefix
<cairo/cairo.h> can cause an un-intended cairo header to be picked up during
compilation due to /usr/include being in the header search path.
2008-12-21 21:52:50 +00:00
Emmanuele Bassi
4e493d1937 Avoid masking math.h exported variables
Our beloved math.h exports, from bits/mathcalls.h, a bare "y1" symbol.
Apparently, it's unthinkable for code including <math.h> to also declare
arguments or variable named "y0", "y1" and "yn".

Anyway, the quick fix already used elsewhere in Clutter's codebase is
to rename the colliding variables "y_0", "y_1" and "y_n" - and
obviously everything similar to them as well, using the same pattern.
2008-12-19 18:21:36 +00:00
Emmanuele Bassi
c93cd4a096 [docs] Documentation fixes for CairoTexture
Sync up the arguments name inside the gtk-doc annotations with their
name inside the function declaration in the header file.
2008-12-19 17:48:30 +00:00
Emmanuele Bassi
2f23003425 Whitespace fixes
Let's try to honour the coding style document, now that we have one.
2008-12-19 17:44:24 +00:00
Emmanuele Bassi
81541e6940 [docs] Parameter naming fixes
The name of the parameter in the header and the one in the gtk-doc
annotation on top of a function must match.

Unfortunately, there is an index() function declared inside strings.h
which makes gcc complain for the "index" argument as soon as we
enable the extra compiler flags we use when distchecking.

Hence, we need to rename "index" to "index_" in the header and in
the source files.
2008-12-19 17:41:44 +00:00
Emmanuele Bassi
8d98c28dfa Merge branch 'cairo-texture'
* cairo-texture:
  [cairo-texture] Remove the construct only restriction on surface size
  [cairo-texture] Silently discard 0x0 surfaces
  Re-indent ClutterPath header
  Add a test case for the new cairo path functions
  Add clutter_path_to_cairo_path and clutter_path_add_cairo_path
  Warn instead of returning in the IN_PAINT check
  Small documentation fixes
  Print a warning when creating a cairo_t while painting
  Do not set the IN_PAINT flag inside the Stage paint
  Set the IN_PAINT private flag
  [docs] Add ClutterCairoTexture to the API reference
  Add ClutterCairoTexture
  Require Cairo as a Clutter dependency

Conflicts:

  Fix merge conflict in clutter/clutter-path.h
2008-12-19 16:44:40 +00:00
Neil Roberts
64de0411ea [cairo-texture] Remove the construct only restriction on surface size
It is possible to change the surface size after construction with
clutter_cairo_texture_set_surface_size so it doesn't seem right to
restrict changing the properties.

clutter_cairo_texture_resize_surface_internal is called in a handler
for the notify signal. It is called there rather than directly in the
set_property handler so that changing both properties in a single
g_object_set will only cause one resize. The constructed override is
no longer needed.

resize_surface_internal will now bail out if the size of the surface
is already the right size.
2008-12-19 15:35:14 +00:00
Emmanuele Bassi
cf5d69139d [texture] Do not mix fixed point and units values
Like we did for ClutterActor in commit cdb78ec4, fix ClutterTexture
usage of CoglFixed and ClutterUnit values without conversion between
the two types.
2008-12-19 13:42:17 +00:00
Emmanuele Bassi
cdb78ec4d2 [units] Do not use fixed point and units interchangeably
Clutter units are, at the moment, implemented as a value in fixed point
notation using the same format as CoglFixed. This is, though, an
implementation detail. For this reason, units should not be treated as
CoglFixed values and should be converted to and from fixed point using
the provided macros.

This commit updates the usage of units and fixed point values in
ClutterActor and rationalises some of the transformation code that
heavily relied on the equivalency between them.
2008-12-19 12:53:57 +00:00
Robert Bragg
5e0daa8ecd Improves tfp performance on Nvidia
Some drivers (e.g. Nvidia) get upset if you try to create multiple glx pixmaps
for the same server side pixmap object, even though you might have unique
client side names, we now avoid hitting this problem by destroying the current
glx pixmap early within clutter_glx_texture_pixmap_create_glx_pixmap.
2008-12-18 17:54:35 +00:00
Neil Roberts
4168ed09de Fix calculation in clutter_cubic_bezier
The calculation for cubic bezier curves had an extra multiplication by
3 which was causing the curve to go over 1.0 very quickly. This had
the affect of making test-animation appear to complete much before the
completed signal is emitted.
2008-12-18 12:20:46 +00:00
Neil Roberts
2bf815131a [clutter-interval] Fix calculation of interval for unsigned types
The patch makes it cast to double before subtracting the original
value from the target value. Otherwise if the target value is less
than the original value then the subtraction will overflow and the
factor will be multiplied by a very large number instead of the
desired interval.

The problem is demonstrable using the border-width property of
ClutterRectangle.
2008-12-17 19:26:24 +00:00
Emmanuele Bassi
e130e0c9b3 [cairo-texture] Silently discard 0x0 surfaces
The current CairoTexture can be created with a surface size of 0
by 0 pixels, but a warning will be printed.

Worse, the surface can be resized to be 0 by 0 pixels without a
warning. The :surface-width and :surface-height properties accept
a minimum value of 0, and not check is performed on either the
constructor or set_surface_size() parameters to enforce the "greater
than zero" rule.

The correct and consistent behaviour is to allow a 0 by 0 pixels
surface size everywhere; inside surface_resize_internal(), the
current surface will be destroyed and if either :surface-width or
:surface-height are set to 0, the resizing terminates.

Attempting to create a Cairo context from a CairoTexture with
either :surface-width or :surface-height set to 0 will result in
a warning.

This allows:

  - creating a CairoTexture with :surface-width or :surface-height
    set to zero and delaying the surface resize at a later point;
  - resizing the surface to 0 by 0 pixels to destroy the image
    surface used internally;
  - increase the consistency in the usage of CairoTexture.
2008-12-17 15:58:11 +00:00
Neil Roberts
140e4e1be2 Minor fix to documentation for clutter_actor_get_anchor_point
In both versions of clutter_actor_get_anchor_point the description of
the @anchor_y parameter was slightly wrong in different ways.
2008-12-17 15:05:08 +00:00
Emmanuele Bassi
6b782ce4e7 Fix the selection behaviour around the 0th glyph
After fixing the cursor position issues around the initial
glyph of the layout, the selection position needs fixing as
well.

The fix is similar: check if the position of the selection
is 0 and provide a fast path by setting the offset to 0.
2008-12-16 15:53:57 +00:00
Neil Roberts
ff92cc9766 Convert clutter_path_get_position to take a gdouble instead of an alpha value
The gdouble value represents an interval along the path from 0.0 to
1.0. This makes more sense than using an alpha value because paths are
not directly related to ClutterAlphas and the rest of the Clutter API
tends to expose gdouble arguments.
2008-12-16 15:39:53 +00:00
Emmanuele Bassi
a3fbdb5949 Add ClutterText::set_selection()
The clutter_text_set_selection() function is a convenience
method for setting the cursor position and the selection
boundary to a given position in a single call, with sanity
checks for the positions.
2008-12-16 12:41:20 +00:00
Emmanuele Bassi
2209e17432 Fix ClutterText::get_selection()
The clutter_text_get_selection() function was not checking the
passed argument, and was still accessing the contents of the
Text actor using clutter_text_get_text().

This commit also adds the last few gtk-doc annotations missing
from ClutterText.
2008-12-16 12:25:45 +00:00
Emmanuele Bassi
e28fb9ae10 [docs] Add more gtk-doc annotations
Almost reaching full documentation.
2008-12-16 12:25:15 +00:00
Emmanuele Bassi
4a43b582ac Use clutter_text_activate()
Instead of repeating the same code for the ::activate signal
emission, use the clutter_text_activate() function inside the
'activate' key binding handler.
2008-12-16 12:05:10 +00:00