1
0
Fork 0
Commit graph

2822 commits

Author SHA1 Message Date
Emmanuele Bassi
0ea25d661b event: Do not generate click count for SCROLL events
The ClutterScrollEvent structure does not have a click count field,
so Clutter should not generate the click count for events of type
CLUTTER_SCROLL.
2010-02-04 18:29:47 +00:00
Neil Roberts
1f70da62a7 glx: Create a colormap for the dummy window
Otherwise X will fail to create the window and throw a BadMatch error
at least on NVidia.
2010-02-04 16:35:42 +00:00
Emmanuele Bassi
466b00a806 glx: Clarify *why* we need the dummy window
The reason why we have a dummy, offscreen Window when we create the
GLX context is that GLX does not like it when you ask the context for
features if it's not made current to a Drawable. Maybe in the future
it will allow us to do so, but right now we have to make do with what
GLX offers us.
2010-02-04 13:59:39 +00:00
Emmanuele Bassi
ea5e33cf3a glx: Do not leak a XVisualInfo
The XVisualInfo we retrieve for the dummy window should be freed after
we used it.
2010-02-04 13:56:33 +00:00
Neil Roberts
e6a3b6ebe7 cogl-texture: Avoid copying the bitmap when premultiplying from a file
In cogl_texture_new_from_file we create and own a temporary
bitmap. There's no need to copy this data if we need to do a premult
conversion so instead it just does conversion before passing it on to
cogl_texture_new_from_bitmap.
2010-02-03 23:27:45 +00:00
Neil Roberts
59198b8ab8 cogl-texture: Split out _cogl_texture_prepare_for_upload
The Cogl atlas code was using _cogl_texture_prepare_for_upload with a
NULL pointer for the dst_bmp to determine the internal format of the
texture without converting the bitmap. It needs to do this to decide
whether the texture will go in the atlas before wasting time on the
conversion. This use of the function is a little confusing so that
part of it has been split out into a new function called
_cogl_texture_determine_internal_format. The code to decide whether a
premult conversion is needed has also been split out.
2010-02-03 23:10:52 +00:00
Neil Roberts
5063f4669c cogl-atlas: Make the cogl_atlas_* API internal
This just adds an underscore to every entry point for the CoglAtlas
API so that it's not exported.
2010-02-03 23:09:26 +00:00
Jussi Kukkonen
cd3c5155d8 text: implement del_word_next/del_word_prev()
Bind ctrl-backspace and ctrl-del to functions that delete a word before
or after the cursor, respectively.

Selection does not affect the deletion, but current selection is
preserved. This mimicks GTK+ functionality in GtkTextView and GtkEntry.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-02-03 17:15:05 +00:00
Emmanuele Bassi
d8d728a8d7 Remove the SDL backend
The SDL API is far too limited for the windowing system needs of
Clutter; the status of the SDL backend was always experimental, and
since the Windows platform is supported by a native backend there is
no point in having the SDL backend around any more.
2010-02-03 16:34:27 +00:00
Neil Roberts
ae188d203c win32: Use a dummy window to support delayed stage creation
The Win32 backend now implements the create_context method which
creates a context and binds it to a 1x1 invisible window. That way
there will always be a context bound and the features can be retrieved
without creating the default stage. This reflects the changes in
1c6ffc8..b245d55 to the GLX backend.
2010-02-03 16:34:27 +00:00
Emmanuele Bassi
479fdffc7d glx: Fix error messages and debug notes
Instead of using g_critical() inside the create_context() implementation
of the ClutterBackendGLX we should use the passed GError, so that the
error message can bubble up to the caller.
2010-02-03 16:34:27 +00:00
Emmanuele Bassi
ede2cbfab0 stage: Create the default stage on demand
Instead of creating the default stage during initialization we can
now safely create it whenever clutter_stage_get_default() is called.

To maintain the invariant, the default stage is immediately realized
by Clutter itself.
2010-02-03 16:34:27 +00:00
Emmanuele Bassi
d2c091e62d glx: Create the dummy Window with the GLX context
Since we must guarantee that Cogl has a GL context to query, it is too
late to use the "dummy Window" trick from within the get_features()
virtual function implementation.

Instead, we can create a dummy Window from create_context() itself and
leave it around - basically trading a default stage with a dummy X
window.

We need to have the dummy X window around all the time so that the
GLX context can be selected and made current.
2010-02-03 16:34:27 +00:00
Emmanuele Bassi
5eb6fb74b6 feature: Make sure we have a GL context
Before asking Cogl and ClutterBackend for the list of features we must
have a GL backend ready.
2010-02-03 16:34:27 +00:00
Emmanuele Bassi
a8daaa8222 stage: Move default title in Stage.init
The default title should be set from within clutter_stage_init(); at
that point clutter_init() must have been called.
2010-02-03 16:34:27 +00:00
Emmanuele Bassi
38f26634ee Lazily create the Pango fontmap
The Pango fontmap needed by Clutter should be initialized the first
time we need a PangoContext, not on initialization.
2010-02-03 16:34:27 +00:00
Emmanuele Bassi
6fbed66add Delay default stage creation
The default stage creation should be delayed as much as possible,
ideally at the end of the init() process.
2010-02-03 16:34:27 +00:00
Emmanuele Bassi
3191ea1195 cogl-debug: Remove redundant newlines
The debugging notes wrapping g_debug() already have an implicit newline
at the end of the passed message.
2010-02-03 16:34:27 +00:00
Emmanuele Bassi
cb52581a24 text: Add :font-description
High level toolkits might wish to construct a PangoFontDescription and
then set it directly on a ClutterText actor proxy or sub-class.
ClutterText should have a :font-description property to set (and get)
the PangoFontDescription.

http://bugzilla.openedhand.com/show_bug.cgi?id=1960
2010-02-03 14:38:13 +00:00
Neil Roberts
74c0170ccc cogl-vertex-buffer: Refix disabling texture coord arrays
Commit 92a375ab4 changed the initial value of max_texcoord_attrib_unit
to -1 so that it could disable the texture coord array for the first
texture unit when there are no texture coords used in the vbo. However
max_texcoord_attrib_unit was an unsigned value so this actually became
G_MAXUINT. The disabling loop at the bottom still worked because
G_MAXUINT+1==0 but the check for whether any texture unit is greater
than max_texcoord_attrib_unit was failing so it would always end up
disabling all texture units. This is now fixed by changing
max_texcoord_attrib_unit to be signed.
2010-02-03 14:31:12 +00:00
Emmanuele Bassi
301863d43b text: Fixes for selection bound
The commit ecbb7ce41a exposed some issues
when positioning the cursor with the mouse pointer: the selection is
not moved along with the cursor when inserting a single character or a
string.

Also, some freeze_notify() are called too early, leading to decoupling
from their respective thaw_notify().

http://bugzilla.openedhand.com/show_bug.cgi?id=1955
2010-02-03 10:48:59 +00:00
Emmanuele Bassi
c9a6e63fa4 docs: Clarify Group's sizing semantics
The documentation for ClutterGroup behaviour when setting an explicit
size is not accurate - or, actually, it was accurate by the time
ClutterGroup was first written but has been neglected in the following
release cycles.

