mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
remote-access-handle: Add 'is-recording' property
Will be TRUE if it is a screen cast session where all streams have the 'is-recording' set to TRUE. For other screen casts or remote desktop sessions, it'll be FALSE. https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1377
This commit is contained in:
parent
153357cd36
commit
34579d71cc
@ -36,6 +36,17 @@ enum
|
|||||||
|
|
||||||
static int handle_signals[N_HANDLE_SIGNALS];
|
static int handle_signals[N_HANDLE_SIGNALS];
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PROP_0,
|
||||||
|
|
||||||
|
PROP_IS_RECORDING,
|
||||||
|
|
||||||
|
N_PROPS
|
||||||
|
};
|
||||||
|
|
||||||
|
static GParamSpec *obj_props[N_PROPS];
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
CONTROLLER_NEW_HANDLE,
|
CONTROLLER_NEW_HANDLE,
|
||||||
@ -50,6 +61,8 @@ typedef struct _MetaRemoteAccessHandlePrivate
|
|||||||
gboolean has_stopped;
|
gboolean has_stopped;
|
||||||
|
|
||||||
gboolean disable_animations;
|
gboolean disable_animations;
|
||||||
|
|
||||||
|
gboolean is_recording;
|
||||||
} MetaRemoteAccessHandlePrivate;
|
} MetaRemoteAccessHandlePrivate;
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_PRIVATE (MetaRemoteAccessHandle,
|
G_DEFINE_TYPE_WITH_PRIVATE (MetaRemoteAccessHandle,
|
||||||
@ -177,6 +190,48 @@ meta_remote_access_controller_new (MetaRemoteDesktop *remote_desktop,
|
|||||||
return remote_access_controller;
|
return remote_access_controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_remote_access_handle_get_property (GObject *object,
|
||||||
|
guint prop_id,
|
||||||
|
GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
MetaRemoteAccessHandle *handle = META_REMOTE_ACCESS_HANDLE (object);
|
||||||
|
MetaRemoteAccessHandlePrivate *priv =
|
||||||
|
meta_remote_access_handle_get_instance_private (handle);
|
||||||
|
|
||||||
|
switch (prop_id)
|
||||||
|
{
|
||||||
|
case PROP_IS_RECORDING:
|
||||||
|
g_value_set_boolean (value, priv->is_recording);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_remote_access_handle_set_property (GObject *object,
|
||||||
|
guint prop_id,
|
||||||
|
const GValue *value,
|
||||||
|
GParamSpec *pspec)
|
||||||
|
{
|
||||||
|
MetaRemoteAccessHandle *handle = META_REMOTE_ACCESS_HANDLE (object);
|
||||||
|
MetaRemoteAccessHandlePrivate *priv =
|
||||||
|
meta_remote_access_handle_get_instance_private (handle);
|
||||||
|
|
||||||
|
switch (prop_id)
|
||||||
|
{
|
||||||
|
case PROP_IS_RECORDING:
|
||||||
|
priv->is_recording = g_value_get_boolean (value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_remote_access_handle_init (MetaRemoteAccessHandle *handle)
|
meta_remote_access_handle_init (MetaRemoteAccessHandle *handle)
|
||||||
{
|
{
|
||||||
@ -185,6 +240,11 @@ meta_remote_access_handle_init (MetaRemoteAccessHandle *handle)
|
|||||||
static void
|
static void
|
||||||
meta_remote_access_handle_class_init (MetaRemoteAccessHandleClass *klass)
|
meta_remote_access_handle_class_init (MetaRemoteAccessHandleClass *klass)
|
||||||
{
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
|
object_class->get_property = meta_remote_access_handle_get_property;
|
||||||
|
object_class->set_property = meta_remote_access_handle_set_property;
|
||||||
|
|
||||||
handle_signals[HANDLE_STOPPED] =
|
handle_signals[HANDLE_STOPPED] =
|
||||||
g_signal_new ("stopped",
|
g_signal_new ("stopped",
|
||||||
G_TYPE_FROM_CLASS (klass),
|
G_TYPE_FROM_CLASS (klass),
|
||||||
@ -192,6 +252,16 @@ meta_remote_access_handle_class_init (MetaRemoteAccessHandleClass *klass)
|
|||||||
0,
|
0,
|
||||||
NULL, NULL, NULL,
|
NULL, NULL, NULL,
|
||||||
G_TYPE_NONE, 0);
|
G_TYPE_NONE, 0);
|
||||||
|
|
||||||
|
obj_props[PROP_IS_RECORDING] =
|
||||||
|
g_param_spec_boolean ("is-recording",
|
||||||
|
"is-recording",
|
||||||
|
"Is a screen recording",
|
||||||
|
FALSE,
|
||||||
|
G_PARAM_READWRITE |
|
||||||
|
G_PARAM_CONSTRUCT_ONLY |
|
||||||
|
G_PARAM_STATIC_STRINGS);
|
||||||
|
g_object_class_install_properties (object_class, N_PROPS, obj_props);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -677,12 +677,37 @@ meta_screen_cast_session_class_init (MetaScreenCastSessionClass *klass)
|
|||||||
object_class->finalize = meta_screen_cast_session_finalize;
|
object_class->finalize = meta_screen_cast_session_finalize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
meta_screen_cast_session_is_recording (MetaScreenCastSession *session)
|
||||||
|
{
|
||||||
|
GList *l;
|
||||||
|
|
||||||
|
if (!session->streams)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
for (l = session->streams; l; l = l->next)
|
||||||
|
{
|
||||||
|
MetaScreenCastStream *stream = l->data;
|
||||||
|
MetaScreenCastFlag flags;
|
||||||
|
|
||||||
|
flags = meta_screen_cast_stream_get_flags (stream);
|
||||||
|
if (!(flags & META_SCREEN_CAST_FLAG_IS_RECORDING))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static MetaScreenCastSessionHandle *
|
static MetaScreenCastSessionHandle *
|
||||||
meta_screen_cast_session_handle_new (MetaScreenCastSession *session)
|
meta_screen_cast_session_handle_new (MetaScreenCastSession *session)
|
||||||
{
|
{
|
||||||
MetaScreenCastSessionHandle *handle;
|
MetaScreenCastSessionHandle *handle;
|
||||||
|
gboolean is_recording;
|
||||||
|
|
||||||
handle = g_object_new (META_TYPE_SCREEN_CAST_SESSION_HANDLE, NULL);
|
is_recording = meta_screen_cast_session_is_recording (session);
|
||||||
|
handle = g_object_new (META_TYPE_SCREEN_CAST_SESSION_HANDLE,
|
||||||
|
"is-recording", is_recording,
|
||||||
|
NULL);
|
||||||
handle->session = session;
|
handle->session = session;
|
||||||
|
|
||||||
return handle;
|
return handle;
|
||||||
|
Loading…
Reference in New Issue
Block a user