From 73197828f3e27cc1c8d70b74c1f5246b270ea6b4 Mon Sep 17 00:00:00 2001 From: tytan652 Date: Thu, 20 Jun 2024 13:34:45 +0200 Subject: [PATCH] screen-cast: Add textual context hint --- data/org.freedesktop.impl.portal.ScreenCast.xml | 10 ++++++++++ data/org.freedesktop.portal.ScreenCast.xml | 8 ++++++++ src/screen-cast.c | 7 +++++++ 3 files changed, 25 insertions(+) diff --git a/data/org.freedesktop.impl.portal.ScreenCast.xml b/data/org.freedesktop.impl.portal.ScreenCast.xml index 5f98edef8..f01433693 100644 --- a/data/org.freedesktop.impl.portal.ScreenCast.xml +++ b/data/org.freedesktop.impl.portal.ScreenCast.xml @@ -138,6 +138,16 @@ Start the screen cast session. This will typically result the portal presenting a dialog letting the user do the selection set up by SelectSources. + Supported keys in the @options vardict include: + + * ``context_hint`` (``s``) + + Textual hint that can be shown on the presented dialog. This allow the user to + know the context behind the selection dialog if the application happens use + multiple sessions. + + The string is localized by the application. + The following results get returned in the @results vardict: * ``streams`` (``a(ua{sv})``) diff --git a/data/org.freedesktop.portal.ScreenCast.xml b/data/org.freedesktop.portal.ScreenCast.xml index 70adf877f..ef065b938 100644 --- a/data/org.freedesktop.portal.ScreenCast.xml +++ b/data/org.freedesktop.portal.ScreenCast.xml @@ -168,6 +168,14 @@ object path element. See the :ref:`org.freedesktop.portal.Request` documentation for more information about the @handle. + * ``context_hint`` (``s``) + + Textual hint that can be shown on the presented dialog. This allow the user to + know the context behind the selection dialog if the application happens use + multiple sessions. + + The string is localized by the application. + The following results get returned via the :ref:`org.freedesktop.portal.Request::Response` signal: diff --git a/src/screen-cast.c b/src/screen-cast.c index 21281cb81..8e48d896e 100644 --- a/src/screen-cast.c +++ b/src/screen-cast.c @@ -831,6 +831,10 @@ start_done (GObject *source_object, } } +static XdpOptionKey start_options[] = { + { "context_hint", G_VARIANT_TYPE_STRING, NULL }, +}; + static gboolean handle_start (XdpDbusScreenCast *object, GDBusMethodInvocation *invocation, @@ -906,6 +910,9 @@ handle_start (XdpDbusScreenCast *object, request_export (request, g_dbus_method_invocation_get_connection (invocation)); g_variant_builder_init (&options_builder, G_VARIANT_TYPE_VARDICT); + xdp_filter_options (arg_options, &options_builder, + start_options, G_N_ELEMENTS (start_options), + NULL); options = g_variant_builder_end (&options_builder); g_object_set_qdata_full (G_OBJECT (request),