1
0
Fork 0
Commit graph

3412 commits

Author SHA1 Message Date
Emmanuele Bassi
1ea4c50041 x11: Use XKB to track the Locks state
For Caps Lock and Num Lock. Store the state of both in the
platform-specific per-event data structure. No accessors, yet.
2010-07-13 09:15:21 +01:00
Emmanuele Bassi
bf2f8d670d x11: Use XKB detectable auto-repeat
If we have XKB support then we should be using it to turn on the
detectable auto-repeat; this allows avoiding the peeking trick
that emulates it inside the event handling code.
2010-07-13 08:27:48 +01:00
Emmanuele Bassi
bea657d3d5 x11: Add a Keymap ancillary object
We should try to abstract everything that is related with the key mapping
to its own object, to avoid complicating ClutterBackendX11 any further.
2010-07-13 08:27:48 +01:00
Emmanuele Bassi
d345a61e6c x11: Store the group inside the event platform data
Now that we have private, per-event platform data, we can start putting
it to good use. The first, most simple use is to store the key group
given the event's modifiers. Since we assume a modern X11, we use XKB
to retrieve it, or we simply fall back to 0 by default.

The data is exposed as a ClutterX11-specific function, within the
sanctioned clutter_x11_* namespace.
2010-07-13 08:27:48 +01:00
Emmanuele Bassi
f44ccba42e events: Add platform-data to allocated Events
Events allocated by Clutter should have a pointer to platform-specific
data; this would allow backends to add separate structures for holding
ancillary data, whilst retaining the ClutterEvent structure for use on
the stack.

In theory, for Clutter 2.x we might just want to drop Event and use an
opaque structure, or a typed data structure inheriting from
GTypeInstance instead.
2010-07-13 08:27:48 +01:00
Øyvind Kolås
25dd0ae356 state: swap clutter_state_set_state and clutter_state_warp_to_state
Got the boolean arguments for the old clutter_state_change wrong,
making the methods do the opposite of what they should.
2010-07-12 17:34:17 +01:00
Neil Roberts
90acc6a2a9 Add the deprecated ref-counting for cogl_program
cogl_program has always had cogl_program_ref and cogl_program_unref
but this was missed from 89cb325fd4 so they got removed.
2010-07-09 19:09:49 +01:00
Neil Roberts
8a85088196 Don't define public cogl_is_* functions for internal types
This adds a COGL_OBJECT_INTERNAL_DEFINE macro and friends that are the
same as COGL_OBJECT_DEFINE except that they prefix the cogl_is_*
function with an underscore so that it doesn't get exported in the
shared library.
2010-07-09 18:57:54 +01:00
Neil Roberts
0e839c3769 Add cogl_vertex_buffer_is_indices to the public headers
This function has always been defined in the shared library but it was
missed from the public headers.
2010-07-09 18:57:54 +01:00
Neil Roberts
89cb325fd4 cogl: Don't define the deprecated ref/unref accessors for new types
Previously COGL_OBJECT_DEFINE would always define deprecated
cogl_$type_{ref,unref} functions even if the type is new or if the
type is entirely internal. An application would still find it
difficult to use these because they wouldn't be in the headers, but it
still looks bad that they are exported from the shared library. This
patch changes it so that the deprecated ref counting functions are
defined using a separate macro and only the types that have these
functions in the headers call this macro.
2010-07-09 18:57:54 +01:00
Emmanuele Bassi
903560c6c8 text: Layouts for single-line-mode entries are boundless
A PangoLayout for an editable, single-line text entry is by definition
without a given width, since the actor will be clipped when being drawn.
2010-07-09 18:38:45 +01:00
Robert Bragg
1635a2db12 material: use common node type for materials and layers
Since 365605cf42, materials and layers are represented in a tree
structure that allows traversing up through parents and iterating down
through children.  This re-works the related typedefs and reparenting
code so that they can be shared.
2010-07-09 18:04:27 +01:00
Damien Lespiau
9e82fe3944 cogl-texture-pixmap-x11: This API is new in 1.4, not 1.2
CoglTexturePixmapX11 has been introduced in the 1.3 development cycle. A
Stability: Unstable tag was missing too, so add it.
2010-07-09 17:55:31 +01:00
Damien Lespiau
892aa45513 cogl: Add Stability tag to new experimental API
Functions guarded with COGL_ENABLE_EXPERIMENTAL API should be also maked
as being Unstable with the Stability gtk-doc tag.

Fixes: http://bugzilla.clutter-project.org/show_bug.cgi?id=2175
2010-07-09 17:17:11 +01:00
Emmanuele Bassi
b7f99ddd3c script: Let ClutterActor parse behaviours
Up until now, the "behaviours" member of an actor definition was parsed
by the ClutterScript parser itself - even though it's not strictly
necessary.

