profile/ivi/clutter.git
14 years agoAdd cogl-subtexture test to the Git ignore file
Emmanuele Bassi [Sat, 6 Feb 2010 11:00:50 +0000 (11:00 +0000)]
Add cogl-subtexture test to the Git ignore file

14 years agoDeprecate clutter_util_next_p2()
Emmanuele Bassi [Fri, 5 Feb 2010 16:22:09 +0000 (16:22 +0000)]
Deprecate clutter_util_next_p2()

The next_p2() function should have never been publicly exposed by
Clutter.

14 years agodocs: Fix whitespace in the App manual stub
Emmanuele Bassi [Fri, 5 Feb 2010 15:31:18 +0000 (15:31 +0000)]
docs: Fix whitespace in the App manual stub

14 years agobuild: Add suppressions file to EXTRA_DIST
Emmanuele Bassi [Fri, 5 Feb 2010 14:47:39 +0000 (14:47 +0000)]
build: Add suppressions file to EXTRA_DIST

14 years agoMerge branch 'more-texture-backends'
Neil Roberts [Sat, 6 Feb 2010 00:20:07 +0000 (00:20 +0000)]
Merge branch 'more-texture-backends'

This adds three new texture backends.

- CoglTexture2D: This is a trimmed down version of CoglTexture2DSliced
  which only supports a single texture and only works with the
  GL_TEXTURE_2D target. The code is a lot simpler so it has a less
  overheads than dealing with slices. Cogl will use this wherever
  possible.

- CoglSubTexture: This is used to get a CoglHandle to represent a
  subregion of another texture. The texture can be used as if it was a
  standalone texture but it does not need to copy the resources.

- CoglAtlasTexture: This collects RGB and RGBA textures into a single
  GL texture with the aim of reducing texture state changes and
  increasing batching. The backend will try to manage the atlas and
  may move the textures around to close gaps in the texture. By
  default all textures will be placed in the atlas.

14 years agocogl-bitmap: Update the format after (un)premultiplying
Neil Roberts [Sat, 6 Feb 2010 00:12:10 +0000 (00:12 +0000)]
cogl-bitmap: Update the format after (un)premultiplying

The pixel format of the bitmap needs to have its premult flag cleared
or set after the premult conversion otherwise it may get converted
again.

14 years agocogl-atlas-texture: Fix a cut and paste error when getting the height
Neil Roberts [Fri, 5 Feb 2010 17:03:04 +0000 (17:03 +0000)]
cogl-atlas-texture: Fix a cut and paste error when getting the height

There was a typo in getting the height of the full texture to check
whether the sub region fits so that it was using the width
instead. This was causing crashes when debugging is enabled for some
apps.

14 years agodocs: Use % for defines not #
Damien Lespiau [Thu, 4 Feb 2010 21:10:02 +0000 (21:10 +0000)]
docs: Use % for defines not #

Some links to defines in the gtk-doc annotations were using '#' instead
of '%'.

14 years agodocs: fix new line in the cogl xml top level document
Damien Lespiau [Wed, 27 Jan 2010 16:03:28 +0000 (16:03 +0000)]
docs: fix new line in the cogl xml top level document

A comma in the FSF address is wrong. Supreme Offence.

14 years agoevent: Do not generate click count for SCROLL events
Emmanuele Bassi [Thu, 4 Feb 2010 18:29:47 +0000 (18:29 +0000)]
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.

14 years agotests: Add a Valgrind suppression file
Emmanuele Bassi [Thu, 4 Feb 2010 16:49:06 +0000 (16:49 +0000)]
tests: Add a Valgrind suppression file

When running tests under Valgrind it would be useful to pass a
suppression file for the known one-off allocations done by Clutter
and by its dependencies. This trims the output of Valgrind and
improves the ability to actually spot leaks.

14 years agoglx: Create a colormap for the dummy window
Neil Roberts [Thu, 4 Feb 2010 16:28:29 +0000 (16:28 +0000)]
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.

14 years agoglx: Clarify *why* we need the dummy window
Emmanuele Bassi [Thu, 4 Feb 2010 13:59:39 +0000 (13:59 +0000)]
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.

14 years agoglx: Do not leak a XVisualInfo
Emmanuele Bassi [Thu, 4 Feb 2010 13:56:33 +0000 (13:56 +0000)]
glx: Do not leak a XVisualInfo

The XVisualInfo we retrieve for the dummy window should be freed after
we used it.

14 years agocogl-texture: Avoid copying the bitmap when premultiplying from a file
Neil Roberts [Wed, 3 Feb 2010 23:08:30 +0000 (23:08 +0000)]
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.

14 years agocogl-texture: Split out _cogl_texture_prepare_for_upload
Neil Roberts [Wed, 3 Feb 2010 22:54:44 +0000 (22:54 +0000)]
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.

14 years agocogl-atlas: Make the cogl_atlas_* API internal
Neil Roberts [Wed, 3 Feb 2010 19:54:12 +0000 (19:54 +0000)]
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.

14 years agotext: implement del_word_next/del_word_prev()
Jussi Kukkonen [Wed, 3 Feb 2010 17:04:38 +0000 (17:04 +0000)]
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>
14 years agoRemove the SDL backend
Emmanuele Bassi [Wed, 9 Dec 2009 00:50:33 +0000 (00:50 +0000)]
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.

14 years agowin32: Use a dummy window to support delayed stage creation
Neil Roberts [Wed, 20 Jan 2010 16:41:25 +0000 (16:41 +0000)]
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.

14 years agoglx: Fix error messages and debug notes
Emmanuele Bassi [Sun, 6 Dec 2009 18:56:14 +0000 (18:56 +0000)]
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.

14 years agostage: Create the default stage on demand
Emmanuele Bassi [Thu, 3 Dec 2009 21:07:45 +0000 (21:07 +0000)]
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.

14 years agoglx: Create the dummy Window with the GLX context
Emmanuele Bassi [Thu, 3 Dec 2009 20:49:54 +0000 (20:49 +0000)]
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.

14 years agofeature: Make sure we have a GL context
Emmanuele Bassi [Thu, 3 Dec 2009 20:48:55 +0000 (20:48 +0000)]
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.

14 years agostage: Move default title in Stage.init
Emmanuele Bassi [Thu, 3 Dec 2009 20:47:48 +0000 (20:47 +0000)]
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.

14 years agoLazily create the Pango fontmap
Emmanuele Bassi [Thu, 3 Dec 2009 17:36:03 +0000 (17:36 +0000)]
Lazily create the Pango fontmap

The Pango fontmap needed by Clutter should be initialized the first
time we need a PangoContext, not on initialization.

14 years agoDelay default stage creation
Emmanuele Bassi [Thu, 3 Dec 2009 17:13:44 +0000 (17:13 +0000)]
Delay default stage creation

The default stage creation should be delayed as much as possible,
ideally at the end of the init() process.

14 years agocogl-debug: Remove redundant newlines
Emmanuele Bassi [Thu, 3 Dec 2009 17:35:19 +0000 (17:35 +0000)]
cogl-debug: Remove redundant newlines

The debugging notes wrapping g_debug() already have an implicit newline
at the end of the passed message.

14 years agotests: Clean up the cairo-flowers interactive test
Emmanuele Bassi [Wed, 3 Feb 2010 15:05:37 +0000 (15:05 +0000)]
tests: Clean up the cairo-flowers interactive test

14 years agotext: Add :font-description
Emmanuele Bassi [Wed, 3 Feb 2010 14:35:45 +0000 (14:35 +0000)]
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

14 years agocogl-vertex-buffer: Refix disabling texture coord arrays
Neil Roberts [Wed, 3 Feb 2010 14:31:12 +0000 (14:31 +0000)]
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.

14 years agotext: Fixes for selection bound
Emmanuele Bassi [Tue, 2 Feb 2010 17:07:22 +0000 (17:07 +0000)]
text: Fixes for selection bound

The commit ecbb7ce41a1a759e246fce07f146b8bed5e3d730 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

14 years agoUse ClutterTimeline in test-clutter-cairo-flowers.c
Kristian Høgsberg [Wed, 27 Jan 2010 17:55:18 +0000 (12:55 -0500)]
Use ClutterTimeline in test-clutter-cairo-flowers.c