To avoid confusion for new users of Clutter the documentation should be
slightly expanded, mentioning the exact semantics of ClutterGroup with
regards to: preferred size, explicitly set size and how to constrain the
visible area of a ClutterGroup to an explicitly set size.

Based on a patch by: Neil Roberts <neil@linux.intel.com>
2010-02-02 14:53:04 +00:00
Emmanuele Bassi
f94e691151 behaviour: Clean up BehaviourOpacity
• Use a consistent coding style

• Call set_bounds() from set_property(), because we need proper
  notification on the modified property
2010-02-02 12:54:51 +00:00
Emmanuele Bassi
521d71d4bc event: Unify the off-stage motion events delivery behaviour
When we disable the per-actor events delivery Clutter replicates the X11
implicit soft grab for motion events with off-stage. The implicit grab
is done whenever the pointer of a device leaves a window with a button
still pressed; with the implicit grab in place the window still receives
motion events even after the LeaveNotify - until the button is released.

The implicit grab is not honoured in the per-actor event deliver case,
though, so we have a mismatch between two in theory equivalent cases.

Luckily, the fix is pretty trivial: when we check for a motion event
with a stage set but without an actor set, and that has off-stage
coordinates, we arbitrarily set the source to be the stage of the event
and emit the pointer event.
2010-02-01 16:36:36 +00:00
Neil Roberts
145cc9d3df Merge remote branch 'master' into texture-debugging
Conflicts:
	clutter/cogl/cogl/cogl-context.h
2010-02-01 13:37:19 +00:00
Neil Roberts
aa6731e338 cogl-material: Compare GL texture numbers for material layer textures
When deciding if a material layer is equal it now compares the GL
target and texture number if the textures are not sliced. This is
needed to get batching across atlased textures.
2010-02-01 13:27:42 +00:00
Neil Roberts
abe91784c4 cogl: Let GL do the format conversion when uploading texture data
Cogl accepts a pixel format for both the data in memory and the
internal format to be used for the texture. If they do not match then
it would convert them using the CoglBitmap functions before uploading
the data. However, GL also lets you specify both formats so it makes
more sense to let GL do the conversion. The driver may need the
texture in a specific format so it may end up being converted anyway.

The cogl_texture_upload_data functions have been removed and replaced
with a single function to prepare the bitmap. This will only do the
premultiplication conversion because that is the only part that GL
can't do directly.
2010-02-01 13:27:34 +00:00
Neil Roberts
e83ffb1fa3 cogl: Do the premult conversion in-place rather than copying to a new buffer
The premult part of _cogl_convert_premult has now been split out as
_cogl_convert_premult_status. _cogl_convert_premult has been renamed
to _cogl_convert_format to make it less confusing. The premult
conversion is now done in-place instead of copying the
buffer. Previously it was copying the buffer once for the format
conversion and then copying it again for the premult conversion. The
premult conversion never changes the size of the buffer so it's quite
easy to do in place. We can also use the separated out function
independently.
2010-02-01 13:27:34 +00:00
Neil Roberts
72fba19eac cogl-atlas-texture: Use a single atlas for both RGB and RGBA textures
The internal format of the atlas texture is still set to the
appropriate format so Cogl will disable blending for textures that are
intended to be RGB. This should end up ignoring the alpha channel from
the texture in the atlas. This makes the code slightly easier to
maintain and should also improve the chances of batching.
2010-02-01 13:27:29 +00:00
Emmanuele Bassi
ad6bd2ee88 actor: Reword the allocation cycle warning
Since we're allowing allocation cycles saying that calling
queue_relayout() inside an allocation cycle "is not allowed" is kind of
confusing. We should say that "it is not recommended".
2010-02-01 12:18:10 +00:00
Emmanuele Bassi
5f1c8a17e4 Merge branch 'device-manager'
* device-manager: (37 commits)
  x11: Re-enable XI1 extension keyboards
  x11: Always handle core device events before XI events
  docs: Documentation fixes for DeviceManager
  device-manager: Fix the signals definition
  docs: Add sections for InputDevice and DeviceManager
  docs: Add clutter_input_device_get_device_name()
  tests: Print out the device details on motion
  Always register core devices
  device: Remove unused is_default member
  win32: Experimental implementation of device support
  tests: Print the device name, as well as its Id
  x11: Fill out the :name property of the InputDevices
  device: Add the :name property to InputDevice
  x11: Store core devices on the X11 Backend singleton
  device: Unset the cursor actor when leaving the stage
  device: Add pointer actor getter
  x11: Discard the LeaveNotify for off-stage ButtonRelease
  device: Do not overwrite the stage for an InputDevice
  event: Off-stage button releases have a click count of 1
  event: Scroll events do not have click count
  ...
2010-02-01 11:26:56 +00:00
Alejandro Piñeiro
ecbb7ce41a Fix problems with "position" and "selection-bound" change notification
Added a "selection-bound" notify on clutter_text_clear_selection as it
changes the value.

Added utility function clutter_text_set_positions, in order to
change both cursor position and selection bound inside a
g_object_[freeze/thaw]_notify block

Added g_object_[freeze/thaw]_notify in other functions that changes
both cursor position and selection bound

Solves http://bugzilla.openedhand.com/show_bug.cgi?id=1955
2010-02-01 11:22:58 +00:00
Emmanuele Bassi
579a9a2665 stage: Add :key-focus property
ClutterStage has both set_key_focus() and get_key_focus() methods, but
there is no :key-focus property. This means that it is not possible to
get notifications when the key-focus has changes except by connecting to
both the ::key-focus-in and ::key-focus-out signals and do additional
bookkeeping.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-02-01 11:09:13 +00:00
Emmanuele Bassi
7a1ebcbced Whitespace fixes in cogl-util 2010-02-01 10:40:34 +00:00
Emmanuele Bassi
578e83e463 Whitespace fixes 2010-02-01 10:40:34 +00:00
Emmanuele Bassi
2d5eeba5d8 docs: Fixes for TimeoutPool and Frame sources
The TimeoutPool is not used by ClutterTimeline any more, so we need to
remove a sentence from its description. We also need to fix the gtk-doc
syntax errors.
2010-02-01 10:40:34 +00:00
Neil Roberts
046a4b8047 cogl: Use the colours of COGL_DEBUG=rectangles to debug batching
Instead of assigning a new colour to each quad of a batch, the
rectangle debugging code now assigns a new colour to each batch so
that it can be used to visually see what is being batched. The colour
is stored in a global variable that is reset during cogl_clear. This
improves the chances that the same colour will be used for a batch in
the next frames to avoid flickering.
2010-01-28 16:52:42 +00:00
Neil Roberts
92a375ab47 cogl-vertex-buffer: Fix disabling the texture arrays from previous prim
When setting up the state for the vertex buffer,
enable_state_for_drawing_buffer tries to keep track of the highest
numbered texture unit in use. It then disables any texture arrays for
units that were previously enabled if they are greater than that
number. However if there is no texturing in the VBO then the max used
unit would be left at 0 which it would later think meant unit 0 is
still in use so it wouldn't disable it. To fix this it now initialises
the max used unit to -1 which it should interpret as ‘no units are in
use’ so it will later disable the arrays for all units.

