Start eradicating the CoglHandle typedef

CoglHandle is a common source of complaints and confusion because people
expect a "handle" to be some form of integer type with some indirection
to lookup the corresponding objects as opposed to a direct pointer.

This patch starts by renaming CoglHandle to CoglObject * and creating
corresponding cogl_object_ APIs to replace the cogl_handle ones.

The next step though is to remove all use of CoglHandle in the Cogl APIs
and replace with strongly typed pointer types such as CoglMaterial * or
CoglTexture * etc also all occurrences of COGL_INVALID_HANDLE can just
use NULL instead.

After this we will consider switching to GTypeInstance internally so we
can have inheritance for our types and hopefully improve how we handle
bindings.

Note all these changes will be done in a way that maintains the API and
ABI.
This commit is contained in:
Robert Bragg
2010-05-27 23:31:40 +01:00
parent 0f32fb4acd
commit 7bcea1c64e
4 changed files with 245 additions and 144 deletions

View File

@ -83,6 +83,27 @@ cogl_handle_ref (CoglHandle handle);
void
cogl_handle_unref (CoglHandle Handle);
/**
* cogl_handle_ref:
* @object: a #CoglObject
*
* Increases the reference count of @handle by 1
*
* Returns: the @object, with its reference count increased
*/
void *
cogl_object_ref (void *object);
/**
* cogl_handle_unref:
* @object: a #CoglObject
*
* Drecreases the reference count of @object by 1; if the reference
* count reaches 0, the resources allocated by @object will be freed
*/
void
cogl_object_unref (void *object);
/**
* CoglFuncPtr:
*