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
This commit is contained in:
Olivier Fourdan 2018-10-15 12:08:29 +02:00
parent bbcb66ddf4
commit c786b6c13c
2 changed files with 22 additions and 2 deletions

View File

@ -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 ();
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,

View File

@ -86,7 +86,10 @@
Record a single window.
Available @properties include: (none)
Available @properties include:
* "window-id" (t): Id of the window to record.
-->
<method name="RecordWindow">
<arg name="properties" type="a{sv}" direction="in" />