Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

screen-cast: Add textual context hint #1379

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading