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

ScreenCast/RemoteDesktop: add option to pass a description #939

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
16 changes: 16 additions & 0 deletions data/org.freedesktop.impl.portal.RemoteDesktop.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,22 @@
@results: Vardict with the results of the call

Start the remote desktop session.

Supported keys in the @options vardict include:
<variablelist>
<varlistentry>
<term>description s</term>
<listitem><para>
A localized user facing string meant to provide a description
about the context the application intends use the shared
resources. Portal backends may incorporate this into potential
dialogs allowing users to make more well informed decisions.
An example of such description can be a name of a web page
making request to use the shared resources.
E.g. www.videomeeting.com is requesting access to your screen.
</para></listitem>
</varlistentry>
</variablelist>
-->
<method name="Start">
<arg type="o" name="handle" direction="in"/>
Expand Down
16 changes: 16 additions & 0 deletions data/org.freedesktop.impl.portal.ScreenCast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,22 @@
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:
<variablelist>
<varlistentry>
<term>description s</term>
<listitem><para>
A localized user facing string meant to provide a description
about the context the application intends use the shared
resources. Portal backends may incorporate this into potential
dialogs allowing users to make more well informed decisions.
An example of such description can be a name of a web page
making request to use the shared resources.
E.g. www.videomeeting.com is requesting access to your screen.
</para></listitem>
</varlistentry>
</variablelist>

The following results get returned via the #org.freedesktop.portal.Request::Response signal:
<variablelist>
<varlistentry>
Expand Down
12 changes: 12 additions & 0 deletions data/org.freedesktop.portal.RemoteDesktop.xml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,18 @@
more information about the @handle.
</para></listitem>
</varlistentry>
<varlistentry>
<term>description s</term>
<listitem><para>
A localized user facing string meant to provide a description
about the context the application intends use the shared
resources. Portal backends may incorporate this into potential
dialogs allowing users to make more well informed decisions.
An example of such description can be a name of a web page
making request to use the shared resources.
E.g. www.videomeeting.com is requesting access to your screen.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think expanding how the string should look, e.g. how to punctuate, how long, etc, and in what context it will be displayed. This is to avoid having one app have

www.videomeeting is requesting access to your screen

while another is

www.videomeeting.com wants to access your screen.

Please select the monitor you want to share and press Submit

Might be good to make it a(ss) so that we can have "plaintext" and potentially add formatable options in the future (e.g. to add emphasis on the domain) in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@allanday can you please help us here? You might know better how to tell consumers how the string should actually look like.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@allanday friendly ping.

</para></listitem>
</varlistentry>
</variablelist>

The following results get returned via the
Expand Down
12 changes: 12 additions & 0 deletions data/org.freedesktop.portal.ScreenCast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,18 @@
more information about the @handle.
</para></listitem>
</varlistentry>
<varlistentry>
<term>description s</term>
<listitem><para>
A localized user facing string meant to provide a description
about the context the application intends use the shared
resources. Portal backends may incorporate this into potential
dialogs allowing users to make more well informed decisions.
An example of such description can be a name of a web page
making request to use the shared resources.
E.g. www.videomeeting.com is requesting access to your screen.
</para></listitem>
</varlistentry>
</variablelist>

The following results get returned via the
Expand Down
12 changes: 12 additions & 0 deletions src/remote-desktop.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,10 @@ start_done (GObject *source_object,
}
}

static XdpOptionKey remote_desktop_start_options[] = {
{ "description", G_VARIANT_TYPE_STRING, NULL }
};

static gboolean
handle_start (XdpDbusRemoteDesktop *object,
GDBusMethodInvocation *invocation,
Expand Down Expand Up @@ -657,6 +661,14 @@ handle_start (XdpDbusRemoteDesktop *object,
request_export (request, g_dbus_method_invocation_get_connection (invocation));

g_variant_builder_init (&options_builder, G_VARIANT_TYPE_VARDICT);
if (!xdp_filter_options (arg_options, &options_builder,
remote_desktop_start_options,
G_N_ELEMENTS (remote_desktop_start_options),
&error))
{
g_dbus_method_invocation_return_gerror (invocation, error);
return G_DBUS_METHOD_INVOCATION_HANDLED;
}
options = g_variant_builder_end (&options_builder);

g_object_set_qdata_full (G_OBJECT (request),
Expand Down
12 changes: 12 additions & 0 deletions src/screen-cast.c
Original file line number Diff line number Diff line change
Expand Up @@ -1140,6 +1140,10 @@ start_done (GObject *source_object,
}
}

static XdpOptionKey screen_cast_start_options[] = {
{ "description", G_VARIANT_TYPE_STRING, NULL }
};

static gboolean
handle_start (XdpDbusScreenCast *object,
GDBusMethodInvocation *invocation,
Expand Down Expand Up @@ -1215,6 +1219,14 @@ handle_start (XdpDbusScreenCast *object,
request_export (request, g_dbus_method_invocation_get_connection (invocation));

g_variant_builder_init (&options_builder, G_VARIANT_TYPE_VARDICT);
if (!xdp_filter_options (arg_options, &options_builder,
screen_cast_start_options,
G_N_ELEMENTS (screen_cast_start_options),
&error))
{
g_dbus_method_invocation_return_gerror (invocation, error);
return G_DBUS_METHOD_INVOCATION_HANDLED;
}
options = g_variant_builder_end (&options_builder);

g_object_set_qdata_full (G_OBJECT (request),
Expand Down