This time, in Clutter core.
The ObjC standard library provides a type called 'id', which obviously
requires any library to either drop the useful shadowed variable warning
or stop using 'id' as a variable name.
Yes, it's almost unbearably stupid. Well, at least it's not 'index' in
string.h, or 'y2' in math.h.
for (l = elements; l != NULL; l = l->next)
{
JsonNode *element = l->data;
- const gchar *id = _clutter_script_get_id_from_node (element);
+ const gchar *id_ = _clutter_script_get_id_from_node (element);
GObject *meta;
- if (id == NULL || *id == '\0')
+ if (id_ == NULL || *id_ == '\0')
continue;
- meta = clutter_script_get_object (script, id);
+ meta = clutter_script_get_object (script, id_);
if (meta == NULL)
continue;
for (l = elements; l != NULL; l = l->next)
{
JsonNode *element = l->data;
- const gchar *id = _clutter_script_get_id_from_node (element);
+ const gchar *id_ = _clutter_script_get_id_from_node (element);
GObject *behaviour;
- if (id == NULL || *id == '\0')
+ if (id_ == NULL || *id_ == '\0')
continue;
- behaviour = clutter_script_get_object (script, id);
+ behaviour = clutter_script_get_object (script, id_);
if (behaviour == NULL)
continue;
ClutterEvent *event,
gboolean capture);
-ClutterActor * clutter_get_actor_by_gid (guint32 id);
+ClutterActor * clutter_get_actor_by_gid (guint32 id_);
gboolean clutter_actor_set_shader (ClutterActor *self,
ClutterShader *shader);
JsonObject *object;
JsonArray *keys;
GObject *gobject;
- const gchar *id, *pname;
+ const gchar *id_, *pname;
GObjectClass *klass;
GParamSpec *pspec;
GSList *valid_keys = NULL;
return;
}
- id = json_object_get_string_member (object, "object");
- gobject = clutter_script_get_object (clos->script, id);
+ id_ = json_object_get_string_member (object, "object");
+ gobject = clutter_script_get_object (clos->script, id_);
if (gobject == NULL)
{
- g_warning ("No object with id '%s' has been defined.", id);
+ g_warning ("No object with id '%s' has been defined.", id_);
return;
}
g_warning ("The object of type '%s' and name '%s' has no "
"property named '%s'",
G_OBJECT_TYPE_NAME (gobject),
- id,
+ id_,
pname);
return;
}
gpointer ptr)
{
gpointer *array;
- guint32 id;
+ 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;
- id = GPOINTER_TO_UINT (id_pool->free_ids->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[id] = ptr;
- return id;
+ array[retval] = ptr;
+ return retval;
}
/* Allocate new id */
- id = id_pool->array->len;
+ retval = id_pool->array->len;
g_array_append_val (id_pool->array, ptr);
- return id;
+
+ return retval;
}
void
clutter_id_pool_remove (ClutterIDPool *id_pool,
- guint32 id)
+ guint32 id_)
{
gpointer *array;
g_return_if_fail (id_pool != NULL);
+
array = (void*) id_pool->array->data;
- array[id] = (void*)0xdecafbad; /* set pointer to a recognizably voided
- value */
+ /* set pointer to a recognizably voided value */
+ array[id_] = (void*)0xdecafbad;
id_pool->free_ids = g_slist_prepend (id_pool->free_ids,
- GUINT_TO_POINTER (id));
+ GUINT_TO_POINTER (id_));
}
gpointer
clutter_id_pool_lookup (ClutterIDPool *id_pool,
- guint32 id)
+ guint32 id_)
{
gpointer *array;
array = (void*) id_pool->array->data;
- if (id >= id_pool->array->len || array[id] == NULL)
+ 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);
+ "glReadPixels() implementation of the GL driver.", id_);
return NULL;
}
- return array[id];
+ return array[id_];
}
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);
+ guint32 id_);
gpointer clutter_id_pool_lookup (ClutterIDPool *id_pool,
- guint32 id);
+ guint32 id_);
G_END_DECLS
}
static inline ClutterActor *
-_clutter_actor_get_by_id (guint32 id)
+_clutter_actor_get_by_id (guint32 actor_id)
{
ClutterMainContext *context = _clutter_context_get_default ();
g_assert (context->id_pool != NULL);
- return clutter_id_pool_lookup (context->id_pool, id);
+ return clutter_id_pool_lookup (context->id_pool, actor_id);
}
void
-_clutter_id_to_color (guint id, ClutterColor *col)
+_clutter_id_to_color (guint id_,
+ ClutterColor *col)
{
ClutterMainContext *ctx;
gint red, green, blue;
}
/* compute the numbers we'll store in the components */
- red = (id >> (ctx->fb_g_mask_used+ctx->fb_b_mask_used))
+ red = (id_ >> (ctx->fb_g_mask_used+ctx->fb_b_mask_used))
& (0xff >> (8-ctx->fb_r_mask_used));
- green = (id >> ctx->fb_b_mask_used)
+ green = (id_ >> ctx->fb_b_mask_used)
& (0xff >> (8-ctx->fb_g_mask_used));
- blue = (id)
+ blue = (id_)
& (0xff >> (8-ctx->fb_b_mask_used));
/* shift left bits a bit and add one, this circumvents
_clutter_pixel_to_id (guchar pixel[4])
{
ClutterMainContext *ctx;
- gint red, green, blue;
- guint id;
+ gint red, green, blue;
+ guint retval;
ctx = _clutter_context_get_default ();
blue = blue >> (ctx->fb_b_mask - ctx->fb_b_mask_used);
/* combine the correct per component values into the final id */
- id = blue
- + (green << ctx->fb_b_mask_used)
- + (red << (ctx->fb_b_mask_used + ctx->fb_g_mask_used));
+ retval = blue
+ + (green << ctx->fb_b_mask_used)
+ + (red << (ctx->fb_b_mask_used + ctx->fb_g_mask_used));
- return id;
+ return retval;
}
#ifdef USE_GDKPIXBUF
static void
-pixbuf_free (guchar *pixels, gpointer data)
+pixbuf_free (guchar *pixels,
+ gpointer data)
{
g_free (pixels);
}
static void
read_pixels_to_file (char *filename_stem,
- int x,
- int y,
- int width,
- int height)
+ int x,
+ int y,
+ int width,
+ int height)
{
#ifdef USE_GDKPIXBUF
GLubyte *data;
ClutterPickMode mode)
{
ClutterMainContext *context;
- guchar pixel[4] = { 0xff, 0xff, 0xff, 0xff };
- CoglColor stage_pick_id;
- guint32 id;
- GLboolean dither_was_on;
- ClutterActor *actor;
- gboolean is_clipped;
+ guchar pixel[4] = { 0xff, 0xff, 0xff, 0xff };
+ CoglColor stage_pick_id;
+ guint32 id_;
+ GLboolean dither_was_on;
+ ClutterActor *actor;
+ gboolean is_clipped;
CLUTTER_STATIC_COUNTER (do_pick_counter,
"_clutter_do_pick counter",
"Increments for each full pick run",
goto result;
}
- id = _clutter_pixel_to_id (pixel);
- actor = _clutter_actor_get_by_id (id);
+ id_ = _clutter_pixel_to_id (pixel);
+ actor = _clutter_actor_get_by_id (id_);
goto result;
}
goto result;
}
- id = _clutter_pixel_to_id (pixel);
- actor = _clutter_actor_get_by_id (id);
+ id_ = _clutter_pixel_to_id (pixel);
+ actor = _clutter_actor_get_by_id (id_);
result:
/**
* clutter_get_actor_by_gid:
- * @id: a #ClutterActor ID.
+ * @id_: a #ClutterActor unique id.
*
- * Retrieves the #ClutterActor with @id.
+ * Retrieves the #ClutterActor with @id_.
*
* Return value: (transfer none): the actor with the passed id or %NULL.
* The returned actor does not have its reference count increased.
* Since: 0.6
*/
ClutterActor *
-clutter_get_actor_by_gid (guint32 id)
+clutter_get_actor_by_gid (guint32 id_)
{
- return _clutter_actor_get_by_id (id);
+ return _clutter_actor_get_by_id (id_);
}
void
/**
* clutter_grab_pointer_for_device:
* @actor: a #ClutterActor
- * @id: a device id, or -1
+ * @id_: a device id, or -1
*
* Grabs all the pointer events coming from the device @id for @actor.
*
*/
void
clutter_grab_pointer_for_device (ClutterActor *actor,
- gint id)
+ gint id_)
{
ClutterInputDevice *dev;
g_return_if_fail (actor == NULL || CLUTTER_IS_ACTOR (actor));
/* essentially a global grab */
- if (id == -1)
+ if (id_ == -1)
{
clutter_grab_pointer (actor);
return;
}
- dev = clutter_get_input_device_for_id (id);
-
- if (!dev)
+ dev = clutter_get_input_device_for_id (id_);
+ if (dev == NULL)
return;
if (dev->pointer_grab_actor == actor)
if (dev->pointer_grab_actor)
{
g_object_weak_unref (G_OBJECT (dev->pointer_grab_actor),
- on_pointer_grab_weak_notify,
- dev);
+ on_pointer_grab_weak_notify,
+ dev);
dev->pointer_grab_actor = NULL;
}
dev->pointer_grab_actor = actor;
g_object_weak_ref (G_OBJECT (actor),
- on_pointer_grab_weak_notify,
- dev);
+ on_pointer_grab_weak_notify,
+ dev);
}
}
/**
* clutter_ungrab_pointer_for_device:
- * @id: a device id
+ * @id_: a device id
*
- * Removes an existing grab of the pointer events for device @id.
+ * Removes an existing grab of the pointer events for device @id_.
*
* Since: 0.8
*/
void
-clutter_ungrab_pointer_for_device (gint id)
+clutter_ungrab_pointer_for_device (gint id_)
{
- clutter_grab_pointer_for_device (NULL, id);
+ clutter_grab_pointer_for_device (NULL, id_);
}
/**
* clutter_get_input_device_for_id:
- * @id: the unique id for a device
+ * @id_: the unique id for a device
*
- * Retrieves the #ClutterInputDevice from its @id. This is a convenience
+ * Retrieves the #ClutterInputDevice from its @id_. This is a convenience
* wrapper for clutter_device_manager_get_device() and it is functionally
* equivalent to:
*
* Since: 0.8
*/
ClutterInputDevice *
-clutter_get_input_device_for_id (gint id)
+clutter_get_input_device_for_id (gint id_)
{
ClutterDeviceManager *manager;
manager = clutter_device_manager_get_default ();
- return clutter_device_manager_get_device (manager, id);
+ return clutter_device_manager_get_device (manager, id_);
}
/**
void clutter_set_font_flags (ClutterFontFlags flags);
ClutterFontFlags clutter_get_font_flags (void);
-ClutterInputDevice *clutter_get_input_device_for_id (gint id);
+ClutterInputDevice *clutter_get_input_device_for_id (gint id_);
void clutter_grab_pointer_for_device (ClutterActor *actor,
- gint id);
+ gint id_);
-void clutter_ungrab_pointer_for_device (gint id);
+void clutter_ungrab_pointer_for_device (gint id_);
PangoFontMap * clutter_get_font_map (void);
static GNode *
find_entry_by_id (ClutterScore *score,
- gulong id)
+ gulong id_)
{
ClutterScorePrivate *priv = score->priv;
TraverseClosure closure;
closure.action = FIND_BY_ID;
closure.score = score;
- closure.d.id = id;
+ closure.d.id = id_;
closure.result = NULL;
g_node_traverse (priv->root,
/**
* clutter_score_remove:
* @score: a #ClutterScore
- * @id: the id of the timeline to remove
+ * @id_: the id of the timeline to remove
*
* Removes the #ClutterTimeline with the given id inside @score. If
* the timeline has other timelines attached to it, those are removed
*/
void
clutter_score_remove (ClutterScore *score,
- gulong id)
+ gulong id_)
{
ClutterScorePrivate *priv;
TraverseClosure closure;
g_return_if_fail (CLUTTER_IS_SCORE (score));
- g_return_if_fail (id > 0);
+ g_return_if_fail (id_ > 0);
priv = score->priv;
closure.action = REMOVE_BY_ID;
closure.score = score;
- closure.d.id = id;
+ closure.d.id = id_;
closure.result = NULL;
g_node_traverse (priv->root,
/**
* clutter_score_get_timeline:
* @score: a #ClutterScore
- * @id: the id of the timeline
+ * @id_: the id of the timeline
*
- * Retrieves the #ClutterTimeline for @id inside @score.
+ * Retrieves the #ClutterTimeline for @id_ inside @score.
*
* Return value: (transfer none): the requested timeline, or %NULL. This
* function does not increase the reference count on the returned
*/
ClutterTimeline *
clutter_score_get_timeline (ClutterScore *score,
- gulong id)
+ gulong id_)
{
GNode *node;
ClutterScoreEntry *entry;
g_return_val_if_fail (CLUTTER_IS_SCORE (score), NULL);
- g_return_val_if_fail (id > 0, NULL);
+ g_return_val_if_fail (id_ > 0, NULL);
- node = find_entry_by_id (score, id);
+ node = find_entry_by_id (score, id_);
if (G_UNLIKELY (!node))
return NULL;
const gchar *marker_name,
ClutterTimeline *timeline);
void clutter_score_remove (ClutterScore *score,
- gulong id);
+ gulong id_);
void clutter_score_remove_all (ClutterScore *score);
ClutterTimeline *clutter_score_get_timeline (ClutterScore *score,
- gulong id);
+ gulong id_);
GSList * clutter_score_list_timelines (ClutterScore *score);
void clutter_score_start (ClutterScore *score);
for (i = 0; i < array_len; i++)
{
JsonNode *child = json_array_get_element (array, i);
- const gchar *id;
+ const gchar *id_;
- id = _clutter_script_get_id_from_node (child);
- if (id)
- retval = g_list_prepend (retval, g_strdup (id));
+ id_ = _clutter_script_get_id_from_node (child);
+ if (id_ != NULL)
+ retval = g_list_prepend (retval, g_strdup (id_));
}
return g_list_reverse (retval);
if (JSON_NODE_TYPE (val) == JSON_NODE_VALUE &&
json_node_get_string (val) != NULL)
{
- const gchar *id = json_node_get_string (val);
+ const gchar *id_ = json_node_get_string (val);
timeline =
- CLUTTER_TIMELINE (clutter_script_get_object (script, id));
+ CLUTTER_TIMELINE (clutter_script_get_object (script, id_));
}
else if (JSON_NODE_TYPE (val) == JSON_NODE_OBJECT)
{
}
val = json_object_get_member (object, "mode");
- if (val)
+ if (val != NULL)
mode = clutter_script_resolve_animation_mode (val);
if (mode == CLUTTER_CUSTOM_MODE)
ClutterScript *script = parser->script;
ObjectInfo *oinfo;
JsonNode *val;
- const gchar *id;
+ const gchar *id_;
GList *members, *l;
/* if the object definition does not have an 'id' field we'll
return;
}
- id = json_object_get_string_member (object, "id");
- CLUTTER_NOTE (SCRIPT, "Getting object info for object '%s'", id);
+ id_ = json_object_get_string_member (object, "id");
+ CLUTTER_NOTE (SCRIPT, "Getting object info for object '%s'", id_);
- oinfo = _clutter_script_get_object_info (script, id);
+ oinfo = _clutter_script_get_object_info (script, id_);
if (oinfo == NULL)
{
const gchar *class_name;
oinfo = g_slice_new0 (ObjectInfo);
oinfo->merge_id = _clutter_script_get_last_merge_id (script);
- oinfo->id = g_strdup (id);
+ oinfo->id = g_strdup (id_);
class_name = json_object_get_string_member (object, "type");
oinfo->class_name = g_strdup (class_name);
{
GType p_type;
ObjectInfo *oinfo;
- const gchar *id;
+ const gchar *id_;
if (G_IS_VALUE (value))
p_type = G_VALUE_TYPE (value);
* definitions are parsed leaf-first we are guaranteed
* to have a defined object at this point
*/
- id = _clutter_script_get_id_from_node (node);
- if (id == NULL || *id == '\0')
+ id_ = _clutter_script_get_id_from_node (node);
+ if (id_ == NULL || *id_ == '\0')
return FALSE;
- oinfo = _clutter_script_get_object_info (script, id);
+ oinfo = _clutter_script_get_object_info (script, id_);
if (oinfo == NULL || oinfo->gtype == G_TYPE_INVALID )
return FALSE;
{
GObject *child = l->data;
ObjectInfo *child_info;
- const gchar *id;
+ const gchar *id_;
- id = clutter_get_script_id (child);
- if (id == NULL || *id == '\0')
+ id_ = clutter_get_script_id (child);
+ if (id_ == NULL || *id_ == '\0')
continue;
- child_info = _clutter_script_get_object_info (script, id);
+ child_info = _clutter_script_get_object_info (script, id_);
if (child_info == NULL)
continue;
/*
* _clutter_script_warn_missing_attribute:
* @script: a #ClutterScript
- * @id: the id of an object definition, or %NULL
+ * @id_: the id of an object definition, or %NULL
* @attribute: the expected attribute
*
* Emits a warning, using GLib's log facilities, for a missing
*/
void
_clutter_script_warn_missing_attribute (ClutterScript *script,
- const gchar *id,
+ const gchar *id_,
const gchar *attribute)
{
ClutterScriptPrivate *priv = script->priv;
JsonParser *parser = JSON_PARSER (priv->parser);
gint current_line = json_parser_get_current_line (parser);
- if (id != NULL && *id != '\0')
+ if (id_ != NULL && *id_ != '\0')
{
g_warning ("%s:%d: object '%s' has no '%s' attribute",
priv->is_filename ? priv->filename : "<input>",
current_line,
- id,
+ id_,
attribute);
}
else
/**
* clutter_scriptable_set_id:
* @scriptable: a #ClutterScriptable
- * @id: the #ClutterScript id of the object
+ * @id_: the #ClutterScript id of the object
*
- * Sets @id as the unique Clutter script it for this instance of
+ * Sets @id_ as the unique Clutter script it for this instance of
* #ClutterScriptableIface.
*
* This name can be used by user interface designer applications to
*/
void
clutter_scriptable_set_id (ClutterScriptable *scriptable,
- const gchar *id)
+ const gchar *id_)
{
ClutterScriptableIface *iface;
g_return_if_fail (CLUTTER_IS_SCRIPTABLE (scriptable));
- g_return_if_fail (id != NULL);
+ g_return_if_fail (id_ != NULL);
iface = CLUTTER_SCRIPTABLE_GET_IFACE (scriptable);
if (iface->set_id)
- iface->set_id (scriptable, id);
+ iface->set_id (scriptable, id_);
else
g_object_set_data_full (G_OBJECT (scriptable),
"clutter-script-id",
- g_strdup (id),
+ g_strdup (id_),
g_free);
}
/*< public >*/
void (* set_id) (ClutterScriptable *scriptable,
- const gchar *id);
+ const gchar *id_);
const gchar *(* get_id) (ClutterScriptable *scriptable);
gboolean (* parse_custom_node) (ClutterScriptable *scriptable,
GType clutter_scriptable_get_type (void) G_GNUC_CONST;
void clutter_scriptable_set_id (ClutterScriptable *scriptable,
- const gchar *id);
+ const gchar *id_);
G_CONST_RETURN gchar *clutter_scriptable_get_id (ClutterScriptable *scriptable);
gboolean clutter_scriptable_parse_custom_node (ClutterScriptable *scriptable,
ClutterScript *script,
if (json_object_has_member (object, "animator"))
{
- const gchar *id = json_object_get_string_member (object, "animator");
+ const gchar *id_ = json_object_get_string_member (object, "animator");
GObject *animator;
- animator = clutter_script_get_object (clos->script, id);
+ animator = clutter_script_get_object (clos->script, id_);
if (animator == NULL)
{
- g_warning ("No object with id '%s' has been defined.", id);
+ g_warning ("No object with id '%s' has been defined.", id_);
return;
}
ClutterStateKey *state_key;
GObject *gobject;
GParamSpec *pspec;
- const gchar *id;
+ const gchar *id_;
const gchar *property;
gulong mode;
gboolean res;
- id = json_array_get_string_element (key, 0);
- gobject = clutter_script_get_object (clos->script, id);
+ id_ = json_array_get_string_element (key, 0);
+ gobject = clutter_script_get_object (clos->script, id_);
if (gobject == NULL)
{
- g_warning ("No object with id '%s' has been defined.", id);
+ g_warning ("No object with id '%s' has been defined.", id_);
continue;
}
g_warning ("The object of type '%s' and name '%s' has no "
"property named '%s'.",
G_OBJECT_TYPE_NAME (gobject),
- id,
+ id_,
property);
continue;
}
g_warning ("Unable to parse the key value for the "
"property '%s' of object '%s' at index %d",
property,
- id,
+ id_,
index_);
clutter_state_key_free (state_key);
continue;
/**
* clutter_timeout_pool_remove:
* @pool: a #ClutterTimeoutPool
- * @id: the id of the timeout to remove
+ * @id_: the id of the timeout to remove
*
- * Removes a timeout function with @id from the timeout pool. The id
+ * Removes a timeout function with @id_ from the timeout pool. The id
* is the same returned when adding a function to the timeout pool with
* clutter_timeout_pool_add().
*
*/
void
clutter_timeout_pool_remove (ClutterTimeoutPool *pool,
- guint id)
+ guint id_)
{
GList *l;
- if ((l = g_list_find_custom (pool->timeouts, GUINT_TO_POINTER (id),
+ if ((l = g_list_find_custom (pool->timeouts, GUINT_TO_POINTER (id_),
clutter_timeout_find_by_id)))
{
clutter_timeout_unref (l->data);
pool->timeouts = g_list_delete_link (pool->timeouts, l);
}
else if ((l = g_list_find_custom (pool->dispatched_timeouts,
- GUINT_TO_POINTER (id),
+ GUINT_TO_POINTER (id_),
clutter_timeout_find_by_id)))
{
clutter_timeout_unref (l->data);
gpointer data,
GDestroyNotify notify);
void clutter_timeout_pool_remove (ClutterTimeoutPool *pool,
- guint id);
+ guint id_);
#endif /* CLUTTER_DISABLE_DEPRECATED */