Thanks to Jon Mayo for reporting the bug.

http://bugzilla.openedhand.com/show_bug.cgi?id=1957
2010-01-27 14:31:59 +00:00
Neil Roberts
f288eae0fc docs: Add some notes about the CoglPixelFormat enums
The pixel format enums didn't explain what order in memory the
components should be so it was difficult to use them.
2010-01-27 12:07:38 +00:00
Damien Lespiau
52cb54f5fa cogl: Fix checks of the number of available texture units
We were checking the number of texture units against the GL enum that is
used in glGetInteger() to query that number. Let's abstract this in a
little function.

Took the opportunity to dig a bit on the usage of GL limits for the
number of texture (image) units and document our use of them. We'll need
something finer grained if we want to fully exploit texture image units
with a programmable pipeline.
2010-01-26 18:47:25 +00:00
Damien Lespiau
06d8ebb0ba cogl: Create CoglTextureUnit with its associated unit number
The index field of CoglTextureUnit was never set, leading to the
creation of units with index set to 0. When trying to retrieve a texture
unit by its index (!= 0) with _cogl_get_texture_unit(), a new one was
created as it could not find it back in the list of textures units:
ctx->texture_units.

http://bugzilla.openedhand.com/show_bug.cgi?id=1958
2010-01-26 12:12:20 +00:00
Emmanuele Bassi
8fc07c51a9 actor: Use GParamSpecUint for :opacity
The :opacity property is defined using a GParamSpecUchar. This usually
leads to issues with language bindings that don't have an 'unsigned
char' type and that need to explicitly handle the conversion between
G_TYPE_UCHAR and G_TYPE_INT or G_TYPE_UINT.

The property definition already specifies an interval size of [0, 255]
on the values; more importantly, GObject already implicitly transforms
between G_TYPE_UCHAR and G_TYPE_UINT (the GValue transformation
functions are registered at type system initialization time) so
switching between a GParamSpecUchar and a GParamSpecUint should not be
an ABI break.