In an effort to minimize the ad hoc code in the Script parser, we should
let ClutterActor handle all the special cases that involve
actor-specific members.
2010-07-09 14:59:32 +01:00
Neil Roberts
a65429363e Use GL_MAX_TEXTURE_SIZE on GLES when checking supported tex size
Under big GL, _cogl_texture_driver_size_supported uses the proxy
texture to check whether the given texture size is supported. Proxy
textures aren't available under GLES so previously this would just
return TRUE to assume all texture sizes are supported. This patch
makes it use glGetIntegerv with GL_MAX_TEXTURE_SIZE to give a second
best guess.

This fixes the sliced texture backend so that it will use slices when
the texture is too big.
2010-07-09 11:14:15 +01:00
Neil Roberts
eb24d2a252 Fix cogl_texture_get_data when an intermediate buffer is used
When an intermediate buffer is used for downloading texture data it
was using the wrong byte length for a row so the copy back to the
user's buffer would fail.
2010-07-09 11:14:15 +01:00
Neil Roberts
9e1bb31922 Use GL_NEAREST filter in the draw-and-read get_data texture fallback
The fallback for when glGetTexImage is not available renders the
texture to the framebuffer to read the data using glReadPixels. This
patch just sets the COGL_MATERIAL_FILTER_NEAREST filter mode on the
material before rendering to avoid linear filtering which would alter
the texture data.
2010-07-09 11:14:15 +01:00
Neil Roberts
25cf5979e6 Use cogl_read_pixels in the cogl texture draw-and-read fallback
The fallback for when glGetTexImage is not available draws parts of
the texture to the framebuffer and uses glReadPixels to extract the
data. However it was using cogl_rectangle to draw and then immediately
using raw glReadPixels to fetch the data. This won't cause a journal
flush so the rectangle won't necessarily have hit the framebuffer
yet. Instead it now uses cogl_read_pixels which does flush the
journal.
2010-07-09 11:14:15 +01:00
Neil Roberts
e454b9cadf cogl-material: Fix some problems with flushing texture overrides
There were a few problems flushing texture overrides so that sliced
textures would not work:

* In _cogl_material_set_layer_texture it ignored the 'overriden'
  parameter and always set texture_overridden to FALSE.

* cogl_texture_get_gl_texture wasn't being called correctly in
  override_layer_texture_cb. It returns a gboolean to indicate the
  error status but this boolean was being assigned to gl_target.

* _cogl_material_layer_texture_equal did not take into account the
  override.

* _cogl_material_layer_get_texture_info did not return the overridden
  texture so it would always use the first texture slice.
2010-07-09 11:14:15 +01:00
Neil Roberts
8beb49164f cogl-texture: Share the common code in the set_region virtual
There was a lot of common code that was copied to all of the backends
to convert the data to a suitable format and wrap it into a CoglBitmap
so that it can be passed to _cogl_texture_driver_upload_subregion_to_gl.
This patch moves the common code to cogl-texture.c so that the virtual
just takes a CoglBitmap that is already in the right format.
2010-07-09 11:14:14 +01:00
Neil Roberts
0577c81c3b cogl-texture: Share the common code in the get_data virtual
Previously cogl_texture_get_data would pretty much directly pass on to
the get_data texture virtual function. This ended up with a lot of
common code that was copied to all of the backends. For example, the
method is expected to return the required data size if the data
pointer is NULL and to calculate its own rowstride if the rowstride is
0. Also it needs to convert the downloaded data if GL can't support
that format directly.

This patch moves the common code to cogl-texture.c so the virtual is
always called with a format that can be downloaded directly by GL and
with a valid rowstride. If the download fails then the virtual can
return FALSE in which case cogl-texture will use the draw and read
fallback.
2010-07-09 11:00:48 +01:00
Neil Roberts
f47152c557 cogl-vertex-buffer: Default to GL_CLAMP_TO_EDGE for point sprites
For point sprites you are usually drawing the whole texture so you
most often want GL_CLAMP_TO_EDGE. This patch removes the override for
COGL_MATERIAL_WRAP_MODE_AUTOMATIC when point sprites are enabled for a
layer so that it will clamp to edge.
2010-07-08 16:34:31 +01:00
Neil Roberts
ab05f6bfb1 cogl-material: Add support for point sprites
This adds a new API call to enable point sprite coordinate generation
for a material layer:

void
cogl_material_set_layer_point_sprite_coords_enabled (CoglHandle material,
                                                     int layer_index,
                                                     gboolean enable);

