Fix various compiler warnings

Most of these fixes are simple symbol shadowing issues, like index and the
braindead y0 and y1 extern symbols exported by math.h on GNU libc systems.

There is a masking issue in ClutterTexture which should be checked; I ran
the tests and everything looked fine.

The rest are just unused variables.
This commit is contained in:
Emmanuele Bassi 2007-07-26 11:04:04 +00:00
parent 71351e6fd8
commit 454e493197
21 changed files with 159 additions and 164 deletions

View File

@ -1269,20 +1269,20 @@ clutter_actor_get_geometry (ClutterActor *self,
/**
* clutter_actor_get_coords:
* @self: A #ClutterActor
* @x1: A location to store actors left position if non NULL.
* @y1: A location to store actors top position if non NULL.
* @x2: A location to store actors right position if non NULL.
* @y2: A location to store actors bottom position if non NULL.
* @x_1: A location to store actors left position, or %NULL.
* @y_1: A location to store actors top position, or %NULL.
* @x_2: A location to store actors right position, or %NULL.
* @y_2: A location to store actors bottom position, or %NULL.
*
* Gets the actors untransformed bounding rectangle co-ordinates in pixels
* relative to any parent actor.
*/
void
clutter_actor_get_coords (ClutterActor *self,
gint *x1,
gint *y1,
gint *x2,
gint *y2)
gint *x_1,
gint *y_1,
gint *x_2,
gint *y_2)
{
ClutterActorBox box;
@ -1290,17 +1290,17 @@ clutter_actor_get_coords (ClutterActor *self,
clutter_actor_query_coords (self, &box);
if (x1)
*x1 = CLUTTER_UNITS_TO_INT (box.x1);
if (x_1)
*x_1 = CLUTTER_UNITS_TO_INT (box.x1);
if (y1)
*y1 = CLUTTER_UNITS_TO_INT (box.y1);
if (y_1)
*y_1 = CLUTTER_UNITS_TO_INT (box.y1);
if (x2)
*x2 = CLUTTER_UNITS_TO_INT (box.x2);
if (x_2)
*x_2 = CLUTTER_UNITS_TO_INT (box.x2);
if (y2)
*y2 = CLUTTER_UNITS_TO_INT (box.y2);
if (y_2)
*y_2 = CLUTTER_UNITS_TO_INT (box.y2);
}
/**

View File

@ -228,10 +228,10 @@ void clutter_actor_set_geometry (ClutterActor *sel
void clutter_actor_get_geometry (ClutterActor *self,
ClutterGeometry *geometry);
void clutter_actor_get_coords (ClutterActor *self,
gint *x1,
gint *y1,
gint *x2,
gint *y2);
gint *x_1,
gint *y_1,
gint *x_2,
gint *y_2);
void clutter_actor_set_size (ClutterActor *self,
gint width,
gint height);

View File

@ -214,16 +214,16 @@ clutter_bezier_advance (ClutterBezier *b, _FixedT L, ClutterKnot * knot)
}
static void
clutter_bezier_init (ClutterBezier * b,
gint x0, gint y0,
gint x1, gint y1,
gint x2, gint y2,
gint x3, gint y3)
clutter_bezier_init (ClutterBezier *b,
gint x_0, gint y_0,
gint x_1, gint y_1,
gint x_2, gint y_2,
gint x_3, gint y_3)
{
_FixedT t;
int i;
int xp = x0;
int yp = y0;
int xp = x_0;
int yp = y_0;
_FixedT length [CBZ_T_SAMPLES + 1];
#ifdef CBZ_L2T_INTERPOLATION
@ -237,17 +237,17 @@ clutter_bezier_init (ClutterBezier * b,
x0, y0, x1, y1, x2, y2, x3, y3);
#endif
b->dx = x0;
b->dy = y0;
b->dx = x_0;
b->dy = y_0;
b->cx = 3 * (x1 - x0);
b->cy = 3 * (y1 - y0);
b->cx = 3 * (x_1 - x_0);
b->cy = 3 * (y_1 - y_0);
b->bx = 3 * (x2 - x1) - b->cx;
b->by = 3 * (y2 - y1) - b->cy;
b->bx = 3 * (x_2 - x_1) - b->cx;
b->by = 3 * (y_2 - y_1) - b->cy;
b->ax = x3 - 3 * x2 + 3 * x1 - x0;
b->ay = y3 - 3 * y2 + 3 * y1 - y0;
b->ax = x_3 - 3 * x_2 + 3 * x_1 - x_0;
b->ay = y_3 - 3 * y_2 + 3 * y_1 - y_0;
#if 0
g_debug ("Cooeficients {{%d,%d},{%d,%d},{%d,%d},{%d,%d}}",
@ -896,7 +896,7 @@ clutter_behaviour_bspline_join (ClutterBehaviourBspline *bs1,
ClutterBehaviourBspline *bs2)
{
ClutterBehaviourBsplinePrivate *priv;
gint i, x1, y1;
gint i, x_1, y_1;
ClutterKnot knot;
ClutterBezier *b, *b2;
@ -907,19 +907,19 @@ clutter_behaviour_bspline_join (ClutterBehaviourBspline *bs1,
b = g_array_index (priv->splines, ClutterBezier*, priv->splines->len - 1);
x1 = clutter_bezier_t2x (b, CBZ_T_ONE);
y1 = clutter_bezier_t2y (b, CBZ_T_ONE);
x_1 = clutter_bezier_t2x (b, CBZ_T_ONE);
y_1 = clutter_bezier_t2y (b, CBZ_T_ONE);
/*
* need to move bs2 so it joins bs1
*/
x1 -= knot.x;
y1 -= knot.y;
x_1 -= knot.x;
y_1 -= knot.y;
for (i = 0; i < priv->splines->len; ++i)
{
b = g_array_index (bs2->priv->splines, ClutterBezier*, i);
b2 = clutter_bezier_clone_and_move (b, x1, y1);
b2 = clutter_bezier_clone_and_move (b, x_1, y_1);
priv->length += b2->length;
g_array_append_val (priv->splines, b2);

View File

@ -421,21 +421,21 @@ clutter_behaviour_get_n_actors (ClutterBehaviour *behave)
/**
* clutter_behaviour_get_nth_actor:
* @behave: a #ClutterBehaviour
* @index: the index of an actor this behaviour is applied too.
* @index_: the index of an actor this behaviour is applied too.
*
* Gets an actor the behaviour was applied to referenced by index num.
*
* Return value: A Clutter actor or NULL if index is invalid.
* Return value: A Clutter actor or NULL if @index_ is invalid.
*
* Since: 0.2
*/
ClutterActor*
clutter_behaviour_get_nth_actor (ClutterBehaviour *behave,
gint index)
gint index_)
{
g_return_val_if_fail (CLUTTER_IS_BEHAVIOUR (behave), NULL);
return g_slist_nth_data (behave->priv->actors, index);
return g_slist_nth_data (behave->priv->actors, index_);
}

View File

@ -387,19 +387,19 @@ clutter_box_query_child (ClutterBox *box,
/**
* clutter_box_query_nth_child:
* @box: a #ClutterBox
* @index: position of the child
* @index_: position of the child
* @child: return value for a #ClutterBoxChild, or %NULL
*
* Queries the child of @box at @index and puts the packing informations
* Queries the child of @box at @index_ and puts the packing informations
* inside @child.
*
* Return value: %TRUE if an actor was found at @index
* Return value: %TRUE if an actor was found at @index_
*
* Since: 0.4
*/
gboolean
clutter_box_query_nth_child (ClutterBox *box,
gint index,
gint index_,
ClutterBoxChild *child)
{
ClutterBoxChild *box_child;
@ -407,7 +407,7 @@ clutter_box_query_nth_child (ClutterBox *box,
g_return_val_if_fail (CLUTTER_IS_BOX (box), FALSE);
g_return_val_if_fail (index > 0, FALSE);
box_child = g_list_nth_data (box->children, index);
box_child = g_list_nth_data (box->children, index_);
if (!box_child)
return FALSE;

View File

@ -92,7 +92,7 @@ gboolean clutter_box_query_child (ClutterBox *box,
ClutterActor *actor,
ClutterBoxChild *child);
gboolean clutter_box_query_nth_child (ClutterBox *box,
gint index,
gint index_,
ClutterBoxChild *child);
G_END_DECLS

View File

@ -63,14 +63,14 @@ struct _ClutterCloneTexturePrivate
static void
clone_texture_render_to_gl_quad (ClutterCloneTexture *ctexture,
int x1,
int y1,
int x2,
int y2)
int x_1,
int y_1,
int x_2,
int y_2)
{
gint qx1 = 0, qx2 = 0, qy1 = 0, qy2 = 0;
gint qwidth = 0, qheight = 0;
gint x, y, i =0, lastx = 0, lasty = 0;
gint x, y, i = 0, lastx = 0, lasty = 0;
gint n_x_tiles, n_y_tiles;
gint pwidth, pheight;
float tx, ty;
@ -80,8 +80,8 @@ clone_texture_render_to_gl_quad (ClutterCloneTexture *ctexture,
priv = ctexture->priv;
qwidth = x2 - x1;
qheight = y2 - y1;
qwidth = x_2 - x_1;
qheight = y_2 - y_1;
if (!CLUTTER_ACTOR_IS_REALIZED (parent_actor))
clutter_actor_realize (parent_actor);
@ -109,7 +109,7 @@ clone_texture_render_to_gl_quad (ClutterCloneTexture *ctexture,
ty = (float) pheight / clutter_util_next_p2 (pheight);
}
cogl_texture_quad (x1, x2, y1, y2,
cogl_texture_quad (x_1, x_2, y_1, y_2,
0,
0,
CLUTTER_FLOAT_TO_FIXED (tx),
@ -142,10 +142,10 @@ clone_texture_render_to_gl_quad (ClutterCloneTexture *ctexture,
tx = (float) actual_w / xsize;
ty = (float) actual_h / ysize;
qx1 = x1 + lastx;
qx1 = x_1 + lastx;
qx2 = qx1 + ((qwidth * actual_w ) / pwidth );
qy1 = y1 + lasty;
qy1 = y_1 + lasty;
qy2 = qy1 + ((qheight * actual_h) / pheight );
CLUTTER_NOTE (TEXTURE,
@ -172,7 +172,7 @@ clutter_clone_texture_paint (ClutterActor *self)
{
ClutterCloneTexturePrivate *priv;
ClutterActor *parent_texture;
gint x1, y1, x2, y2;
gint x_1, y_1, x_2, y_2;
GLenum target_type;
ClutterColor col = { 0xff, 0xff, 0xff, 0xff };
@ -213,16 +213,16 @@ clutter_clone_texture_paint (ClutterActor *self)
col.alpha = clutter_actor_get_opacity (self);
cogl_color (&col);
clutter_actor_get_coords (self, &x1, &y1, &x2, &y2);
clutter_actor_get_coords (self, &x_1, &y_1, &x_2, &y_2);
CLUTTER_NOTE (PAINT, "paint to x1: %i, y1: %i x2: %i, y2: %i "
"opacity: %i",
x1, y1, x2, y2,
x_1, y_1, x_2, y_2,
clutter_actor_get_opacity (self));
/* Parent paint translated us into position */
clone_texture_render_to_gl_quad (CLUTTER_CLONE_TEXTURE (self),
0, 0, x2 - x1, y2 - y1);
0, 0, x_2 - x_1, y_2 - y_1);
cogl_pop_matrix ();
}

View File

@ -295,17 +295,17 @@ static void
clutter_entry_ensure_cursor_position (ClutterEntry *entry)
{
ClutterEntryPrivate *priv;
gint index;
PangoRectangle rect;
gint index_;
PangoRectangle rect;
priv = entry->priv;
if (priv->position == -1)
index = g_utf8_strlen (priv->text, -1);
index_ = g_utf8_strlen (priv->text, -1);
else
index = priv->position;
index_ = priv->position;
pango_layout_get_cursor_pos (priv->layout, index, &rect, NULL);
pango_layout_get_cursor_pos (priv->layout, index_, &rect, NULL);
priv->cursor_pos.x = rect.x / PANGO_SCALE;
priv->cursor_pos.y = rect.y / PANGO_SCALE;
priv->cursor_pos.width = ENTRY_CURSOR_WIDTH;

View File

@ -508,21 +508,21 @@ clutter_group_get_n_children (ClutterGroup *self)
/**
* clutter_group_get_nth_child:
* @self: A #ClutterGroup
* @index: the position of the requested actor.
* @index_: the position of the requested actor.
*
* Gets a groups child held at position index in stack.
* Gets a groups child held at @index_ in stack.
*
* Return value: A Clutter actor or NULL if index is invalid.
* Return value: A Clutter actor or NULL if @index_ is invalid.
*
* Since: 0.2
**/
ClutterActor *
clutter_group_get_nth_child (ClutterGroup *self,
gint index)
gint index_)
{
g_return_val_if_fail (CLUTTER_IS_GROUP (self), NULL);
return g_list_nth_data (self->priv->children, index);
return g_list_nth_data (self->priv->children, index_);
}
/**

View File

@ -89,7 +89,7 @@ ClutterActor *clutter_group_new (void);
ClutterActor *clutter_group_find_child_by_id (ClutterGroup *self,
guint id);
ClutterActor *clutter_group_get_nth_child (ClutterGroup *self,
gint index);
gint index_);
gint clutter_group_get_n_children (ClutterGroup *self);
void clutter_group_remove_all (ClutterGroup *group);

View File

@ -294,10 +294,10 @@ texture_init_tiles (ClutterTexture *texture)
static void
texture_render_to_gl_quad (ClutterTexture *texture,
int x1,
int y1,
int x2,
int y2)
int x_1,
int y_1,
int x_2,
int y_2)
{
int qx1 = 0, qx2 = 0, qy1 = 0, qy2 = 0;
int qwidth = 0, qheight = 0;
@ -308,8 +308,8 @@ texture_render_to_gl_quad (ClutterTexture *texture,
priv = texture->priv;
qwidth = x2-x1;
qheight = y2-y1;
qwidth = x_2 - x_1;
qheight = y_2 - y_1;
if (!priv->is_tiled)
{
@ -327,10 +327,10 @@ texture_render_to_gl_quad (ClutterTexture *texture,
}
qx1 = x1; qx2 = x2;
qy1 = y1; qy2 = y2;
qx1 = x_1; qx2 = x_2;
qy1 = y_1; qy2 = y_2;
cogl_texture_quad (x1, x2, y1, y2,
cogl_texture_quad (x_1, x_2, y_1, y_2,
0,
0,
CLUTTER_FLOAT_TO_FIXED (tx),
@ -339,7 +339,7 @@ texture_render_to_gl_quad (ClutterTexture *texture,
return;
}
for (x=0; x < priv->n_x_tiles; x++)
for (x = 0; x < priv->n_x_tiles; x++)
{
lasty = 0;
@ -359,10 +359,10 @@ texture_render_to_gl_quad (ClutterTexture *texture,
tx = (float) actual_w / priv->x_tiles[x].size;
ty = (float) actual_h / priv->y_tiles[y].size;
qx1 = x1 + lastx;
qx1 = x_1 + lastx;
qx2 = qx1 + ((qwidth * actual_w ) / priv->width );
qy1 = y1 + lasty;
qy1 = y_1 + lasty;
qy2 = qy1 + ((qheight * actual_h) / priv->height );
cogl_texture_quad (qx1, qx2, qy1, qy2,
@ -461,21 +461,21 @@ texture_upload_data (ClutterTexture *texture,
if (create_textures)
{
gint width, height;
gint tex_width, tex_height;
width = priv->width;
height = priv->height;
tex_width = priv->width;
tex_height = priv->height;
if (priv->target_type == CGL_TEXTURE_2D) /* POT */
{
width = clutter_util_next_p2(priv->width);
height = clutter_util_next_p2(priv->height);
tex_width = clutter_util_next_p2 (priv->width);
tex_height = clutter_util_next_p2 (priv->height);
}
cogl_texture_image_2d (priv->target_type,
CGL_RGBA,
width,
height,
tex_width,
tex_height,
priv->pixel_format,
priv->pixel_type,
NULL);
@ -703,22 +703,22 @@ static void
clutter_texture_paint (ClutterActor *self)
{
ClutterTexture *texture = CLUTTER_TEXTURE (self);
gint x1, y1, x2, y2;
ClutterTexturePrivate *priv = texture->priv;
gint x_1, y_1, x_2, y_2;
ClutterColor col = { 0xff, 0xff, 0xff, 0xff };
if (!CLUTTER_ACTOR_IS_REALIZED (CLUTTER_ACTOR(texture)))
clutter_actor_realize (CLUTTER_ACTOR(texture));
if (texture->priv->tiles == NULL)
if (priv->tiles == NULL)
{
/* We just need do debug this state, it doesn't really need to
* throw a an error as what previously happened. Sub classes
* quite likely may not be able to realize.
*/
CLUTTER_NOTE (PAINT,
"unable to paint texture '%s', contains no tiles",
clutter_actor_get_name (self)
? clutter_actor_get_name (self)
CLUTTER_NOTE (PAINT, "unable to paint texture '%s', contains no tiles",
clutter_actor_get_name (self)
? clutter_actor_get_name (self)
: "unknown");
return;
}
@ -729,7 +729,7 @@ clutter_texture_paint (ClutterActor *self)
: "unknown");
cogl_push_matrix ();
switch (texture->priv->target_type)
switch (priv->target_type)
{
case CGL_TEXTURE_2D:
cogl_enable (CGL_ENABLE_TEXTURE_2D|CGL_ENABLE_BLEND);
@ -745,15 +745,15 @@ clutter_texture_paint (ClutterActor *self)
cogl_color (&col);
clutter_actor_get_coords (self, &x1, &y1, &x2, &y2);
clutter_actor_get_coords (self, &x_1, &y_1, &x_2, &y_2);
CLUTTER_NOTE (PAINT, "paint to x1: %i, y1: %i x2: %i, y2: %i "
"opacity: %i",
x1, y1, x2, y2,
"opacity: %i",
x_1, y_1, x_2, y_2,
clutter_actor_get_opacity (self));
/* Paint will of translated us */
texture_render_to_gl_quad (texture, 0, 0, x2 - x1, y2 - y1);
texture_render_to_gl_quad (texture, 0, 0, x_2 - x_1, y_2 - y_1);
cogl_pop_matrix ();
}
@ -761,7 +761,7 @@ clutter_texture_paint (ClutterActor *self)
static void
clutter_texture_dispose (GObject *object)
{
ClutterTexture *texture = CLUTTER_TEXTURE(object);
ClutterTexture *texture = CLUTTER_TEXTURE (object);
ClutterTexturePrivate *priv;
priv = texture->priv;
@ -1589,7 +1589,7 @@ clutter_texture_get_base_size (ClutterTexture *texture,
/**
* clutter_texture_bind_tile:
* @texture: A #ClutterTexture
* @index: Tile index to bind
* @index_: Tile index to bind
*
* Proxys a call to glBindTexture a to bind an internal 'tile'.
*
@ -1597,12 +1597,16 @@ clutter_texture_get_base_size (ClutterTexture *texture,
* and never should be called by an application.
**/
void
clutter_texture_bind_tile (ClutterTexture *texture, gint index)
clutter_texture_bind_tile (ClutterTexture *texture,
gint index_)
{
ClutterTexturePrivate *priv;
g_return_if_fail (CLUTTER_IS_TEXTURE (texture));
priv = texture->priv;
cogl_texture_bind (priv->target_type, priv->tiles[index]);
cogl_texture_bind (priv->target_type, priv->tiles[index_]);
}
/**

View File

@ -311,7 +311,7 @@ draw_glyph (PangoRenderer *renderer_,
{
PangoClutterRenderer *renderer = PANGO_CLUTTER_RENDERER (renderer_);
glyph_info *g;
float x1, y1, x2, y2;
struct { float x1, y1, x2, y2; } box;
if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
{
@ -373,10 +373,10 @@ draw_glyph (PangoRenderer *renderer_,
x += g->left;
y -= g->top;
x1 = g->tex.x * (1. / TC_WIDTH );
y1 = g->tex.y * (1. / TC_HEIGHT);
x2 = g->tex.w * (1. / TC_WIDTH ) + x1;
y2 = g->tex.h * (1. / TC_HEIGHT) + y1;
box.x1 = g->tex.x * (1. / TC_WIDTH );
box.y1 = g->tex.y * (1. / TC_HEIGHT);
box.x2 = g->tex.w * (1. / TC_WIDTH ) + box.x1;
box.y2 = g->tex.h * (1. / TC_HEIGHT) + box.y1;
if (g->tex.name != renderer->curtex)
{
@ -395,19 +395,19 @@ draw_glyph (PangoRenderer *renderer_,
x + g->tex.w,
y,
y + g->tex.h,
CLUTTER_FLOAT_TO_FIXED(x1),
CLUTTER_FLOAT_TO_FIXED(y1),
CLUTTER_FLOAT_TO_FIXED(x2),
CLUTTER_FLOAT_TO_FIXED(y2));
CLUTTER_FLOAT_TO_FIXED (box.x1),
CLUTTER_FLOAT_TO_FIXED (box.y1),
CLUTTER_FLOAT_TO_FIXED (box.x2),
CLUTTER_FLOAT_TO_FIXED (box.y2));
}
static void
draw_trapezoid (PangoRenderer *renderer_,
PangoRenderPart part,
double y1,
double y01,
double x11,
double x21,
double y2,
double y02,
double x12,
double x22)
{
@ -422,10 +422,10 @@ draw_trapezoid (PangoRenderer *renderer_,
/* Turn texturing off */
cogl_enable (CGL_ENABLE_BLEND);
cogl_trapezoid ((gint) y1,
cogl_trapezoid ((gint) y01,
(gint) x11,
(gint) x21,
(gint) y2,
(gint) y02,
(gint) x12,
(gint) x22);

View File

@ -41,8 +41,6 @@ input_cb (ClutterStage *stage,
ClutterEvent *event,
gpointer data)
{
SuperOH *oh = (SuperOH *)data;
if (event->type == CLUTTER_BUTTON_PRESS)
{
ClutterButtonEvent *button_event;
@ -81,7 +79,6 @@ frame_cb (ClutterTimeline *timeline,
gpointer data)
{
SuperOH *oh = (SuperOH *)data;
ClutterActor *stage = clutter_stage_get_default ();
gint i;
/* Rotate everything clockwise about stage center*/
@ -158,7 +155,7 @@ main (int argc, char *argv[])
/* Create a timeline to manage animation */
timeline = clutter_timeline_new (360, 60); /* num frames, fps */
g_object_set(timeline, "loop", TRUE, 0); /* have it loop */
g_object_set (timeline, "loop", TRUE, NULL); /* have it loop */
/* fire a callback for frame change */
g_signal_connect (timeline, "new-frame", G_CALLBACK (frame_cb), oh);

View File

@ -61,7 +61,6 @@ main (int argc, char *argv[])
ClutterColor rect_border_color = { 0, 0, 0, 0 };
GdkPixbuf *pixbuf;
int i;
char *p;
path_t path_type = PATH_POLY;
ClutterKnot knots_poly[] = {{ 0, 0 }, { 0, 300 }, { 300, 300 },
@ -150,7 +149,7 @@ main (int argc, char *argv[])
/* Make a timeline */
timeline = clutter_timeline_new (100, 26); /* num frames, fps */
g_object_set (timeline, "loop", TRUE, 0);
g_object_set (timeline, "loop", TRUE, NULL);
/* Set an alpha func to power behaviour - ramp is constant rise/fall */
alpha = clutter_alpha_new_full (timeline,

View File

@ -1,10 +1,12 @@
#include <clutter/clutter.h>
#if 0
static void
on_entry_text_changed (ClutterEntry *entry)
{
g_print ("Text changed\n");
}
#endif
void
on_key_release_cb (ClutterStage *stage, ClutterEvent *event, ClutterEntry *entry)
@ -26,11 +28,8 @@ on_entry_activated (ClutterEntry *entry, gpointer null)
int
main (int argc, char *argv[])
{
ClutterTimeline *timeline;
ClutterActor *entry;
ClutterActor *stage;
gchar *text;
gsize size;
ClutterColor stage_color = { 0x00, 0x00, 0x00, 0xff };
ClutterColor entry_color = { 0x33, 0xdd, 0xff, 0xff };
@ -56,7 +55,7 @@ main (int argc, char *argv[])
clutter_actor_show_all (stage);
g_signal_connect (stage, "key-release-event",
G_CALLBACK (on_key_release_cb), (gpointer)entry);
G_CALLBACK (on_key_release_cb), entry);
/*
g_signal_connect (entry, "text-changed",
@ -64,6 +63,7 @@ main (int argc, char *argv[])
*/
g_signal_connect (entry, "activate",
G_CALLBACK (on_entry_activated), NULL);
clutter_main();
return 0;

View File

@ -14,13 +14,13 @@ input_cb (ClutterStage *stage,
len = g_unichar_to_utf8 (clutter_keysym_to_unicode (event->key.keyval),
keybuf);
keybuf[len] = '\0';
printf("- KEY PRESS '%s'\n", keybuf);
printf ("- KEY PRESS '%s'\n", keybuf);
break;
case CLUTTER_KEY_RELEASE:
len = g_unichar_to_utf8 (clutter_keysym_to_unicode (event->key.keyval),
keybuf);
keybuf[len] = '\0';
printf("- KEY RELEASE '%s'\n");
printf ("- KEY RELEASE '%s'\n", keybuf);
break;
case CLUTTER_MOTION:
printf("- MOTION\n");
@ -52,6 +52,8 @@ input_cb (ClutterStage *stage,
case CLUTTER_DELETE:
printf("- DELETE\n");
break;
case CLUTTER_NOTHING:
break;
}
}

View File

@ -2,8 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
ClutterActor *stage, *rect, *p[5];
gboolean init_done = FALSE;
static ClutterActor *main_stage, *rect, *p[5];
static void
init_handles ()
@ -19,7 +18,7 @@ init_handles ()
p[i] = clutter_rectangle_new_with_color (&blue);
clutter_actor_set_size (p[i], 5, 5);
clutter_actor_set_position (p[i], 0, 0);
clutter_group_add (CLUTTER_GROUP(stage), p[i]);
clutter_group_add (CLUTTER_GROUP (main_stage), p[i]);
clutter_actor_set_position (p[i],
CLUTTER_FIXED_INT (v[i].x) -
@ -40,7 +39,7 @@ init_handles ()
p[4] = clutter_rectangle_new_with_color (&blue);
clutter_actor_set_size (p[4], 5, 5);
clutter_actor_set_position (p[4], 0, 0);
clutter_group_add (CLUTTER_GROUP(stage), p[4]);
clutter_group_add (CLUTTER_GROUP (main_stage), p[4]);
clutter_actor_set_position (p[4],
CLUTTER_FIXED_INT (v2.x) -
clutter_actor_get_width (p[4])/2,
@ -58,7 +57,6 @@ place_handles ()
gint i;
ClutterVertex v[4];
ClutterVertex v1, v2;
ClutterColor blue = { 0, 0, 0xff, 0xff };
clutter_actor_get_vertices (rect, v);
for (i = 0; i < 4; ++i)
@ -116,8 +114,6 @@ on_event (ClutterStage *stage,
if (actor != CLUTTER_ACTOR (stage))
{
guint32 x, y;
if (actor != rect)
dragging = actor;
}
@ -205,37 +201,33 @@ on_event (ClutterStage *stage,
int
main (int argc, char *argv[])
{
ClutterAlpha *alpha;
ClutterBehaviour *o_behave;
ClutterActor *label;
ClutterActor *label;
ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff },
red = { 0xff, 0, 0, 0xff },
white = { 0xff, 0xff, 0xff, 0xff };
clutter_init (&argc, &argv);
stage = clutter_stage_get_default ();
main_stage = clutter_stage_get_default ();
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color);
clutter_actor_set_size (stage, 640, 480);
clutter_stage_set_color (CLUTTER_STAGE (main_stage), &stage_color);
clutter_actor_set_size (main_stage, 640, 480);
rect = clutter_rectangle_new_with_color (&white);
clutter_actor_set_size (rect, 320, 240);
clutter_actor_set_position (rect, 180, 120);
clutter_actor_rotate_y (rect, 60, 0, 0);
clutter_group_add (CLUTTER_GROUP(stage), rect);
clutter_group_add (CLUTTER_GROUP (main_stage), rect);
label = clutter_label_new_with_text ("Mono 8pt",
"Drag the blue rectangles");
label = clutter_label_new_with_text ("Mono 8pt", "Drag the blue rectangles");
clutter_label_set_color (CLUTTER_LABEL (label), &white);
clutter_actor_set_position (label, 10, 10);
clutter_group_add (CLUTTER_GROUP(stage), label);
clutter_group_add (CLUTTER_GROUP (main_stage), label);
clutter_actor_show_all (stage);
clutter_actor_show_all (main_stage);
g_signal_connect (stage, "event", G_CALLBACK (on_event), NULL);
g_signal_connect (main_stage, "event", G_CALLBACK (on_event), NULL);
init_handles ();

View File

@ -15,8 +15,6 @@ main (int argc, char *argv[])
ClutterActor *stage;
ClutterActor *hand, *label;
ClutterColor stage_color = { 0xcc, 0xcc, 0xcc, 0xff };
ClutterColor rect_bg_color = { 0x33, 0x22, 0x22, 0xff };
ClutterColor rect_border_color = { 0, 0, 0, 0 };
GdkPixbuf *pixbuf;
clutter_init (&argc, &argv);
@ -46,7 +44,7 @@ main (int argc, char *argv[])
/* Make a timeline */
timeline = clutter_timeline_new (200, 26); /* num frames, fps */
g_object_set (timeline, "loop", TRUE, 0);
g_object_set (timeline, "loop", TRUE, NULL);
/* Set an alpha func to power behaviour - ramp is constant rise/fall */
alpha = clutter_alpha_new_full (timeline,
@ -59,7 +57,8 @@ main (int argc, char *argv[])
CLUTTER_ROTATE_CW,
0.0, 360.0);
clutter_behaviour_rotate_set_center (r_behave, 86, 125, 0);
clutter_behaviour_rotate_set_center (CLUTTER_BEHAVIOUR_ROTATE (r_behave),
86, 125, 0);
/* Apply it to our actor */
clutter_behaviour_apply (r_behave, hand);

View File

@ -1,3 +1,4 @@
#include <stdlib.h>
#include <clutter/clutter.h>
ClutterGravity gravitys[] = {
@ -77,4 +78,6 @@ main (int argc, char *argv[])
clutter_actor_show_all (stage);
clutter_main();
return EXIT_SUCCESS;
}

View File

@ -40,7 +40,7 @@ main (int argc, char *argv[])
clutter_actor_show_all (stage);
timeline = clutter_timeline_new (400, 60); /* num frames, fps */
g_object_set(timeline, "loop", TRUE, 0); /* have it loop */
g_object_set(timeline, "loop", TRUE, NULL); /* have it loop */
g_signal_connect(timeline, "new-frame", G_CALLBACK (frame_cb), label);

View File

@ -7,7 +7,6 @@ make_pixbuf (int width, int height, int bpp, int has_alpha)
GdkPixbuf *px;
gint x,y, rowstride, n_channels, i = 0;
guchar *pixels;
px = gdk_pixbuf_new (GDK_COLORSPACE_RGB,
has_alpha,
@ -20,12 +19,12 @@ make_pixbuf (int width, int height, int bpp, int has_alpha)
rowstride = gdk_pixbuf_get_rowstride (px);
n_channels = gdk_pixbuf_get_n_channels (px);
for (y=0; y<height; y++)
for (y = 0; y < height; y++)
{
i = 0;
for (x=0; x<width; x++)
for (x = 0; x < width; x++)
{
guchar *p, r, g, b, a;
guchar *p;
p = gdk_pixbuf_get_pixels (px) + y * rowstride + x * n_channels;