http://bugzilla.openedhand.com/show_bug.cgi?id=1969
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
14 years agodocs: Clarify Group's sizing semantics
Emmanuele Bassi [Tue, 2 Feb 2010 14:50:03 +0000 (14:50 +0000)]
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>

14 years agotests: Add an initial Behaviour conformance suite
Emmanuele Bassi [Tue, 2 Feb 2010 12:56:04 +0000 (12:56 +0000)]
tests: Add an initial Behaviour conformance suite

The coverage of the Behaviour sub-classes is currently abysmal. An
initial test suite for Behaviours should at least verify that the
accessors and the constructors are doing the right thing.

This initial test suite just verifies the BehaviourOpacity sub-class,
but it already bumps up the overall coverage by 2%.

14 years agobehaviour: Clean up BehaviourOpacity
Emmanuele Bassi [Tue, 2 Feb 2010 12:54:51 +0000 (12:54 +0000)]
behaviour: Clean up BehaviourOpacity

• Use a consistent coding style

• Call set_bounds() from set_property(), because we need proper
  notification on the modified property

14 years agoevent: Unify the off-stage motion events delivery behaviour
Emmanuele Bassi [Mon, 1 Feb 2010 15:47:50 +0000 (15:47 +0000)]
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.

14 years agobuild: -Wformat is required for -Wformat-security
Emmanuele Bassi [Mon, 1 Feb 2010 14:53:13 +0000 (14:53 +0000)]
build: -Wformat is required for -Wformat-security

GCC will ignore -Wformat-security without -Wformat on the same compiler
flags.

14 years agobuild: Retrieve X11 cflags and libraries
Emmanuele Bassi [Mon, 1 Feb 2010 14:48:50 +0000 (14:48 +0000)]
build: Retrieve X11 cflags and libraries

When using pkg-config to check for the x11 package compiler flags and
libraries we actually need to retrieve those values from the pc file.

This should also fix the issue with non-canonical installations of the
X11 headers and shared objects.

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

14 years agoMerge remote branch 'master' into texture-debugging
Neil Roberts [Mon, 1 Feb 2010 13:37:19 +0000 (13:37 +0000)]
Merge remote branch 'master' into texture-debugging

Conflicts:
clutter/cogl/cogl/cogl-context.h

14 years agocogl-material: Compare GL texture numbers for material layer textures
Neil Roberts [Mon, 1 Feb 2010 13:25:19 +0000 (13:25 +0000)]
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.

14 years agocogl: Let GL do the format conversion when uploading texture data
Neil Roberts [Mon, 1 Feb 2010 12:11:58 +0000 (12:11 +0000)]
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.

14 years agocogl: Do the premult conversion in-place rather than copying to a new buffer
Neil Roberts [Fri, 29 Jan 2010 15:15:08 +0000 (15:15 +0000)]
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.

14 years agocogl-atlas-texture: Use a single atlas for both RGB and RGBA textures
Neil Roberts [Fri, 29 Jan 2010 12:19:42 +0000 (12:19 +0000)]
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.

14 years agoactor: Reword the allocation cycle warning
Emmanuele Bassi [Mon, 1 Feb 2010 12:18:10 +0000 (12:18 +0000)]
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".

14 years agoMerge branch 'device-manager'
Emmanuele Bassi [Mon, 1 Feb 2010 11:26:56 +0000 (11:26 +0000)]
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
  ...

14 years agoFix problems with "position" and "selection-bound" change notification
Alejandro Piñeiro [Mon, 25 Jan 2010 15:13:58 +0000 (16:13 +0100)]
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

14 years agostage: Add :key-focus property
Emmanuele Bassi [Mon, 1 Feb 2010 11:04:59 +0000 (11:04 +0000)]
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>
14 years agodocs: Update the README
Emmanuele Bassi [Fri, 29 Jan 2010 10:13:57 +0000 (10:13 +0000)]
docs: Update the README

Clean up the grammar and some wrinkles in the text.

14 years agodocs: Update the configure switches in the README
Emmanuele Bassi [Fri, 29 Jan 2010 09:31:13 +0000 (09:31 +0000)]
docs: Update the configure switches in the README