There is also a corresponding get function.

Enabling point sprite coords simply sets the GL_COORD_REPLACE of the
GL_POINT_SPRITE glTexEnv when flusing the material. There is no
separate application control for glEnable(GL_POINT_SPRITE). Instead it
is left permanently enabled under the assumption that it has no affect
unless GL_COORD_REPLACE is enabled for a texture unit.

http://bugzilla.openedhand.com/show_bug.cgi?id=2047
2010-07-08 16:34:30 +01:00
Neil Roberts
73642ac9c4 cogl-material: Add a property for setting the point size
This adds cogl_material_{get,set}_point_size. If the point size is not
1.0f then glPointSize will be called when the material is flushed.

http://bugzilla.openedhand.com/show_bug.cgi?id=2047
2010-07-08 16:34:30 +01:00
Robert Bragg
b2decfe762 material: support dumping layer state graph to dot file
Recently I added a _cogl_debug_dump_materials_dot_file function for
debugging the sparse material state. This extends the state dumped to
include the graph of layer state also.
2010-07-07 20:46:50 +01:00
Robert Bragg
7eedf0f234 material: set ->layer_index on new layers for unit0
We were mistakenly only initializing layer->layer_index for new layers
associated with texture units > 0. This had gone unnoticed because
normally layers associated with texture unit0 have a layer index of 0
too. Mutter was hitting this issue because it was initializing layer 1
before layer 0 for one of its materials so layer 1 was temporarily
associated with texture unit 0.
2010-07-07 20:46:04 +01:00
Øyvind Kolås
9e730727ca state: add clutter_state_set_state and clutter_state_warp_to_state
Replaced clutter_state_change with a boolean argument for animating the
transition or not with two separate argument-less methods.
2010-07-07 18:17:09 +01:00
Emmanuele Bassi
f87e4037a8 build: Distcheck fixes after the Cally merge 2010-07-07 16:30:31 +01:00
Emmanuele Bassi
e3a8ece54d Merge branch 'cally-merge'
* cally-merge:
  cally: Add introspection generation
  cally: Improving cally doc
  cally: Cleaning CallyText
  cally: Refactoring "window:create" and "window:destroy" emission code
  cally: Use proper backend information on CallyActor
  cally: Check HAVE_CONFIG_H on cally-util.c
  docs: Fix Cally documentation
  cally: Clean up the headers
  Add binaries of the Cally examples to the ignore file
  docs: Add Cally API reference
  Avoid to load cally module on a11y examples
  Add accessibility tests
  Initialize accessibility support on clutter_init
  Rename some methods and includes to avoid -Wshadow warnings
  Cally initialization code
  Add Cally
2010-07-07 16:06:30 +01:00
Emmanuele Bassi
a3c69dc27c cally: Add introspection generation
Toolkits and applications not written in C might still need access to
the Cally API to write accessibility extensions based on it for their
own native elements.
2010-07-07 15:57:43 +01:00
Emmanuele Bassi
608a5a8ae6 x11: Clean up NET_WM_STATE modifiers
Use a separate function to avoid code duplication.
2010-07-07 14:52:19 +01:00
Emmanuele Bassi
eca398f113 x11: Do not swallow XSettings events
We might want pieces higher in the stack (like Mx) to handle XSettings
events as well, and swallowing them by removing them from the events
queue would make it impossible.
2010-07-07 14:52:19 +01:00
Alejandro Piñeiro
a2f8ce175f cally: Improving cally doc
* Add documentation for all undocumented symbols
  * Add an overview section
2010-07-07 15:48:08 +02:00
Alejandro Piñeiro
c931e11e3d cally: Cleaning CallyText
* Removing superfluous g_return_if_fail
  * Removing unused ClutterText::text-changed callback
2010-07-07 15:48:00 +02:00
Alejandro Piñeiro
137790bec9 cally: Refactoring "window:create" and "window:destroy" emission code
Previously "window:create" and "window:destroy" were emitted on
CallyUtil. Although it works, and CallyUtil already have callbacks to
stage_added/removed signals, I think that it is more tidy/clear to do
that on CallyRoot:

  * CallyRoot already has code to manage ClutterStage addition/removal

  * In fact, we can see CallyRoot as the object exposing the a11y
    information from ClutterStageManager, so it fits better here.

  * CallyUtil callbacks these signals are related to key event
    listeners (key snooper simulation). One of the main CallyUtil
    responsabilities is managing event (connecting, emitting), so I
    would prefer to not start to add/mix more functionalities here.

