mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 03:22:04 +00:00
clutter/stage: Subclass ClutterActor
ClutterStage is the one and only subclass of ClutterGroup, but it overrides basically everything specific to ClutterGroup to mimic a ClutterActor. What a waste! Subclass ClutterActor directly and remove all the now useless vfunc overrides from ClutterStage. Adapt CallyStage to subclass CallyActor as well. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1332
This commit is contained in:
parent
d4953c77c3
commit
8d83dec044
@ -63,7 +63,7 @@ struct _CallyStagePrivate
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (CallyStage,
|
||||
cally_stage,
|
||||
CALLY_TYPE_GROUP,
|
||||
CALLY_TYPE_ACTOR,
|
||||
G_ADD_PRIVATE (CallyStage)
|
||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_WINDOW,
|
||||
cally_stage_window_interface_init));
|
||||
|
@ -25,7 +25,7 @@
|
||||
#error "Only <cally/cally.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <cally/cally-group.h>
|
||||
#include <cally/cally-actor.h>
|
||||
#include <clutter/clutter.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@ -52,7 +52,7 @@ typedef struct _CallyStagePrivate CallyStagePrivate;
|
||||
struct _CallyStage
|
||||
{
|
||||
/*< private >*/
|
||||
CallyGroup parent;
|
||||
CallyActor parent;
|
||||
|
||||
CallyStagePrivate *priv;
|
||||
};
|
||||
@ -68,7 +68,7 @@ struct _CallyStage
|
||||
struct _CallyStageClass
|
||||
{
|
||||
/*< private >*/
|
||||
CallyGroupClass parent_class;
|
||||
CallyActorClass parent_class;
|
||||
|
||||
/* padding for future expansion */
|
||||
gpointer _padding_dummy[16];
|
||||
|
@ -192,61 +192,7 @@ static void clutter_stage_set_viewport (ClutterStage *stage,
|
||||
float width,
|
||||
float height);
|
||||
|
||||
static void clutter_container_iface_init (ClutterContainerIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (ClutterStage, clutter_stage, CLUTTER_TYPE_GROUP,
|
||||
G_ADD_PRIVATE (ClutterStage)
|
||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_CONTAINER,
|
||||
clutter_container_iface_init))
|
||||
|
||||
static void
|
||||
clutter_stage_real_add (ClutterContainer *container,
|
||||
ClutterActor *child)
|
||||
{
|
||||
clutter_actor_add_child (CLUTTER_ACTOR (container), child);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_real_remove (ClutterContainer *container,
|
||||
ClutterActor *child)
|
||||
{
|
||||
clutter_actor_remove_child (CLUTTER_ACTOR (container), child);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_real_raise (ClutterContainer *container,
|
||||
ClutterActor *child,
|
||||
ClutterActor *sibling)
|
||||
{
|
||||
clutter_actor_set_child_above_sibling (CLUTTER_ACTOR (container),
|
||||
child,
|
||||
sibling);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_real_lower (ClutterContainer *container,
|
||||
ClutterActor *child,
|
||||
ClutterActor *sibling)
|
||||
{
|
||||
clutter_actor_set_child_below_sibling (CLUTTER_ACTOR (container),
|
||||
child,
|
||||
sibling);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_real_sort_depth_order (ClutterContainer *container)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_container_iface_init (ClutterContainerIface *iface)
|
||||
{
|
||||
iface->add = clutter_stage_real_add;
|
||||
iface->remove = clutter_stage_real_remove;
|
||||
iface->raise = clutter_stage_real_raise;
|
||||
iface->lower = clutter_stage_real_lower;
|
||||
iface->sort_depth_order = clutter_stage_real_sort_depth_order;
|
||||
}
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterStage, clutter_stage, CLUTTER_TYPE_ACTOR)
|
||||
|
||||
static void
|
||||
clutter_stage_get_preferred_width (ClutterActor *self,
|
||||
@ -951,38 +897,6 @@ _clutter_stage_emit_after_paint (ClutterStage *stage)
|
||||
g_signal_emit (stage, stage_signals[AFTER_PAINT], 0);
|
||||
}
|
||||
|
||||
/* If we don't implement this here, we get the paint function
|
||||
* from the deprecated clutter-group class, which doesn't
|
||||
* respect the Z order as it uses our empty sort_depth_order.
|
||||
*/
|
||||
static void
|
||||
clutter_stage_paint (ClutterActor *self,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
ClutterActorIter iter;
|
||||
ClutterActor *child;
|
||||
|
||||
clutter_actor_iter_init (&iter, self);
|
||||
while (clutter_actor_iter_next (&iter, &child))
|
||||
clutter_actor_paint (child, paint_context);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_stage_pick (ClutterActor *self,
|
||||
ClutterPickContext *pick_context)
|
||||
{
|
||||
ClutterActorIter iter;
|
||||
ClutterActor *child;
|
||||
|
||||
/* Note: we don't chain up to our parent as we don't want any geometry
|
||||
* emitted for the stage itself. The stage's pick id is effectively handled
|
||||
* by the call to cogl_clear done in clutter-main.c:_clutter_do_pick_async()
|
||||
*/
|
||||
clutter_actor_iter_init (&iter, self);
|
||||
while (clutter_actor_iter_next (&iter, &child))
|
||||
clutter_actor_pick (child, pick_context);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
clutter_stage_get_paint_volume (ClutterActor *self,
|
||||
ClutterPaintVolume *volume)
|
||||
@ -1950,8 +1864,6 @@ clutter_stage_class_init (ClutterStageClass *klass)
|
||||
actor_class->allocate = clutter_stage_allocate;
|
||||
actor_class->get_preferred_width = clutter_stage_get_preferred_width;
|
||||
actor_class->get_preferred_height = clutter_stage_get_preferred_height;
|
||||
actor_class->paint = clutter_stage_paint;
|
||||
actor_class->pick = clutter_stage_pick;
|
||||
actor_class->get_paint_volume = clutter_stage_get_paint_volume;
|
||||
actor_class->realize = clutter_stage_realize;
|
||||
actor_class->unrealize = clutter_stage_unrealize;
|
||||
|
@ -28,8 +28,8 @@
|
||||
#error "Only <clutter/clutter.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <clutter/clutter-actor.h>
|
||||
#include <clutter/clutter-types.h>
|
||||
#include <clutter/clutter-group.h>
|
||||
#include <clutter/clutter-stage-view.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
@ -56,7 +56,7 @@ typedef struct _ClutterStagePrivate ClutterStagePrivate;
|
||||
struct _ClutterStage
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterGroup parent_instance;
|
||||
ClutterActor parent_instance;
|
||||
|
||||
ClutterStagePrivate *priv;
|
||||
};
|
||||
@ -74,7 +74,7 @@ struct _ClutterStage
|
||||
struct _ClutterStageClass
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterGroupClass parent_class;
|
||||
ClutterActorClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
/* signals */
|
||||
|
Loading…
Reference in New Issue
Block a user