2008-06-16 13:40:39 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2015-07-11 09:12:33 +00:00
|
|
|
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
2008-06-16 13:40:39 +00:00
|
|
|
#include <clutter/clutter.h>
|
|
|
|
|
2013-12-12 14:51:00 +00:00
|
|
|
static void
|
|
|
|
actor_initial_state (void)
|
2008-06-16 13:40:39 +00:00
|
|
|
{
|
|
|
|
ClutterActor *actor;
|
|
|
|
|
2013-06-12 09:27:37 +00:00
|
|
|
actor = clutter_actor_new ();
|
2012-02-15 13:43:15 +00:00
|
|
|
g_object_ref_sink (actor);
|
2013-06-12 09:27:37 +00:00
|
|
|
g_object_add_weak_pointer (G_OBJECT (actor), (gpointer *) &actor);
|
2012-02-15 13:43:15 +00:00
|
|
|
|
|
|
|
if (g_test_verbose ())
|
|
|
|
g_print ("initial state - visible: %s, realized: %s, mapped: %s\n",
|
|
|
|
CLUTTER_ACTOR_IS_VISIBLE (actor) ? "yes" : "no",
|
|
|
|
CLUTTER_ACTOR_IS_REALIZED (actor) ? "yes" : "no",
|
|
|
|
CLUTTER_ACTOR_IS_MAPPED (actor) ? "yes" : "no");
|
2008-06-16 13:40:39 +00:00
|
|
|
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_REALIZED (actor)));
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (actor)));
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (actor)));
|
|
|
|
|
|
|
|
clutter_actor_destroy (actor);
|
2013-06-12 09:27:37 +00:00
|
|
|
g_assert (actor == NULL);
|
2008-06-16 13:40:39 +00:00
|
|
|
}
|
|
|
|
|
2013-12-12 14:51:00 +00:00
|
|
|
static void
|
|
|
|
actor_shown_not_parented (void)
|
Enforce invariants on mapped, realized, visibility states
Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-04-02 13:16:43 +00:00
|
|
|
{
|
|
|
|
ClutterActor *actor;
|
|
|
|
|
2013-12-12 14:51:00 +00:00
|
|
|
actor = clutter_actor_new ();
|
2012-02-15 13:43:15 +00:00
|
|
|
g_object_ref_sink (actor);
|
2013-06-12 09:27:37 +00:00
|
|
|
g_object_add_weak_pointer (G_OBJECT (actor), (gpointer *) &actor);
|
Enforce invariants on mapped, realized, visibility states
Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-04-02 13:16:43 +00:00
|
|
|
|
|
|
|
clutter_actor_show (actor);
|
|
|
|
|
2012-02-15 13:43:15 +00:00
|
|
|
if (g_test_verbose ())
|
|
|
|
g_print ("show without a parent - visible: %s, realized: %s, mapped: %s\n",
|
|
|
|
CLUTTER_ACTOR_IS_VISIBLE (actor) ? "yes" : "no",
|
|
|
|
CLUTTER_ACTOR_IS_REALIZED (actor) ? "yes" : "no",
|
|
|
|
CLUTTER_ACTOR_IS_MAPPED (actor) ? "yes" : "no");
|
|
|
|
|
Enforce invariants on mapped, realized, visibility states
Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-04-02 13:16:43 +00:00
|
|
|
g_assert (!CLUTTER_ACTOR_IS_REALIZED (actor));
|
|
|
|
g_assert (!CLUTTER_ACTOR_IS_MAPPED (actor));
|
|
|
|
g_assert (CLUTTER_ACTOR_IS_VISIBLE (actor));
|
|
|
|
|
|
|
|
clutter_actor_destroy (actor);
|
2013-06-12 09:27:37 +00:00
|
|
|
g_assert (actor == NULL);
|
Enforce invariants on mapped, realized, visibility states
Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-04-02 13:16:43 +00:00
|
|
|
}
|
|
|
|
|
2013-12-12 14:51:00 +00:00
|
|
|
static void
|
|
|
|
actor_realized (void)
|
2008-06-16 13:40:39 +00:00
|
|
|
{
|
|
|
|
ClutterActor *actor;
|
Enforce invariants on mapped, realized, visibility states
Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-04-02 13:16:43 +00:00
|
|
|
ClutterActor *stage;
|
|
|
|
|
2013-12-12 14:51:00 +00:00
|
|
|
stage = clutter_test_get_stage ();
|
2008-06-16 13:40:39 +00:00
|
|
|
|
2012-02-15 13:43:15 +00:00
|
|
|
actor = clutter_actor_new ();
|
2008-06-16 13:40:39 +00:00
|
|
|
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_REALIZED (actor)));
|
|
|
|
|
Enforce invariants on mapped, realized, visibility states
Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-04-02 13:16:43 +00:00
|
|
|
clutter_actor_hide (actor); /* don't show, so won't map */
|
2012-02-15 13:43:15 +00:00
|
|
|
clutter_actor_add_child (stage, actor);
|
2008-06-16 13:40:39 +00:00
|
|
|
clutter_actor_realize (actor);
|
|
|
|
|
|
|
|
g_assert (CLUTTER_ACTOR_IS_REALIZED (actor));
|
|
|
|
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (actor)));
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (actor)));
|
|
|
|
}
|
|
|
|
|
2013-12-12 14:51:00 +00:00
|
|
|
static void
|
|
|
|
actor_mapped (void)
|
2008-06-16 13:40:39 +00:00
|
|
|
{
|
|
|
|
ClutterActor *actor;
|
Enforce invariants on mapped, realized, visibility states
Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-04-02 13:16:43 +00:00
|
|
|
ClutterActor *stage;
|
|
|
|
|
2013-12-12 14:51:00 +00:00
|
|
|
stage = clutter_test_get_stage ();
|
2010-02-24 12:09:13 +00:00
|
|
|
clutter_actor_show (stage);
|
2008-06-16 13:40:39 +00:00
|
|
|
|
2012-02-15 13:43:15 +00:00
|
|
|
actor = clutter_actor_new ();
|
2008-06-16 13:40:39 +00:00
|
|
|
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_REALIZED (actor)));
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (actor)));
|
|
|
|
|
2012-02-15 13:43:15 +00:00
|
|
|
clutter_actor_add_child (stage, actor);
|
|
|
|
|
|
|
|
if (g_test_verbose ())
|
|
|
|
g_print ("adding to a container should map - "
|
|
|
|
"visible: %s, realized: %s, mapped: %s\n",
|
|
|
|
CLUTTER_ACTOR_IS_VISIBLE (actor) ? "yes" : "no",
|
|
|
|
CLUTTER_ACTOR_IS_REALIZED (actor) ? "yes" : "no",
|
|
|
|
CLUTTER_ACTOR_IS_MAPPED (actor) ? "yes" : "no");
|
2008-06-16 13:40:39 +00:00
|
|
|
|
|
|
|
g_assert (CLUTTER_ACTOR_IS_REALIZED (actor));
|
|
|
|
g_assert (CLUTTER_ACTOR_IS_MAPPED (actor));
|
|
|
|
g_assert (CLUTTER_ACTOR_IS_VISIBLE (actor));
|
|
|
|
|
2012-02-15 13:43:15 +00:00
|
|
|
clutter_actor_hide (actor);
|
|
|
|
|
|
|
|
if (g_test_verbose ())
|
|
|
|
g_print ("hiding should unmap - "
|
|
|
|
"visible: %s, realized: %s, mapped: %s\n",
|
|
|
|
CLUTTER_ACTOR_IS_VISIBLE (actor) ? "yes" : "no",
|
|
|
|
CLUTTER_ACTOR_IS_REALIZED (actor) ? "yes" : "no",
|
|
|
|
CLUTTER_ACTOR_IS_MAPPED (actor) ? "yes" : "no");
|
|
|
|
|
|
|
|
g_assert (CLUTTER_ACTOR_IS_REALIZED (actor));
|
|
|
|
g_assert (!CLUTTER_ACTOR_IS_MAPPED (actor));
|
|
|
|
g_assert (!CLUTTER_ACTOR_IS_VISIBLE (actor));
|
2008-06-16 13:40:39 +00:00
|
|
|
}
|
|
|
|
|
2013-12-12 14:51:00 +00:00
|
|
|
static void
|
|
|
|
actor_visibility_not_recursive (void)
|
2012-03-05 17:45:23 +00:00
|
|
|
{
|
|
|
|
ClutterActor *actor, *group;
|
|
|
|
ClutterActor *stage;
|
|
|
|
|
2013-12-12 14:51:00 +00:00
|
|
|
stage = clutter_test_get_stage ();
|
|
|
|
|
2012-03-05 17:45:23 +00:00
|
|
|
group = clutter_actor_new ();
|
|
|
|
actor = clutter_actor_new ();
|
|
|
|
|
|
|
|
clutter_actor_hide (group); /* don't show, so won't map */
|
|
|
|
clutter_actor_hide (actor); /* don't show, so won't map */
|
|
|
|
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (stage)));
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (group)));
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (actor)));
|
|
|
|
|
|
|
|
clutter_actor_add_child (stage, group);
|
|
|
|
clutter_actor_add_child (group, actor);
|
|
|
|
|
|
|
|
clutter_actor_show (actor);
|
|
|
|
g_assert (CLUTTER_ACTOR_IS_VISIBLE (actor));
|
|
|
|
g_assert (!CLUTTER_ACTOR_IS_VISIBLE (group));
|
|
|
|
g_assert (!CLUTTER_ACTOR_IS_VISIBLE (stage));
|
|
|
|
|
|
|
|
clutter_actor_show (stage);
|
|
|
|
g_assert (CLUTTER_ACTOR_IS_VISIBLE (actor));
|
|
|
|
g_assert (!CLUTTER_ACTOR_IS_VISIBLE (group));
|
|
|
|
g_assert (CLUTTER_ACTOR_IS_VISIBLE (stage));
|
|
|
|
|
|
|
|
clutter_actor_hide (actor);
|
|
|
|
clutter_actor_hide (group);
|
|
|
|
clutter_actor_hide (stage);
|
|
|
|
g_assert (!CLUTTER_ACTOR_IS_VISIBLE (actor));
|
|
|
|
|
|
|
|
clutter_actor_show (stage);
|
|
|
|
g_assert (!CLUTTER_ACTOR_IS_VISIBLE (actor));
|
|
|
|
}
|
|
|
|
|
2013-12-12 14:51:00 +00:00
|
|
|
static void
|
|
|
|
actor_realize_not_recursive (void)
|
Enforce invariants on mapped, realized, visibility states
Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-04-02 13:16:43 +00:00
|
|
|
{
|
|
|
|
ClutterActor *actor, *group;
|
|
|
|
ClutterActor *stage;
|
|
|
|
|
2013-12-12 14:51:00 +00:00
|
|
|
stage = clutter_test_get_stage ();
|
2010-02-24 12:09:13 +00:00
|
|
|
clutter_actor_show (stage);
|
Enforce invariants on mapped, realized, visibility states
Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-04-02 13:16:43 +00:00
|
|
|
|
2012-02-15 13:43:15 +00:00
|
|
|
group = clutter_actor_new ();
|
Enforce invariants on mapped, realized, visibility states
Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-04-02 13:16:43 +00:00
|
|
|
|
2012-02-15 13:43:15 +00:00
|
|
|
actor = clutter_actor_new ();
|
Enforce invariants on mapped, realized, visibility states
Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-04-02 13:16:43 +00:00
|
|
|
|
|
|
|
clutter_actor_hide (group); /* don't show, so won't map */
|
|
|
|
clutter_actor_hide (actor); /* don't show, so won't map */
|
|
|
|
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_REALIZED (group)));
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_REALIZED (actor)));
|
|
|
|
|
2012-02-15 13:43:15 +00:00
|
|
|
clutter_actor_add_child (stage, group);
|
|
|
|
clutter_actor_add_child (group, actor);
|
Enforce invariants on mapped, realized, visibility states
Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-04-02 13:16:43 +00:00
|
|
|
|
|
|
|
clutter_actor_realize (group);
|
|
|
|
|
|
|
|
g_assert (CLUTTER_ACTOR_IS_REALIZED (group));
|
|
|
|
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (group)));
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (group)));
|
|
|
|
|
|
|
|
/* realizing group did not realize the child */
|
|
|
|
g_assert (!CLUTTER_ACTOR_IS_REALIZED (actor));
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (actor)));
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (actor)));
|
|
|
|
}
|
|
|
|
|
2013-12-12 14:51:00 +00:00
|
|
|
static void
|
|
|
|
actor_map_recursive (void)
|
Enforce invariants on mapped, realized, visibility states
Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-04-02 13:16:43 +00:00
|
|
|
{
|
|
|
|
ClutterActor *actor, *group;
|
|
|
|
ClutterActor *stage;
|
|
|
|
|
2013-12-12 14:51:00 +00:00
|
|
|
stage = clutter_test_get_stage ();
|
2010-02-24 12:09:13 +00:00
|
|
|
clutter_actor_show (stage);
|
Enforce invariants on mapped, realized, visibility states
Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-04-02 13:16:43 +00:00
|
|
|
|
2012-02-15 13:43:15 +00:00
|
|
|
group = clutter_actor_new ();
|
Enforce invariants on mapped, realized, visibility states
Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-04-02 13:16:43 +00:00
|
|
|
|
2012-02-15 13:43:15 +00:00
|
|
|
actor = clutter_actor_new ();
|
Enforce invariants on mapped, realized, visibility states
Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-04-02 13:16:43 +00:00
|
|
|
|
|
|
|
clutter_actor_hide (group); /* hide at first */
|
|
|
|
clutter_actor_show (actor); /* show at first */
|
|
|
|
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_REALIZED (group)));
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_REALIZED (actor)));
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (group)));
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (actor)));
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (group)));
|
|
|
|
g_assert ((CLUTTER_ACTOR_IS_VISIBLE (actor)));
|
|
|
|
|
2012-02-15 13:43:15 +00:00
|
|
|
clutter_actor_add_child (stage, group);
|
|
|
|
clutter_actor_add_child (group, actor);
|
Enforce invariants on mapped, realized, visibility states
Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-04-02 13:16:43 +00:00
|
|
|
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_REALIZED (group)));
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_REALIZED (actor)));
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (group)));
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (actor)));
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (group)));
|
|
|
|
g_assert ((CLUTTER_ACTOR_IS_VISIBLE (actor)));
|
|
|
|
|
|
|
|
/* show group, which should map and realize both
|
|
|
|
* group and child.
|
|
|
|
*/
|
|
|
|
clutter_actor_show (group);
|
|
|
|
g_assert (CLUTTER_ACTOR_IS_REALIZED (group));
|
|
|
|
g_assert (CLUTTER_ACTOR_IS_REALIZED (actor));
|
|
|
|
g_assert (CLUTTER_ACTOR_IS_MAPPED (group));
|
|
|
|
g_assert (CLUTTER_ACTOR_IS_MAPPED (actor));
|
|
|
|
g_assert (CLUTTER_ACTOR_IS_VISIBLE (group));
|
|
|
|
g_assert (CLUTTER_ACTOR_IS_VISIBLE (actor));
|
|
|
|
}
|
|
|
|
|
2013-12-12 14:51:00 +00:00
|
|
|
static void
|
|
|
|
actor_show_on_set_parent (void)
|
2008-06-16 13:40:39 +00:00
|
|
|
{
|
|
|
|
ClutterActor *actor, *group;
|
|
|
|
gboolean show_on_set_parent;
|
Enforce invariants on mapped, realized, visibility states
Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-04-02 13:16:43 +00:00
|
|
|
ClutterActor *stage;
|
|
|
|
|
2013-12-12 14:51:00 +00:00
|
|
|
stage = clutter_test_get_stage ();
|
2008-06-16 13:40:39 +00:00
|
|
|
|
2012-02-15 13:43:15 +00:00
|
|
|
group = clutter_actor_new ();
|
2008-06-16 13:40:39 +00:00
|
|
|
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (group)));
|
|
|
|
|
2012-02-15 13:43:15 +00:00
|
|
|
clutter_actor_add_child (stage, group);
|
Enforce invariants on mapped, realized, visibility states
Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-04-02 13:16:43 +00:00
|
|
|
|
2012-02-15 13:43:15 +00:00
|
|
|
actor = clutter_actor_new ();
|
2011-06-16 16:07:32 +00:00
|
|
|
g_object_get (actor,
|
2008-06-16 13:40:39 +00:00
|
|
|
"show-on-set-parent", &show_on_set_parent,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_VISIBLE (actor)));
|
2012-03-05 17:26:09 +00:00
|
|
|
g_assert (show_on_set_parent);
|
2008-06-16 13:40:39 +00:00
|
|
|
|
2012-02-15 13:43:15 +00:00
|
|
|
clutter_actor_add_child (group, actor);
|
2011-06-16 16:07:32 +00:00
|
|
|
g_object_get (actor,
|
2008-06-16 13:40:39 +00:00
|
|
|
"show-on-set-parent", &show_on_set_parent,
|
|
|
|
NULL);
|
|
|
|
|
|
|
|
g_assert (CLUTTER_ACTOR_IS_VISIBLE (actor));
|
2012-03-05 17:26:09 +00:00
|
|
|
g_assert (show_on_set_parent);
|
2008-06-16 13:40:39 +00:00
|
|
|
|
|
|
|
g_object_ref (actor);
|
2012-02-15 13:43:15 +00:00
|
|
|
clutter_actor_remove_child (group, actor);
|
2011-06-16 16:07:32 +00:00
|
|
|
g_object_get (actor,
|
2008-06-16 13:40:39 +00:00
|
|
|
"show-on-set-parent", &show_on_set_parent,
|
|
|
|
NULL);
|
|
|
|
|
Enforce invariants on mapped, realized, visibility states
Bug 1138 - No trackable "mapped" state
* Add a VISIBLE flag tracking application programmer's
expected showing-state for the actor, allowing us to
always ensure we keep what the app wants while tracking
internal implementation state separately.
* Make MAPPED reflect whether the actor will be painted;
add notification on a ClutterActor::mapped property.
Keep MAPPED state updated as the actor is shown,
ancestors are shown, actor is reparented, etc.
* Require a stage and realized parents to realize; this means
at realization time the correct window system and GL resources
are known. But unparented actors can no longer be realized.
* Allow children to be unrealized even if parent is realized.
Otherwise in effect either all actors or no actors are realized,
i.e. it becomes a stage-global flag.
* Allow clutter_actor_realize() to "fail" if not inside a toplevel
* Rework clutter_actor_unrealize() so internally we have
a flavor that does not mess with visibility flag
* Add _clutter_actor_rerealize() to encapsulate a somewhat
tricky operation we were doing in a couple of places
* Do not realize/unrealize children in ClutterGroup,
ClutterActor already does it
* Do not realize impl by hand in clutter_stage_show(),
since showing impl already does that
* Do not unrealize in various dispose() methods, since
ClutterActor dispose implementation already does it
and chaining up is mandatory
* ClutterTexture uses COGL while unrealizable (before it's
added to a stage). Previously this breakage was affecting
ClutterActor because we had to allow realize outside
a stage. Move the breakage to ClutterTexture, by making
ClutterTexture just use COGL while not realized.
* Unrealize before we set parent to NULL in clutter_actor_unparent().
This means unrealize() implementations can get to the stage.
Because actors need the stage in order to detach from stage.
* Update clutter-actor-invariants.txt to reflect latest changes
* Remove explicit hide/unrealize from ClutterActor::dispose since
unparent already forces those
Instead just assert that unparent() occurred and did the right thing.
* Check whether parent implements unrealize before chaining up
Needed because ClutterGroup no longer has to implement unrealize.
* Perform unrealize in the default handler for the signal.
This allows non-containers that have children to work properly,
and allows containers to override how it's done.
* Add map/unmap virtual methods and set MAPPED flag on self and
children in there. This allows subclasses to hook map/unmap.
These are not signals, because notify::mapped is better for
anything it's legitimate for a non-subclass to do.
Signed-off-by: Emmanuele Bassi <ebassi@linux.intel.com>
2009-04-02 13:16:43 +00:00
|
|
|
g_assert (!CLUTTER_ACTOR_IS_REALIZED (actor));
|
|
|
|
g_assert (!CLUTTER_ACTOR_IS_MAPPED (actor));
|
|
|
|
g_assert (CLUTTER_ACTOR_IS_VISIBLE (actor));
|
2012-03-05 17:26:09 +00:00
|
|
|
g_assert (show_on_set_parent);
|
2008-06-16 13:40:39 +00:00
|
|
|
|
|
|
|
clutter_actor_destroy (actor);
|
|
|
|
clutter_actor_destroy (group);
|
2012-03-05 17:26:09 +00:00
|
|
|
|
|
|
|
actor = clutter_actor_new ();
|
|
|
|
clutter_actor_add_child (stage, actor);
|
|
|
|
clutter_actor_hide (actor);
|
|
|
|
g_object_get (actor,
|
|
|
|
"show-on-set-parent", &show_on_set_parent,
|
|
|
|
NULL);
|
|
|
|
g_assert (!CLUTTER_ACTOR_IS_VISIBLE (actor));
|
|
|
|
g_assert (!CLUTTER_ACTOR_IS_MAPPED (actor));
|
|
|
|
g_assert (show_on_set_parent);
|
|
|
|
|
|
|
|
clutter_actor_destroy (actor);
|
|
|
|
|
|
|
|
actor = clutter_actor_new ();
|
|
|
|
clutter_actor_hide (actor);
|
|
|
|
clutter_actor_add_child (stage, actor);
|
|
|
|
g_object_get (actor,
|
|
|
|
"show-on-set-parent", &show_on_set_parent,
|
|
|
|
NULL);
|
|
|
|
g_assert (!CLUTTER_ACTOR_IS_VISIBLE (actor));
|
|
|
|
g_assert (!CLUTTER_ACTOR_IS_MAPPED (actor));
|
|
|
|
g_assert (!show_on_set_parent);
|
|
|
|
|
|
|
|
clutter_actor_destroy (actor);
|
2008-06-16 13:40:39 +00:00
|
|
|
}
|
2009-06-12 02:46:38 +00:00
|
|
|
|
2013-12-12 14:51:00 +00:00
|
|
|
static void
|
|
|
|
clone_no_map (void)
|
2009-06-12 02:46:38 +00:00
|
|
|
{
|
|
|
|
ClutterActor *stage;
|
|
|
|
ClutterActor *group;
|
|
|
|
ClutterActor *actor;
|
|
|
|
ClutterActor *clone;
|
|
|
|
|
2013-12-12 14:51:00 +00:00
|
|
|
stage = clutter_test_get_stage ();
|
2010-02-24 12:09:13 +00:00
|
|
|
clutter_actor_show (stage);
|
2009-06-12 02:46:38 +00:00
|
|
|
|
2013-06-12 09:27:37 +00:00
|
|
|
group = clutter_actor_new ();
|
|
|
|
actor = clutter_actor_new ();
|
2009-06-12 02:46:38 +00:00
|
|
|
|
|
|
|
clutter_actor_hide (group);
|
|
|
|
|
2013-06-12 09:27:37 +00:00
|
|
|
clutter_actor_add_child (group, actor);
|
|
|
|
clutter_actor_add_child (stage, group);
|
2009-06-12 02:46:38 +00:00
|
|
|
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (group)));
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (actor)));
|
|
|
|
|
|
|
|
clone = clutter_clone_new (group);
|
|
|
|
|
2013-06-12 09:27:37 +00:00
|
|
|
clutter_actor_add_child (stage, clone);
|
2009-06-12 02:46:38 +00:00
|
|
|
|
|
|
|
g_assert (CLUTTER_ACTOR_IS_MAPPED (clone));
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (group)));
|
|
|
|
g_assert (!(CLUTTER_ACTOR_IS_MAPPED (actor)));
|
|
|
|
|
|
|
|
clutter_actor_destroy (CLUTTER_ACTOR (clone));
|
|
|
|
clutter_actor_destroy (CLUTTER_ACTOR (group));
|
2010-09-27 21:17:12 +00:00
|
|
|
}
|
2011-11-08 17:04:44 +00:00
|
|
|
|
2013-12-12 14:51:00 +00:00
|
|
|
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
|
|
|
static void
|
|
|
|
default_stage (void)
|
2011-11-08 17:04:44 +00:00
|
|
|
{
|
|
|
|
ClutterActor *stage, *def_stage;
|
|
|
|
|
2013-12-12 14:51:00 +00:00
|
|
|
stage = clutter_test_get_stage ();
|
2011-11-08 17:04:44 +00:00
|
|
|
def_stage = clutter_stage_get_default ();
|
|
|
|
|
|
|
|
if (clutter_feature_available (CLUTTER_FEATURE_STAGE_MULTIPLE))
|
|
|
|
g_assert (stage != def_stage);
|
|
|
|
else
|
|
|
|
g_assert (stage == def_stage);
|
|
|
|
|
|
|
|
g_assert (CLUTTER_ACTOR_IS_REALIZED (def_stage));
|
|
|
|
}
|
2013-12-12 14:51:00 +00:00
|
|
|
G_GNUC_END_IGNORE_DEPRECATIONS
|
|
|
|
|
|
|
|
CLUTTER_TEST_SUITE (
|
|
|
|
CLUTTER_TEST_UNIT ("/actor/invariants/initial-state", actor_initial_state)
|
|
|
|
CLUTTER_TEST_UNIT ("/actor/invariants/show-not-parented", actor_shown_not_parented)
|
|
|
|
CLUTTER_TEST_UNIT ("/actor/invariants/realized", actor_realized)
|
|
|
|
CLUTTER_TEST_UNIT ("/actor/invariants/mapped", actor_mapped)
|
|
|
|
CLUTTER_TEST_UNIT ("/actor/invariants/visibility-not-recursive", actor_visibility_not_recursive)
|
|
|
|
CLUTTER_TEST_UNIT ("/actor/invariants/realize-not-recursive", actor_realize_not_recursive)
|
|
|
|
CLUTTER_TEST_UNIT ("/actor/invariants/map-recursive", actor_map_recursive)
|
|
|
|
CLUTTER_TEST_UNIT ("/actor/invariants/show-on-set-parent", actor_show_on_set_parent)
|
|
|
|
CLUTTER_TEST_UNIT ("/actor/invariants/clone-no-map", clone_no_map)
|
|
|
|
CLUTTER_TEST_UNIT ("/actor/invariants/default-stage", default_stage)
|
|
|
|
)
|