screen-cast/stream: Add 'is-configured' property

When this is TRUE, it has a size, position etc. Only virtual streams do
this asynchronously, as they go via monitor configuration after being
created.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3241>
This commit is contained in:
Jonas Ådahl 2023-09-04 11:44:48 +02:00
parent 731c3e0ba3
commit 242737c4dc
5 changed files with 41 additions and 0 deletions

View File

@ -110,6 +110,7 @@ meta_screen_cast_area_stream_new (MetaScreenCastSession *session,
"connection", connection,
"cursor-mode", cursor_mode,
"flags", flags,
"is-configured", TRUE,
NULL);
if (!area_stream)
return NULL;

View File

@ -134,6 +134,7 @@ meta_screen_cast_monitor_stream_new (MetaScreenCastSession *session,
"connection", connection,
"cursor-mode", cursor_mode,
"flags", flags,
"is-configured", TRUE,
"monitor", monitor,
NULL);
if (!monitor_stream)

View File

@ -38,6 +38,7 @@ enum
PROP_CONNECTION,
PROP_CURSOR_MODE,
PROP_FLAGS,
PROP_IS_CONFIGURED,
N_PROPS
};
@ -62,6 +63,7 @@ typedef struct _MetaScreenCastStreamPrivate
MetaScreenCastCursorMode cursor_mode;
MetaScreenCastFlag flags;
gboolean is_configured;
MetaScreenCastStreamSrc *src;
@ -233,6 +235,25 @@ meta_screen_cast_stream_get_mapping_id (MetaScreenCastStream *stream)
return priv->mapping_id;
}
gboolean
meta_screen_cast_stream_is_configured (MetaScreenCastStream *stream)
{
MetaScreenCastStreamPrivate *priv =
meta_screen_cast_stream_get_instance_private (stream);
return priv->is_configured;
}
void
meta_screen_cast_stream_notify_is_configured (MetaScreenCastStream *stream)
{
MetaScreenCastStreamPrivate *priv =
meta_screen_cast_stream_get_instance_private (stream);
priv->is_configured = TRUE;
g_object_notify_by_pspec (G_OBJECT (stream), obj_props[PROP_IS_CONFIGURED]);
}
static void
meta_screen_cast_stream_set_property (GObject *object,
guint prop_id,
@ -257,6 +278,9 @@ meta_screen_cast_stream_set_property (GObject *object,
case PROP_FLAGS:
priv->flags = g_value_get_flags (value);
break;
case PROP_IS_CONFIGURED:
priv->is_configured = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@ -286,6 +310,9 @@ meta_screen_cast_stream_get_property (GObject *object,
case PROP_FLAGS:
g_value_set_flags (value, priv->flags);
break;
case PROP_IS_CONFIGURED:
g_value_set_boolean (value, priv->is_configured);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@ -459,6 +486,12 @@ meta_screen_cast_stream_class_init (MetaScreenCastStreamClass *klass)
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS);
obj_props[PROP_IS_CONFIGURED] =
g_param_spec_boolean ("is-configured", NULL, NULL,
FALSE,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT |
G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPS, obj_props);
signals[CLOSED] = g_signal_new ("closed",

View File

@ -69,3 +69,7 @@ MetaScreenCastCursorMode meta_screen_cast_stream_get_cursor_mode (MetaScreenCast
MetaScreenCastFlag meta_screen_cast_stream_get_flags (MetaScreenCastStream *stream);
const char * meta_screen_cast_stream_get_mapping_id (MetaScreenCastStream *stream);
gboolean meta_screen_cast_stream_is_configured (MetaScreenCastStream *stream);
void meta_screen_cast_stream_notify_is_configured (MetaScreenCastStream *stream);

View File

@ -283,6 +283,8 @@ init_record_callbacks (MetaScreenCastVirtualStreamSrc *virtual_src)
break;
}
meta_screen_cast_stream_notify_is_configured (stream);
if (meta_screen_cast_stream_get_cursor_mode (stream) ==
META_SCREEN_CAST_CURSOR_MODE_EMBEDDED)
inhibit_hw_cursor (virtual_src);