2008-04-04 Matthew Allum <mallum@openedhand.com>

* clutter/clutter-actor.c:
        Remove uneeded stage private member.
        Add show-on-set-parent prop and make so by default Actors are
        now automatically shown when reparented (#791)

        * clutter/eglx/clutter-backend-egl.c:
        * clutter/cogl/gles/cogl.c:
        A couple of minor comments.

        * clutter/eglnative/Makefile.am:
        Add missing clutter-egl.h header (back port from trunk)

        * tests/test-actors.c:
        Modify to take advantage of new show-on-set-parent functionality.
This commit is contained in:
Matthew Allum 2008-04-04 13:20:02 +00:00
parent dfd78ac502
commit e44ac14ef7
6 changed files with 93 additions and 16 deletions

View File

@ -1,3 +1,16 @@
2008-04-04 Matthew Allum <mallum@openedhand.com>
reviewed by: <delete if not using a buddy>
* clutter/clutter-actor.c: (clutter_actor_real_hide),
(clutter_actor_unrealize), (clutter_actor_set_property),
(clutter_actor_get_property), (clutter_actor_class_init),
(clutter_actor_init), (clutter_actor_set_parent):
* clutter/cogl/gles/cogl.c: (cogl_texture_quad), (cogl_fog_set):
* clutter/eglnative/Makefile.am:
* clutter/eglx/clutter-backend-egl.c:
* tests/test-actors.c: (main):
2008-04-03 Emmanuele Bassi <ebassi@openedhand.com>
* clutter/Makefile.am: Only export symbols matching "^clutter.*",

View File

@ -199,7 +199,7 @@ struct _ClutterActorPrivate
ShaderData *shader_data;
ClutterStage *stage;
gboolean show_on_set_parent;
};
enum
@ -232,7 +232,9 @@ enum
PROP_ROTATION_CENTER_Z,
PROP_ANCHOR_X,
PROP_ANCHOR_Y
PROP_ANCHOR_Y,
PROP_SHOW_ON_SET_PARENT
};
enum
@ -279,8 +281,6 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (ClutterActor,
clutter_scriptable_iface_init));
static void
clutter_actor_real_show (ClutterActor *self)
{
@ -310,6 +310,15 @@ clutter_actor_real_show (ClutterActor *self)
void
clutter_actor_show (ClutterActor *self)
{
ClutterActorPrivate *priv;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
priv = self->priv;
if (priv->show_on_set_parent == FALSE && priv->parent_actor == NULL)
g_object_set (self, "show-on-set-parent", TRUE, NULL);
if (!CLUTTER_ACTOR_IS_VISIBLE (self))
{
g_object_ref (self);
@ -366,13 +375,19 @@ clutter_actor_real_hide (ClutterActor *self)
void
clutter_actor_hide (ClutterActor *self)
{
if (CLUTTER_ACTOR_IS_VISIBLE (self))
ClutterActorPrivate *priv;
g_return_if_fail (CLUTTER_IS_ACTOR (self));
priv = self->priv;
if (priv->show_on_set_parent == TRUE && priv->parent_actor == NULL)
g_object_set (self, "show-on-set-parent", FALSE, NULL);
if (CLUTTER_ACTOR_IS_MAPPED (self))
{
g_object_ref (self);
if (CLUTTER_ACTOR_IS_REACTIVE(self))
; /* FIXME: decrease global reactive count */
g_signal_emit (self, actor_signals[HIDE], 0);
g_object_notify (G_OBJECT (self), "visible");
@ -447,8 +462,6 @@ clutter_actor_unrealize (ClutterActor *self)
if (klass->unrealize)
(klass->unrealize) (self);
priv->stage = NULL;
}
static void
@ -1504,6 +1517,9 @@ clutter_actor_set_property (GObject *object,
case PROP_ANCHOR_Y:
priv->anchor_y = CLUTTER_UNITS_FROM_DEVICE (g_value_get_int (value));
break;
case PROP_SHOW_ON_SET_PARENT:
priv->show_on_set_parent = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -1618,6 +1634,9 @@ clutter_actor_get_property (GObject *object,
case PROP_ANCHOR_Y:
g_value_set_int (value, CLUTTER_UNITS_TO_DEVICE (priv->anchor_y));
break;
case PROP_SHOW_ON_SET_PARENT:
g_value_set_boolean (value, priv->show_on_set_parent);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -1984,6 +2003,24 @@ clutter_actor_class_init (ClutterActorClass *klass)
0,
CLUTTER_PARAM_READWRITE));
/**
* ClutterActor:show-on-set-parent:
*
* If TRUE, the Actor is automatically shown when parented.
*
* Since: 0.8
*/
g_object_class_install_property
(object_class,
PROP_SHOW_ON_SET_PARENT,
g_param_spec_boolean ("show-on-set-parent",
"Show on set parent",
"Whether the actor is shown"
" when parented",
TRUE,
CLUTTER_PARAM_READWRITE));
/**
* ClutterActor::destroy:
* @actor: the object which received the signal
@ -2342,6 +2379,7 @@ clutter_actor_init (ClutterActor *self)
priv->scale_x = CFX_ONE;
priv->scale_y = CFX_ONE;
priv->shader_data = NULL;
priv->show_on_set_parent = TRUE;
memset (priv->clip, 0, sizeof (ClutterUnit) * 4);
@ -4027,6 +4065,10 @@ clutter_actor_set_parent (ClutterActor *self,
self->priv->parent_actor = parent;
g_signal_emit (self, actor_signals[PARENT_SET], 0, NULL);
if (self->priv->show_on_set_parent == TRUE)
clutter_actor_show (self);
/* FIXME: below likely not needed */
if (CLUTTER_ACTOR_IS_REALIZED (self->priv->parent_actor))
clutter_actor_realize (self);

View File

@ -359,6 +359,8 @@ cogl_texture_quad (gint x1,
GE( glDrawArrays(GL_TRIANGLES, 0, 6) );
GE( glDisableClientState(GL_TEXTURE_COORD_ARRAY) );
GE( glDisableClientState(GL_VERTEX_ARRAY) );
/* Note also see glDrawTexxOES for potential optimisation */
}
void
@ -645,8 +647,13 @@ cogl_fog_set (const ClutterColor *fog_color,
glFogx (GL_FOG_END, (GLfixed) z_far);
}
/* Offscreen - TODO: possible support from FBO's */
/* Offscreen - TODO: possible support from FBO's/PBuffers
* See;
* http://www.khronos.org/message_boards/viewtopic.php?t=589
* http://www.gamedev.net/community/forums/topic.asp?topic_id=369739
*
* Likely requires EGL 1.3 for eglBindTexImage
*/
COGLuint
cogl_offscreen_create (COGLuint target_texture)
{

View File

@ -1,4 +1,5 @@
libclutterincludedir = $(includedir)/clutter-@CLUTTER_MAJORMINOR@/clutter
libclutterinclude_HEADERS = clutter-egl.h
INCLUDES = \
-DG_LOG_DOMAIN=\"ClutterEGL\" \

View File

@ -124,8 +124,24 @@ clutter_backend_egl_constructor (GType gtype,
static ClutterFeatureFlags
clutter_backend_egl_get_features (ClutterBackend *backend)
{
ClutterBackendEGL *backend_egl = CLUTTER_BACKEND_EGL (backend);
CLUTTER_NOTE (BACKEND, "Checking features\n"
"GL_VENDOR: %s\n"
"GL_RENDERER: %s\n"
"GL_VERSION: %s\n"
"EGL_VENDOR: %s\n",
"EGL_VERSION: %s\n",
"EGL_EXTENSIONS: %s\n",
glGetString(GL_VENDOR),
glGetString(GL_RENDERER),
glGetString(GL_VERSION),
eglQueryString(backend_egl->edpy, EGL_VENDOR),
eglQueryString(backend_egl->edpy, EGL_VERSION),
eglQueryString(backend_egl->edpy, EGL_EXTENSIONS));
/* We can actually resize too */
return CLUTTER_FEATURE_STAGE_CURSOR;
return CLUTTER_FEATURE_STAGE_CURSOR|CLUTTER_FEATURE_STAGE_MULTIPLE;
}
static gboolean

View File

@ -224,14 +224,12 @@ main (int argc, char *argv[])
#endif
}
clutter_actor_show_all (oh->group);
/* Add the group to the stage */
clutter_container_add_actor (CLUTTER_CONTAINER (stage),
CLUTTER_ACTOR (oh->group));
/* Show everying ( and map window ) */
clutter_actor_show_all (stage);
clutter_actor_show (stage);
g_signal_connect (stage, "button-press-event",