Ideally it would be better to emit all CallyStage methods from
CallyStage, but it is clear that "create" and "destroy" are more easy
to emit from a external object
2010-07-07 15:47:56 +02:00
Alejandro Piñeiro
ffd1f12560 cally: Use proper backend information on CallyActor
It uses HAVE_CLUTTER_GLX to check the current backend in use for
some accessibility related methods.

Fixes CB#2071
2010-07-07 15:47:45 +02:00
Alejandro Piñeiro
d45499f88b cally: Check HAVE_CONFIG_H on cally-util.c 2010-07-07 15:46:34 +02:00
Robert Bragg
1dd174add3 framebuffer: Replace CoglHandle with CoglFramebuffer *
One more object converted to stop using CoglHandle re:a8c8cbee513
2010-07-07 14:41:54 +01:00
Robert Bragg
9b9e764dc1 material: route fogging state through CoglMaterial
Previously cogl_set_fog would cause a flush of the Cogl journal and
would directly bang the GL state machine to setup fogging. As part of
the ongoing effort to track most state in CoglMaterial to support
renderlists this now adds an indirection so that cogl_set_fog now just
updates ctx->legacy_fog_state. The fogging state then gets enabled as a
legacy override similar to how the old depth testing API is handled.
2010-07-07 14:12:15 +01:00
Robert Bragg
279e68d8d9 osx: explicitly request depth and stencil buffer bits
This is a blind patch because I don't know enough about the osx backend
and the osx backend probably doesn't even work these days anyway but
since people have filed bugs specifically on OSX that imply they don't
have a depth or stencil buffer this tries to fix that.

Maybe someone will eventually pick up the osx backend again and verify
if this helps.

http://bugzilla.clutter-project.org/show_bug.cgi?id=1394
2010-07-07 14:09:32 +01:00
Robert Bragg
2e0d2cf055 cogl-buffer: Move malloc fallback logic into CoglBuffer
Since we'll want to share the fallback logic with CoglVertexArray this
moves the malloc based fallback (for when OpenGL doesn't support vertex
or pixel buffer objects) into cogl-buffer.c.
2010-07-07 14:08:11 +01:00
Robert Bragg
2353aa56ea cogl-buffer: consider it an error to free a mapped buffer
Explicitly warn if we detect that a CoglBuffer is being freed while it
is still mapped. Previously we silently unmapped the buffer, but it's
not something we want to encourage.
2010-07-07 14:08:11 +01:00
Robert Bragg
429d7cf696 cogl-buffer: Track the last used bind target in CoglBuffer
This makes CoglBuffer track the last used bind target as a private
property. This is later used when binding a buffer to map instead of
always using the PIXEL_UNPACK target.

This also adds some additional sanity checks that code doesn't try to
nest binds to the same target or bind a buffer to multiple targets at
the same time.
2010-07-07 14:08:11 +01:00
Robert Bragg
3570852b02 cogl: expose the semantic differences of gl/gles2 npot textures
This adds three new feature flags COGL_FEATURE_TEXTURE_NPOT_BASIC,
COGL_FEATURE_TEXTURE_NPOT_MIPMAP and COGL_FEATURE_TEXTURE_NPOT_REPEAT
that can tell you if your hardware supports non power of two textures,
npot textures + mipmaps and npot textures + wrap modes other than
CLAMP_TO_EDGE.

The pre-existing COGL_FEATURE_TEXTURE_NPOT feature implies all of the
above.

