Skip to content

Commit

Permalink
screen-cast: Add textual context hint
Browse files Browse the repository at this point in the history
  • Loading branch information
tytan652 committed Jun 20, 2024
1 parent 7209054 commit 7319782
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
10 changes: 10 additions & 0 deletions data/org.freedesktop.impl.portal.ScreenCast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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})``)
Expand Down
8 changes: 8 additions & 0 deletions data/org.freedesktop.portal.ScreenCast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
7 changes: 7 additions & 0 deletions src/screen-cast.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 7319782

Please sign in to comment.