Emmanuele Bassi [Mon, 31 Jan 2011 13:58:12 +0000 (13:58 +0000)]
Merge remote branch 'elliot/cookbook-actors-composite'
* elliot/cookbook-actors-composite:
docs: Add reference to useful GObject tutorial
docs: Explain why destroy() is implemented
docs: Implement destroy() rather than dispose()
docs: Don't use clutter_stage_get_default()
docs: Change text on button
docs: Add a note about other state variables
docs: Complete composite actor recipe
docs: Change order of functions in example to match docs
docs: Add more comments on how allocate() works
docs: Include code examples in the recipe
docs: Explain enums for properties and signals
docs: Don't set explicit size on button
docs: Add example of preferred_height() and preferred_width()
docs: Add recipe for creating a custom ClutterActor with composition
docs: Add more comments on code example for composite actor
docs: Improve example code formatting
docs: Add some gtk-doc annotations to example
docs: Add custom ClutterActor example which uses composition
Emmanuele Bassi [Mon, 31 Jan 2011 13:50:37 +0000 (13:50 +0000)]
docs: Update NEWS file
Emmanuele Bassi [Fri, 28 Jan 2011 14:53:08 +0000 (14:53 +0000)]
osx: Add devices to event translation code
Use a DeviceManager sub-class similar to the Win32 backend one, which
creates two InputDevices: a core pointer and a core keyboard.
The event translation code then uses these two devices to fill out the
.device field of the events.
Throw in enter/leave tracking, given that we need to update the device's
state.
http://bugzilla.clutter-project.org/show_bug.cgi?id=2490
Viatcheslav Gachkaylo [Fri, 28 Jan 2011 12:56:57 +0000 (12:56 +0000)]
osx: Improve the event loop
Implementation of event loop which works with GLib events, native OS X
events and Clutter events.
The event loop source code comes from the equivalent code in the Quartz
GDK backend from GTK+ 2.22.1, which is LGPL v2.1+ and thus compatible
with Clutter's licensing terms.
The code has been tested with libsoup, which did not work before together
with Clutter.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
http://bugzilla.clutter-project.org/show_bug.cgi?id=2490
Elliot Smith [Mon, 31 Jan 2011 13:40:10 +0000 (13:40 +0000)]
docs: Add reference to useful GObject tutorial
Add a reference to a GObject tutorial which
is a good introduction to the various macros etc.
and what they're for.
Elliot Smith [Mon, 31 Jan 2011 13:39:11 +0000 (13:39 +0000)]
docs: Explain why destroy() is implemented
As destroy() is Clutter-specific and not generic
GObject code, explain why we implement it
(rather than dispose()).
Emmanuele Bassi [Mon, 31 Jan 2011 13:37:32 +0000 (13:37 +0000)]
docs: Fix documentation for clutter_actor_pop_internal()
http://bugzilla.clutter-project.org/show_bug.cgi?id=2534
Elliot Smith [Mon, 31 Jan 2011 13:36:37 +0000 (13:36 +0000)]
docs: Implement destroy() rather than dispose()
Remove the dispose() implementation and replace
with destroy().
This should be promoted as the standard approach
for implementing a composite actor, as it emits a
signal when instances of the actor subclass are destroyed.
Emmanuele Bassi [Mon, 31 Jan 2011 13:04:49 +0000 (13:04 +0000)]
docs: Update Cogl release notes for 1.6
Emmanuele Bassi [Mon, 31 Jan 2011 13:04:35 +0000 (13:04 +0000)]
Update the NEWS file
Emmanuele Bassi [Mon, 31 Jan 2011 12:51:14 +0000 (12:51 +0000)]
docs: Update the documentation for clutter_actor_unparent()
Make sure that we document the semantics of unparent() and who should
call it.
Emmanuele Bassi [Mon, 31 Jan 2011 12:50:25 +0000 (12:50 +0000)]
docs: Update documentation for ::destroy
The ::destroy signal is meant to be used to break reference cycles on
third party code. The documentation should really make it clear.
Emmanuele Bassi [Mon, 31 Jan 2011 12:28:03 +0000 (12:28 +0000)]
docs: Update release notes for 1.6
Elliot Smith [Mon, 31 Jan 2011 12:18:58 +0000 (12:18 +0000)]
docs: Don't use clutter_stage_get_default()
clutter_stage_get_new() is the recommended way to
get a stage instance, so use that instead.
Elliot Smith [Mon, 31 Jan 2011 11:06:01 +0000 (11:06 +0000)]
docs: Change text on button
Modify the text shown on the button to "hello / world"
rather than "winkle / pickers". Slightly more
sensible.
Elliot Smith [Mon, 31 Jan 2011 11:05:27 +0000 (11:05 +0000)]
docs: Add a note about other state variables
Explain that the private structure would be the
place to store other state variables for the instance.
Elliot Smith [Mon, 31 Jan 2011 10:53:52 +0000 (10:53 +0000)]
docs: Complete composite actor recipe
Add some extra detail to the Discussion section of the
composite actor recipe, concentrating on the pros and
cons of this approach.
Also explain more about the Clutter parts of the implementation.
Also general tidy up of language and style.
Elliot Smith [Fri, 28 Jan 2011 17:09:24 +0000 (17:09 +0000)]
docs: Change order of functions in example to match docs
Moved the functions around in the C code file, to match
the order Clutter uses them, and the order they are explained
in the recipe.
Elliot Smith [Fri, 28 Jan 2011 16:43:22 +0000 (16:43 +0000)]
docs: Add more comments on how allocate() works
Add some extra description to the allocate() function,
explaining how the allocation has to be adjusted to
coordinates relative to the actor as a whole, before
applying to the single child actor it is composed from.
Elliot Smith [Fri, 28 Jan 2011 11:49:08 +0000 (11:49 +0000)]
docs: Include code examples in the recipe
Include all the code examples inline as part of the recipe.
Remove sections around each code example, as these are
unnecessary; leave full discussion for the Discussion section
instead of trying to cram it in around the code example.
Elliot Smith [Fri, 28 Jan 2011 11:39:26 +0000 (11:39 +0000)]
docs: Explain enums for properties and signals
Add some more explanatory comments about the PROP_ and
signals enums.
Elliot Smith [Fri, 28 Jan 2011 11:36:20 +0000 (11:36 +0000)]
docs: Don't set explicit size on button
Rather than set a size on the CbButton instance, let it
size itself automatically, based on the size requisition
functions.
Elliot Smith [Fri, 28 Jan 2011 11:35:14 +0000 (11:35 +0000)]
docs: Add example of preferred_height() and preferred_width()
As most actor subclasses will probably want to implement
size requisition, give a simple example of how to do this
on the basis of the composed actor's size, plus some padding.
Elliot Smith [Wed, 26 Jan 2011 11:22:07 +0000 (11:22 +0000)]
docs: Add recipe for creating a custom ClutterActor with composition
Elliot Smith [Fri, 28 Jan 2011 11:13:47 +0000 (11:13 +0000)]
docs: Add more comments on code example for composite actor
Add more comments about the specific purpose of functions
and variables in the composite actor example, particularly
around GObject implementation.
Elliot Smith [Wed, 26 Jan 2011 11:18:23 +0000 (11:18 +0000)]
docs: Improve example code formatting
Improve code formatting to adhere to Clutter uncrustify rules.
Elliot Smith [Tue, 25 Jan 2011 11:36:13 +0000 (11:36 +0000)]
docs: Add some gtk-doc annotations to example
As this is a full GObject class implementation, add some
gtk-doc annotations to demonstrate how how custom actor subclasses
should be documented.
Elliot Smith [Fri, 21 Jan 2011 16:43:03 +0000 (16:43 +0000)]
docs: Add custom ClutterActor example which uses composition
Emmanuele Bassi [Sun, 30 Jan 2011 23:00:00 +0000 (23:00 +0000)]
text: Bind BackSpace + Shift as BackSpace
Follow this old GTK+ bug:
https://bugzilla.gnome.org/show_bug.cgi?id=80302
and ignore the Shift mask.
Emmanuele Bassi [Fri, 28 Jan 2011 18:05:06 +0000 (18:05 +0000)]
x11/stage: Use a global Window ↔ Stage relationship
Since we need to find the stage from the X11 Window, it's better to use
a static hashmap that gets updated every time the ClutterStageX11:xwin
member is changed, instead of iterating over every stage handled by the
global ClutterStageManager singleton.
Emmanuele Bassi [Fri, 28 Jan 2011 17:25:43 +0000 (17:25 +0000)]
win32: Small clean ups in the event code
Use clutter_event_set_device() instead of setting the device field.
Also, use G_N_ELEMENTS() to determine the size of the key symbols
mapping array.
Emmanuele Bassi [Thu, 27 Jan 2011 17:26:16 +0000 (17:26 +0000)]
Clean up crossing event synthesis code
Clutter should just require that the windowing system used by a backend
adds a device to the stage when the device enters, and removes it from
the stage when the device leaves; with this information, we can
synthesize every crossing event and update the device state without
other intervention from the backend-specific code.
The generation of additional crossing events for actors that are
covering the stage at the coordinates of the crossing event should be
delegated to the event processing code.
The x11 and win32 backends need to be modified to relay the enter and
leave events from the windowing system.
Emmanuele Bassi [Thu, 27 Jan 2011 17:21:08 +0000 (17:21 +0000)]
event: Add a setter for the device field
When synthesizing events coming from input devices it should be
possible to just call a setter function, to avoid a huge switch
on the type of the event.
Clutter should also store the device pointer inside the private
data, for faster access of the pointer in allocated events.
Finally, the get_device_id() and get_device_type() accessors should
just be wrappers around clutter_event_get_device(), to reduce the
amount of code duplication.
Emmanuele Bassi [Wed, 26 Jan 2011 12:44:03 +0000 (12:44 +0000)]
x11/stage: Remove redundant line location
The CLUTTER_NOTE() macro already adds the line location; adding another
will just clutter up the log.
Emmanuele Bassi [Wed, 26 Jan 2011 11:58:08 +0000 (11:58 +0000)]
x11: Store a back pointer to the backend in the stage
Since we access it in order to get the X11 Display pointer, it makes
sense to have the ClutterBackendX11 already available inside the
ClutterStageX11 structure, and avoid the pattern:
ClutterBackend *backend = clutter_get_default_backend ();
ClutterBackendX11 *backend_x11 = CLUTTER_BACKEND_X11 (backend);
which costs us a function call, a type cast and an unused variable.
Neil Roberts [Fri, 28 Jan 2011 18:11:38 +0000 (18:11 +0000)]
test-path: Fix the test when running against latest Cairo versions
Cairo has recently changed so that it no longer adds a final move-to
command when the path ends with a close. This patch makes the test
check the run-time version number of Cairo to avoid duplicating this
behaviour when testing the conversion to and from a Cairo path.
Neil Roberts [Tue, 25 Jan 2011 15:53:35 +0000 (15:53 +0000)]
clutter-stage-x11: Don't ensure the viewport when the window moves
When we receive a ConfigureNotify event that doesn't affect the size
of the window (only the position) then we were still calling
clutter_stage_ensure_viewport which ends up queueing a full stage
redraw. This patch makes it so that it only ensures the viewport when
the size changes as it already did for avoiding queueing a relayout.
It now also avoids setting the clipped redraws cool off period when
the window only moves under the assumption that it's only necessary
for size changes.
Rob Bradford [Mon, 24 Jan 2011 18:41:49 +0000 (18:41 +0000)]
animator: Only free the animator key when we've finished with it
Fixes: http://bugzilla.clutter-project.org/show_bug.cgi?id=2530
Emmanuele Bassi [Wed, 26 Jan 2011 10:32:42 +0000 (10:32 +0000)]
Include stdint.h when using uint32_t
Since the XI2 device manager code is going to be compiled only on
POSIX compliant systems, we can safely assume the presence of stdint.h
and include it unconditionally.
Emmanuele Bassi [Tue, 25 Jan 2011 11:10:29 +0000 (11:10 +0000)]
bind-constraint: Add BIND_POSITION and BIND_SIZE
CLUTTER_BIND_POSITION and CLUTTER_BIND_SIZE are two convenience
enumeration values for binding x and y, and width and height
respectively, using a single ClutterBindConstraint.
Emmanuele Bassi [Tue, 25 Jan 2011 11:00:20 +0000 (11:00 +0000)]
x11: Remove more private symbols
Some private functions escaped my wrath in commit
a277b4091a3fa09a39cf001809c3048eb27f3952.
Thanks to: Emilio Pozuelo Monfort on #clutter
Robert Bragg [Mon, 24 Jan 2011 18:42:28 +0000 (18:42 +0000)]
pipeline: fix for _init_multi_property_sparse_state
When copying COMBINE state in
_cogl_pipeline_layer_init_multi_property_sparse_state we would read some
state from the destination layer (invalid data potentially), then
redundantly set the value back on the destination. This was picked up by
valgrind, and the code is now more careful about how it references the
src layer vs the destination layer.
Robert Bragg [Fri, 21 Jan 2011 19:05:23 +0000 (19:05 +0000)]
framebuffer: flush journal when switching framebuffers
There is currently a problem with per-framebuffer journals in that it's
possible to create a framebuffer from a texture which then gets rendered
too but the framebuffer (and corresponding journal) can be freed before
the texture gets used to draw with.
Conceptually we want to make sure when freeing a framebuffer that - if
it is associated with a texture - we flush the journal as the last thing
before really freeing the framebuffer's meta data. Technically though
this is awkward to implement since the obvious mechanism for us to be
notified about the framebuffer's destruction (by setting some user data
internally with a callback) notifies when the framebuffer has a
ref-count of 0. This means we'd have to be careful what we do with the
framebuffer to consider e.g. recursive destruction; anything that would
set more user data on the framebuffer while it is being destroyed and
ensuring nothing else gets notified of the framebuffer's destruction
before the journal has been flushed.
For simplicity, for now, this patch provides another solution which is
to flush framebuffer journals whenever we switch away from a given
framebuffer via cogl_set_framebuffer or cogl_push/pop_framebuffer. The
disadvantage of this approach is that we can't batch all the geometry of
a scene that involves intermediate renders to offscreen framebufers.
Clutter is doing this more and more with applications that use the
ClutterEffect APIs so this is a shame. Hopefully this will only be a
stop-gap solution while we consider how to reliably support journal
logging across framebuffer changes.
Neil Roberts [Mon, 24 Jan 2011 17:32:06 +0000 (17:32 +0000)]
cogl-clip-stack: Fix flushing multiple stencil rectangles
When flushing a clip stack that contains more than one rectangle which
needs to use the stencil buffer the code takes a different path so
that it can combine the new rectangle with the existing contents of
the stencil buffer. However it was not correctly flushing the
modelview and projection matrices so that rectangle would be in the
wrong place.
Neil Roberts [Mon, 24 Jan 2011 17:17:16 +0000 (17:17 +0000)]
test-clip: Replace the ellipse with a rotated rectangle
With test-clip it's possible to draw three different shapes depending
on what mouse button is used: a rectangle, an ellipse or a path
containing multiple shapes. However the ellipse is also a path so it
doesn't really test anything extra from the third option. This
replaces the ellipse with a rectangle that is first rotated by the
modelview matrix. The rotated matrix won't be able to use the scissor
so it can be used to test stencil and clip plane clipping.
Neil Roberts [Mon, 24 Jan 2011 16:36:56 +0000 (16:36 +0000)]
cogl-debug: Add a debug option for tracing clipping
This adds a COGL_DEBUG=clipping option that reports how the clip is
being flushed. This is needed to determine whether the scissor,
stencil clip planes or software clipping is being used.
Neil Roberts [Mon, 24 Jan 2011 14:28:00 +0000 (14:28 +0000)]
cogl-debug: Split the flags to support more than 32
The CoglDebugFlags are now stored in an array of unsigned ints rather
than a single variable. The flags are accessed using macros instead of
directly peeking at the cogl_debug_flags variable. The index values
are stored in the enum rather than the actual mask values so that the
enum doesn't need to be more than 32 bits wide. The hope is that the
code to determine the index into the array can be optimized out by the
compiler so it should have exactly the same performance as the old
code.
Neil Roberts [Fri, 14 Jan 2011 11:11:44 +0000 (11:11 +0000)]
cogl-pipeline: Flush the lighting params in common code not vertend
The lighting parameters such as the diffuse and ambient colors were
previously only flushed in the fixed vertend. This meant that if a
vertex shader was used then they would not be set. The lighting
parameters are uniforms which are just as useful in a fragment shader
so it doesn't really make sense to set them in the vertend. They are
now flushed in the common cogl-pipeline-opengl code but the code is
#ifdef'd for GLES2 because they need to be part of the progend in that
case.
Neil Roberts [Thu, 13 Jan 2011 18:24:22 +0000 (18:24 +0000)]
cogl-pipeline-progend-glsl: Generalize updating GLES2 uniforms
The uniforms for the alpha test reference value and point size on
GLES2 are updating using similar code. This generalizes the code so
that there is a static array of predefined builtin uniforms which
contains the uniform name, a pointer to a function to get the value
from the pipeline, a pointer to a function to update the uniform and a
flag representing which CoglPipelineState change affects the
uniform. The uniforms are then updated in a loop. This should simplify
adding more builtin uniforms.
Neil Roberts [Wed, 12 Jan 2011 13:47:55 +0000 (13:47 +0000)]
cogl-shader-boilerplate: Move the uniforms to the common code
The builtin uniforms are accessible from either the vertex shader or
the fragment shader so we should define them in the common
section. This doesn't really matter for the current list of uniforms
because it's pretty unlikely that you'd want to access the matrices
from the fragment shader, but for other builtins such as the lighting
material properties it makes sense.
Neil Roberts [Mon, 24 Jan 2011 11:49:04 +0000 (11:49 +0000)]
ClutterTimeline: Fix the 'msecs' parameter for the new-frame signal
Between Clutter 0.8 and 1.0, the new-frame signal of ClutterTimeline
changed the second parameter to be an elapsed time in milliseconds
rather than the frame number. However a few places in clutter were
still calling the parameter 'frame_num' which is a bit
misleading. Notably the signature for the signal class closure in the
header was using the wrong name. This changes them to use 'msecs'.
Neil Roberts [Mon, 24 Jan 2011 11:29:59 +0000 (11:29 +0000)]
clutter-timeline: Emit the new-frame signal even on the first frame
ClutterTimeline has special handling for the first time do_tick is
called which was not emitting a new-frame signal. This meant that an
application which directly uses the timeline would have to manually
setup the initial state of an animation after starting a timeline to
avoid painting a single frame with the wrong state. It seems to make
more sense to instead emit the new-frame signal so that the
application always sees a new-frame when the progress changes before a
paint.
Emmanuele Bassi [Mon, 24 Jan 2011 10:51:06 +0000 (10:51 +0000)]
Post-release version bump to 1.5.15
Emmanuele Bassi [Mon, 24 Jan 2011 10:23:36 +0000 (10:23 +0000)]
Release Clutter 1.5.14 (1.6.0rc1)
Emmanuele Bassi [Fri, 21 Jan 2011 20:46:09 +0000 (20:46 +0000)]
Update the NEWS file
Bastian Winkler [Fri, 21 Jan 2011 13:50:44 +0000 (14:50 +0100)]
model: Add support to define rows in ClutterScript
This adds a custom "rows" property, that allows to define the rows of a
ClutterModel. A single row can either an array of all columns or an
object with column-name : column-value pairs.
http://bugzilla.clutter-project.org/show_bug.cgi?id=2528
Bastian Winkler [Wed, 12 Jan 2011 12:09:52 +0000 (13:09 +0100)]
script-parser: Allow initialized GValue arg in clutter_script_parse_node
Allow to 'abuse' the clutter_script_parse_node function by calling it
with an initialized GValue instead of a valid GParamSpec argument to
obtain the correct typed value from the json node.
http://bugzilla.clutter-project.org/show_bug.cgi?id=2528
Bastian Winkler [Wed, 12 Jan 2011 11:54:43 +0000 (12:54 +0100)]
model: Change the column argument type to gint for clutter_model_set_sort
Like in clutter_model_set_sorting_column this function should take a
gint column, otherwise GObject-Introspection won't allow to pass a NULL
sorting function.
http://bugzilla.clutter-project.org/show_bug.cgi?id=2527
Bastian Winkler [Sat, 22 Jan 2011 11:51:31 +0000 (12:51 +0100)]
model: Fix some GObject-Introspection annotations
http://bugzilla.clutter-project.org/show_bug.cgi?id=2526
Emmanuele Bassi [Fri, 21 Jan 2011 20:22:32 +0000 (20:22 +0000)]
Merge branch 'xi2'
* xi2: (41 commits)
test-devices: Actually print the axis data
device-manager/xi2: Sync the stage of source devices
event: Clean up clutter_event_copy()
device: unset the axes array pointer when resetting
device-manager/xi2: Fix device hotplugging
glx: Clean up GLX implementation
device/x11: Store min/max keycode in the XI device class
x11: Hide all private symbols
docs: More documentation fixes for InputDevice
*/event: Never manipulate the event queue directly
win32: Update DeviceManager device creation
device: Allow enabling/disabling non-master devices
backend/eglx: Add newly created stages to the translators
device: Add more doc annotations
device: Use a double for translate_axis() argument
test-devices: Clean up and show axes data
event: Fix up clutter_event_copy()
device/xi2: Translate the axis data after setting devices
device: Add more accessors for properties
docs: Update API reference
...
Robert Bragg [Fri, 21 Jan 2011 18:43:35 +0000 (18:43 +0000)]
cogl: call _cogl_texture_init for x11 tfp
When we added the texture->framebuffers member a _cogl_texture_init
funciton was added to initialize the list of framebuffers associated
with a texture to NULL. All the backends were updated except the
x11 tfp backend. This was causing crashes in test-pixmap.
Robert Bragg [Fri, 21 Jan 2011 17:38:14 +0000 (17:38 +0000)]
journal: start uprof flush timer after flushing fb deps
This avoids us recursively starting the _cogl_journal_flush uprof timer
by only starting it after flushing the journals of dependency
framebuffers.
Robert Bragg [Fri, 21 Jan 2011 17:28:34 +0000 (17:28 +0000)]
cogl: make sure to init ctx->framebuffers
This makes sure to initialize ctx->framebuffers to NULL otherwise we can
get apps crashing when they create their first framebuffer.
Robert Bragg [Thu, 20 Jan 2011 19:31:53 +0000 (19:31 +0000)]
cogl: rename CoglVertexAttribute CoglAttribute
This is part of a broader cleanup of some of the experimental Cogl API.
One of the reasons for this particular rename is to reduce the verbosity
of using the API. Another reason is that CoglVertexArray is going to be
renamed CoglAttributeBuffer and we want to help emphasize the
relationship between CoglAttributes and CoglAttributeBuffers.
Robert Bragg [Thu, 20 Jan 2011 18:51:24 +0000 (18:51 +0000)]
docs: Adds bitmap section to cogl reference manual
This adds an include for the cogl-bitmap section to cogl-docs.xml.in
Robert Bragg [Thu, 20 Jan 2011 12:29:49 +0000 (12:29 +0000)]
cogl: s/Cogl*Vertex/CoglVertex*/
We have a bunch of experimental convenience functions like
cogl_primitive_p2/p2t2 that have corresponding vertex structures but it
seemed a bit odd to have the vertex annotation e.g. "P2T2" be an infix
of the type like CoglP2T2Vertex instead of be a postfix like
CoglVertexP2T2. This switches them all to follow the postfix naming
style.
Robert Bragg [Thu, 20 Jan 2011 18:30:55 +0000 (18:30 +0000)]
test-picking: Don't manually paint the stage
Instead of using an idle handler that synchonously paints the stage
by manually calling clutter_actor_paint (stage) the test now uses an
idle handler that repeatedly queues a redraw on the stage.
do_events is now called from a "paint" signal handler for the stage, and
instead of manually determining the fps the test now uses
CLUTTER_SHOW_FPS=1 instead.
Robert Bragg [Thu, 20 Jan 2011 14:41:51 +0000 (14:41 +0000)]
debug: Adds a COGL_DEBUG=disable-fast-read-pixel option
COGL_DEBUG=disable-fast-read-pixel can be used to disable the
optimization for reading a single pixel colour back by looking at the
geometry in the journal and not involving the GPU. With this disabled we
will always flush the journal, rendering to the framebuffer and then use
glReadPixels to get the result.
Robert Bragg [Wed, 12 Jan 2011 22:12:41 +0000 (22:12 +0000)]
cogl: Implements a software only read-pixel fast-path
This adds a transparent optimization to cogl_read_pixels for when a
single pixel is being read back and it happens that all the geometry of
the current frame is still available in the framebuffer's associated
journal.
The intention is to indirectly optimize Clutter's render based picking
mechanism in such a way that the 99% of cases where scenes are comprised
of trivial quad primitives that can easily be intersected we can avoid
the latency of kicking a GPU render and blocking for the result when we
know we can calculate the result manually on the CPU probably faster
than we could even kick a render.
A nice property of this solution is that it maintains all the
flexibility of the render based picking provided by Clutter and it can
gracefully fall back to GPU rendering if actors are drawn using anything
more complex than a quad for their geometry.
It seems worth noting that there is a limitation to the extensibility of
this approach in that it can only optimize picking a against geometry
that passes through Cogl's journal which isn't something Clutter
directly controls. For now though this really doesn't matter since
basically all apps should end up hitting this fast-path. The current
idea to address this longer term would be a pick2 vfunc for ClutterActor
that can support geometry and render based input regions of actors and
move this optimization up into Clutter instead.
Note: currently we don't have a primitive count threshold to consider
that there could be scenes with enough geometry for us to compensate for
the cost of kicking a render and determine a result more efficiently by
utilizing the GPU. We don't currently expect this to be common though.
Note: in the future it could still be interesting to revive something
like the wip/async-pbo-picking branch to provide an asynchronous
read-pixels based optimization for Clutter picking in cases where more
complex input regions that necessitate rendering are in use or if we do
add a threshold for rendering as mentioned above.
Robert Bragg [Tue, 18 Jan 2011 16:37:01 +0000 (16:37 +0000)]
matrix: fix transform/project_points() APIs
Both cogl_matrix_transform_points and _project_points take points_in and
points_out arguments and explicitly allow pointing to the same array
(i.e. to transform in-place) The implementation of the various internal
transform functions though were not handling this possability and so it
was possible the reference partially transformed vertex values as if
they were original input values leading to incorrect results. This patch
ensures we take a temporary copy of the current input point when
transforming.
Robert Bragg [Thu, 13 Jan 2011 14:29:46 +0000 (14:29 +0000)]
cogl: Adds _cogl_util_point_in_polygon API
This adds a utility function that can determine if a given point
intersects an arbitrary polygon, by counting how many edges a
"semi-infinite" horizontal ray crosses from that point. The plan is to
use this for a software based read-pixel fast path that avoids using the
GPU to rasterize journaled primitives and can instead intersect a point
being read with quads in the journal to determine the correct color.
Robert Bragg [Wed, 12 Jan 2011 22:06:58 +0000 (22:06 +0000)]
cogl: Adds _cogl_swap_buffers_notify for clutter backends
This adds a stop-gap mechanism for Cogl to know when the window system
is requested to present the current backbuffer to the frontbuffer by
adding a _cogl_swap_buffers_notify function that backends are now
expected to call right after issuing the equivalent request to OpenGL
vie the platforms OpenGL binding layer. This (blindly) updates all the
backends to call this new function.
For now Cogl doesn't do anything with the notification but the intention
is to use it as part of a planned read-pixel optimization which will
need to reset some state at the start of each new frame.
Robert Bragg [Wed, 12 Jan 2011 19:30:30 +0000 (19:30 +0000)]
clip: rename get_clip_stack + add framebuffer_get_stack
Instead of having _cogl_get/set_clip stack which reference the global
CoglContext this instead makes those into CoglClipState method functions
named _cogl_clip_state_get/set_stack that take an explicit pointer to a
CoglClipState.
This also adds _cogl_framebuffer_get/set_clip_stack convenience
functions that avoid having to first get the ClipState from a
framebuffer then the stack from that - so we can maintain the
convenience of _cogl_get_clip_stack.
Robert Bragg [Wed, 12 Jan 2011 19:13:45 +0000 (19:13 +0000)]
clip-stack: Adds _cogl_clip_stack_get_bounds API
This adds an internal function to be able to query the screen space
bounding box of the current clip entries contained in a given
CoglClipStack.
This bounding box which is cheap to determine can be useful to know the
largest extents that might be updated while drawing with this clip
stack.
For example the plan is to use this as part of an optimized read-pixel
path handled on the CPU which will need to track the currently valid
extents of the last call to cogl_clear()
Robert Bragg [Thu, 6 Jan 2011 13:25:45 +0000 (13:25 +0000)]
journal: Support per-framebuffer journals
Instead of having a single journal per context, we now have a
CoglJournal object for each CoglFramebuffer. This means we now don't
have to flush the journal when switching/pushing/popping between
different framebuffers so for example a Clutter scene that involves some
ClutterEffect actors that transiently redirect to an FBO can still be
batched.
This also allows us to track state in the journal that relates to the
current frame of its associated framebuffer which we'll need for our
optimization for using the CPU to handle reading a single pixel back
from a framebuffer when we know the whole scene is currently comprised
of simple rectangles in a journal.
Robert Bragg [Wed, 12 Jan 2011 20:37:53 +0000 (20:37 +0000)]
cogl-object: Adds an internal _cogl_object_set_user_data
This adds an internal alternative to cogl_object_set_user_data that also
passes an instance pointer to destroy notify callbacks.
When setting private data on a CoglObject it's often desirable to know
the instance being destroyed when we are being notified to free the
private data due to the object being freed. The typical solution to this
is to track a pointer to the instance in the private data itself so it
can be identified but that usually requires an extra micro allocation
for the private data that could have been avoided if only the callback
were given an instance pointer.
The new internal _cogl_object_set_user_data passes the instance pointer
as a second argument which means it is ABI compatible for us to layer
the public version on top of this internal function.
Robert Bragg [Wed, 5 Jan 2011 15:30:04 +0000 (15:30 +0000)]
framebuffer: Move clear code to cogl-framebuffer.c
This moves the implementation of cogl_clear into cogl-framebuffer.c as
two new internal functions _cogl_framebuffer_clear and
_cogl_framebuffer_clear4f. It's not clear if this is what the API will
look like as we make more of the CoglFramebuffer API public due to the
limitations of using flags to identify buffers when framebuffers may
contain any number of ancillary buffers but conceptually it makes some
sense to tie the operation of clearing a color buffer to a framebuffer.
The short term intention is to enable tracking the current clear color
as a property of the framebuffer as part of an optimization for reading
back single pixels when the geometry is simple enough that we can
compute the result quickly on the CPU. (If the point doesn't intersect
any geometry we'll need to return the last clear color.)
Emmanuele Bassi [Fri, 21 Jan 2011 15:27:56 +0000 (15:27 +0000)]
test-devices: Actually print the axis data
Returning in an if() block whose condition we assume to be true doesn't
play nicely with having statements after the block. Let's fix that.
Emmanuele Bassi [Fri, 21 Jan 2011 15:26:52 +0000 (15:26 +0000)]
device-manager/xi2: Sync the stage of source devices
Keep the slave devices in sync with their master, so that we don't
ignore their events because they lack the stage pointer.
Emmanuele Bassi [Fri, 21 Jan 2011 15:14:11 +0000 (15:14 +0000)]
event: Clean up clutter_event_copy()
Try to avoid duplication of variables and blocks.
Emmanuele Bassi [Fri, 21 Jan 2011 14:12:19 +0000 (14:12 +0000)]
device: unset the axes array pointer when resetting
Otherwise we'll get a nice realloc() error from glibc.
Emmanuele Bassi [Fri, 21 Jan 2011 11:43:00 +0000 (11:43 +0000)]
stage: Do not create the default stage on stage.is_default()
Use the stage manager to see if a default stage was effectively set,
otherwise we end up creating a default stage when destroying a
non-default one.
Emmanuele Bassi [Fri, 21 Jan 2011 11:41:36 +0000 (11:41 +0000)]
device-manager/xi2: Fix device hotplugging
Hierarchy and Device changed events come through with the X window set
to be the root window, not the stage window. We need to whitelist them
so that we can actually support hotplugging and device changes.
Emmanuele Bassi [Fri, 21 Jan 2011 10:49:12 +0000 (10:49 +0000)]
glx: Clean up GLX implementation
Like commit
a277b4091a3fa09a39cf001809c3048eb27f3952, but targeted at
the GLX backend.
Emmanuele Bassi [Fri, 21 Jan 2011 10:24:34 +0000 (10:24 +0000)]
device/x11: Store min/max keycode in the XI device class
The generic device class shouldn't have the minimum and maximum keycode,
since no other input backend provides those.
Emmanuele Bassi [Thu, 20 Jan 2011 15:39:28 +0000 (15:39 +0000)]
x11: Hide all private symbols
The x11 backend exposes a lot of symbols that are meant to only be used
when implementing a subclassed backend, like the glx and eglx ones.
The uninstalled headers are also filled with cruft declarations of
functions long since removed.
Let's try to clean up this mess.
Emmanuele Bassi [Wed, 19 Jan 2011 17:03:27 +0000 (17:03 +0000)]
docs: More documentation fixes for InputDevice
Emmanuele Bassi [Wed, 19 Jan 2011 16:34:49 +0000 (16:34 +0000)]
*/event: Never manipulate the event queue directly
Always use _clutter_event_push() instead.
Emmanuele Bassi [Wed, 19 Jan 2011 16:34:37 +0000 (16:34 +0000)]
win32: Update DeviceManager device creation
Emmanuele Bassi [Wed, 19 Jan 2011 16:23:45 +0000 (16:23 +0000)]
device: Allow enabling/disabling non-master devices
Slave and floating devices should always be disabled, and not deliver
events to the scene. It is up to the user to enable non-master devices
and handle events coming from them.
ClutterInputDevice gets a new :enabled property, defaulting to FALSE;
when a device manager creates a new device it has to set it to TRUE if
the :device-mode property is set to CLUTTER_INPUT_MODE_MASTER.
The main event queue entry point, _clutter_event_push(), will
automatically discard events coming from disabled devices.
Emmanuele Bassi [Wed, 19 Jan 2011 15:17:34 +0000 (15:17 +0000)]
backend/eglx: Add newly created stages to the translators
The events directed to the stage should be translated by the stage.
Emmanuele Bassi [Wed, 19 Jan 2011 13:54:27 +0000 (13:54 +0000)]
device: Add more doc annotations
Even for internal API.
Emmanuele Bassi [Wed, 19 Jan 2011 13:53:20 +0000 (13:53 +0000)]
device: Use a double for translate_axis() argument
While XI1 has axis data in events exposed as integers, XI2 uses double
precision floating point values.
Emmanuele Bassi [Wed, 19 Jan 2011 13:52:33 +0000 (13:52 +0000)]
test-devices: Clean up and show axes data
Emmanuele Bassi [Tue, 18 Jan 2011 22:31:14 +0000 (22:31 +0000)]
event: Fix up clutter_event_copy()
We need to copy the scroll axis data, and we need to copy the private
Event data from the source event to the target event structure.
Emmanuele Bassi [Tue, 18 Jan 2011 22:30:21 +0000 (22:30 +0000)]
device/xi2: Translate the axis data after setting devices
We need the devices (source and virtual) to be set before translating
the axis data from XI2 to the Clutter event.
Emmanuele Bassi [Tue, 18 Jan 2011 17:33:22 +0000 (17:33 +0000)]
device: Add more accessors for properties
Allow using real accessor methods for getting the ClutterInputDevice
properties set on construction.
Emmanuele Bassi [Tue, 18 Jan 2011 16:57:14 +0000 (16:57 +0000)]
docs: Update API reference
Emmanuele Bassi [Tue, 18 Jan 2011 16:55:14 +0000 (16:55 +0000)]
device: Add get_axis_value()
We need a convenience function for extracting the value of a specific
axis type out of the array of axis values attached to events.
Emmanuele Bassi [Tue, 18 Jan 2011 16:54:12 +0000 (16:54 +0000)]
event: Add accessor for the axes field
CLUTTER_BUTTON_* and CLUTTER_MOTION event types have axes data attached
to them, so we want to expose a common ClutterEvent method for
extracting that data.