diff --git a/clutter/clutter/clutter-id-pool.c b/clutter/clutter/clutter-id-pool.c deleted file mode 100644 index c71729443..000000000 --- a/clutter/clutter/clutter-id-pool.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Clutter. - * - * An OpenGL based 'interactive canvas' library. - * - * Authored By Matthew Allum - * - * Copyright (C) 2006-2008 OpenedHand - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - * - * - * ClutterIDPool: pool of reusable integer ids associated with pointers. - * - * Author: Øyvind Kolås - * - */ - -#include "clutter-build-config.h" - -#include "clutter-debug.h" -#include "clutter-id-pool.h" - -struct _ClutterIDPool -{ - GArray *array; /* Array of pointers */ - GSList *free_ids; /* A stack of freed ids */ -}; - -ClutterIDPool * -_clutter_id_pool_new (guint initial_size) -{ - ClutterIDPool *self; - - self = g_new0 (ClutterIDPool, 1); - - self->array = g_array_sized_new (FALSE, FALSE, - sizeof (gpointer), initial_size); - self->free_ids = NULL; - return self; -} - -void -_clutter_id_pool_free (ClutterIDPool *id_pool) -{ - g_return_if_fail (id_pool != NULL); - - g_array_free (id_pool->array, TRUE); - g_slist_free (id_pool->free_ids); - g_free (id_pool); -} - -guint32 -_clutter_id_pool_add (ClutterIDPool *id_pool, - gpointer ptr) -{ - gpointer *array; - guint32 retval; - - g_return_val_if_fail (id_pool != NULL, 0); - - if (id_pool->free_ids) /* There are items on our freelist, reuse one */ - { - array = (void*) id_pool->array->data; - retval = GPOINTER_TO_UINT (id_pool->free_ids->data); - - id_pool->free_ids = g_slist_remove (id_pool->free_ids, - id_pool->free_ids->data); - array[retval] = ptr; - return retval; - } - - /* Allocate new id */ - retval = id_pool->array->len; - g_array_append_val (id_pool->array, ptr); - - return retval; -} - -void -_clutter_id_pool_remove (ClutterIDPool *id_pool, - guint32 id_) -{ - gpointer *array; - - g_return_if_fail (id_pool != NULL); - - array = (void*) id_pool->array->data; - - array[id_] = NULL; - - id_pool->free_ids = g_slist_prepend (id_pool->free_ids, - GUINT_TO_POINTER (id_)); -} - -gpointer -_clutter_id_pool_lookup (ClutterIDPool *id_pool, - guint32 id_) -{ - gpointer *array; - - g_return_val_if_fail (id_pool != NULL, NULL); - g_return_val_if_fail (id_pool->array != NULL, NULL); - - array = (void*) id_pool->array->data; - - if (id_ >= id_pool->array->len || array[id_] == NULL) - { - g_warning ("The required ID of %u does not refer to an existing actor; " - "this usually implies that the pick() of an actor is not " - "correctly implemented or that there is an error in the " - "glReadPixels() implementation of the GL driver.", id_); - return NULL; - } - - return array[id_]; -} diff --git a/clutter/clutter/clutter-id-pool.h b/clutter/clutter/clutter-id-pool.h deleted file mode 100644 index 2c41363ae..000000000 --- a/clutter/clutter/clutter-id-pool.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Clutter. - * - * An OpenGL based 'interactive canvas' library. - * - * Authored By Matthew Allum - * - * Copyright (C) 2008 OpenedHand - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - * - * ClutterIDPool: pool of reusable integer ids associated with pointers. - * - * Author: Øyvind Kolås - */ - -#ifndef __CLUTTER_ID_POOL_H__ -#define __CLUTTER_ID_POOL_H__ - -#include - -G_BEGIN_DECLS - -typedef struct _ClutterIDPool ClutterIDPool; - -ClutterIDPool * _clutter_id_pool_new (guint initial_size); -void _clutter_id_pool_free (ClutterIDPool *id_pool); - -guint32 _clutter_id_pool_add (ClutterIDPool *id_pool, - gpointer ptr); -void _clutter_id_pool_remove (ClutterIDPool *id_pool, - guint32 id_); -gpointer _clutter_id_pool_lookup (ClutterIDPool *id_pool, - guint32 id_); - - -G_END_DECLS - -#endif /* __CLUTTER_ID_POOL_H__ */ diff --git a/clutter/clutter/clutter-private.h b/clutter/clutter/clutter-private.h index f16333e0a..9492ba4af 100644 --- a/clutter/clutter/clutter-private.h +++ b/clutter/clutter/clutter-private.h @@ -34,7 +34,6 @@ #include "clutter-backend.h" #include "clutter-effect.h" #include "clutter-event.h" -#include "clutter-id-pool.h" #include "clutter-layout-manager.h" #include "clutter-settings.h" #include "clutter-stage-manager.h" diff --git a/clutter/clutter/clutter-stage.c b/clutter/clutter/clutter-stage.c index 3b083d0cc..048c46a58 100644 --- a/clutter/clutter/clutter-stage.c +++ b/clutter/clutter/clutter-stage.c @@ -56,7 +56,6 @@ #include "clutter-frame-clock.h" #include "clutter-frame.h" #include "clutter-grab.h" -#include "clutter-id-pool.h" #include "clutter-input-device-private.h" #include "clutter-main.h" #include "clutter-marshal.h" diff --git a/clutter/clutter/meson.build b/clutter/clutter/meson.build index 41c5b0e74..8a96e3150 100644 --- a/clutter/clutter/meson.build +++ b/clutter/clutter/meson.build @@ -204,7 +204,6 @@ clutter_private_headers = [ 'clutter-frame-private.h', 'clutter-graphene.h', 'clutter-gesture-action-private.h', - 'clutter-id-pool.h', 'clutter-input-device-private.h', 'clutter-input-focus-private.h', 'clutter-input-method-private.h', @@ -226,7 +225,6 @@ clutter_private_headers = [ clutter_nonintrospected_sources = [ 'clutter-easing.c', - 'clutter-id-pool.c', ] clutter_deprecated_headers = [