Skip to content

Commit

Permalink
[org.freedesktop.portal.Clipboard]
Browse files Browse the repository at this point in the history
first pass on implementing an interface to
add Clipboard controls to RemoteDesktop sessions
  • Loading branch information
maxhbooth committed Aug 10, 2022
1 parent a566b44 commit 01ac995
Show file tree
Hide file tree
Showing 19 changed files with 1,535 additions and 10 deletions.
2 changes: 2 additions & 0 deletions Makefile.am.inc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
PORTAL_IFACE_FILES =\
$(top_srcdir)/data/org.freedesktop.portal.Account.xml \
$(top_srcdir)/data/org.freedesktop.portal.Background.xml \
$(top_srcdir)/data/org.freedesktop.portal.Clipboard.xml \
$(top_srcdir)/data/org.freedesktop.portal.Camera.xml \
$(top_srcdir)/data/org.freedesktop.portal.Device.xml \
$(top_srcdir)/data/org.freedesktop.portal.Documents.xml \
Expand Down Expand Up @@ -35,6 +36,7 @@ PORTAL_IMPL_IFACE_FILES =\
$(top_srcdir)/data/org.freedesktop.impl.portal.Account.xml \
$(top_srcdir)/data/org.freedesktop.impl.portal.AppChooser.xml \
$(top_srcdir)/data/org.freedesktop.impl.portal.Background.xml \
$(top_srcdir)/data/org.freedesktop.impl.portal.Clipboard.xml \
$(top_srcdir)/data/org.freedesktop.impl.portal.DynamicLauncher.xml \
$(top_srcdir)/data/org.freedesktop.impl.portal.Email.xml \
$(top_srcdir)/data/org.freedesktop.impl.portal.FileChooser.xml \
Expand Down
2 changes: 2 additions & 0 deletions data/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ portal_sources = files(
'org.freedesktop.portal.Account.xml',
'org.freedesktop.portal.Background.xml',
'org.freedesktop.portal.Camera.xml',
'org.freedesktop.portal.Clipboard.xml',
'org.freedesktop.portal.Device.xml',
'org.freedesktop.portal.Documents.xml',
'org.freedesktop.portal.DynamicLauncher.xml',
Expand Down Expand Up @@ -38,6 +39,7 @@ portal_impl_sources = files(
'org.freedesktop.impl.portal.Account.xml',
'org.freedesktop.impl.portal.AppChooser.xml',
'org.freedesktop.impl.portal.Background.xml',
'org.freedesktop.impl.portal.Clipboard.xml',
'org.freedesktop.impl.portal.DynamicLauncher.xml',
'org.freedesktop.impl.portal.Email.xml',
'org.freedesktop.impl.portal.FileChooser.xml',
Expand Down
146 changes: 146 additions & 0 deletions data/org.freedesktop.impl.portal.Clipboard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<?xml version="1.0"?>
<!--
Copyright 2022 Google LLC
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
-->

<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
<!--
org.freedesktop.impl.portal.Clipboard
-->
<interface name="org.freedesktop.impl.portal.Clipboard">
<!--
EnableClipboard:
@handle: Object path for the #org.freedesktop.impl.portal.Request object representing this call
@session_handle: Object path for the #org.freedesktop.portal.Session object
@app_id: App id of the application
@options: Vardict with optional further information
@response: Numeric response
@results: Vardict with the results of the call
-->
<method name="EnableClipboard">
<arg type="o" name="handle" direction="in"/>
<arg type="o" name="session_handle" direction="in"/>
<arg type="s" name="app_id" direction="in"/>
<arg type="a{sv}" name="options" direction="in"/>
<arg type="u" name="response" direction="out"/>
<arg type="a{sv}" name="results" direction="out"/>
</method>
<!--
SetSelection:
@handle: Object path for the #org.freedesktop.impl.portal.Request object representing this call
@session_handle: Object path for the #org.freedesktop.portal.Session object
@app_id: App id of the application
@options: Vardict with optional further information
@response: Numeric response
@results: Vardict with the results of the call
-->
<method name="SetSelection">
<arg type="o" name="handle" direction="in"/>
<arg type="o" name="session_handle" direction="in"/>
<arg type="s" name="app_id" direction="in"/>
<arg type="a{sv}" name="options" direction="in"/>
<arg type="u" name="response" direction="out"/>
<arg type="a{sv}" name="results" direction="out"/>
</method>
<!--
SelectionWrite:
@handle: Object path for the #org.freedesktop.impl.portal.Request object representing this call
@session_handle: Object path for the #org.freedesktop.portal.Session object
@app_id: App id of the application
@serial: The serial of the request where this answer is directed to
@options: Vardict with optional further information
@response: Numeric response
@results: Vardict with the results of the call
-->
<method name="SelectionWrite">
<annotation name="org.gtk.GDBus.C.Name" value="selection_write"/>
<annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
<arg type="o" name="handle" direction="in"/>
<arg type="o" name="session_handle" direction="in"/>
<arg type="s" name="app_id" direction="in"/>
<arg type="u" name="serial" direction="in"/>
<arg type="a{sv}" name="options" direction="in"/>
<arg type="u" name="response" direction="out"/>
<arg type="a{sv}" name="results" direction="out"/>
</method>
<!--
SelectionWriteDone:
@handle: Object path for the #org.freedesktop.impl.portal.Request object representing this call
@session_handle: Object path for the #org.freedesktop.portal.Session object
@app_id: App id of the application
@serial: The serial of the request where this answer is directed to
@success: A boolean which indicates whether the transfer of the clipboard
data was successful ('true') or not ('false').
@options: Vardict with optional further information
@response: Numeric response
@results: Vardict with the results of the call
-->
<method name="SelectionWriteDone">
<arg type="o" name="handle" direction="in"/>
<arg type="o" name="session_handle" direction="in"/>
<arg type="s" name="app_id" direction="in"/>
<arg type="u" name="serial" direction="in"/>
<arg type="b" name="success" direction="in"/>
<arg type="a{sv}" name="options" direction="in"/>
<arg type="u" name="response" direction="out"/>
<arg type="a{sv}" name="results" direction="out"/>
</method>
<!--
SelectionRead:
@handle: Object path for the #org.freedesktop.impl.portal.Request object representing this call
@session_handle: Object path for the #org.freedesktop.portal.Session object
@app_id: App id of the application
@mime_type: The mime-type string of the requested format
@options: Vardict with optional further information
@response: Numeric response
@results: Vardict with the results of the call
-->
<method name="SelectionRead">
<annotation name="org.gtk.GDBus.C.Name" value="selection_read"/>
<annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
<arg type="o" name="handle" direction="in"/>
<arg type="o" name="session_handle" direction="in"/>
<arg type="s" name="app_id" direction="in"/>
<arg type="s" name="mime_type" direction="in"/>
<arg type="a{sv}" name="options" direction="in"/>
<arg type="u" name="response" direction="out"/>
<annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QVariantMap"/>
<arg type="a{sv}" name="results" direction="out"/>
</method>
<!--
SelectionOwnerChanged:
@session_handle: Object path for the #org.freedesktop.portal.Session object
@options: Vardict with optional further information
-->
<signal name="SelectionOwnerChanged">
<arg type="o" name="session_handle" direction="in"/>
<arg type="a{sv}" name="options"/>
</signal>
<!--
SelectionTransfer:
@session_handle: Object path for the #org.freedesktop.portal.Session object
@mime_type: The mime-type string of the requested format
@serial: The serial, that the answer of this particular request, MUST use
-->
<signal name="SelectionTransfer">
<arg type="o" name="session_handle" direction="in"/>
<arg type="s" name="mime_type"/>
<arg type="u" name="serial"/>
</signal>

<property name="version" type="u" access="read"/>
</interface>
</node>
135 changes: 135 additions & 0 deletions data/org.freedesktop.portal.Clipboard.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<?xml version="1.0"?>
<!--
Copyright 2022 Google LLC
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library. If not, see <http://www.gnu.org/licenses/>.
-->

<node name="/" xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
<!--
org.freedesktop.portal.Clipboard
-->
<interface name="org.freedesktop.portal.Clipboard">
<!--
EnableClipboard:
@session_handle: Object path for the #org.freedesktop.portal.Session object
@options: Options for the clipboard
@handle: Object path for the #org.freedesktop.portal.Request object representing this call
-->
<method name="EnableClipboard">
<arg type="o" name="session_handle" direction="in"/>
<arg type="a{sv}" name="options" direction="in"/>
<arg type="o" name="handle" direction="out"/>
</method>
<!--
SetSelection:
@session_handle: Object path for the #org.freedesktop.portal.Session object
@options: Vardict with optional further information
@handle: Object path for the #org.freedesktop.portal.Request object representing this call
-->
<method name="SetSelection">
<arg type="o" name="session_handle" direction="in"/>
<arg type="a{sv}" name="options" direction="in"/>
<arg type="o" name="handle" direction="out"/>
</method>
<!--
SelectionWrite:
@session_handle: Object path for the #org.freedesktop.portal.Session object
@serial: The serial of the request where this answer is directed to
@options: Vardict with optional further information
@handle: Object path for the #org.freedesktop.portal.Request object representing this call
The following results get returned via the #org.freedesktop.portal.Request::Response signal:
<variablelist>
<varlistentry>
<term>fd h</term>
<listitem><para>
The file descriptor. A UnixFD handle to the contents of the selection being written.
</para></listitem>
</varlistentry>
</variablelist>
-->
<method name="SelectionWrite">
<annotation name="org.gtk.GDBus.C.Name" value="selection_write"/>
<annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
<arg type="o" name="session_handle" direction="in"/>
<arg type="u" name="serial" direction="in"/>
<arg type="a{sv}" name="options" direction="in"/>
<arg type="o" name="handle" direction="out"/>
</method>
<!--
SelectionWriteDone:
@session_handle: Object path for the #org.freedesktop.portal.Session object
@serial: The serial of the request where this answer is directed to
@success: A boolean which indicates whether the transfer of the clipboard
data was successful ('true') or not ('false').
@options: Vardict with optional further information
@handle: Object path for the #org.freedesktop.portal.Request object representing this call
-->
<method name="SelectionWriteDone">
<arg type="o" name="session_handle" direction="in"/>
<arg type="u" name="serial" direction="in"/>
<arg type="b" name="success" direction="in"/>
<arg type="a{sv}" name="options" direction="in"/>
<arg type="o" name="handle" direction="out"/>
</method>
<!--
SelectionRead:
@session_handle: Object path for the #org.freedesktop.portal.Session object
@mime_type: The mime-type string of the requested format
@options: Vardict with optional further information
@handle: Object path for the #org.freedesktop.portal.Request object representing this call
The following results get returned via the #org.freedesktop.portal.Request::Response signal:
<variablelist>
<varlistentry>
<term>fd h</term>
<listitem><para>
The file descriptor. A UnixFD handle to the contents of the selection being read.
</para></listitem>
</varlistentry>
</variablelist>
-->
<method name="SelectionRead">
<annotation name="org.gtk.GDBus.C.Name" value="selection_read"/>
<annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
<arg type="o" name="session_handle" direction="in"/>
<arg type="s" name="mime_type" direction="in"/>
<arg type="a{sv}" name="options" direction="in"/>
<arg type="o" name="handle" direction="out"/>
</method>
<!--
SelectionOwnerChanged:
@session_handle: Object path for the #org.freedesktop.portal.Session object
@options: Vardict with optional further information
-->
<signal name="SelectionOwnerChanged">
<arg type="o" name="session_handle" direction="out"/>
<arg type="a{sv}" name="options" direction="out"/>
</signal>
<!--
SelectionTransfer:
@session_handle: Object path for the #org.freedesktop.portal.Session object
@mime_type: The mime-type string of the requested format
@serial: The serial, that the answer of this particular request, MUST use
-->
<signal name="SelectionTransfer">
<arg type="o" name="session_handle" direction="out"/>
<arg type="s" name="mime_type" direction="out"/>
<arg type="u" name="serial" direction="out"/>
</signal>

<property name="version" type="u" access="read"/>
</interface>
</node>
4 changes: 2 additions & 2 deletions data/org.freedesktop.portal.RemoteDesktop.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
A remote desktop session may only be started and stopped with this interface,
but you can use the #org.freedesktop.portal.Session object created with this
method together with certain methods on the #org.freedesktop.portal.ScreenCast
interface. Specifically, you can call
method together with certain methods on the #org.freedesktop.portal.ScreenCast and
#org.freedesktop.portal.Clipboard interfaces. Specifically, you can call
org.freedesktop.portal.ScreenCast.SelectSources() to also get screen content,
and org.freedesktop.portal.ScreenCast.OpenPipewireRemote() to acquire a file
descriptor for a PipeWire remote. See #org.freedesktop.portal.ScreenCast for
Expand Down
2 changes: 2 additions & 0 deletions doc/portal-docs.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
<xi:include href="portal-org.freedesktop.portal.Account.xml"/>
<xi:include href="portal-org.freedesktop.portal.Background.xml"/>
<xi:include href="portal-org.freedesktop.portal.Camera.xml"/>
<xi:include href="portal-org.freedesktop.portal.Clipboard.xml"/>
<xi:include href="portal-org.freedesktop.portal.Device.xml"/>
<xi:include href="portal-org.freedesktop.portal.Documents.xml"/>
<xi:include href="portal-org.freedesktop.portal.DynamicLauncher.xml"/>
Expand Down Expand Up @@ -147,6 +148,7 @@
<xi:include href="portal-org.freedesktop.impl.portal.Account.xml"/>
<xi:include href="portal-org.freedesktop.impl.portal.AppChooser.xml"/>
<xi:include href="portal-org.freedesktop.impl.portal.Background.xml"/>
<xi:include href="portal-org.freedesktop.impl.portal.Clipboard.xml"/>
<xi:include href="portal-org.freedesktop.impl.portal.Email.xml"/>
<xi:include href="portal-org.freedesktop.impl.portal.FileChooser.xml"/>
<xi:include href="portal-org.freedesktop.impl.portal.Inhibit.xml"/>
Expand Down
2 changes: 2 additions & 0 deletions src/Makefile.am.inc
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,8 @@ xdg_desktop_portal_SOURCES += \
src/pipewire.h \
src/camera.c \
src/camera.h \
src/clipboard.c \
src/clipboard.h \
$(NULL)
endif

Expand Down
Loading

0 comments on commit 01ac995

Please sign in to comment.