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>
|
2007-06-13 Tomas Frydrych <tf@openedhand.com>
|
||||||
|
|
||||||
* clutter/clutter-actor.c:
|
* clutter/clutter-actor.c:
|
||||||
|
@ -533,7 +533,7 @@ clutter_actor_project_vertices (ClutterActor * self,
|
|||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTOR (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.
|
* sure untransformed box is up to date.
|
||||||
*/
|
*/
|
||||||
priv = self->priv;
|
priv = self->priv;
|
||||||
@ -901,19 +901,19 @@ clutter_actor_request_coords (ClutterActor *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_actor_allocate_coords:
|
* clutter_actor_query_coords:
|
||||||
* @self: A #ClutterActor
|
* @self: A #ClutterActor
|
||||||
* @box: A location to store the actors #ClutterActorBox co-ordinates
|
* @box: A location to store the actors #ClutterActorBox co-ordinates
|
||||||
*
|
*
|
||||||
* Requests the allocated co-ordinates for the #ClutterActor relative
|
* Requests the queryd un transformed co-ordinates for the #ClutterActor
|
||||||
* to any parent.
|
* relative to any parent.
|
||||||
*
|
*
|
||||||
* This function should not be called directly by applications instead
|
* This function should not be called directly by applications instead
|
||||||
* the various position/geometry methods should be used.
|
* the various position/geometry methods should be used.
|
||||||
**/
|
**/
|
||||||
void
|
void
|
||||||
clutter_actor_allocate_coords (ClutterActor *self,
|
clutter_actor_query_coords (ClutterActor *self,
|
||||||
ClutterActorBox *box)
|
ClutterActorBox *box)
|
||||||
{
|
{
|
||||||
ClutterActorClass *klass;
|
ClutterActorClass *klass;
|
||||||
|
|
||||||
@ -924,14 +924,14 @@ clutter_actor_allocate_coords (ClutterActor *self,
|
|||||||
box->x2 = self->priv->coords.x2;
|
box->x2 = self->priv->coords.x2;
|
||||||
box->y2 = self->priv->coords.y2;
|
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*
|
/* FIXME: This is kind of a cludge - we pass out *private*
|
||||||
* co-ords down to any subclasses so they can modify
|
* co-ords down to any subclasses so they can modify
|
||||||
* we then resync any changes. Needed for group class.
|
* we then resync any changes. Needed for group class.
|
||||||
* Need to figure out nicer way.
|
* 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.x1 = box->x1;
|
||||||
self->priv->coords.y1 = box->y1;
|
self->priv->coords.y1 = box->y1;
|
||||||
@ -1339,7 +1339,7 @@ clutter_actor_queue_redraw (ClutterActor *self)
|
|||||||
{
|
{
|
||||||
CLUTTER_TIMESTAMP (SCHEDULER,
|
CLUTTER_TIMESTAMP (SCHEDULER,
|
||||||
"Adding ideler for actor: %p", self);
|
"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,
|
redraw_update_idle,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
@ -1381,7 +1381,7 @@ clutter_actor_get_geometry (ClutterActor *self,
|
|||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTOR (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->x = CLUTTER_UNITS_TO_INT (box.x1);
|
||||||
geometry->y = CLUTTER_UNITS_TO_INT (box.y1);
|
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));
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||||
|
|
||||||
clutter_actor_allocate_coords (self, &box);
|
clutter_actor_query_coords (self, &box);
|
||||||
|
|
||||||
if (x1)
|
if (x1)
|
||||||
*x1 = CLUTTER_UNITS_TO_INT (box.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));
|
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.x2 += (CLUTTER_UNITS_FROM_INT (x) - box.x1);
|
||||||
box.y2 += (CLUTTER_UNITS_FROM_INT (y) - box.y1);
|
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));
|
g_return_if_fail (CLUTTER_IS_ACTOR (self));
|
||||||
|
|
||||||
clutter_actor_allocate_coords (self, &box);
|
clutter_actor_query_coords (self, &box);
|
||||||
|
|
||||||
box.x2 += dxu;
|
box.x2 += dxu;
|
||||||
box.y2 += dyu;
|
box.y2 += dyu;
|
||||||
@ -1505,7 +1505,7 @@ clutter_actor_set_size (ClutterActor *self,
|
|||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTOR (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.x2 = box.x1 + CLUTTER_UNITS_FROM_INT (width);
|
||||||
box.y2 = box.y1 + CLUTTER_UNITS_FROM_INT (height);
|
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));
|
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;
|
parent = self->priv->parent_actor;
|
||||||
|
|
||||||
@ -1630,7 +1630,7 @@ clutter_actor_get_abs_size_units (ClutterActor *self,
|
|||||||
ClutterActorBox box;
|
ClutterActorBox box;
|
||||||
ClutterActor *parent;
|
ClutterActor *parent;
|
||||||
|
|
||||||
clutter_actor_allocate_coords (self, &box);
|
clutter_actor_query_coords (self, &box);
|
||||||
|
|
||||||
if (width)
|
if (width)
|
||||||
*width = box.x2 - box.x1;
|
*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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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);
|
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_get_abs_size_units (self, &sw, &sh);
|
||||||
|
|
||||||
clutter_actor_allocate_coords (self, &box);
|
clutter_actor_query_coords (self, &box);
|
||||||
x = box.x1;
|
x = box.x1;
|
||||||
y = box.y1;
|
y = box.y1;
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ struct _ClutterActorClass
|
|||||||
void (* paint) (ClutterActor *actor);
|
void (* paint) (ClutterActor *actor);
|
||||||
void (* request_coords) (ClutterActor *actor,
|
void (* request_coords) (ClutterActor *actor,
|
||||||
ClutterActorBox *box);
|
ClutterActorBox *box);
|
||||||
void (* allocate_coords) (ClutterActor *actor,
|
void (* query_coords) (ClutterActor *actor,
|
||||||
ClutterActorBox *box);
|
ClutterActorBox *box);
|
||||||
void (* set_depth) (ClutterActor *actor,
|
void (* set_depth) (ClutterActor *actor,
|
||||||
gint depth);
|
gint depth);
|
||||||
@ -176,7 +176,7 @@ void clutter_actor_queue_redraw (ClutterActor *sel
|
|||||||
void clutter_actor_destroy (ClutterActor *self);
|
void clutter_actor_destroy (ClutterActor *self);
|
||||||
void clutter_actor_request_coords (ClutterActor *self,
|
void clutter_actor_request_coords (ClutterActor *self,
|
||||||
ClutterActorBox *box);
|
ClutterActorBox *box);
|
||||||
void clutter_actor_allocate_coords (ClutterActor *self,
|
void clutter_actor_query_coords (ClutterActor *self,
|
||||||
ClutterActorBox *box);
|
ClutterActorBox *box);
|
||||||
void clutter_actor_set_geometry (ClutterActor *self,
|
void clutter_actor_set_geometry (ClutterActor *self,
|
||||||
const ClutterGeometry *geometry);
|
const ClutterGeometry *geometry);
|
||||||
|
@ -124,7 +124,7 @@ clutter_group_request_coords (ClutterActor *self,
|
|||||||
{
|
{
|
||||||
ClutterActorBox cbox;
|
ClutterActorBox cbox;
|
||||||
|
|
||||||
clutter_actor_allocate_coords (self, &cbox);
|
clutter_actor_query_coords (self, &cbox);
|
||||||
|
|
||||||
/* Only positioning works.
|
/* Only positioning works.
|
||||||
* Sizing requests fail, use scale() instead
|
* Sizing requests fail, use scale() instead
|
||||||
@ -134,8 +134,8 @@ clutter_group_request_coords (ClutterActor *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_group_allocate_coords (ClutterActor *self,
|
clutter_group_query_coords (ClutterActor *self,
|
||||||
ClutterActorBox *box)
|
ClutterActorBox *box)
|
||||||
{
|
{
|
||||||
ClutterGroupPrivate *priv;
|
ClutterGroupPrivate *priv;
|
||||||
GList *child_item;
|
GList *child_item;
|
||||||
@ -157,7 +157,7 @@ clutter_group_allocate_coords (ClutterActor *self,
|
|||||||
{
|
{
|
||||||
ClutterActorBox cbox;
|
ClutterActorBox cbox;
|
||||||
|
|
||||||
clutter_actor_allocate_coords (child, &cbox);
|
clutter_actor_query_coords (child, &cbox);
|
||||||
|
|
||||||
/* Ignore any children with offscreen ( negaive )
|
/* Ignore any children with offscreen ( negaive )
|
||||||
* positions.
|
* positions.
|
||||||
@ -300,7 +300,7 @@ clutter_group_class_init (ClutterGroupClass *klass)
|
|||||||
actor_class->show_all = clutter_group_real_show_all;
|
actor_class->show_all = clutter_group_real_show_all;
|
||||||
actor_class->hide_all = clutter_group_real_hide_all;
|
actor_class->hide_all = clutter_group_real_hide_all;
|
||||||
actor_class->request_coords = clutter_group_request_coords;
|
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:
|
* ClutterGroup::add:
|
||||||
|
@ -278,8 +278,8 @@ clutter_label_paint (ClutterActor *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_label_allocate_coords (ClutterActor *self,
|
clutter_label_query_coords (ClutterActor *self,
|
||||||
ClutterActorBox *box)
|
ClutterActorBox *box)
|
||||||
{
|
{
|
||||||
ClutterLabel *label = CLUTTER_LABEL(self);
|
ClutterLabel *label = CLUTTER_LABEL(self);
|
||||||
ClutterLabelPrivate *priv;
|
ClutterLabelPrivate *priv;
|
||||||
@ -382,7 +382,7 @@ clutter_label_class_init (ClutterLabelClass *klass)
|
|||||||
|
|
||||||
actor_class->paint = clutter_label_paint;
|
actor_class->paint = clutter_label_paint;
|
||||||
actor_class->request_coords = clutter_label_request_coords;
|
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->finalize = clutter_label_finalize;
|
||||||
gobject_class->dispose = clutter_label_dispose;
|
gobject_class->dispose = clutter_label_dispose;
|
||||||
|
@ -193,7 +193,7 @@ clutter_stage_egl_realize (ClutterActor *actor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_egl_allocate_coords (ClutterActor *self,
|
clutter_stage_egl_query_coords (ClutterActor *self,
|
||||||
ClutterActorBox *box)
|
ClutterActorBox *box)
|
||||||
{
|
{
|
||||||
ClutterStageEGL *stage_egl = CLUTTER_STAGE_EGL (self);
|
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->realize = clutter_stage_egl_realize;
|
||||||
actor_class->unrealize = clutter_stage_egl_unrealize;
|
actor_class->unrealize = clutter_stage_egl_unrealize;
|
||||||
actor_class->request_coords = clutter_stage_egl_request_coords;
|
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_fullscreen = clutter_stage_egl_set_fullscreen;
|
||||||
stage_class->set_cursor_visible = clutter_stage_egl_set_cursor_visible;
|
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.time = xevent->xkey.time;
|
||||||
event->key.modifier_state = (ClutterModifierType) xevent->xkey.state;
|
event->key.modifier_state = (ClutterModifierType) xevent->xkey.state;
|
||||||
event->key.hardware_keycode = xevent->xkey.keycode;
|
event->key.hardware_keycode = xevent->xkey.keycode;
|
||||||
event->key.keyval = XKeycodeToKeysym (xevent->xkey.display,
|
|
||||||
xevent->xkey.keycode,
|
/* FIXME: We need to handle other modifiers rather than just shift */
|
||||||
0); /* FIXME: index with modifiers */
|
event->key.keyval
|
||||||
|
= XKeycodeToKeysym (xevent->xkey.display,
|
||||||
|
xevent->xkey.keycode,
|
||||||
|
(event->key.modifier_state & CLUTTER_SHIFT_MASK)
|
||||||
|
? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -313,8 +313,8 @@ clutter_stage_glx_realize (ClutterActor *actor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_glx_allocate_coords (ClutterActor *self,
|
clutter_stage_glx_query_coords (ClutterActor *self,
|
||||||
ClutterActorBox *box)
|
ClutterActorBox *box)
|
||||||
{
|
{
|
||||||
ClutterStageGLX *stage_glx = CLUTTER_STAGE_GLX (self);
|
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->realize = clutter_stage_glx_realize;
|
||||||
actor_class->unrealize = clutter_stage_glx_unrealize;
|
actor_class->unrealize = clutter_stage_glx_unrealize;
|
||||||
actor_class->request_coords = clutter_stage_glx_request_coords;
|
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_fullscreen = clutter_stage_glx_set_fullscreen;
|
||||||
stage_class->set_cursor_visible = clutter_stage_glx_set_cursor_visible;
|
stage_class->set_cursor_visible = clutter_stage_glx_set_cursor_visible;
|
||||||
|
@ -88,7 +88,7 @@ clutter_stage_sdl_realize (ClutterActor *actor)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_sdl_allocate_coords (ClutterActor *self,
|
clutter_stage_sdl_query_coords (ClutterActor *self,
|
||||||
ClutterActorBox *box)
|
ClutterActorBox *box)
|
||||||
{
|
{
|
||||||
ClutterStageSDL *stage_sdl = CLUTTER_STAGE_SDL (self);
|
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->realize = clutter_stage_sdl_realize;
|
||||||
actor_class->unrealize = clutter_stage_sdl_unrealize;
|
actor_class->unrealize = clutter_stage_sdl_unrealize;
|
||||||
actor_class->request_coords = clutter_stage_sdl_request_coords;
|
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_fullscreen = clutter_stage_sdl_set_fullscreen;
|
||||||
stage_class->set_cursor_visible = clutter_stage_sdl_set_cursor_visible;
|
stage_class->set_cursor_visible = clutter_stage_sdl_set_cursor_visible;
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#include <clutter/clutter.h>
|
#include <clutter/clutter.h>
|
||||||
#ifdef CLUTTER_FLAVOUR_GLX
|
|
||||||
#include <clutter/clutter-glx.h>
|
|
||||||
#endif
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -13,9 +11,9 @@
|
|||||||
|
|
||||||
typedef struct SuperOH
|
typedef struct SuperOH
|
||||||
{
|
{
|
||||||
ClutterActor **hand, *bgtex;
|
ClutterActor **hand, *bgtex;
|
||||||
ClutterActor *group;
|
ClutterActor *group;
|
||||||
GdkPixbuf *bgpixb;
|
GdkPixbuf *bgpixb;
|
||||||
|
|
||||||
} SuperOH;
|
} SuperOH;
|
||||||
|
|
||||||
@ -34,39 +32,7 @@ static GOptionEntry super_oh_entries[] = {
|
|||||||
static gint
|
static gint
|
||||||
get_radius (void)
|
get_radius (void)
|
||||||
{
|
{
|
||||||
return (CLUTTER_STAGE_WIDTH() + CLUTTER_STAGE_HEIGHT()) / n_hands;
|
return (CLUTTER_STAGE_HEIGHT() + 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
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* input handler */
|
/* input handler */
|
||||||
@ -93,6 +59,7 @@ input_cb (ClutterStage *stage,
|
|||||||
|
|
||||||
if (e)
|
if (e)
|
||||||
clutter_actor_hide (e);
|
clutter_actor_hide (e);
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (event->type == CLUTTER_KEY_RELEASE)
|
else if (event->type == CLUTTER_KEY_RELEASE)
|
||||||
{
|
{
|
||||||
@ -117,42 +84,37 @@ frame_cb (ClutterTimeline *timeline,
|
|||||||
ClutterActor *stage = clutter_stage_get_default ();
|
ClutterActor *stage = clutter_stage_get_default ();
|
||||||
gint i;
|
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*/
|
/* Rotate everything clockwise about stage center*/
|
||||||
clutter_actor_rotate_z (CLUTTER_ACTOR (oh->group),
|
clutter_actor_rotate_z (CLUTTER_ACTOR (oh->group),
|
||||||
frame_num,
|
frame_num,
|
||||||
CLUTTER_STAGE_WIDTH() / 2,
|
CLUTTER_STAGE_WIDTH() / 2,
|
||||||
CLUTTER_STAGE_HEIGHT() / 2);
|
CLUTTER_STAGE_HEIGHT() / 2);
|
||||||
|
|
||||||
for (i = 0; i < n_hands; i++)
|
for (i = 0; i < n_hands; i++)
|
||||||
{
|
{
|
||||||
/* rotate each hand around there centers */
|
gdouble scale_x, scale_y;
|
||||||
clutter_actor_rotate_z (oh->hand[i],
|
|
||||||
- 6.0 * frame_num,
|
|
||||||
clutter_actor_get_width (oh->hand[i]) / 2,
|
clutter_actor_get_scale (oh->hand[i], &scale_x, &scale_y);
|
||||||
clutter_actor_get_height (oh->hand[i]) / 2);
|
|
||||||
|
/* 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
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
ClutterTimeline *timeline;
|
ClutterTimeline *timeline;
|
||||||
ClutterActor *stage;
|
ClutterAlpha *alpha;
|
||||||
|
ClutterBehaviour *scaler_1, *scaler_2;
|
||||||
|
ClutterActor *stage;
|
||||||
ClutterColor stage_color = { 0x61, 0x64, 0x8c, 0xff };
|
ClutterColor stage_color = { 0x61, 0x64, 0x8c, 0xff };
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
SuperOH *oh;
|
SuperOH *oh;
|
||||||
@ -160,6 +122,7 @@ main (int argc, char *argv[])
|
|||||||
GError *error;
|
GError *error;
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
|
|
||||||
clutter_init_with_args (&argc, &argv,
|
clutter_init_with_args (&argc, &argv,
|
||||||
NULL,
|
NULL,
|
||||||
super_oh_entries,
|
super_oh_entries,
|
||||||
@ -175,31 +138,37 @@ main (int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
stage = clutter_stage_get_default ();
|
stage = clutter_stage_get_default ();
|
||||||
|
clutter_actor_set_size (stage, 800, 600);
|
||||||
|
|
||||||
pixbuf = gdk_pixbuf_new_from_file ("redhand.png", NULL);
|
pixbuf = gdk_pixbuf_new_from_file ("redhand.png", NULL);
|
||||||
|
|
||||||
if (!pixbuf)
|
if (!pixbuf)
|
||||||
g_error("pixbuf load failed");
|
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),
|
clutter_stage_set_color (CLUTTER_STAGE (stage),
|
||||||
&stage_color);
|
&stage_color);
|
||||||
|
|
||||||
oh = g_new(SuperOH, 1);
|
oh = g_new(SuperOH, 1);
|
||||||
|
|
||||||
#if TRAILS
|
/* Create a timeline to manage animation */
|
||||||
oh->bgtex = clutter_texture_new();
|
timeline = clutter_timeline_new (360, 120); /* num frames, fps */
|
||||||
clutter_actor_set_size (oh->bgtex,
|
g_object_set(timeline, "loop", TRUE, 0); /* have it loop */
|
||||||
CLUTTER_STAGE_WIDTH(), CLUTTER_STAGE_HEIGHT());
|
|
||||||
clutter_actor_set_opacity (oh->bgtex, 0x99);
|
/* fire a callback for frame change */
|
||||||
clutter_container_add_actor (CLUTTER_CONTAINER (stage), oh->bgtex);
|
g_signal_connect (timeline, "new-frame", G_CALLBACK (frame_cb), oh);
|
||||||
#endif
|
|
||||||
|
/* 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 */
|
/* create a new group to hold multiple actors in a group */
|
||||||
oh->group = clutter_group_new();
|
oh->group = clutter_group_new();
|
||||||
@ -233,21 +202,13 @@ main (int argc, char *argv[])
|
|||||||
|
|
||||||
/* Add to our group group */
|
/* Add to our group group */
|
||||||
clutter_container_add_actor (CLUTTER_CONTAINER (oh->group), oh->hand[i]);
|
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);
|
clutter_actor_show_all (oh->group);
|
||||||
|
|
||||||
/* Add the group to the stage */
|
/* Add the group to the stage */
|
||||||
@ -265,14 +226,6 @@ main (int argc, char *argv[])
|
|||||||
G_CALLBACK (input_cb),
|
G_CALLBACK (input_cb),
|
||||||
oh);
|
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 */
|
/* and start it */
|
||||||
clutter_timeline_start (timeline);
|
clutter_timeline_start (timeline);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user