From c9065da44217ec3ed4068d6c3a8509b172077079 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Mon, 15 Oct 2018 12:08:29 +0200 Subject: [PATCH] screen-cast-session: Add window-id support Use the "window-id" property to select the window to cast using RecordWindow. https://gitlab.gnome.org/GNOME/mutter/merge_requests/306 (cherry picked from commit c786b6c13cf9cb1bb9d7f7d2ca0ead0bf28a5fcd) --- src/backends/meta-screen-cast-session.c | 19 ++++++++++++++++++- src/org.gnome.Mutter.ScreenCast.xml | 5 ++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/backends/meta-screen-cast-session.c b/src/backends/meta-screen-cast-session.c index 3ee02c552..d0f5a79d9 100644 --- a/src/backends/meta-screen-cast-session.c +++ b/src/backends/meta-screen-cast-session.c @@ -340,6 +340,7 @@ handle_record_window (MetaDBusScreenCastSession *skeleton, MetaWindow *window; GError *error = NULL; MetaDisplay *display; + GVariant *window_id_variant = NULL; MetaScreenCastWindowStream *window_stream; MetaScreenCastStream *stream; char *stream_path; @@ -352,8 +353,24 @@ handle_record_window (MetaDBusScreenCastSession *skeleton, return TRUE; } + if (properties_variant) + window_id_variant = g_variant_lookup_value (properties_variant, + "window-id", + G_VARIANT_TYPE ("t")); + display = meta_get_display (); - window = meta_display_get_focus_window (display); + if (window_id_variant) + { + uint64_t window_id; + + g_variant_get (window_id_variant, "t", &window_id); + window = meta_display_get_window_from_id (display, window_id); + } + else + { + window = meta_display_get_focus_window (display); + } + if (!window) { g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, diff --git a/src/org.gnome.Mutter.ScreenCast.xml b/src/org.gnome.Mutter.ScreenCast.xml index 61345564b..3cd02b6cb 100644 --- a/src/org.gnome.Mutter.ScreenCast.xml +++ b/src/org.gnome.Mutter.ScreenCast.xml @@ -86,7 +86,10 @@ Record a single window. - Available @properties include: (none) + Available @properties include: + + * "window-id" (t): Id of the window to record. + -->