I have tested a simple program using the opacity property before and
after the change and I cannot see any run-time warnings related to this
issue.
2010-01-22 21:47:20 +00:00
Emmanuele Bassi
7073e69b4e animation: Verify internal state
Be more drastic if the internal state is broken, and assert() if the
expected Alpha and Timeline instances we need are not valid. This
usually implies a library bug or a massive heap corruption.
2010-01-22 21:42:55 +00:00
Emmanuele Bassi
8daa3035e5 docs: Fix the Animation:object property
There is a typo in the Animation:object property gtk-doc declaration.
2010-01-22 21:42:10 +00:00
Emmanuele Bassi
0788aa43b2 animation: Add more debug annotations
We need some better tracking of the Animation's lifetime.
2010-01-22 21:41:33 +00:00
Emmanuele Bassi
7fa7c4a1b6 animation: Transform if necessary
The Animation code does transformation of values between type A and A'
after checking for compatibility using g_value_type_compatible(). This
is incorrect: compatibility means that the two types can be copied. The
correct conversion should follow:

        if (compatible (type (A), type (A')))
          copy (A, A');
        else
          if (transformable (type (A), type (A')))
            transform (A, A');
          else
            error("Unable to trasform type A in A'");

The transformation might still fail, so we need to check for errors
there as well as a fall-through case.
2010-01-22 21:36:41 +00:00
Emmanuele Bassi
94249efff7 animation: Check for value transformability
We should not just check for compatibility, but also for the ability to
transform a GValue of type A into another of type A'.

Usually compatibility is enough, especially if types can be
introspected beforehand; some times, though, we also need to check for
transformability as a type can provide the transformation functions
necessary for the operation.
2010-01-22 21:33:28 +00:00
Neil Roberts
996614cfaf cogl-atlas-texture: Add a debug option to disable the atlas
If the user specifies the 'disable-atlas' debug option then no texture
will be put in the atlas.
2010-01-22 15:54:15 +00:00
Emmanuele Bassi
a545f66a5c master clock: Improve the timeline advancement protection
The commit 1c69c61745 which improved the
protection against timeline removals during the master clock advancement
was only doing half the job - and actually broke the chaining of
animations inside the ::completed signal.

We cannot simply take a reference on the timelines and still use the list
held by the master clock because the do_tick() might result in the
creation of a new timeline, which gets added at the end of the list with
no reference increase and thus gets disposed at the end of the iteration.

We also cannot steal the master clock timelines list because a timeline
might be removed as the direct result of do_tick() and remove_timeline()
would not find the timeline, failing and leaving a dangling pointer
behind.

For this reason we copy the list of timelines out of the one that the
Master Clock holds, take a reference on each timeline, advance them all,
release the reference and free the list.
2010-01-21 23:54:25 +00:00
Emmanuele Bassi
8a4b647154 x11: Re-enable XI1 extension keyboards
The extension keyboard support in XInput 1.x is hopelessly broken.

Nevertheless, it's possible to use some bits of it, as we prefer the
core keyboard events to the XInput events, thus at least having proper
handling for X11 key events on the Stage window.
2010-01-20 19:40:58 +00:00
Emmanuele Bassi
94f9f3bd93 x11: Always handle core device events before XI events
The XI 1.0 layer is complementary to the X11 core devices handling; this
means that core events will still be emitted for the core pointer and
keyboard devices, and that secondary (floating) devices should be
handled on top of that.

Thus, the XI event handling code should be executed (if explicitly
compiled in and enabled) if the core device events have not been parsed.

Note: this is going away with XI2, which completely replaces both core and
XI1 events.
2010-01-20 00:39:18 +00:00
Emmanuele Bassi
dc39e9eff9 docs: Documentation fixes for DeviceManager 2010-01-20 00:38:53 +00:00
Emmanuele Bassi
65c7ff7d05 device-manager: Fix the signals definition
Add documentation for the signals, as well as using the correct type for
the marshallers.
2010-01-20 00:38:53 +00:00
Emmanuele Bassi
d8e167f151 Always register core devices
Even with XInput support we should always register core devices. This
allows us to handle enter and leave events correctly on the Stage and
to have a working XInput 1.x support in Clutter.
2010-01-20 00:38:53 +00:00
Emmanuele Bassi
e0b8d63159 device: Remove unused is_default member
The is_default member of the InputDevice structure was not used
anywhere.
2010-01-20 00:38:53 +00:00
Emmanuele Bassi
74dbcede25 win32: Experimental implementation of device support
Mostly lifted from the core pointer and keyboard X11 backend support.

The win32 backend registers two devices (a core pointer and a core
keyboard) and assigns them to the event structure when doing the
translation from native events to Clutter events.

Thanks to: Samuel Degrande <Samuel.Degrande@lifl.fr> for testing this
patch.
2010-01-20 00:38:09 +00:00
Emmanuele Bassi
66740e8000 x11: Fill out the :name property of the InputDevices
For the core pointer and keyboard we assign the names ourselves; for
devices coming from XI we can use the XDeviceInfo.name member.
2010-01-20 00:38:09 +00:00
Emmanuele Bassi
cf4e05930a device: Add the :name property to InputDevice
The InputDevice should have a name, possibly user readable, coming from
the backend.
2010-01-20 00:38:09 +00:00
Emmanuele Bassi
79ad2b6a72 x11: Store core devices on the X11 Backend singleton
Instead of overloading the device id of 0 and 1 we should treat the core
devices as special, and have a pointer inside the X11 backend singleton
structure, for fast access.
2010-01-20 00:38:09 +00:00
Emmanuele Bassi
8a579838d5 device: Unset the cursor actor when leaving the stage
When an InputDevice leaves a stage we set the stage member of
InputDevice to NULL. We should also unset the cursor_actor (as the
device is obviously not on an actor any more).

When the device re-enters the Stage the ENTER/LEAVE event generation
machinery will then be able to emit the ENTER event on the Stage.
2010-01-20 00:38:09 +00:00
Emmanuele Bassi
55e4315aa5 device: Add pointer actor getter
ClutterInputDevice should have a getter method for retrieving the
reactive actor underneath the pointer.
2010-01-20 00:38:09 +00:00
Emmanuele Bassi
25c6ebbb2c x11: Discard the LeaveNotify for off-stage ButtonRelease
If the user presses a button on a pointer device and then moves out the
Stage X11 will emit the following events:

  LeaveNotify ➔ MotionNotify ... ➔ ButtonRelease ➔ LeaveNotify

The second LeaveNotify differs from the first by the state field.

Unfortunately, ClutterCrossingEvent doesn't have a modifier_state field
like other events, so we cannot provide a way for programmatically
distinguishing them from a Clutter perspective. This is also an X11-ism
we might not even want to replicate on every backend with sane
enter/leave semantics.

For this reason we should check inside the X11 event processing if the
pointer device has already left the Stage and ignore the second
LeaveNotify.
2010-01-20 00:38:09 +00:00
Emmanuele Bassi
8736b53d7c device: Do not overwrite the stage for an InputDevice
The Stage field of an InputDevice is set by the backend, whenever the
pointer enters or leaves the Stage. The Stage should not overwrite the
stage field for every event it processes.
2010-01-20 00:38:08 +00:00
Emmanuele Bassi
cf287db204 event: Off-stage button releases have a click count of 1
The ButtonRelease off-stage should not have a click count of 0 but a
click count initialized to 1.
2010-01-20 00:38:08 +00:00
Emmanuele Bassi
bddabf6d2c event: Scroll events do not have click count
Remove the unneeded CLUTTER_SCROLL case from the click count checks.
2010-01-20 00:38:08 +00:00
Emmanuele Bassi
e30856a54d Whitespace and indentation fixes 2010-01-20 00:38:08 +00:00
Emmanuele Bassi
0f9cfd9911 event: Clean up click-count detection
Avoid a few indirections and direct access to the Event and InputDevice
structures.
2010-01-20 00:38:08 +00:00
Emmanuele Bassi
cf8a06f018 device: Store the current state, not the previous
The previous state for the device is used by the click count machinery
and we should not be overwriting it at every event; instead, we should
use a parallel storage for the current state coming from the windowing
system.
2010-01-20 00:38:08 +00:00
Emmanuele Bassi
b3a42c3b09 docs: Update the API reference
Add the new symbols for InputDevice and DeviceManager
2010-01-20 00:38:08 +00:00
Emmanuele Bassi
130286979d Do not pick when motion event delivery is disabled
The device manager does not need to update the state of the devices
when the user has disabled the delivery of motion events to actors:
the events will always be delivered as they are to the stage.
2010-01-20 00:38:08 +00:00
Emmanuele Bassi
687c70dffa Rework the emission of LEAVE/ENTER event pairs
The LEAVE/ENTER event pairs should be queued during the InputDevice
update process, when we change the actor under the device pointer.

This commit cleans up the event emission code inside clutter-main.c
and the logic of the event processing.
2010-01-20 00:38:08 +00:00
Emmanuele Bassi
a056ae7164 Add docs and licensing notices 2010-01-20 00:38:08 +00:00
Emmanuele Bassi
9506510d1c Move all picking-related operations inside InputDevice
The InputDevice objects stores pointer coordinates, state, stage and
the actor under the cursor, so if the current backend provides us with
one attached to the Event structure then we want the InputDevice itself
to update its state and give us the ClutterActor underneath the
pointer's cursor.
2010-01-20 00:38:08 +00:00
Emmanuele Bassi
1f87cac069 actor: Add :has-pointer property
ClutterActor should be able to tell whether a pointer is within
its area or not.
2010-01-20 00:38:08 +00:00
Emmanuele Bassi
d23dd9af6b device: Make InputDevice an object and subclass it for X11
ClutterInputDevice should be a type that we can subclass per-backend
to add functionality.
2010-01-20 00:38:08 +00:00
Emmanuele Bassi
157da20e86 x11: Always assign a device to pointer and key events
Even when we are not using XInput we now have fallback devices; the
X11 backend should always assign the default devices when translating
the X events to Clutter events.
2010-01-20 00:38:07 +00:00
Emmanuele Bassi
ca16446319 Add :is-default flag to InputDevice 2010-01-20 00:38:07 +00:00
Emmanuele Bassi
3027d4327a Port the X11 backend to the Device Manager
Use the device manager to store the input devices. Also, provide
two fallback devices when initializing the X11 backend: device 0
for the pointer and device 1 for the keyboard.
2010-01-20 00:38:07 +00:00
Emmanuele Bassi
d34f1aa775 Add ClutterDeviceManager
The ClutterDeviceManager is a singleton object that behaves like the
StageManager: it holds all input devices and notifies on addition and
removal.
2010-01-20 00:38:07 +00:00
Neil Roberts
08b8b2791f cogl-atlas-texture: Don't create atlas textures with the premult bit
Previously the atlas textures were being created with whatever format
the first sub texture is in. Only three formats are supported so this
only matters if the first texture is a premultiplied alpha
texture. Instead it now masks out the premultiplied bit so that the
textures are always either RGB_888 or RGBA_8888.
2010-01-19 17:15:51 +00:00
Neil Roberts
14a28620ae win32: Use an invisible cursor when cursor-visible is FALSE
The win32 backend now handles the WM_SETCURSOR message and sets a
fully transparent cursor if the cursor-visible property has been
cleared on the stage. The icon is stored in the library via a resource
file. The instance handle for the DLL is needed to load the resource
so there is now a DllMain function to grab the handle.
2010-01-19 16:10:23 +00:00
Neil Roberts
ce030a3fce clutter-group: Use g_list_foreach in clutter_group_real_foreach
g_list_foreach has better protection against the current node being
removed. This will happen for example if someone calls
clutter_container_foreach(container, clutter_actor_destroy). This was
causing valgrind errors for the conformance tests which do just that.
2010-01-18 12:42:42 +00:00
Neil Roberts
c4adefffd3 cogl-atlas-texture: Fix premultiplied texture formats
When uploading texture data it was just calling cogl_texture_set_data
on the large texture. This would attempt to convert the data to the
format of the large texture. All of the textures with alpha channels
are stored together regardless of whether they are premultiplied so
this was causing premultiplied textures to be unpremultiplied
again. It now just uploads the data ignoring the premult bit of the
format so that it only gets converted once.
2010-01-18 10:53:00 +00:00
Neil Roberts
b78024bd2d cogl-primitives: Ensure the mipmaps for a layer before logging quads
With the atlas texture backend ensuring the mipmaps can make it become
a completely different texture which will have different texture
coordinates or may even be sliced. Therefore we need to ensure the
mipmaps before deciding which quads to log in the journal. This adds a
new private function to cogl-material which ensures the mipmaps if
needed.
2010-01-18 09:22:11 +00:00
Neil Roberts
36f18e5ac5 cogl: Make CoglSubTexture only work for quad rendering
The sub texture backend doesn't work well as a completely general
texture backend because for example when rendering with cogl_polygon
it needs to be able to tranform arbitrary texture coordinates without
reference to the other coordintes. This can't be done when the texture
coordinates are a multiple of one because sometimes the coordinate
should represent the left or top edge and sometimes it should
represent the bottom or top edge. For example if the s coordinates are
0 and 1 then 1 represents the right edge but if they are 1 and 2 then
1 represents the left edge.

Instead the sub-textures are now documented not to support coordinates
outside the range [0,1]. The coordinates for the sub-region are now
represented as integers as this helps avoid rounding issues. The
region can no longer be a super-region of the texture as this
simplifies the code quite a lot.

There are two new texture virtual functions:

transform_quad_coords_to_gl - This transforms two pairs of coordinates
     representing a quad. It will return FALSE if the coordinates can
     not be transformed. The sub texture backend uses this to detect
     coordinates that require repeating which causes cogl-primitives
     to use manual repeating.

ensure_non_quad_rendering - This is used in cogl_polygon and
     cogl_vertex_buffer to inform the texture backend that
     transform_quad_to_gl is going to be used. The atlas backend
     migrates the texture out of the atlas when it hits this.
2010-01-18 09:22:04 +00:00
Samuel Degrande
3d373c7278 win32: Fix computation of the fullscreen size during stage realization
http://bugzilla.openedhand.com/show_bug.cgi?id=1905

Signed-off-by: Neil Roberts <neil@linux.intel.com>
2010-01-15 17:35:09 +00:00
Emmanuele Bassi
ea662b9eca docs: Display the features section
The features section of the API reference is built but not used, and it
has some copy-and-paste errors.
2010-01-15 17:06:56 +00:00
Emmanuele Bassi
e019547e8c x11: Fix typo in clutter_x11_set_use_argb_visual() declaration
The function should have a lowercase x11, not an uppercase X11 in its
name.
2010-01-15 14:48:42 +00:00
Neil Roberts
b844653c64 cogl-texture: Fix manual repeating for negative coordinates
When calculating the next integer position for negative coordinates it
would not increment if the position is already a multiple of one so we
need to manually add one.
2010-01-15 12:16:06 +00:00
Neil Roberts
a01b4eefce cogl-texture-2d: Fix the coordinate wrapping for negative coordinates
The formula to wrap the coordinates to the [0,1] range was broken when
the coordinates were negative.
2010-01-15 12:16:06 +00:00
Neil Roberts
ead4399536 Merge branch 'master' into more-texture-backends 2010-01-15 12:15:46 +00:00
Neil Roberts
8247bdf4f9 cogl-framebuffer: Return gboolean from try_creating_fbo
When try_creating_fbo fails it returns 0 to report the error and if it
succeeds it returns ‘flags’. However cogl_offscreen_new_to_texture
also passes in 0 for the flags as the last fallback to create the fbo
with nothing but the color buffer. In that case it will return 0
regardless of whether it succeeded so the last fallback will always be
considered a failure.

To fix this it now just returns a gboolean to indicate whether it
succeeded and the flags used for each attempt is assigned when passing
the argument rather than from the return value of the function.

Also if the only configuration that succeeded was with flags==0 then
it would always try all combinations because last_working_flags would
also be zero. To avoid this it now uses a separate gboolean to mark
whether we found a successful set of flags.

http://bugzilla.openedhand.com/show_bug.cgi?id=1873
2010-01-14 14:10:05 +00:00
Emmanuele Bassi
4388509a15 master-clock: Add profiling timers
Use the newly-added profiling timers inside the master clock dispatch
function to see how much time we spend:

  • in the whole function
    • in the event processing for each stage
    • in the timeline advancement
2010-01-14 12:30:48 +00:00
Emmanuele Bassi
948db40c87 Add gcov support to the build
Using gcov it's possible to get a coverage report, that is a break down
of how much the exposed API is exercised by the conformance test suite.
2010-01-13 17:15:06 +00:00
Emmanuele Bassi
5322546a4e build: Clean up COGL build flags 2010-01-13 17:15:06 +00:00
Damien Lespiau
18d96005ec texture: Remove reading the texture data back in ::unrealize()
Reading back the texture data in unrealize does not seem like a
desirable feature any more, clutter has evolved a lot since it was
implemented.

What's wrong with it now:

  * It takes *a lot* of time to read the data back with glReadPixel(),
  * When several textures share the same CoglTexture, the same data can
    be read back multiple times,
  * If the underlying material uses multiple texture units, only the
    first one was copied back,
  * In ClutterCairoTexture, we end up having two separate copies of the
    data,
  * GL actually manages texture memory accross system/video memory
    for us!

For all the reasons above, let's get rid of the glReadPixel() in
Texture::unrealize()

Fixes: OHB#1842
2010-01-13 15:13:10 +00:00
Neil Roberts
778e08e4e2 cogl-framebuffer: Add some missing GL defines
Since 755cce33a7 the framebuffer code is using the GL enums
GL_DEPTH_ATTACHMENT and GL_DEPTH_COMPONENT16. These aren't available
directly under GLES except with the OES suffix so we need to define
them manually as we do with the other framebuffer constants.
2010-01-12 17:10:15 +00:00
Neil Roberts
bb8352ca95 cogl: Remove the CGL_* defines
These macros used to define Cogl wrappers for the GLenum values. There are
now Cogl enums everywhere in the API where these were required so we
shouldn't need them anymore. They were in the public headers but as
they are not neccessary and were not in the API docs for Clutter 1.0
it should be safe to remove them.
2010-01-12 17:10:15 +00:00
Emmanuele Bassi
1c6ffc8a23 stage: Add the delete-event signal
Using the ::event signal to match the CLUTTER_DELETE event type (and
block the stage destruction) can be costly, since it means checking
every single event.

The ::delete-event signal is similar in spirit to any other specialized
signal handler dealing with events, and retains the same semantics.
2010-01-12 15:58:27 +00:00
Robert Bragg
8b950bdc87 journal: Fixes logging of multiple sets of texture coordinates
If a user supplied multiple groups of texture coordinates with
cogl_rectangle_with_multitexture_coords() then we would repeatedly log only
the first group in the journal.  This fixes that bug and adds a conformance
test to verify the fix.

Thanks to Gord Allott for reporting this bug.
2010-01-12 11:22:08 +00:00
Emmanuele Bassi
bc8a80fee5 text: Zero out the cursor_pos member
Do not trust the zero-ing done by GObject on the private data structure,
and use memset() instead to zero the ClutterGeometry structure.
2010-01-11 17:10:00 +00:00
Robert Bragg
755cce33a7 cogl: Support multiple fallbacks in cogl_offscreen_new_to_texture()
The Intel drivers in Mesa 7.6 (and possibly earlier versions) don't
support creating FBOs with a stencil buffer but without a depth
buffer. This reworks framebuffer allocation so that we try a number
of fallback options before failing.

The options we try in order are:
- the same options that were sucessful last time if available
- combined depth and stencil
- separate depth and stencil
- just stencil, no depth
- just depth, no stencil
- neither depth or stencil
2010-01-11 15:32:52 +00:00
Damien Lespiau
4c1231c7fe media: Add an API to specify which font should be used for subtitles
Allow the user of the ClutterMedia interface to specify a Pango font
description to display subtitles. Even if the underlying implementation
of the interface does not natively use Pange, it must be capable of
parsing the grammar that pango_font_description_from_string() accepts.
2010-01-11 13:04:16 +00:00
Emmanuele Bassi
8e9f56c411 build: Clean up private header/source files
Some source files should not be passed through the introspection parser,
as they are fully private and do not expose any valuable API.

Also the clutter-profile.h header is private and should not be
installed.
2010-01-10 11:35:26 +00:00
Robert Bragg
d9b91d61f5 framebuffers: cogl_offscreen_new_to_texture should take a ref on the texture
We weren't taking a reference on the texture to be used as the color buffer
for offscreen rendering, so it was possible to free the texture leaving the
framebuffer in an inconsistent state.
2010-01-08 20:42:35 +00:00
Robert Bragg
30b557c465 profiling: Adds initial UProf accounting to Cogl
This adds gives Cogl a dedicated UProf context which will be linked together
with Clutter's context during clutter_init_real().

Initial timers cover _cogl_journal_flush and _cogl_journal_log_quad

You can explicitly ask for a report of Cogl statistics by exporting
COGL_PROFILE_OUTPUT_REPORT=1 but since the context is linked with Clutter's
the statisitcs will also be shown in the automatic Clutter reports.
2010-01-08 20:19:50 +00:00
Robert Bragg
0b6515a1d5 profiling: Allow limiting statisics just to picking
This suspends and resumes all uprof timers and counters except while dealing
with picking, so as to give more focused statistics.

Be aware that there are still some issues with this profile option since
there are a few special case counters and timers that shouldn't be
suspended; noteably the frame counters are incorrect so the per frame stats
can't be trusted.
2010-01-08 20:19:50 +00:00
Robert Bragg
9cb530d42e profiling: Parse --clutter-profile and CLUTTER_PROFILE= options
As we have for debugging, this adds the ability to control profiling flags
either via the command line or an environment variable.

The first option added is CLUTTER_PROFILE=disable-report

This also changes the reporting to be opt-out so you don't need to export
CLUTTER_PROFILE_OUTPUT_REPORT=1 to see a report but you can use
CLUTTER_PROFILE=disable-report to disable it if desired.
2010-01-08 20:19:50 +00:00
Robert Bragg
0057755854 profiling: Adds initial UProf support across clutter
UProf is a small library that aims to help applications/libraries provide
domain specific reports about performance.  It currently provides high
precision timer primitives (rdtsc on x86) and simple counters, the ability
to link statistics between optional components at runtime and makes report
generation easy.

This adds initial accounting for:
- Total mainloop time
- Painting
- Picking
- Layouting
- Idle time

The timing done by uprof is of wall clock time. It's not based on stochastic
samples we simply sample a counter at the start and end.  When dealing with
the complexities of GPU drivers and with various kinds of IO this form of
profiling can be quite enlightening as it will be able to represent where
your application is blocking unlike tools such as sysprof.

To enable uprof accounting you must configure Clutter with --enable-profile
and have uprof-0.2 installed from git://git.moblin.org/uprof

If you want to see a report of statistics when Clutter applications exit you
should export CLUTTER_PROFILE_OUTPUT_REPORT=1 before running them.

Just a final word of caution; this stuff is new and the manual nature of
adding uprof instrumentation means it is prone to some errors when modifying
code.  This just means that when you question strange results don't rule out
a mistake in the instrumentation.  Obviously though we hope the benfits out
weigh e.g.  by focusing on very key stats and by having automatic reporting.
2010-01-08 20:19:49 +00:00
Emmanuele Bassi
5157da9fc8 x11: Switch back to RGB visuals by default
Since asking for ARGB by default is still somewhat experimental on X11
and not every toolkit or complex widgets (like WebKit) still do not like
dealing with ARGB visuals, we should switch back to RGB by default - now
that at least we know it works.

For applications (and toolkit integration libraries) that want to enable
the ClutterStage:use-alpha property there is a new function:

  void clutter_x11_set_use_argb_visual (gboolean use_argb);

which needs to be called before clutter_init().

The CLUTTER_DISABLE_ARGB_VISUAL environment variable can still be used
to force this value off at run-time.
2010-01-08 15:09:21 +00:00
Emmanuele Bassi
bf4818bd75 actor: Just emit a relayout cycle warning
Currently, ClutterActor detects a relayout cycle (an actor causing a
relayout to be queued from within an allocate() function) and aborts
after printing out a warning. This might be a little bit too anal
retentive, and it currently breaks GTK+ embedding inside clutter-gtk
so we should probably relax the behaviour a bit. Now we just emit the
warning but we still go ahead with the relayout.
2010-01-07 17:37:14 +00:00
Neil Roberts
821e622de6 Don't set the GLX_TRANSPARENT_TYPE attribute to choose an FBConfig
When Clutter tries to pick an ARGB visual it tried to set the
GLX_TRANSPARENT_TYPE attribute of the FBConfig to
GLX_TRANSPARENT_RGB. However the code to do this was broken so that it
was actually trying to set the non-existant attribute number 0x8008
instead. Mesa silently ignored this so it appeared as if it was
working but the Nvidia drivers do not like it.

It appears that the TRANSPARENT_TYPE attribute is not neccessary for
getting an ARGB visual anyway and instead it is intended to support
color-key transparency. Therefore we can just remove it and get all of
the FBConfigs. Then if we need an ARGB visual we can just walk the
list to look for one with depth == 32.

The fbconfig is now stored in a single variable instead of having a
separate variable for the rgb and rgba configs because the old code
only ever retrieved one of them anyway.
2010-01-07 15:58:53 +00:00
Emmanuele Bassi
8b59573190 Covert stb_image.c to Unix format
The file is still in DOS format (CRLF instead of LF) and this confuses
the hell out of some versions of Git.
2010-01-05 18:02:29 +00:00
Emmanuele Bassi
58b5a46e0e Include cogl-defines.h before using GL types
If we are using GL* types we should also be including cogl-defines.h, as
that will include the right GL header.
2010-01-05 17:55:47 +00:00
Emmanuele Bassi
793fec8138 cogl: Fix array annotations
The arrays in the cogl_program_set_uniform_* API should be marked as
such, and have their length arguments specified.
2010-01-05 17:55:47 +00:00
Neil Roberts
59105341bc text: Store the markup attributes separately
Previously when the markup property is set it would generate an
attribute list from the markup and then merge it with the attributes
from the attribute property and store it as the effective
attributes. The markup attributes and the marked up text would then be
forgotten. This breaks if the application then later changes the
attributes property because it would try to regenerate the effective
attributes from the markup text but the stored text no longer contains
any markup. If the original markup text happened to contain entities
like '&lt;' they would end up causing parse errors because they would
be converted to the actual symbols.

To fix this the attributes from the markup are now stored
independently from the effective attributes. The effective attributes
are now regenerated if either set of attributes changes right before a
layout is created.

http://bugzilla.openedhand.com/show_bug.cgi?id=1940
2010-01-05 15:00:36 +00:00
Neil Roberts
32b456fc8c text: Free the Pango attribute list resources
The ClutterText owns three PangoAttrList resources which were not
being unref'd. This adds the unref calls to the finalize method.
2010-01-05 15:00:36 +00:00
Emmanuele Bassi
64c1294cc2 x11 tfp: Plug a leak
Destroy the dummy XImage we create even on success.

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

Based on a patch by: Carlos Martín Nieto <carlos@cmartin.tk>

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-01-05 14:22:35 +00:00
Emmanuele Bassi
fa298b45b5 Merge branch 'matrix-mode'
* matrix-mode:
  build: Move CoglMatrixMode to cogl-matrix-stack.h
2010-01-05 11:04:50 +00:00
Emmanuele Bassi
2aa9d7bdc7 script: Copy the JSON node in PropertyInfo
PropertyInfo should store a copy of the JsonNodes it references, so
that property_info_free() can safely dispose them, and we can reference
values across different UI definition data.

The implicit timeline parsing code is not copying the JsonNode; this
leads to a double free in some cases, which is masked by the GSlice
allocator and produces a heap corruption later on.
2010-01-05 10:55:28 +00:00
Damien Lespiau
10963d1ae0 [media] Add an API to play a subtitle file along with the media
Allow the user of the ClutterMedia interface to specify an external (as
in not multiplexed with the audio/video streams) location of a subtitle
stream.
2010-01-04 16:25:48 +01:00
Emmanuele Bassi
5d5c7142f7 text: Use G_SIGNAL_ACTION for ::insert-text and ::delete-text
Both the ::insert-text and ::delete-text are "action" signals, that is
signals that are safe to (and should) be emitted using g_signal_emit()
directly.
2010-01-04 12:03:47 +00:00
Alejandro Piñeiro
bf43cb6cdc Added ClutterText::insert-text and ClutterText::delete-text signals
* clutter/clutter-marshal.list: added new marshaller
* clutter/clutter-text.c
(clutter_text_class_init): added insert-text and delete-text signals
(clutter_text_insert_unichar): emits insert-text signal
(clutter_text_insert_text): emits insert-text signal
(clutter_text_delete_text): emits delete-text signal
(clutter_text_delete_chars): emits delete-text signal
(clutter_text_set_markup_internal): emits delete-text and insert-text signals
(clutter_text_set_text): emits delete-text and insert-text signals

http://bugzilla.openedhand.com/show_bug.cgi?id=1894
2010-01-04 12:01:51 +00:00
Emmanuele Bassi
4adc2c2d83 build: Move CoglMatrixMode to cogl-matrix-stack.h
This avoids a redeclaration of _cogl_matrix_stack_flush_to_gl() from
using GLenum to CoglMatrixMode.

http://bugzilla.openedhand.com/show_bug.cgi?id=1928
2010-01-04 11:58:32 +00:00
Halton Huo
eb90295041 cogl-texture: Remove return in void functions
http://bugzilla.o-hand.com/show_bug.cgi?id=1929

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-01-04 11:51:06 +00:00
Emmanuele Bassi
b98d486fc9 build: Maintainer cflags go in the _CFLAGS target
The maintainer compiler flags are not pre-processor flags.
2010-01-04 11:49:13 +00:00
Emmanuele Bassi
0fb51658fd cogl: Const-ify vertices in cogl_polygon()
The CoglTextureVertex array passed to cogl_polygon() is a pure
in-argument and should be const-ified.

http://bugzilla.openedhand.com/show_bug.cgi?id=1917
2010-01-04 11:43:00 +00:00
Emmanuele Bassi
1c69c61745 master-clock: Take a reference before advancing timelines
A timeline advancement might cause another timeline to be
destroyed, which will likely lead to a segmentation fault.

Before advancing the timelines we should take a reference
on them - just like we do for the stages before doing
event processing. This will prevent dispose() from running
until the end of the advancement.

http://bugzilla.openedhand.com/show_bug.cgi?id=1854
2010-01-04 11:30:28 +00:00
Emmanuele Bassi
8d40cb9470 Disable g_set_prgname()
Apparently, calling g_set_prgname() multiple times is not allowed
anymore, and hence clutter_init_* calls should not do that. Though this
is really GLib's fault - and a massive nuisance for us - we should
prolly comply to avoid the test suite dying on us.
2010-01-03 20:14:15 +00:00
Emmanuele Bassi
3d350078a8 Merge branch 'animate-layout-manager' into ebassi-next
* animate-layout-manager:
  layout-manager: Document the animation support
  layout-manager: Rewind the timeline in begin_animation()
  box-layout: Remove the allocations hash table
  docs: Clean up the README file
  layout: Let begin_animation() return the Alpha
  box-layout: Add knobs for controlling animations
  box-layout: Animate layout properties
  layout: Add animation support to LayoutManager
  Add ActorBox animation methods
2009-12-23 10:38:02 +00:00
Emmanuele Bassi
934eee17ae layout-manager: Document the animation support
Add a section inside the LayoutManager class API reference documenting,
with examples, how to implement animation support inside a layout
manager sub-class.
2009-12-23 10:37:10 +00:00
Emmanuele Bassi
713c295241 layout-manager: Rewind the timeline in begin_animation()
If the default implementation begin_animation() is called twice then we
should rewind the timeline, as well as updating its duration and the
easing mode of the alpha.
2009-12-23 10:37:09 +00:00
Emmanuele Bassi
b9c1de0ec7 box-layout: Remove the allocations hash table
The BoxLayout uses a HashTable to map the latest stable allocation of
each child, in order to use that as the initial value during an
animation; this in spite of already having a perfectly valid per-child
storage as part of the layout manager: ClutterBoxChild.

The last stable allocation should be stored inside the ClutterBoxChild
instead of having it in the private data for ClutterBoxLayout. The
access remains O(1), since there is a 1:1 mapping between child and
BoxChild instances, but we save a little bit of memory and we avoid
keeping aroud allocations for old children.
2009-12-23 10:36:46 +00:00
Emmanuele Bassi
a09ac0b27c Merge branch 'stage-use-alpha' into ebassi-next
* stage-use-alpha:
  tests: Use accessor methods for :use-alpha
  stage: Add accessors for :use-alpha
  tests: Allow setting the stage opacity in test-paint-wrapper
  stage: Premultiply the stage color
  stage: Composite the opacity with the alpha channel
  glx: Always request an ARGB visual
  stage: Add :use-alpha property
  materials: Get the right blend function for alpha
2009-12-20 17:39:12 +00:00
Emmanuele Bassi
b6bd8be6cb Merge branch 'internal-flag' into ebassi-next
* internal-flag:
  conform: Add test unit for the destruction of Containers
  actor: Add internal child flag
  Clean up whitespace, indentation and comments
2009-12-20 17:33:51 +00:00
Emmanuele Bassi
1520ba6190 actor: Add internal child flag
ClutterActor checks, when destroying and reparenting, if the parent
actor implements the Container interface, and automatically calls the
remove() method to perform a clean removal.

Actors implementing Container, though, might have internal children;
that is, children that are not added through the Container API. It is
already possible to iterate through them using the Container API to
avoid breaking invariants - but calling clutter_actor_destroy() on
these children (even from the Container implementation, and thus outside
of Clutter's control) will either lead to leaks or to segmentation
faults.

Clutter needs a way to distinguish a clutter_actor_set_parent() done on
an internal child from one done on a "public" child; for this reason, a
push/pop pair of functions should be available to Actor implementations
to mark the section where they wish to add internal children:

  ➔ clutter_actor_push_internal ();
    ...
    clutter_actor_set_parent (child1, parent);
    clutter_actor_set_parent (child2, parent);
    ...
  ➔ clutter_actor_pop_internal ();

The set_parent() call will automatically set the newly added
INTERNAL_CHILD private flag on each child, and both
clutter_actor_destroy() and clutter_actor_unparent() will check for the
flag before deciding whether to call the Container's remove method.
2009-12-18 23:33:14 +00:00
Emmanuele Bassi
4a21425f48 layout: Let begin_animation() return the Alpha
When beginning a new animation for a LayoutManager, the implementation
should return the ClutterAlpha used. This allows controlling the
timeline and/or modifying the animation parameters on the fly.
2009-12-13 01:23:54 +00:00
Emmanuele Bassi
2e6397c391 box-layout: Add knobs for controlling animations
ClutterLayoutManager does not have any state associated with it, and
defers all the state to its sub-classes.

The BoxLayout is thus in charge of controlling:

  • whether or not animations should be used
  • the duration of the animation
  • the easing mode of the animation

By adding three new properties:

  • ClutterBoxLayout:use-animations
  • ClutterBoxLayout:easing-duration
  • ClutterBoxLayout:easing-mode

And their relative accessors pairs we can make BoxLayout decide whether
or not, and with which parameters, call the begin_animation() method of
ClutterLayoutManager.

The test-box-layout has been modified to reflect this new functionality,
by checking the key-press event for the 'a' key symbol to toggle the use
of animations.
2009-12-13 01:15:02 +00:00
Emmanuele Bassi
3c2e91aef5 box-layout: Animate layout properties
Use the newly added animation support inside LayoutManager to animate
between state changes of the BoxLayout properties.

The implementation is based on equivalent code from Mx, written by:

  Thomas Wood <thomas.wood@intel.com>
2009-12-13 01:14:16 +00:00
Emmanuele Bassi
f94a903d9e layout: Add animation support to LayoutManager
In order to animate a fluid layout we cannot use the common animation
code paths as they will override the size request and allocation paths
that are handled by the layout manager itself.

One way to introduce animations in the allocation sequence is to use a
Timeline and an Alpha to compute a progress value and then use that
value to interpolate an ActorBox between the initial and final states of
the animation - with the initial state being the last allocation of the
child prior to the animation start, and the final state the allocation
of the child at the end; for every frame of the Timeline we then queue a
relayout on the layout manager's container, which will result in an
animation.

ClutterLayoutManager is the most likely place to add a generic API for
beginning and ending an animation, as well as the place to provide a
default code path to create the ancillary Timeline and Alpha instances
needed to drive the animation.

A LayoutManager sub-class will need to:

  • call clutter_layout_manager_begin_animation() whenever it should
    animate between two states, for instance: whenever a layout property
    changes value;
  • eventually override begin_animation() and end_animation() in case
    further state needs to be set up, and then chain up to the default
    implementation provided by LayoutManager;
  • if a completely different implementation is required, the layout
    manager sub-class should override begin_animation(), end_animation()
    and get_animation_progress().

Inside the allocate() implementation the sub-class should also
interpolate between the last known allocation of a child and the newly
computed allocation.
2009-12-13 01:13:42 +00:00
Emmanuele Bassi
999359d64c Add ActorBox animation methods
ClutterActorBox should have an interpolate() method that allows to
compute the intermediate values between two states, given a progress
value, e.g.:

        clutter_actor_box_interpolate (start, end, alpha, &result);

Another utility method, useful for layout managers, is a modifier
that clamps the members of the actor box to the nearest integer
value.
2009-12-11 23:48:58 +00:00
Emmanuele Bassi
d2ea7cd6a8 Clean up whitespace, indentation and comments 2009-12-11 20:17:58 +00:00
Emmanuele Bassi
7b53aa7510 Merge branch 'get-current-event' into ebassi-next
* get-current-event:
  Add clutter_get_current_event
2009-12-10 23:36:04 +00:00
Colin Walters
1374b5aac9 Add clutter_get_current_event
When getting signals from higher level toolkits, occasionally
one wants access to the underlying event; say for a Button
widget's "clicked" signal, to get the keyboard state.

Rather than having all of the highlevel widgets emit
ClutterEvent just for the more unusual use cases,
add a global function to access the event state.

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

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-12-10 22:20:36 +00:00
Emmanuele Bassi
60a6bff313 Merge branch 'no-layout-flag' into ebassi-next
* no-layout-flag:
  actor: Add a NO_LAYOUT flag for actors
2009-12-09 23:32:41 +00:00
Emmanuele Bassi
dc47550bc8 Merge branch 'size-cache' into ebassi-next
* size-cache:
  tests: Clean up the BoxLayout interactive test
  actor: Add debugging notes for size cache
  Add a cache of size requests
2009-12-09 23:32:18 +00:00
Emmanuele Bassi
86ce92eec1 x11: Emulate XKB's detectable key auto-repeat
Old-style X11 terminals require that even modern X11 send KeyPress
and KeyRelease pairs when auto-repeating. For this reason modern(-ish)
API like XKB has a way to detect auto-repeat and do a single KeyRelease
at the end of a KeyPress sequence.

The newly added check emulates XKB's detectable auto-repeat by peeking
the next event after a KeyRelease and checking if it's a KeyPress for
the same key and timestamp - and then ignoring the KeyRelease if it
matches.
2009-12-09 18:46:25 +00:00
Emmanuele Bassi
1ffd2ccb87 stage: Deprecate default stage size macros
The macros for getting the size of the default stage are a relic of the
past and they should be deprecated.
2009-12-09 17:19:32 +00:00
Emmanuele Bassi
1208e47198 stage: Add accessors for :use-alpha
Use real accessors for the :use-alpha property.
2009-12-09 02:05:24 +00:00
Emmanuele Bassi
3a3c815286 stage: Premultiply the stage color
In case we are using Stage:use-alpha then we need to premultiply the
stage color to get the correct blending from the compositor.
2009-12-09 01:46:09 +00:00