By default GLES 2 core supports npot textures but mipmaps and repeat
modes can only be used with power of two textures. This patch also makes
GLES check for the GL_OES_texture_npot extension to determine if mipmaps
and repeating are supported with npot textures.
2010-07-07 13:26:41 +01:00
Neil Roberts
ced7915ea1 cogl-vertex-buffer: Fix the #define for glDisableVertexAttribArray
glDisableVertexAttribArray was defined to glEnableVertexAttribArray so
it would probably cause crashes if it was ever used. Presumably
nothing is using these yet because the generic attributes are not yet
tied to shader attributes in a predictable way.
2010-07-06 16:08:44 +01:00
Øyvind Kolås
290038ee68 animator: fix removal of multiple keys
When removing keys, sometimes a couple of keys would be remaining.
2010-07-06 14:14:34 +01:00
Øyvind Kolås
ec05230b97 state: added clutter_state_key_get_property_type
A function to retrieve the type of the value stored in a key, the
equivalent already exists for ClutterAnimator.
2010-07-06 14:14:34 +01:00
Øyvind Kolås
6d1f697bc4 state: automatically remove unused states
When there is no further keys with a state as the target state, remove
the state (and all transitions that used this state as a target)
2010-07-06 14:14:34 +01:00
Alexandros Frantzis
140f76abf4 build: Exclude built sources from the dist
http://bugzilla.clutter-project.org/show_bug.cgi?id=2169

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-07-06 13:24:00 +01:00
Robert Bragg
739240095f debug: Adds a COGL_DEBUG=disable-pbos debug option
For testing purposes, either to identify bugs in Cogl or the driver or
simulate lack of PBO support COGL_DEBUG=disable-pbos can be used to
fallback to malloc instead.
2010-07-06 12:09:01 +01:00
Robert Bragg
b4b98358e1 pango-render: set CLAMP_TO_EDGE wrap mode on glyph_material
The pango renderer was causing lots of override materials to be allocated
because the vertex_buffer API converts AUTOMATIC mode into REPEAT for
backwards compatibility. By explicitly setting the wrap mode to
CLAMP_TO_EDGE when creating the glyph_material then the vertex_buffer
API will leave it untouched.
2010-07-06 12:07:29 +01:00
Robert Bragg
82ba7220af pixel-array: Allow passing of hints to cogl_buffer_map
This allows you to tell Cogl that you are planning to replace all the
buffer's data once it is mapped with cogl_buffer_map. This means if the
buffer is currently being accessed by the GPU then the driver doesn't
have to stall and wait for it to finish before it can access it from the
CPU and can instead potentially allocate a new buffer with undefined
data and map that.
2010-07-06 12:07:28 +01:00
Emmanuele Bassi
a63eb10855 docs: Fix Cally documentation 2010-07-05 16:45:43 +01:00
Emmanuele Bassi
09c6553f0d cally: Clean up the headers
Make Cally follow the single-include header file policy of Clutter and
Cogl; this means making cally.h the single include header, and requires
a new cally-main.h file for the functions defined by cally.h.

Also:

  • clean up the licensing notice and remove the FSF address;

  • document the object structures (instance and class);

  • G_GNUC_CONST-ify the get_type() functions;

  • reduce the padding for CallyActor sub-classes;

  • reduce the amount of headers included.
2010-07-05 16:45:43 +01:00
Alejandro Piñeiro
8f8e88b692 Initialize accessibility support on clutter_init
Initialize the accessibility support calling cally_accessibility_init

Take into account that this is required to at least be sure that
CallyUtil class is available.

It also modifies cally_accessibility_module_init in order to return
if the initialization was fine (and the name, removing the module word).

It also removes the gnome accessibility hooks, as it is not anymore
module code.

Solves CB#2098
2010-07-05 16:45:43 +01:00
Alejandro Piñeiro
774541d71e Rename some methods and includes to avoid -Wshadow warnings
http://bugzilla.clutter-project.org/show_bug.cgi?id=2097
2010-07-05 16:45:43 +01:00
Alejandro Piñeiro
72da871c0a Cally initialization code
This commit includes a method to init the a11y support. Two main purposes:

 * Register the different Atk factories.
 * Ensure that there are a AtkUtil implementation class available.

Part of CB#2097
2010-07-05 16:45:43 +01:00
Alejandro Piñeiro
c0f753d108 Add Cally
The Clutter Accessibility Library is an implementation of the ATK,
the Accessibility Toolkit, which exposes Clutter actors to accessibility
tools. This allows not only writing accessible user interfaces, but also
allows testing and verification frameworks based on A11Y technologies to
inspect and test a Clutter scene graph.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2097

Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2010-07-05 16:45:43 +01:00
Robert Bragg
3e03ba1e7e cogl-object: cogl_is_XYZ prototype should take void *
This changes the cogl_is_XYZ function prototypes generated when using
the COGL_OBJECT_DEFINE macro to take a void * argument instead of a
CoglHandle argument.
2010-07-05 15:47:02 +01:00
Robert Bragg
8a5aed36fe pixel-array: Only allow allocation of arrays with a 2D size
This removes cogl_pixel_array_new which just took a size in bytes.

Without the image size and pixel format then the driver often doesn't
have enough information to allocate optimal GPU memory that can be
textured from directly. This is because GPUs often have ways to
spatially alter the layout of a texture to improve cache access patterns
which may require special alignment and padding dependant in the images
width, height and bpp.