14 years agobuild: Warn with --disable-conformance and --enable-gcov
Emmanuele Bassi [Fri, 29 Jan 2010 09:29:53 +0000 (09:29 +0000)]
build: Warn with --disable-conformance and --enable-gcov

When building Clutter without conformance test suite we ought to warn
the user that the coverage report is not going to be accurate.

14 years agoRemove tabs from configure.ac
Emmanuele Bassi [Fri, 29 Jan 2010 09:29:37 +0000 (09:29 +0000)]
Remove tabs from configure.ac

14 years agobuild: Allow disabling the conformance test suite
Emmanuele Bassi [Fri, 29 Jan 2010 09:26:47 +0000 (09:26 +0000)]
build: Allow disabling the conformance test suite

When building Clutter for packaging on headless boxes it's pointless to
allow building the conformance test to be built (and run on 'make
check').

14 years agoWhitespace fixes in cogl-util
Emmanuele Bassi [Wed, 27 Jan 2010 21:26:26 +0000 (21:26 +0000)]
Whitespace fixes in cogl-util

14 years agoWhitespace fixes
Emmanuele Bassi [Wed, 27 Jan 2010 21:16:28 +0000 (21:16 +0000)]
Whitespace fixes

14 years agodocs: Fixes for TimeoutPool and Frame sources
Emmanuele Bassi [Wed, 27 Jan 2010 21:14:43 +0000 (21:14 +0000)]
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.

14 years agocogl: Use the colours of COGL_DEBUG=rectangles to debug batching
Neil Roberts [Fri, 22 Jan 2010 18:14:57 +0000 (18:14 +0000)]
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.

14 years agocogl-vertex-buffer: Fix disabling the texture arrays from previous prim
Neil Roberts [Tue, 26 Jan 2010 13:46:27 +0000 (13:46 +0000)]
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

14 years agodocs: Add some notes about the CoglPixelFormat enums
Neil Roberts [Wed, 27 Jan 2010 12:06:22 +0000 (12:06 +0000)]
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.

14 years agodocs: Fix some of the examples for the animation docs
Neil Roberts [Wed, 27 Jan 2010 11:02:34 +0000 (11:02 +0000)]
docs: Fix some of the examples for the animation docs

In the example for clutter_actor_animate the "x" and "y" properties
are floats so they need to be passed float values in the var args
otherwise it will crash. There was also a missing comma.

There were some other minor problems with the behaviours example which
would cause it not to compile.

14 years agocogl: Fix checks of the number of available texture units
Damien Lespiau [Tue, 26 Jan 2010 18:47:25 +0000 (18:47 +0000)]
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.

14 years agocogl: Fix gl equivalent of blend string
Damien Lespiau [Sun, 15 Nov 2009 20:17:47 +0000 (20:17 +0000)]
cogl: Fix gl equivalent of blend string

An example of what could be the equivalent of
    "RBG = REPLACE(TEXTURE)
     A   = MODULATE(PREVIOUS,TEXTURE)"
using the ARB_texture_env_combine extension was given, but it seems that
a few typo were left:
    * remove a spurius GL_COMBINE_ALPHA
    * use the _ALPHA variant of SRCN and OPERANDN when setting up the
      alpha combiner

14 years agotests: blend-string: use g_assert_cmpint
Damien Lespiau [Wed, 18 Nov 2009 01:13:11 +0000 (01:13 +0000)]
tests: blend-string: use g_assert_cmpint

It's very useful to see the actual number the reference value is
compared too when the test fails. GTest has g_assert_cmp$type()
functions for that, so make good use of them.

14 years agotest-cogl-multitexture: use several materials with texture matrices
Damien Lespiau [Tue, 26 Jan 2010 16:59:50 +0000 (16:59 +0000)]
test-cogl-multitexture: use several materials with texture matrices

A small doubt has risen about the use of CoglTextureUnit in materials:
will texture matrices still work if we have several materials, each of
them having at texture on the same texture unit? The answer is yes!

test-cogl-multitexture has been extended to use 2 materials with about
the same setup except a little difference: the texture matrices for the
lightmaps rotate in opposite directions.

While at it, changed the rotation behaviour by an implicit animation
with a small additional bonus bling.

14 years agocogl: Create CoglTextureUnit with its associated unit number
Damien Lespiau [Sun, 15 Nov 2009 19:54:17 +0000 (19:54 +0000)]
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

14 years agoactor: Use GParamSpecUint for :opacity
Emmanuele Bassi [Thu, 21 Jan 2010 17:41:10 +0000 (17:41 +0000)]
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.

14 years agotest-easing: Do not reconnect signals multiple times
Emmanuele Bassi [Fri, 22 Jan 2010 21:44:28 +0000 (21:44 +0000)]
test-easing: Do not reconnect signals multiple times

The test should keep track of the last animation and avoid reconnecting
signals to the same instance in case the -r argument has been passed.

14 years agoanimation: Verify internal state
Emmanuele Bassi [Fri, 22 Jan 2010 21:42:55 +0000 (21:42 +0000)]
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.

14 years agodocs: Fix the Animation:object property
Emmanuele Bassi [Fri, 22 Jan 2010 21:42:10 +0000 (21:42 +0000)]
docs: Fix the Animation:object property

There is a typo in the Animation:object property gtk-doc declaration.

14 years agoanimation: Add more debug annotations
Emmanuele Bassi [Fri, 22 Jan 2010 21:41:33 +0000 (21:41 +0000)]
animation: Add more debug annotations

We need some better tracking of the Animation's lifetime.

14 years agoanimation: Transform if necessary
Emmanuele Bassi [Fri, 22 Jan 2010 21:36:41 +0000 (21:36 +0000)]
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.

14 years agoanimation: Check for value transformability
Emmanuele Bassi [Fri, 22 Jan 2010 21:33:28 +0000 (21:33 +0000)]
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.

14 years agocogl-atlas-texture: Add a debug option to disable the atlas
Neil Roberts [Thu, 21 Jan 2010 15:34:19 +0000 (15:34 +0000)]
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.

14 years agobuild: Use no-define
Emmanuele Bassi [Fri, 22 Jan 2010 00:06:17 +0000 (00:06 +0000)]
build: Use no-define

We don't need the PACKAGE and VERSION defines in the config.h.

14 years agobuild: Add no-portability option to automake
Emmanuele Bassi [Thu, 21 Jan 2010 23:57:38 +0000 (23:57 +0000)]
build: Add no-portability option to automake

We require the GNU version of make for some of our rules, and it's been
so for a while now.

14 years agomaster clock: Improve the timeline advancement protection
Emmanuele Bassi [Thu, 21 Jan 2010 23:41:18 +0000 (23:41 +0000)]
master clock: Improve the timeline advancement protection

The commit 1c69c61745ed510f0b6ab16cb963ca01994cb9fc 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.

14 years agox11: Re-enable XI1 extension keyboards
Emmanuele Bassi [Wed, 20 Jan 2010 19:40:58 +0000 (19:40 +0000)]
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.

14 years agox11: Always handle core device events before XI events
Emmanuele Bassi [Fri, 15 Jan 2010 16:28:00 +0000 (16:28 +0000)]
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.

14 years agodocs: Documentation fixes for DeviceManager
Emmanuele Bassi [Fri, 15 Jan 2010 15:29:52 +0000 (15:29 +0000)]
docs: Documentation fixes for DeviceManager

14 years agodevice-manager: Fix the signals definition
Emmanuele Bassi [Fri, 15 Jan 2010 15:29:14 +0000 (15:29 +0000)]
device-manager: Fix the signals definition

Add documentation for the signals, as well as using the correct type for
the marshallers.

14 years agodocs: Add sections for InputDevice and DeviceManager
Emmanuele Bassi [Fri, 15 Jan 2010 14:56:43 +0000 (14:56 +0000)]
docs: Add sections for InputDevice and DeviceManager

14 years agodocs: Add clutter_input_device_get_device_name()
Emmanuele Bassi [Fri, 15 Jan 2010 14:42:19 +0000 (14:42 +0000)]
docs: Add clutter_input_device_get_device_name()

14 years agotests: Print out the device details on motion
Emmanuele Bassi [Fri, 15 Jan 2010 12:24:21 +0000 (12:24 +0000)]
tests: Print out the device details on motion

The test-device interactive test should print out the device name and id
when it detects a motion event.

14 years agoAlways register core devices
Emmanuele Bassi [Fri, 15 Jan 2010 12:22:29 +0000 (12:22 +0000)]
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.

14 years agodevice: Remove unused is_default member
Emmanuele Bassi [Fri, 15 Jan 2010 11:52:27 +0000 (11:52 +0000)]
device: Remove unused is_default member

The is_default member of the InputDevice structure was not used
anywhere.

14 years agowin32: Experimental implementation of device support
Emmanuele Bassi [Fri, 15 Jan 2010 11:47:05 +0000 (11:47 +0000)]
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.

14 years agotests: Print the device name, as well as its Id
Emmanuele Bassi [Fri, 15 Jan 2010 11:40:01 +0000 (11:40 +0000)]
tests: Print the device name, as well as its Id

The test-devices interactive test should display the device name along
with the id.

14 years agox11: Fill out the :name property of the InputDevices
Emmanuele Bassi [Fri, 15 Jan 2010 11:38:58 +0000 (11:38 +0000)]
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.

14 years agodevice: Add the :name property to InputDevice
Emmanuele Bassi [Fri, 15 Jan 2010 11:37:43 +0000 (11:37 +0000)]
device: Add the :name property to InputDevice

The InputDevice should have a name, possibly user readable, coming from
the backend.

14 years agox11: Store core devices on the X11 Backend singleton
Emmanuele Bassi [Fri, 15 Jan 2010 11:21:52 +0000 (11:21 +0000)]
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.

14 years agodevice: Unset the cursor actor when leaving the stage
Emmanuele Bassi [Thu, 14 Jan 2010 17:14:33 +0000 (17:14 +0000)]
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.

14 years agodevice: Add pointer actor getter
Emmanuele Bassi [Tue, 12 Jan 2010 11:53:12 +0000 (11:53 +0000)]
device: Add pointer actor getter

ClutterInputDevice should have a getter method for retrieving the
reactive actor underneath the pointer.

14 years agox11: Discard the LeaveNotify for off-stage ButtonRelease
Emmanuele Bassi [Wed, 9 Dec 2009 00:03:13 +0000 (00:03 +0000)]
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.

14 years agodevice: Do not overwrite the stage for an InputDevice
Emmanuele Bassi [Wed, 9 Dec 2009 00:01:50 +0000 (00:01 +0000)]
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.

14 years agoevent: Off-stage button releases have a click count of 1
Emmanuele Bassi [Wed, 9 Dec 2009 00:00:49 +0000 (00:00 +0000)]
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.

14 years agoevent: Scroll events do not have click count
Emmanuele Bassi [Tue, 8 Dec 2009 23:59:56 +0000 (23:59 +0000)]
event: Scroll events do not have click count

Remove the unneeded CLUTTER_SCROLL case from the click count checks.

14 years agoWhitespace and indentation fixes
Emmanuele Bassi [Tue, 8 Dec 2009 18:33:01 +0000 (18:33 +0000)]
Whitespace and indentation fixes

14 years agoevent: Clean up click-count detection
Emmanuele Bassi [Mon, 7 Dec 2009 23:13:52 +0000 (23:13 +0000)]
event: Clean up click-count detection

Avoid a few indirections and direct access to the Event and InputDevice
structures.

14 years agodevice: Store the current state, not the previous
Emmanuele Bassi [Mon, 7 Dec 2009 23:05:20 +0000 (23:05 +0000)]
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.

14 years agotests: Fix test-events output
Emmanuele Bassi [Mon, 7 Dec 2009 23:02:48 +0000 (23:02 +0000)]
tests: Fix test-events output

• The enter/leave event line should take into account the case where
  the related field is set to NULL (meaning entering from off-stage
  and leaving the stage).

• The ButtonRelease line shows the click count but uses the button; the
  button *and* the click count should be displayed for both ButtonPress
  and ButtonRelease, to verify they match.