diff --git a/ChangeLog b/ChangeLog index 142a80261..94eb51d95 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2008-04-04 Matthew Allum + + reviewed by: + + * 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 * clutter/Makefile.am: Only export symbols matching "^clutter.*", diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c index b8a2418e7..db9c1ea97 100644 --- a/clutter/clutter-actor.c +++ b/clutter/clutter-actor.c @@ -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); diff --git a/clutter/cogl/gles/cogl.c b/clutter/cogl/gles/cogl.c index aea9c22fd..f87812d81 100644 --- a/clutter/cogl/gles/cogl.c +++ b/clutter/cogl/gles/cogl.c @@ -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) { diff --git a/clutter/eglnative/Makefile.am b/clutter/eglnative/Makefile.am index 8d23aa2df..d12a931ee 100644 --- a/clutter/eglnative/Makefile.am +++ b/clutter/eglnative/Makefile.am @@ -1,4 +1,5 @@ libclutterincludedir = $(includedir)/clutter-@CLUTTER_MAJORMINOR@/clutter +libclutterinclude_HEADERS = clutter-egl.h INCLUDES = \ -DG_LOG_DOMAIN=\"ClutterEGL\" \ diff --git a/clutter/eglx/clutter-backend-egl.c b/clutter/eglx/clutter-backend-egl.c index a56ff1293..c7c7ae143 100644 --- a/clutter/eglx/clutter-backend-egl.c +++ b/clutter/eglx/clutter-backend-egl.c @@ -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 diff --git a/tests/test-actors.c b/tests/test-actors.c index d3e3eb50c..1633a6b5d 100644 --- a/tests/test-actors.c +++ b/tests/test-actors.c @@ -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",