mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
2007-06-14 Matthew Allum <mallum@openedhand.com>
* clutter/clutter-actor.c: * clutter/clutter-actor.h: * clutter/clutter-group.c: * clutter/clutter-label.c: * clutter/egl/clutter-stage-egl.c: * clutter/glx/clutter-stage-glx.c: * clutter/sdl/clutter-stage-sdl.c: Rename clutter_actor_allocate_coords -> clutter_actor_query_coords Change repaints to G_PRIORITY_DEFAULT + 10. (timelines are G_PRIORITY_DEFAULT + 30, events G_PRIORITY_DEFAULT) * clutter/glx/clutter-event-glx.c: Handle shift modifier in keycode -> keysym translation. * tests/test-actors.c: Remove (broken) screen saver code. Add scaling behaviour, clean code a little
This commit is contained in:
parent
ae0de6c67c
commit
61e3252ff1
21
ChangeLog
21
ChangeLog
@ -1,3 +1,24 @@
|
||||
2007-06-14 Matthew Allum <mallum@openedhand.com>
|
||||
|
||||
* clutter/clutter-actor.c:
|
||||
* clutter/clutter-actor.h:
|
||||
* clutter/clutter-group.c:
|
||||
* clutter/clutter-label.c:
|
||||
* clutter/egl/clutter-stage-egl.c:
|
||||
* clutter/glx/clutter-stage-glx.c:
|
||||
* clutter/sdl/clutter-stage-sdl.c:
|
||||
Rename clutter_actor_allocate_coords -> clutter_actor_query_coords
|
||||
|
||||
Change repaints to G_PRIORITY_DEFAULT + 10.
|
||||
(timelines are G_PRIORITY_DEFAULT + 30, events G_PRIORITY_DEFAULT)
|
||||
|
||||
* clutter/glx/clutter-event-glx.c:
|
||||
Handle shift modifier in keycode -> keysym translation.
|
||||
|
||||
* tests/test-actors.c:
|
||||
Remove (broken) screen saver code.
|
||||
Add scaling behaviour, clean code a little.
|
||||
|
||||
2007-06-13 Tomas Frydrych <tf@openedhand.com>
|
||||
|
||||
* clutter/clutter-actor.c:
|
||||
|
@ -533,7 +533,7 @@ clutter_actor_project_vertices (ClutterActor * self,
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||
|
||||
/* FIXME: we should probably call allocate_cords on the actor to make
|
||||
/* FIXME: we should probably call query_cords on the actor to make
|
||||
* sure untransformed box is up to date.
|
||||
*/
|
||||
priv = self->priv;
|
||||
@ -901,19 +901,19 @@ clutter_actor_request_coords (ClutterActor *self,
|
||||
}
|
||||
|
||||
/**
|
||||
* clutter_actor_allocate_coords:
|
||||
* clutter_actor_query_coords:
|
||||
* @self: A #ClutterActor
|
||||
* @box: A location to store the actors #ClutterActorBox co-ordinates
|
||||
*
|
||||
* Requests the allocated co-ordinates for the #ClutterActor relative
|
||||
* to any parent.
|
||||
* Requests the queryd un transformed co-ordinates for the #ClutterActor
|
||||
* relative to any parent.
|
||||
*
|
||||
* This function should not be called directly by applications instead
|
||||
* the various position/geometry methods should be used.
|
||||
**/
|
||||
void
|
||||
clutter_actor_allocate_coords (ClutterActor *self,
|
||||
ClutterActorBox *box)
|
||||
clutter_actor_query_coords (ClutterActor *self,
|
||||
ClutterActorBox *box)
|
||||
{
|
||||
ClutterActorClass *klass;
|
||||
|
||||
@ -924,14 +924,14 @@ clutter_actor_allocate_coords (ClutterActor *self,
|
||||
box->x2 = self->priv->coords.x2;
|
||||
box->y2 = self->priv->coords.y2;
|
||||
|
||||
if (klass->allocate_coords)
|
||||
if (klass->query_coords)
|
||||
{
|
||||
/* FIXME: This is kind of a cludge - we pass out *private*
|
||||
* co-ords down to any subclasses so they can modify
|
||||
* we then resync any changes. Needed for group class.
|
||||
* Need to figure out nicer way.
|
||||
*/
|
||||
klass->allocate_coords(self, box);
|
||||
klass->query_coords(self, box);
|
||||
|
||||
self->priv->coords.x1 = box->x1;
|
||||
self->priv->coords.y1 = box->y1;
|
||||
@ -1339,7 +1339,7 @@ clutter_actor_queue_redraw (ClutterActor *self)
|
||||
{
|
||||
CLUTTER_TIMESTAMP (SCHEDULER,
|
||||
"Adding ideler for actor: %p", self);
|
||||
ctx->update_idle = g_idle_add_full (-100 , /* very high priority */
|
||||
ctx->update_idle = g_idle_add_full (G_PRIORITY_DEFAULT + 10,
|
||||
redraw_update_idle,
|
||||
NULL, NULL);
|
||||
}
|
||||
@ -1381,7 +1381,7 @@ clutter_actor_get_geometry (ClutterActor *self,
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||
|
||||
clutter_actor_allocate_coords (self, &box);
|
||||
clutter_actor_query_coords (self, &box);
|
||||
|
||||
geometry->x = CLUTTER_UNITS_TO_INT (box.x1);
|
||||
geometry->y = CLUTTER_UNITS_TO_INT (box.y1);
|
||||
@ -1411,7 +1411,7 @@ clutter_actor_get_coords (ClutterActor *self,
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||
|
||||
clutter_actor_allocate_coords (self, &box);
|
||||
clutter_actor_query_coords (self, &box);
|
||||
|
||||
if (x1)
|
||||
*x1 = CLUTTER_UNITS_TO_INT (box.x1);
|
||||
@ -1444,7 +1444,7 @@ clutter_actor_set_position (ClutterActor *self,
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||
|
||||
clutter_actor_allocate_coords (self, &box);
|
||||
clutter_actor_query_coords (self, &box);
|
||||
|
||||
box.x2 += (CLUTTER_UNITS_FROM_INT (x) - box.x1);
|
||||
box.y2 += (CLUTTER_UNITS_FROM_INT (y) - box.y1);
|
||||
@ -1477,7 +1477,7 @@ clutter_actor_move_by (ClutterActor *self,
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||
|
||||
clutter_actor_allocate_coords (self, &box);
|
||||
clutter_actor_query_coords (self, &box);
|
||||
|
||||
box.x2 += dxu;
|
||||
box.y2 += dyu;
|
||||
@ -1505,7 +1505,7 @@ clutter_actor_set_size (ClutterActor *self,
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||
|
||||
clutter_actor_allocate_coords (self, &box);
|
||||
clutter_actor_query_coords (self, &box);
|
||||
|
||||
box.x2 = box.x1 + CLUTTER_UNITS_FROM_INT (width);
|
||||
box.y2 = box.y1 + CLUTTER_UNITS_FROM_INT (height);
|
||||
@ -1559,7 +1559,7 @@ clutter_actor_get_abs_position_units (ClutterActor *self,
|
||||
|
||||
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||
|
||||
clutter_actor_allocate_coords (self, &box);
|
||||
clutter_actor_query_coords (self, &box);
|
||||
|
||||
parent = self->priv->parent_actor;
|
||||
|
||||
@ -1630,7 +1630,7 @@ clutter_actor_get_abs_size_units (ClutterActor *self,
|
||||
ClutterActorBox box;
|
||||
ClutterActor *parent;
|
||||
|
||||
clutter_actor_allocate_coords (self, &box);
|
||||
clutter_actor_query_coords (self, &box);
|
||||
|
||||
if (width)
|
||||
*width = box.x2 - box.x1;
|
||||
@ -1702,7 +1702,7 @@ clutter_actor_get_width (ClutterActor *self)
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
|
||||
|
||||
clutter_actor_allocate_coords (self, &box);
|
||||
clutter_actor_query_coords (self, &box);
|
||||
|
||||
return CLUTTER_UNITS_TO_INT (box.x2 - box.x1);
|
||||
}
|
||||
@ -1722,7 +1722,7 @@ clutter_actor_get_height (ClutterActor *self)
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
|
||||
|
||||
clutter_actor_allocate_coords (self, &box);
|
||||
clutter_actor_query_coords (self, &box);
|
||||
|
||||
return CLUTTER_UNITS_TO_INT (box.y2 - box.y1);
|
||||
}
|
||||
@ -1777,7 +1777,7 @@ clutter_actor_get_x (ClutterActor *self)
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
|
||||
|
||||
clutter_actor_allocate_coords (self, &box);
|
||||
clutter_actor_query_coords (self, &box);
|
||||
|
||||
return CLUTTER_UNITS_TO_INT (box.x1);
|
||||
}
|
||||
@ -1797,7 +1797,7 @@ clutter_actor_get_y (ClutterActor *self)
|
||||
|
||||
g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
|
||||
|
||||
clutter_actor_allocate_coords (self, &box);
|
||||
clutter_actor_query_coords (self, &box);
|
||||
|
||||
return CLUTTER_UNITS_TO_INT (box.y1);
|
||||
}
|
||||
@ -1945,7 +1945,7 @@ clutter_actor_set_scale_with_gravityx (ClutterActor *self,
|
||||
|
||||
clutter_actor_get_abs_size_units (self, &sw, &sh);
|
||||
|
||||
clutter_actor_allocate_coords (self, &box);
|
||||
clutter_actor_query_coords (self, &box);
|
||||
x = box.x1;
|
||||
y = box.y1;
|
||||
|
||||
|
@ -142,7 +142,7 @@ struct _ClutterActorClass
|
||||
void (* paint) (ClutterActor *actor);
|
||||
void (* request_coords) (ClutterActor *actor,
|
||||
ClutterActorBox *box);
|
||||
void (* allocate_coords) (ClutterActor *actor,
|
||||
void (* query_coords) (ClutterActor *actor,
|
||||
ClutterActorBox *box);
|
||||
void (* set_depth) (ClutterActor *actor,
|
||||
gint depth);
|
||||
@ -176,7 +176,7 @@ void clutter_actor_queue_redraw (ClutterActor *sel
|
||||
void clutter_actor_destroy (ClutterActor *self);
|
||||
void clutter_actor_request_coords (ClutterActor *self,
|
||||
ClutterActorBox *box);
|
||||
void clutter_actor_allocate_coords (ClutterActor *self,
|
||||
void clutter_actor_query_coords (ClutterActor *self,
|
||||
ClutterActorBox *box);
|
||||
void clutter_actor_set_geometry (ClutterActor *self,
|
||||
const ClutterGeometry *geometry);
|
||||
|
@ -124,7 +124,7 @@ clutter_group_request_coords (ClutterActor *self,
|
||||
{
|
||||
ClutterActorBox cbox;
|
||||
|
||||
clutter_actor_allocate_coords (self, &cbox);
|
||||
clutter_actor_query_coords (self, &cbox);
|
||||
|
||||
/* Only positioning works.
|
||||
* Sizing requests fail, use scale() instead
|
||||
@ -134,8 +134,8 @@ clutter_group_request_coords (ClutterActor *self,
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_group_allocate_coords (ClutterActor *self,
|
||||
ClutterActorBox *box)
|
||||
clutter_group_query_coords (ClutterActor *self,
|
||||
ClutterActorBox *box)
|
||||
{
|
||||
ClutterGroupPrivate *priv;
|
||||
GList *child_item;
|
||||
@ -157,7 +157,7 @@ clutter_group_allocate_coords (ClutterActor *self,
|
||||
{
|
||||
ClutterActorBox cbox;
|
||||
|
||||
clutter_actor_allocate_coords (child, &cbox);
|
||||
clutter_actor_query_coords (child, &cbox);
|
||||
|
||||
/* Ignore any children with offscreen ( negaive )
|
||||
* positions.
|
||||
@ -300,7 +300,7 @@ clutter_group_class_init (ClutterGroupClass *klass)
|
||||
actor_class->show_all = clutter_group_real_show_all;
|
||||
actor_class->hide_all = clutter_group_real_hide_all;
|
||||
actor_class->request_coords = clutter_group_request_coords;
|
||||
actor_class->allocate_coords = clutter_group_allocate_coords;
|
||||
actor_class->query_coords = clutter_group_query_coords;
|
||||
|
||||
/**
|
||||
* ClutterGroup::add:
|
||||
|
@ -278,8 +278,8 @@ clutter_label_paint (ClutterActor *self)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_label_allocate_coords (ClutterActor *self,
|
||||
ClutterActorBox *box)
|
||||
clutter_label_query_coords (ClutterActor *self,
|
||||
ClutterActorBox *box)
|
||||
{
|
||||
ClutterLabel *label = CLUTTER_LABEL(self);
|
||||
ClutterLabelPrivate *priv;
|
||||
@ -382,7 +382,7 @@ clutter_label_class_init (ClutterLabelClass *klass)
|
||||
|
||||
actor_class->paint = clutter_label_paint;
|
||||
actor_class->request_coords = clutter_label_request_coords;
|
||||
actor_class->allocate_coords = clutter_label_allocate_coords;
|
||||
actor_class->query_coords = clutter_label_query_coords;
|
||||
|
||||
gobject_class->finalize = clutter_label_finalize;
|
||||
gobject_class->dispose = clutter_label_dispose;
|
||||
|
@ -193,7 +193,7 @@ clutter_stage_egl_realize (ClutterActor *actor)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_egl_allocate_coords (ClutterActor *self,
|
||||
clutter_stage_egl_query_coords (ClutterActor *self,
|
||||
ClutterActorBox *box)
|
||||
{
|
||||
ClutterStageEGL *stage_egl = CLUTTER_STAGE_EGL (self);
|
||||
@ -360,7 +360,7 @@ clutter_stage_egl_class_init (ClutterStageEGLClass *klass)
|
||||
actor_class->realize = clutter_stage_egl_realize;
|
||||
actor_class->unrealize = clutter_stage_egl_unrealize;
|
||||
actor_class->request_coords = clutter_stage_egl_request_coords;
|
||||
actor_class->allocate_coords = clutter_stage_egl_allocate_coords;
|
||||
actor_class->query_coords = clutter_stage_egl_query_coords;
|
||||
|
||||
stage_class->set_fullscreen = clutter_stage_egl_set_fullscreen;
|
||||
stage_class->set_cursor_visible = clutter_stage_egl_set_cursor_visible;
|
||||
|
@ -244,9 +244,13 @@ translate_key_event (ClutterBackend *backend,
|
||||
event->key.time = xevent->xkey.time;
|
||||
event->key.modifier_state = (ClutterModifierType) xevent->xkey.state;
|
||||
event->key.hardware_keycode = xevent->xkey.keycode;
|
||||
event->key.keyval = XKeycodeToKeysym (xevent->xkey.display,
|
||||
xevent->xkey.keycode,
|
||||
0); /* FIXME: index with modifiers */
|
||||
|
||||
/* FIXME: We need to handle other modifiers rather than just shift */
|
||||
event->key.keyval
|
||||
= XKeycodeToKeysym (xevent->xkey.display,
|
||||
xevent->xkey.keycode,
|
||||
(event->key.modifier_state & CLUTTER_SHIFT_MASK)
|
||||
? 1 : 0);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -313,8 +313,8 @@ clutter_stage_glx_realize (ClutterActor *actor)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_glx_allocate_coords (ClutterActor *self,
|
||||
ClutterActorBox *box)
|
||||
clutter_stage_glx_query_coords (ClutterActor *self,
|
||||
ClutterActorBox *box)
|
||||
{
|
||||
ClutterStageGLX *stage_glx = CLUTTER_STAGE_GLX (self);
|
||||
|
||||
@ -542,7 +542,7 @@ clutter_stage_glx_class_init (ClutterStageGLXClass *klass)
|
||||
actor_class->realize = clutter_stage_glx_realize;
|
||||
actor_class->unrealize = clutter_stage_glx_unrealize;
|
||||
actor_class->request_coords = clutter_stage_glx_request_coords;
|
||||
actor_class->allocate_coords = clutter_stage_glx_allocate_coords;
|
||||
actor_class->query_coords = clutter_stage_glx_query_coords;
|
||||
|
||||
stage_class->set_fullscreen = clutter_stage_glx_set_fullscreen;
|
||||
stage_class->set_cursor_visible = clutter_stage_glx_set_cursor_visible;
|
||||
|
@ -88,7 +88,7 @@ clutter_stage_sdl_realize (ClutterActor *actor)
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_sdl_allocate_coords (ClutterActor *self,
|
||||
clutter_stage_sdl_query_coords (ClutterActor *self,
|
||||
ClutterActorBox *box)
|
||||
{
|
||||
ClutterStageSDL *stage_sdl = CLUTTER_STAGE_SDL (self);
|
||||
@ -195,7 +195,7 @@ clutter_stage_sdl_class_init (ClutterStageSDLClass *klass)
|
||||
actor_class->realize = clutter_stage_sdl_realize;
|
||||
actor_class->unrealize = clutter_stage_sdl_unrealize;
|
||||
actor_class->request_coords = clutter_stage_sdl_request_coords;
|
||||
actor_class->allocate_coords = clutter_stage_sdl_allocate_coords;
|
||||
actor_class->query_coords = clutter_stage_sdl_query_coords;
|
||||
|
||||
stage_class->set_fullscreen = clutter_stage_sdl_set_fullscreen;
|
||||
stage_class->set_cursor_visible = clutter_stage_sdl_set_cursor_visible;
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include <clutter/clutter.h>
|
||||
#ifdef CLUTTER_FLAVOUR_GLX
|
||||
#include <clutter/clutter-glx.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
@ -13,9 +11,9 @@
|
||||
|
||||
typedef struct SuperOH
|
||||
{
|
||||
ClutterActor **hand, *bgtex;
|
||||
ClutterActor *group;
|
||||
GdkPixbuf *bgpixb;
|
||||
ClutterActor **hand, *bgtex;
|
||||
ClutterActor *group;
|
||||
GdkPixbuf *bgpixb;
|
||||
|
||||
} SuperOH;
|
||||
|
||||
@ -34,39 +32,7 @@ static GOptionEntry super_oh_entries[] = {
|
||||
static gint
|
||||
get_radius (void)
|
||||
{
|
||||
return (CLUTTER_STAGE_WIDTH() + CLUTTER_STAGE_HEIGHT()) / n_hands;
|
||||
}
|
||||
|
||||
void
|
||||
screensaver_setup (void)
|
||||
{
|
||||
#ifdef CLUTTER_FLAVOUR_GLX
|
||||
const gchar *preview_xid;
|
||||
gboolean foreign_success = FALSE;
|
||||
ClutterActor *stage;
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
|
||||
preview_xid = g_getenv ("XSCREENSAVER_WINDOW");
|
||||
|
||||
if (preview_xid && *preview_xid)
|
||||
{
|
||||
char *end;
|
||||
Window remote_xwin = (Window) strtoul (preview_xid, &end, 0);
|
||||
|
||||
if ((remote_xwin != None) && (end != NULL) &&
|
||||
((*end == ' ') || (*end == '\0')) &&
|
||||
((remote_xwin < G_MAXULONG) || (errno != ERANGE)))
|
||||
{
|
||||
|
||||
foreign_success =
|
||||
clutter_glx_stage_set_foreign (CLUTTER_STAGE (stage), remote_xwin);
|
||||
}
|
||||
}
|
||||
|
||||
if (!foreign_success)
|
||||
clutter_actor_set_size (stage, 800, 600);
|
||||
#endif
|
||||
return (CLUTTER_STAGE_HEIGHT() + CLUTTER_STAGE_HEIGHT()) / n_hands ;
|
||||
}
|
||||
|
||||
/* input handler */
|
||||
@ -93,6 +59,7 @@ input_cb (ClutterStage *stage,
|
||||
|
||||
if (e)
|
||||
clutter_actor_hide (e);
|
||||
|
||||
}
|
||||
else if (event->type == CLUTTER_KEY_RELEASE)
|
||||
{
|
||||
@ -117,42 +84,37 @@ frame_cb (ClutterTimeline *timeline,
|
||||
ClutterActor *stage = clutter_stage_get_default ();
|
||||
gint i;
|
||||
|
||||
#if TRAILS
|
||||
oh->bgpixb = clutter_stage_snapshot (CLUTTER_STAGE (stage),
|
||||
0, 0,
|
||||
CLUTTER_STAGE_WIDTH(),
|
||||
CLUTTER_STAGE_HEIGHT());
|
||||
clutter_texture_set_pixbuf (CLUTTER_TEXTURE (oh->bgtex), oh->bgpixb);
|
||||
g_object_unref (G_OBJECT (oh->bgpixb));
|
||||
#endif
|
||||
|
||||
/* Rotate everything clockwise about stage center*/
|
||||
clutter_actor_rotate_z (CLUTTER_ACTOR (oh->group),
|
||||
frame_num,
|
||||
CLUTTER_STAGE_WIDTH() / 2,
|
||||
CLUTTER_STAGE_HEIGHT() / 2);
|
||||
|
||||
for (i = 0; i < n_hands; i++)
|
||||
{
|
||||
/* rotate each hand around there centers */
|
||||
clutter_actor_rotate_z (oh->hand[i],
|
||||
- 6.0 * frame_num,
|
||||
clutter_actor_get_width (oh->hand[i]) / 2,
|
||||
clutter_actor_get_height (oh->hand[i]) / 2);
|
||||
gdouble scale_x, scale_y;
|
||||
|
||||
|
||||
clutter_actor_get_scale (oh->hand[i], &scale_x, &scale_y);
|
||||
|
||||
/* Rotate each hand around there centers - to get this we need
|
||||
* to take into account any scaling.
|
||||
*/
|
||||
clutter_actor_rotate_z
|
||||
(oh->hand[i],
|
||||
- 6.0 * frame_num,
|
||||
(clutter_actor_get_width (oh->hand[i]) / 2) * scale_x,
|
||||
(clutter_actor_get_height (oh->hand[i]) / 2) * scale_y);
|
||||
}
|
||||
|
||||
/*
|
||||
clutter_actor_rotate_x (CLUTTER_ACTOR(oh->group),
|
||||
75.0,
|
||||
CLUTTER_STAGE_HEIGHT()/2, 0);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
ClutterTimeline *timeline;
|
||||
ClutterActor *stage;
|
||||
ClutterAlpha *alpha;
|
||||
ClutterBehaviour *scaler_1, *scaler_2;
|
||||
ClutterActor *stage;
|
||||
ClutterColor stage_color = { 0x61, 0x64, 0x8c, 0xff };
|
||||
GdkPixbuf *pixbuf;
|
||||
SuperOH *oh;
|
||||
@ -160,6 +122,7 @@ main (int argc, char *argv[])
|
||||
GError *error;
|
||||
|
||||
error = NULL;
|
||||
|
||||
clutter_init_with_args (&argc, &argv,
|
||||
NULL,
|
||||
super_oh_entries,
|
||||
@ -175,31 +138,37 @@ main (int argc, char *argv[])
|
||||
}
|
||||
|
||||
stage = clutter_stage_get_default ();
|
||||
clutter_actor_set_size (stage, 800, 600);
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_file ("redhand.png", NULL);
|
||||
|
||||
if (!pixbuf)
|
||||
g_error("pixbuf load failed");
|
||||
|
||||
/* Set our stage (window) size */
|
||||
// clutter_actor_set_size (stage, WINWIDTH, WINHEIGHT);
|
||||
|
||||
/* and its background color */
|
||||
|
||||
screensaver_setup ();
|
||||
|
||||
clutter_stage_set_color (CLUTTER_STAGE (stage),
|
||||
&stage_color);
|
||||
|
||||
oh = g_new(SuperOH, 1);
|
||||
|
||||
#if TRAILS
|
||||
oh->bgtex = clutter_texture_new();
|
||||
clutter_actor_set_size (oh->bgtex,
|
||||
CLUTTER_STAGE_WIDTH(), CLUTTER_STAGE_HEIGHT());
|
||||
clutter_actor_set_opacity (oh->bgtex, 0x99);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), oh->bgtex);
|
||||
#endif
|
||||
/* Create a timeline to manage animation */
|
||||
timeline = clutter_timeline_new (360, 120); /* num frames, fps */
|
||||
g_object_set(timeline, "loop", TRUE, 0); /* have it loop */
|
||||
|
||||
/* fire a callback for frame change */
|
||||
g_signal_connect (timeline, "new-frame", G_CALLBACK (frame_cb), oh);
|
||||
|
||||
/* Set up some behaviours to handle scaling */
|
||||
alpha = clutter_alpha_new_full (timeline, CLUTTER_ALPHA_SINE, NULL, NULL);
|
||||
|
||||
scaler_1 = clutter_behaviour_scale_new (alpha,
|
||||
0.5,
|
||||
1.0,
|
||||
CLUTTER_GRAVITY_CENTER);
|
||||
|
||||
scaler_2 = clutter_behaviour_scale_new (alpha,
|
||||
1.0,
|
||||
0.5,
|
||||
CLUTTER_GRAVITY_CENTER);
|
||||
|
||||
/* create a new group to hold multiple actors in a group */
|
||||
oh->group = clutter_group_new();
|
||||
@ -233,21 +202,13 @@ main (int argc, char *argv[])
|
||||
|
||||
/* Add to our group group */
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER (oh->group), oh->hand[i]);
|
||||
|
||||
if (i % 2)
|
||||
clutter_behaviour_apply (scaler_1, oh->hand[i]);
|
||||
else
|
||||
clutter_behaviour_apply (scaler_2, oh->hand[i]);
|
||||
}
|
||||
|
||||
#if 0
|
||||
{
|
||||
clutter_actor_set_scale (oh->group, .1, 0.1);
|
||||
|
||||
guint w, h;
|
||||
clutter_actor_get_abs_size (CLUTTER_ACTOR(oh->hand[0]), &w, &h);
|
||||
g_print ("%ix%i\n", w, h);
|
||||
g_print ("%ix%i\n",
|
||||
clutter_actor_get_width(oh->hand[0]),
|
||||
clutter_actor_get_height(oh->hand[0]));
|
||||
}
|
||||
#endif
|
||||
|
||||
clutter_actor_show_all (oh->group);
|
||||
|
||||
/* Add the group to the stage */
|
||||
@ -265,14 +226,6 @@ main (int argc, char *argv[])
|
||||
G_CALLBACK (input_cb),
|
||||
oh);
|
||||
|
||||
/* Create a timeline to manage animation */
|
||||
timeline = clutter_timeline_new (360, 90); /* num frames, fps */
|
||||
g_object_set(timeline, "loop", TRUE, 0); /* have it loop */
|
||||
|
||||
/* fire a callback for frame change */
|
||||
g_signal_connect (timeline, "new-frame",
|
||||
G_CALLBACK (frame_cb), oh);
|
||||
|
||||
/* and start it */
|
||||
clutter_timeline_start (timeline);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user