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

View File

@ -340,6 +340,7 @@ handle_record_window (MetaDBusScreenCastSession *skeleton,
MetaWindow *window; MetaWindow *window;
GError *error = NULL; GError *error = NULL;
MetaDisplay *display; MetaDisplay *display;
GVariant *window_id_variant = NULL;
MetaScreenCastWindowStream *window_stream; MetaScreenCastWindowStream *window_stream;
MetaScreenCastStream *stream; MetaScreenCastStream *stream;
char *stream_path; char *stream_path;
@ -352,8 +353,24 @@ handle_record_window (MetaDBusScreenCastSession *skeleton,
return TRUE; return TRUE;
} }
if (properties_variant)
window_id_variant = g_variant_lookup_value (properties_variant,
"window-id",
G_VARIANT_TYPE ("t"));
display = meta_get_display (); 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) if (!window)
{ {
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,

View File

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