Although currently we are limited by OpenGL because it doesn't let us
pass on the width and height when allocating a PBO, the hope is that we
can define a better extension at some point.
2010-07-05 15:20:04 +01:00
Robert Bragg
cfef390d87 pixel-array: rename new_from_size to new_with_size
It is more in keeping with other coding conventions in Cogl to use new
"with" size instead of new "from" size.
2010-07-05 15:20:04 +01:00
Robert Bragg
8ae0478850 cogl-buffer-private.h: cleanup up the coding style
This file was following the Clutter coding style of arranging prototypes
into columns which Cogl doesn't copy.
2010-07-05 15:20:04 +01:00
Robert Bragg
54f4a3a752 rename CoglPixelBuffer to CoglPixelArray
This renames CoglPixelBuffer to CoglPixelArray to be consistent with the
new CoglVertexArray API.
2010-07-05 15:20:04 +01:00
Robert Bragg
57341dbb60 cogl-buffer: make the COGL_BUFFER_USAGE_HINT private
The usage hint should be implied by the CoglBuffer subclass type so the
public getter and setter APIs for manually changing the usage hint of a
CoglBuffer have now been removed.
2010-07-05 15:20:04 +01:00
Robert Bragg
7820842262 cogl-buffer: Handle subclass registration like cogl-texture
Instead of having to extend cogl_is_buffer with new buffer types
manually this now adds a new COGL_BUFFER_DEFINE macro to be used instead
of COGL_OBJECT_DEFINE for CoglBuffer subclasses. This macro will
automatically register the new type with ctx->buffer_types which will
iterated by cogl_is_buffer. This is the same coding pattern used for
CoglTexture.
2010-07-05 15:20:03 +01:00
Robert Bragg
90931e261f pixel-buffer: Replace CoglHandle with CoglPixelBuffer *
One more file converted to stop using CoglHandle re:a8c8cbee513
2010-07-05 15:20:03 +01:00
Robert Bragg
baacf2e707 cogl-material: Adds debug api to dump sparse material graph
This adds a _cogl_debug_dump_materials_dot_file function that can be
used to dump all the descendants of the default material to a file using
the dot format which can then be converted to an image to visualize.
2010-07-05 15:04:46 +01:00
Robert Bragg
f3b75541c7 cogl-vertex-buffer.h: #include <cogl/cogl-defines.h>
cogl-vertex-buffer.h was assuming that the platforms GL headers had
already been included but that shouldn't have to be the case.
2010-07-05 14:54:21 +01:00
Robert Bragg
ed23207083 cogl-object-private.h: #include glib.h and cogl-types.h
cogl-object-private.h was only working in places that had already
included glib.h and cogl-types.h
2010-07-05 14:51:28 +01:00
Robert Bragg
cf8e88768f material: don't keep extra ref on copy-on-write materials
In _cogl_material_pre_change_notify if a material with descendants is
modified then we create a new material that is a copy of the one being
modified and reparent those descendants to the new material.

This patch ensures we drop the reference we get from cogl_material_copy
since we can rely on the descendants to keep the new material alive.
2010-07-05 14:51:05 +01:00
Robert Bragg
70925a3194 build: Fix GLES builds since the material backend split
The commit to split the fragment processing backends out from
cogl-material.c (3e1323a636) broke the GLES 1 and 2 builds the
fix was to guard the code in each backend according to the
COGL_MATERIAL_BACKEND_XYZ defines which are setup in
cogl-material-private.h.
2010-07-05 14:50:47 +01:00
Øyvind Kolås
38941372bf state: rename property "target-state" to "state"
This reduces the amount of typing, and should provide for more readable
code for most uses of ClutterState.
2010-07-02 17:41:33 +01:00
Neil Roberts
25509e6a7b Convert the ASCII art documentation in cogl-vertex-buffer to PNGs
The documentation for cogl_vertex_buffer_indices_get_for_quads was
using ugly ASCII art to draw the diagrams. These have now been
replaced with PNG figures.
2010-07-02 17:29:34 +01:00
Neil Roberts
86500cd3d5 Add CoglMaterialWrapMode to the Cogl docs and fix docs for the getters
CoglMaterialWrapMode was missing from the cogl-sections.txt file so it
wasn't getting displayed. There were also no documented return values
from the getters.
2010-07-02 17:29:34 +01:00
Emmanuele Bassi
9338df438c align-constraint: Offset the position after the alignment factor
Instead of aligning (pos + size), align on size alone, and then offset
by pos.

http://bugzilla.clutter-project.org/show_bug.cgi?id=2168
2010-07-02 11:38:22 +01:00
Neil Roberts
884df17536 Fix building the tesselator code for GLES
The tesselator code uses some defines that it expects to be in the GL
headers such as GLAPI and GLAPIENTRY. These are used to mark the entry
points as exportable on each platform. We don't really want the
tesselator code to use these but we also don't want to modify the C
files so instead they are #defined to be empty in the stub glu.h. That
header is only included internally when building the tesselator/ files
so it shouldn't affect the rest of Cogl.

