clutter/stage-view: Add name property

Will be used for logging to identify what view a log entry concerns. For
the native and nested backend this is the name of the output the CRTC is
assigned to drive; for X11 it's just "X11 screen", and for the legacy
"X11 screen" emulation mode of the nested backend it's called "legacy
nested".

https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1237
This commit is contained in:
Jonas Ådahl 2020-04-30 10:42:30 +02:00 committed by Georges Basile Stavracas Neto
parent 9bf6faf639
commit 6db94a0b77
4 changed files with 22 additions and 0 deletions

View File

@ -31,6 +31,7 @@ enum
{ {
PROP_0, PROP_0,
PROP_NAME,
PROP_LAYOUT, PROP_LAYOUT,
PROP_FRAMEBUFFER, PROP_FRAMEBUFFER,
PROP_OFFSCREEN, PROP_OFFSCREEN,
@ -44,6 +45,8 @@ static GParamSpec *obj_props[PROP_LAST];
typedef struct _ClutterStageViewPrivate typedef struct _ClutterStageViewPrivate
{ {
char *name;
cairo_rectangle_int_t layout; cairo_rectangle_int_t layout;
float scale; float scale;
CoglFramebuffer *framebuffer; CoglFramebuffer *framebuffer;
@ -442,6 +445,9 @@ clutter_stage_view_get_property (GObject *object,
switch (prop_id) switch (prop_id)
{ {
case PROP_NAME:
g_value_set_string (value, priv->name);
break;
case PROP_LAYOUT: case PROP_LAYOUT:
g_value_set_boxed (value, &priv->layout); g_value_set_boxed (value, &priv->layout);
break; break;
@ -475,6 +481,9 @@ clutter_stage_view_set_property (GObject *object,
switch (prop_id) switch (prop_id)
{ {
case PROP_NAME:
priv->name = g_value_dup_string (value);
break;
case PROP_LAYOUT: case PROP_LAYOUT:
layout = g_value_get_boxed (value); layout = g_value_get_boxed (value);
priv->layout = *layout; priv->layout = *layout;
@ -517,6 +526,7 @@ clutter_stage_view_dispose (GObject *object)
ClutterStageViewPrivate *priv = ClutterStageViewPrivate *priv =
clutter_stage_view_get_instance_private (view); clutter_stage_view_get_instance_private (view);
g_clear_pointer (&priv->name, g_free);
g_clear_pointer (&priv->framebuffer, cogl_object_unref); g_clear_pointer (&priv->framebuffer, cogl_object_unref);
g_clear_pointer (&priv->shadowfb, cogl_object_unref); g_clear_pointer (&priv->shadowfb, cogl_object_unref);
g_clear_pointer (&priv->offscreen, cogl_object_unref); g_clear_pointer (&priv->offscreen, cogl_object_unref);
@ -550,6 +560,14 @@ clutter_stage_view_class_init (ClutterStageViewClass *klass)
object_class->set_property = clutter_stage_view_set_property; object_class->set_property = clutter_stage_view_set_property;
object_class->dispose = clutter_stage_view_dispose; object_class->dispose = clutter_stage_view_dispose;
obj_props[PROP_NAME] =
g_param_spec_string ("name",
"Name",
"Name of view",
NULL,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_LAYOUT] = obj_props[PROP_LAYOUT] =
g_param_spec_boxed ("layout", g_param_spec_boxed ("layout",
"View layout", "View layout",

View File

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

View File

@ -51,6 +51,7 @@ meta_renderer_x11_cm_ensure_screen_view (MetaRendererX11Cm *renderer_x11_cm,
.height = height, .height = height,
}; };
renderer_x11_cm->screen_view = g_object_new (META_TYPE_RENDERER_VIEW, renderer_x11_cm->screen_view = g_object_new (META_TYPE_RENDERER_VIEW,
"name", "X11 screen",
"layout", &view_layout, "layout", &view_layout,
NULL); NULL);
meta_renderer_add_view (META_RENDERER (renderer_x11_cm), meta_renderer_add_view (META_RENDERER (renderer_x11_cm),

View File

@ -163,6 +163,7 @@ meta_renderer_x11_nested_ensure_legacy_view (MetaRendererX11Nested *renderer_x11
.height = height .height = height
}; };
legacy_view = g_object_new (META_TYPE_RENDERER_VIEW, legacy_view = g_object_new (META_TYPE_RENDERER_VIEW,
"name", "legacy nested",
"layout", &view_layout, "layout", &view_layout,
"framebuffer", COGL_FRAMEBUFFER (fake_onscreen), "framebuffer", COGL_FRAMEBUFFER (fake_onscreen),
NULL); NULL);
@ -212,6 +213,7 @@ meta_renderer_x11_nested_create_view (MetaRenderer *renderer,
&view_layout); &view_layout);
view = g_object_new (META_TYPE_RENDERER_VIEW, view = g_object_new (META_TYPE_RENDERER_VIEW,
"name", meta_output_get_name (output),
"layout", &view_layout, "layout", &view_layout,
"framebuffer", COGL_FRAMEBUFFER (fake_onscreen), "framebuffer", COGL_FRAMEBUFFER (fake_onscreen),
"offscreen", COGL_FRAMEBUFFER (offscreen), "offscreen", COGL_FRAMEBUFFER (offscreen),