[mutter] screen-cast: Add screen cast flag to streams
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] screen-cast: Add screen cast flag to streams
- Date: Fri, 31 Jul 2020 09:17:15 +0000 (UTC)
commit 14cd78a0161c8598d46ec0874a86bed7fc4b67ef
Author: Jonas Ådahl <jadahl gmail com>
Date: Tue Apr 21 16:54:54 2020 +0200
screen-cast: Add screen cast flag to streams
Intended to be used to pass state from screen cast clients down the
line. The first use case will be a boolean whether a screen cast is a
plain recording or not, e.g. letting the Shell decide whether to use a
red dot as the icon, or the generic "sharing" symbol.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1377
src/backends/meta-screen-cast-area-stream.c | 2 ++
src/backends/meta-screen-cast-area-stream.h | 1 +
src/backends/meta-screen-cast-monitor-stream.c | 2 ++
src/backends/meta-screen-cast-monitor-stream.h | 1 +
src/backends/meta-screen-cast-session.c | 12 ++++++++
src/backends/meta-screen-cast-stream.c | 30 +++++++++++++++++++
src/backends/meta-screen-cast-stream.h | 2 ++
src/backends/meta-screen-cast-window-stream.c | 2 ++
src/backends/meta-screen-cast-window-stream.h | 1 +
src/backends/meta-screen-cast.h | 5 ++++
src/meson.build | 12 ++++++++
src/meta-private-enum-types.c.in | 40 ++++++++++++++++++++++++++
src/meta-private-enum-types.h.in | 25 ++++++++++++++++
src/tests/clutter/conform/meson.build | 1 +
src/tests/clutter/interactive/meson.build | 1 +
15 files changed, 137 insertions(+)
---
diff --git a/src/backends/meta-screen-cast-area-stream.c b/src/backends/meta-screen-cast-area-stream.c
index 98883b2fce..9dd59fbfe6 100644
--- a/src/backends/meta-screen-cast-area-stream.c
+++ b/src/backends/meta-screen-cast-area-stream.c
@@ -87,6 +87,7 @@ meta_screen_cast_area_stream_new (MetaScreenCastSession *session,
MetaRectangle *area,
ClutterStage *stage,
MetaScreenCastCursorMode cursor_mode,
+ MetaScreenCastFlag flags,
GError **error)
{
MetaScreenCastAreaStream *area_stream;
@@ -105,6 +106,7 @@ meta_screen_cast_area_stream_new (MetaScreenCastSession *session,
"session", session,
"connection", connection,
"cursor-mode", cursor_mode,
+ "flags", flags,
NULL);
if (!area_stream)
return NULL;
diff --git a/src/backends/meta-screen-cast-area-stream.h b/src/backends/meta-screen-cast-area-stream.h
index 47d1079e09..b11ec1fb9c 100644
--- a/src/backends/meta-screen-cast-area-stream.h
+++ b/src/backends/meta-screen-cast-area-stream.h
@@ -37,6 +37,7 @@ MetaScreenCastAreaStream * meta_screen_cast_area_stream_new (MetaScreenCastSessi
MetaRectangle *area,
ClutterStage *stage,
MetaScreenCastCursorMode cursor_mode,
+ MetaScreenCastFlag flags,
GError **error);
ClutterStage * meta_screen_cast_area_stream_get_stage (MetaScreenCastAreaStream *area_stream);
diff --git a/src/backends/meta-screen-cast-monitor-stream.c b/src/backends/meta-screen-cast-monitor-stream.c
index 4de430a252..9c138611ca 100644
--- a/src/backends/meta-screen-cast-monitor-stream.c
+++ b/src/backends/meta-screen-cast-monitor-stream.c
@@ -110,6 +110,7 @@ meta_screen_cast_monitor_stream_new (MetaScreenCastSession *session,
MetaMonitor *monitor,
ClutterStage *stage,
MetaScreenCastCursorMode cursor_mode,
+ MetaScreenCastFlag flags,
GError **error)
{
MetaGpu *gpu = meta_monitor_get_gpu (monitor);
@@ -130,6 +131,7 @@ meta_screen_cast_monitor_stream_new (MetaScreenCastSession *session,
"session", session,
"connection", connection,
"cursor-mode", cursor_mode,
+ "flags", flags,
"monitor", monitor,
NULL);
if (!monitor_stream)
diff --git a/src/backends/meta-screen-cast-monitor-stream.h b/src/backends/meta-screen-cast-monitor-stream.h
index f8dc04181a..04c48e980b 100644
--- a/src/backends/meta-screen-cast-monitor-stream.h
+++ b/src/backends/meta-screen-cast-monitor-stream.h
@@ -40,6 +40,7 @@ MetaScreenCastMonitorStream * meta_screen_cast_monitor_stream_new (MetaScreenCas
MetaMonitor *monitor,
ClutterStage *stage,
MetaScreenCastCursorMode cursor_mode,
+ MetaScreenCastFlag flags,
GError **error);
ClutterStage * meta_screen_cast_monitor_stream_get_stage (MetaScreenCastMonitorStream *monitor_stream);
diff --git a/src/backends/meta-screen-cast-session.c b/src/backends/meta-screen-cast-session.c
index 377dafd1f7..a97254d7fa 100644
--- a/src/backends/meta-screen-cast-session.c
+++ b/src/backends/meta-screen-cast-session.c
@@ -310,6 +310,7 @@ handle_record_monitor (MetaDBusScreenCastSession *skeleton,
meta_backend_get_monitor_manager (backend);
MetaMonitor *monitor;
MetaScreenCastCursorMode cursor_mode;
+ MetaScreenCastFlag flags;
ClutterStage *stage;
GError *error = NULL;
MetaScreenCastMonitorStream *monitor_stream;
@@ -358,11 +359,14 @@ handle_record_monitor (MetaDBusScreenCastSession *skeleton,
stage = CLUTTER_STAGE (meta_backend_get_stage (backend));
+ flags = META_SCREEN_CAST_FLAG_NONE;
+
monitor_stream = meta_screen_cast_monitor_stream_new (session,
connection,
monitor,
stage,
cursor_mode,
+ flags,
&error);
if (!monitor_stream)
{
@@ -398,6 +402,7 @@ handle_record_window (MetaDBusScreenCastSession *skeleton,
GDBusConnection *connection;
MetaWindow *window;
MetaScreenCastCursorMode cursor_mode;
+ MetaScreenCastFlag flags;
GError *error = NULL;
MetaDisplay *display;
GVariant *window_id_variant = NULL;
@@ -457,10 +462,13 @@ handle_record_window (MetaDBusScreenCastSession *skeleton,
interface_skeleton = G_DBUS_INTERFACE_SKELETON (skeleton);
connection = g_dbus_interface_skeleton_get_connection (interface_skeleton);
+ flags = META_SCREEN_CAST_FLAG_NONE;
+
window_stream = meta_screen_cast_window_stream_new (session,
connection,
window,
cursor_mode,
+ flags,
&error);
if (!window_stream)
{
@@ -501,6 +509,7 @@ handle_record_area (MetaDBusScreenCastSession *skeleton,
MetaBackend *backend;
ClutterStage *stage;
MetaScreenCastCursorMode cursor_mode;
+ MetaScreenCastFlag flags;
g_autoptr (GError) error = NULL;
MetaRectangle rect;
MetaScreenCastAreaStream *area_stream;
@@ -535,6 +544,8 @@ handle_record_area (MetaDBusScreenCastSession *skeleton,
backend = meta_screen_cast_get_backend (session->screen_cast);
stage = CLUTTER_STAGE (meta_backend_get_stage (backend));
+ flags = META_SCREEN_CAST_FLAG_NONE;
+
rect = (MetaRectangle) {
.x = x,
.y = y,
@@ -546,6 +557,7 @@ handle_record_area (MetaDBusScreenCastSession *skeleton,
&rect,
stage,
cursor_mode,
+ flags,
&error);
if (!area_stream)
{
diff --git a/src/backends/meta-screen-cast-stream.c b/src/backends/meta-screen-cast-stream.c
index e7bc7f2167..fa2f3684bc 100644
--- a/src/backends/meta-screen-cast-stream.c
+++ b/src/backends/meta-screen-cast-stream.c
@@ -26,6 +26,8 @@
#include "backends/meta-screen-cast-session.h"
+#include "meta-private-enum-types.h"
+
#define META_SCREEN_CAST_STREAM_DBUS_IFACE "org.gnome.Mutter.ScreenCast.Stream"
#define META_SCREEN_CAST_STREAM_DBUS_PATH "/org/gnome/Mutter/ScreenCast/Stream"
@@ -36,6 +38,7 @@ enum
PROP_SESSION,
PROP_CONNECTION,
PROP_CURSOR_MODE,
+ PROP_FLAGS,
};
enum
@@ -55,6 +58,7 @@ typedef struct _MetaScreenCastStreamPrivate
char *object_path;
MetaScreenCastCursorMode cursor_mode;
+ MetaScreenCastFlag flags;
MetaScreenCastStreamSrc *src;
} MetaScreenCastStreamPrivate;
@@ -187,6 +191,15 @@ meta_screen_cast_stream_get_cursor_mode (MetaScreenCastStream *stream)
return priv->cursor_mode;
}
+MetaScreenCastFlag
+meta_screen_cast_stream_get_flags (MetaScreenCastStream *stream)
+{
+ MetaScreenCastStreamPrivate *priv =
+ meta_screen_cast_stream_get_instance_private (stream);
+
+ return priv->flags;
+}
+
static void
meta_screen_cast_stream_set_property (GObject *object,
guint prop_id,
@@ -208,6 +221,9 @@ meta_screen_cast_stream_set_property (GObject *object,
case PROP_CURSOR_MODE:
priv->cursor_mode = g_value_get_uint (value);
break;
+ case PROP_FLAGS:
+ priv->flags = g_value_get_flags (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -234,6 +250,9 @@ meta_screen_cast_stream_get_property (GObject *object,
case PROP_CURSOR_MODE:
g_value_set_uint (value, priv->cursor_mode);
break;
+ case PROP_FLAGS:
+ g_value_set_flags (value, priv->flags);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
@@ -337,6 +356,17 @@ meta_screen_cast_stream_class_init (MetaScreenCastStreamClass *klass)
G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
+ g_object_class_install_property (object_class,
+ PROP_FLAGS,
+ g_param_spec_flags ("flags",
+ "flags",
+ "Screen cast flags",
+ META_TYPE_SCREEN_CAST_FLAG,
+ META_SCREEN_CAST_FLAG_NONE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
+
signals[CLOSED] = g_signal_new ("closed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
diff --git a/src/backends/meta-screen-cast-stream.h b/src/backends/meta-screen-cast-stream.h
index 4fc10869d7..1fa8ddd7ac 100644
--- a/src/backends/meta-screen-cast-stream.h
+++ b/src/backends/meta-screen-cast-stream.h
@@ -67,4 +67,6 @@ void meta_screen_cast_stream_transform_position (MetaScreenCastStream *stream,
MetaScreenCastCursorMode meta_screen_cast_stream_get_cursor_mode (MetaScreenCastStream *stream);
+MetaScreenCastFlag meta_screen_cast_stream_get_flags (MetaScreenCastStream *stream);
+
#endif /* META_SCREEN_CAST_STREAM_H */
diff --git a/src/backends/meta-screen-cast-window-stream.c b/src/backends/meta-screen-cast-window-stream.c
index 493a0b3f4e..4c235d150e 100644
--- a/src/backends/meta-screen-cast-window-stream.c
+++ b/src/backends/meta-screen-cast-window-stream.c
@@ -84,6 +84,7 @@ meta_screen_cast_window_stream_new (MetaScreenCastSession *session,
GDBusConnection *connection,
MetaWindow *window,
MetaScreenCastCursorMode cursor_mode,
+ MetaScreenCastFlag flags,
GError **error)
{
return g_initable_new (META_TYPE_SCREEN_CAST_WINDOW_STREAM,
@@ -92,6 +93,7 @@ meta_screen_cast_window_stream_new (MetaScreenCastSession *session,
"session", session,
"connection", connection,
"cursor-mode", cursor_mode,
+ "flags", flags,
"window", window,
NULL);
}
diff --git a/src/backends/meta-screen-cast-window-stream.h b/src/backends/meta-screen-cast-window-stream.h
index 6eae74f1cd..0acceaac6c 100644
--- a/src/backends/meta-screen-cast-window-stream.h
+++ b/src/backends/meta-screen-cast-window-stream.h
@@ -36,6 +36,7 @@ MetaScreenCastWindowStream * meta_screen_cast_window_stream_new (MetaScreenCastS
GDBusConnection *connection,
MetaWindow *window,
MetaScreenCastCursorMode cursor_mode,
+ MetaScreenCastFlag flags,
GError **error);
MetaWindow * meta_screen_cast_window_stream_get_window (MetaScreenCastWindowStream *window_stream);
diff --git a/src/backends/meta-screen-cast.h b/src/backends/meta-screen-cast.h
index a3b650cd80..ac1f9fed5a 100644
--- a/src/backends/meta-screen-cast.h
+++ b/src/backends/meta-screen-cast.h
@@ -37,6 +37,11 @@ typedef enum _MetaScreenCastCursorMode
META_SCREEN_CAST_CURSOR_MODE_METADATA = 2,
} MetaScreenCastCursorMode;
+typedef enum _MetaScreenCastFlag
+{
+ META_SCREEN_CAST_FLAG_NONE = 0,
+} MetaScreenCastFlag;
+
#define META_TYPE_SCREEN_CAST (meta_screen_cast_get_type ())
G_DECLARE_FINAL_TYPE (MetaScreenCast, meta_screen_cast,
META, SCREEN_CAST,
diff --git a/src/meson.build b/src/meson.build
index 54b3af8fa7..df95d4ccfa 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -719,6 +719,18 @@ endif
mutter_built_sources = []
+if have_remote_desktop
+ mutter_private_enum_types = gnome.mkenums('meta-private-enum-types',
+ sources: [
+ 'backends/meta-screen-cast.h',
+ ],
+ c_template: 'meta-private-enum-types.c.in',
+ h_template: 'meta-private-enum-types.h.in',
+ )
+
+ mutter_built_sources += mutter_private_enum_types
+endif
+
dbus_display_config_built_sources = gnome.gdbus_codegen('meta-dbus-display-config',
'org.gnome.Mutter.DisplayConfig.xml',
interface_prefix: 'org.gnome.Mutter.',
diff --git a/src/meta-private-enum-types.c.in b/src/meta-private-enum-types.c.in
new file mode 100644
index 0000000000..55d323e45e
--- /dev/null
+++ b/src/meta-private-enum-types.c.in
@@ -0,0 +1,40 @@
+/*** BEGIN file-header ***/
+#include "meta-private-enum-types.h"
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+
+/* enumerations from "@filename@" */
+#include "@filename@"
+
+/*** END file-production ***/
+
+/*** BEGIN value-header ***/
+GType
+@enum_name@_get_type (void)
+{
+ static volatile gsize g_enum_type_id__volatile = 0;
+
+ if (g_once_init_enter (&g_enum_type_id__volatile))
+ {
+ static const G@Type@Value values[] = {
+/*** END value-header ***/
+
+/*** BEGIN value-production ***/
+ { @VALUENAME@, "@VALUENAME@", "@valuenick@" },
+/*** END value-production ***/
+
+/*** BEGIN value-tail ***/
+ { 0, NULL, NULL }
+ };
+ GType g_enum_type_id;
+
+ g_enum_type_id =
+ g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
+
+ g_once_init_leave (&g_enum_type_id__volatile, g_enum_type_id);
+ }
+
+ return g_enum_type_id__volatile;
+}
+/*** END value-tail ***/
diff --git a/src/meta-private-enum-types.h.in b/src/meta-private-enum-types.h.in
new file mode 100644
index 0000000000..2427a0c686
--- /dev/null
+++ b/src/meta-private-enum-types.h.in
@@ -0,0 +1,25 @@
+/*** BEGIN file-header ***/
+#ifndef META_PRIVATE_ENUM_TYPES_H
+#define META_PRIVATE_ENUM_TYPES_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+/*** END file-header ***/
+
+/*** BEGIN file-production ***/
+/* enumerations from "@basename@" */
+/*** END file-production ***/
+
+/*** BEGIN file-tail ***/
+G_END_DECLS
+
+#endif /* !__MUTTER_ENUM_TYPES_H__ */
+/*** END file-tail ***/
+
+/*** BEGIN value-header ***/
+GType @enum_name@_get_type (void) G_GNUC_CONST;
+#define META_TYPE_@ENUMSHORT@ (@enum_name@_get_type())
+
+/*** END value-header ***/
diff --git a/src/tests/clutter/conform/meson.build b/src/tests/clutter/conform/meson.build
index 9758598b90..e1f3449b6a 100644
--- a/src/tests/clutter/conform/meson.build
+++ b/src/tests/clutter/conform/meson.build
@@ -1,6 +1,7 @@
clutter_tests_conform_c_args = [
'-DG_LOG_DOMAIN="Clutter-Conform"',
'-DCOGL_DISABLE_DEPRECATION_WARNINGS',
+ '-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()),
]
clutter_tests_conform_c_args += clutter_debug_c_args
diff --git a/src/tests/clutter/interactive/meson.build b/src/tests/clutter/interactive/meson.build
index 0e7180f136..fc3f24350f 100644
--- a/src/tests/clutter/interactive/meson.build
+++ b/src/tests/clutter/interactive/meson.build
@@ -7,6 +7,7 @@ clutter_tests_interactive_c_args = [
'-DGLIB_DISABLE_DEPRECATION_WARNINGS',
'-DCOGL_DISABLE_DEPRECATION_WARNINGS',
'-DCLUTTER_DISABLE_DEPRECATION_WARNINGS',
+ '-DGETTEXT_PACKAGE="@0@"'.format(meson.project_name()),
]
clutter_tests_interactive_c_args += clutter_debug_c_args
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]