GLES also doesn't have a GLdouble type so we just #define this to be a
regular double.
2010-07-01 20:39:57 +01:00
Neil Roberts
b74c722670 cogl-material: Don't doubly ref the parent in cogl_material_copy
cogl_material_copy was taking a reference on the original texture when
making a copy. However it then calls _cogl_material_set_parent on the
material which also takes a reference on the parent. The second
reference is cleaned up whenever _cogl_material_unparent is called and
this is also called by _cogl_material_free. However, it seems that
nothing was cleaning up the first reference. I think the reference is
entirely unnecessary so this patch removes it.
2010-07-01 15:32:08 +01:00
Emmanuele Bassi
daf19205e0 align-constraint: Follow the position of the source
The AlignConstraint update is using only the width/height of the source,
but it should also take into account the position.

Also, instead of using the ::notify signal, it should follow the
BindConstraint, and switch to the ::allocation-changed signal, since
it's less expensive (one emission instead of four notifications, one for
each property we use).
2010-07-01 14:11:58 +01:00
Robert Bragg
b625d94362 cogl: don't include cogl-vector.h twice in cogl.h
cogl-vector.h should only be included by cogl.h when
COGL_ENABLE_EXPERIMENTAL_API is defined. This removes the unguarded
duplicate include.
2010-07-01 12:23:10 +01:00
Robert Bragg
534472a0d4 cogl: declare experimental symbols consistently
We had several different ways of exposing experimental API, in one case
the symbols had no special suffix, in two other ways the symbols were
given an _EXP suffix but in different ways.

This makes all experimental API have an _EXP suffix which is handled
using #defines in the header so the prototypes in the .c and .h files
don't have the suffix.

The documented reason for the suffix is so that anyone watching Cogl for
ABI changes who sees symbols disappear will hopefully understand what's
going on.
2010-06-30 18:51:31 +01:00
Neil Roberts
698743d454 cogl/tesselator: Update to the latest code from GLU
This grabs the latest code for libtess from git Mesa. This is mostly
so that we can get the following commit which fixes a lot of compiler
warnings in Clutter:

commit 75acb896c6da758d03e86f8725d6ca0cb2c6ad82
Author: Neil Roberts <neil@linux.intel.com>
Date:   Wed Jun 30 12:41:11 2010 +0100

    glu: Fix some compiler warnings in libtess
    
    When compiled with the more aggressive compiler warnings such as
    -Wshadow and -Wempty-body the libtess code gives a lot more
    warnings. This fixes the following issues:
    
    * The 'Swap' macro tries to combine multiple statements into one and
      then consume the trailing semicolon by using if(1){/*...*/}else.
      This gives warnings because the else part ends up with an empty
      statement. It also seems a bit dangerous because if the semicolon
      were missed then it would still be valid syntax but it would just
      ignore the following statement. This patch replaces it with the more
      common idiom do { /*...*/ } while(0).
    
    * 'free' was being used as a local variable name but this shadows the
      global function. This has been renamed to 'free_handle'
    
    * TRUE and FALSE were being unconditionally defined. Although this
      isn't currently a problem it seems better to guard them with #ifndef
      because it's quite common for them to be defined in other headers.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=28845
2010-06-30 16:35:33 +01:00
Emmanuele Bassi
4ed4e86e75 docs: Various fixes for gtk-doc 2010-06-30 15:51:12 +01:00
Emmanuele Bassi
005a99f346 backend: Move one-off free in finalize()
Instead of using dispose().
2010-06-30 15:51:12 +01:00
Emmanuele Bassi
7ca340fade docs: Avoid warnings from the g-ir-scanner
The scanner has some issues when parsing valid gtk-doc annotations; we
should make its (and, in return, ours) life easier.

