clutter/stage-view: Pass a pointer to the stage during constuction

This is so that stage views can interact with the stage they are views
of.

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1285
This commit is contained in:
Jonas Ådahl 2020-03-30 17:34:43 +02:00
parent ca82cde6dd
commit 59eebd6f6d
3 changed files with 22 additions and 0 deletions

View File

@ -33,6 +33,7 @@ enum
PROP_0,
PROP_NAME,
PROP_STAGE,
PROP_LAYOUT,
PROP_FRAMEBUFFER,
PROP_OFFSCREEN,
@ -48,6 +49,8 @@ typedef struct _ClutterStageViewPrivate
{
char *name;
ClutterStage *stage;
cairo_rectangle_int_t layout;
float scale;
CoglFramebuffer *framebuffer;
@ -1003,6 +1006,9 @@ clutter_stage_view_get_property (GObject *object,
case PROP_NAME:
g_value_set_string (value, priv->name);
break;
case PROP_STAGE:
g_value_set_boxed (value, &priv->stage);
break;
case PROP_LAYOUT:
g_value_set_boxed (value, &priv->layout);
break;
@ -1039,6 +1045,9 @@ clutter_stage_view_set_property (GObject *object,
case PROP_NAME:
priv->name = g_value_dup_string (value);
break;
case PROP_STAGE:
priv->stage = g_value_get_object (value);
break;
case PROP_LAYOUT:
layout = g_value_get_boxed (value);
priv->layout = *layout;
@ -1146,6 +1155,16 @@ clutter_stage_view_class_init (ClutterStageViewClass *klass)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_STAGE] =
g_param_spec_object ("stage",
"The stage",
"The ClutterStage",
CLUTTER_TYPE_STAGE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_LAYOUT] =
g_param_spec_boxed ("layout",
"View layout",

View File

@ -3247,6 +3247,7 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
&view_layout);
view = g_object_new (META_TYPE_RENDERER_VIEW,
"name", meta_output_get_name (output),
"stage", meta_backend_get_stage (backend),
"layout", &view_layout,
"scale", scale,
"framebuffer", onscreen,

View File

@ -164,6 +164,7 @@ meta_renderer_x11_nested_ensure_legacy_view (MetaRendererX11Nested *renderer_x11
};
legacy_view = g_object_new (META_TYPE_RENDERER_VIEW,
"name", "legacy nested",
"stage", meta_backend_get_stage (backend),
"layout", &view_layout,
"framebuffer", COGL_FRAMEBUFFER (fake_onscreen),
NULL);
@ -216,6 +217,7 @@ meta_renderer_x11_nested_create_view (MetaRenderer *renderer,
view = g_object_new (META_TYPE_RENDERER_VIEW,
"name", meta_output_get_name (output),
"stage", meta_backend_get_stage (backend),
"layout", &view_layout,
"framebuffer", COGL_FRAMEBUFFER (fake_onscreen),
"offscreen", COGL_FRAMEBUFFER (offscreen),