We still get warnings for code declared in <programlisting> sections,
unfortunately.
2010-06-30 15:51:12 +01:00
Robert Bragg
e32c6c1235 material: Replace CoglHandle with CoglMaterial *
As part of the ongoing effort to remove CoglHandle from the API this
switches the cogl_material API to use a strongly typed CoglMaterial
pointer instead of CoglHandle.
2010-06-30 15:04:18 +01:00
Robert Bragg
3e1323a636 material: Split the fragment processing backends out
This splits the fragment processing backends (glsl, arbfp and fixed) out
from cogl-material.c into their own cogl-material-{glsl,arbfp,fixed}.c
files in an effort to help and keep cogl-material.c maintainable.
2010-06-30 15:04:10 +01:00
Robert Bragg
411438f309 material: remove a duplicate gtk-doc "Since: 1.4"
The cogl_material_get_depth_writing_enabled documentation had two
"Since: 1.4" annotations which was confusing the gobject introspection
scanner.
2010-06-30 14:31:46 +01:00
Robert Bragg
f4e825b81d backend: fix double free of priv->font_name
If the backend was disposed then priv->font_name would be freed but not
set to NULL and so if clutter_backend_get_font_name was then called it
would double free priv->font_name.
2010-06-30 14:30:35 +01:00
Emmanuele Bassi
286f307c10 docs: Various fixes 2010-06-30 11:32:15 +01:00
Neil Roberts
3a1456f34e cogl-path: Allow changing the fill rule
This adds two new API calls- cogl_path_set_fill_rule and
cogl_path_get_fill_rule. This allows modifying the fill rule of the
current path. In addition to the previous default fill rule of
'even-odd' it now supports the 'non-zero' rule. The fill rule is a
property of the path (not the Cogl context) so creating a new path or
preserving a path with cogl_path_get_handle affects the fill rule.
2010-06-29 20:37:14 +01:00
Neil Roberts
95317b9623 cogl-debug: Remove the force-scanline-paths option
The scanline path rasterizer has been removed because the paths can be
drawn with the tesselator instead. The option therefore no longer does
anything.
2010-06-29 20:37:13 +01:00
Neil Roberts
0cdbe7e098 cogl-path: Use the GLU tesselator to draw paths
Instead of drawing paths using the stencil buffer trick, it now
tesselates the path into triangles using the GLU tesselator and
renders them directly. A vbo is created with one vertex for each node
on the path. The tesselator is used to generate a series of indices
into the vbo as triangles. The tesselator's output of strips and fans
is converted into GL_TRIANGLES so that it can be rendered with a
single draw call (but the vertices are still shared via the
indices). The vbo is stored with the path so that if the application
uses retained paths then Cogl won't have to tessellate again.

The vertices also have texture coordinates associated with them so
that it can replicate the old behaviour of drawing a material with a
texture by fitting the texture to the bounding box of the path and
then clipping it. However if the texture contains waste or is sliced
then the vertex buffer code will refuse to draw it. In this case it
will revert back to drawing the path into the stencil buffer and then
drawing the material as a clipped quad.

The VBO is used even when setting up the stencil buffer for clipping
to a path because the tessellated geometry may cover less area.

The old scanline rasterizer has been removed because the tesselator
should work equally well on drivers with no stencil buffer.
2010-06-29 20:37:13 +01:00
Neil Roberts
fae4d60106 cogl: Pull in the code for GLU tesselator from Mesa/SGI
This copies the files for the GLU tesselator from Mesa. The Mesa code
is based on the original SGI code and is released under a BSD license.

The memalloc.h header has been replaced with one that forces the code
to use g_malloc and friends. The rest of the files are not altered
from the original so it should be possible to later upgrade the files
by simply overwriting them.

There is a tesselator.h header which is expected to be included by
rest of Cogl to use the tesselator. This contains a trimmed down
version of glu.h that only includes parts that pertain to the
tesselator. There is also a stub glu.h in the GL directory which is
just provided so that the tesselator code can include <GL/gl.h>
without depending on the system header. It just redirects to
tesselator.h
2010-06-29 20:37:13 +01:00
Chris Lord
8801c947d5 event: Typos in event code could cause crashes
A typo in clutter-event.c meant that the wrong struct location could be
used for the input device of key events. Also, a typo in the X11 event
code meant that key-presses would come from the pointer device (releases
would still come from the keyboard device).
2010-06-29 15:42:59 +01:00
Emmanuele Bassi
32ad63efef bind-constraint: Add width and height binding
Allow using the BindConstraint to bind width and height of a source
actor.

Also, add a test for the BindConstraint showing all types of usages
for this constraint class.
2010-06-28 18:06:23 +01:00
Neil Roberts
b3ffe602a2 cogl: Add const to some pointer arguments
Some of the arguments to the material and path functions were taking a
pointer to a CoglColor or an array of floats that was not intended to
be written to but were not marked with const.
2010-06-28 15:25:19 +01:00
Emmanuele Bassi
a20def9df6 text: Use the ::settings-changed signal
Instead of the ::font-changed one.
2010-06-28 10:43:13 +01:00
Emmanuele Bassi
c81ef75942 x11: Add XSETTINGS watcher
If we want to be able to get live notification of system settings
changes, we need watch the window that the XSETTINGS client conjures
up for us.
2010-06-28 10:32:54 +01:00
Emmanuele Bassi
31fc8e9664 text: Document and annotate :font-name for NULL values
Update the documentation of :font-name, to make it clear that by setting
it to NULL the Text actor will use the default font.

Also, set the annotation for the @font_name argument of the setter to be
allow-none, and allow passing NULL through bindings.
2010-06-26 23:05:36 +01:00