<?xml version="1.0"?>
<!--
 Copyright (C) 2017-2018 Red Hat, Inc.

 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.ScreenCast:
      @short_description: Screen cast portal
  -->
  <interface name="org.freedesktop.portal.ScreenCast">
    <!--
        CreateSession:
        @options: Vardict with optional further information
        @handle: Object path for the #org.freedesktop.portal.Request object representing this call

        Create a screen cast session. A successfully created session can at
        any time be closed using org.freedesktop.portal.Session::Close, or may
        at any time be closed by the portal implementation, which will be
        signalled via org.freedesktop.portal.Session::Closed.

        The following results get returned via the #org.freedesktop.portal.Request::Response signal:
        <variablelist>
          <varlistentry>
            <term>session_handle o</term>
            <listitem><para>
              The session handle. An object path for the
              #org.freedesktop.portal.Session object representing the created
              session.
            </para></listitem>
          </varlistentry>
        </variablelist>
    -->
    <method name="CreateSession">
      <arg type="a{sv}" name="options" direction="in"/>
      <annotation name="org.qtproject.QtDBus.QtTypeName.In0" value="QVariantMap"/>
      <arg type="o" name="handle" direction="out"/>
    </method>
    <!--
        SelectSources:
        @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

        Configure what the screen cast session should record. This method must
        be called before starting the session.

        Passing invalid input to this method will cause the session to be
        closed. An application may only attempt to select sources once per
        session.

        Supported keys in the @options vardict include:
        <variablelist>
          <varlistentry>
            <term>types u</term>
            <listitem><para>
              Bitmask of what types of content to record. Default is MONITOR.
            </para></listitem>
          </varlistentry>
          <varlistentry>
            <term>multiple b</term>
            <listitem><para>
              Whether to allow selecting multiple sources. Default is no.
            </para></listitem>
          </varlistentry>
        </variablelist>

        For available source types, see the AvailableSourceTypes property.
    -->
    <method name="SelectSources">
      <arg type="o" name="session_handle" direction="in"/>
      <arg type="a{sv}" name="options" direction="in"/>
      <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
      <arg type="o" name="handle" direction="out"/>
    </method>
    <!--
        Start:
        @session_handle: Object path for the #org.freedesktop.portal.Session object
        @parent_window: Identifier for the application window
        @options: Vardict with optional further information
        @handle: Object path for the #org.freedesktop.portal.Request object representing this call

        Start the screen cast session. This will typically result the portal
        presenting a dialog letting the user do the selection set up by
        SelectSources. An application can only attempt start a session once.

        A screen cast session may only be started after having selected sources
        using org.freedesktop.portal.ScreenCast::SelectSources.

        The @parent_window identifier must be of the form "x11:$XID" for an X11
        window. Support for other window systems may be added in the future.

        The following results get returned via the
        #org.freedesktop.portal.Request::Response signal:
        <variablelist>
          <varlistentry>
            <term>streams a(ua{sv})</term>
            <listitem><para>
              An array of PipeWire streams. Each stream consists of a PipeWire
              node ID (the first element in the tuple, and a Vardict of
              properties.

              The array will contain a single stream if 'multiple' (see
              SelectSources) was set to 'false', or at least one stream if
              'multiple' was set to 'true' as part of the SelectSources method.
            </para></listitem>
          </varlistentry>
        </variablelist>

        Stream properties include:
        <variablelist>
          <varlistentry>
            <term>position (ii)</term>
            <listitem><para>
              A tuple consisting of the position (x, y) in the compositor
              coordinate space. Note that the position may not be equivalent to a
              position in a pixel coordinate space. Only available for monitor
              streams.
            </para></listitem>
          </varlistentry>
          <varlistentry>
            <term>size (ii)</term>
            <listitem><para>
              A tuple consisting of (width, height). The size represents the size
              of the stream as it is displayed in the compositor coordinate
              space. Note that this size may not be equivalent to a size in a
              pixel coordinate space. The size may differ from the size of the
              stream.
            </para></listitem>
          </varlistentry>
        </variablelist>
    -->
    <method name="Start">
      <arg type="o" name="session_handle" direction="in"/>
      <arg type="s" name="parent_window" direction="in"/>
      <arg type="a{sv}" name="options" direction="in"/>
      <annotation name="org.qtproject.QtDBus.QtTypeName.In2" value="QVariantMap"/>
      <arg type="o" name="handle" direction="out"/>
    </method>
    <!--
        OpenPipeWireRemote:
        @session_handle: Object path for the #org.freedesktop.portal.Session object
        @options: Vardict with optional further information
        @fd: File descriptor of an open PipeWire remote.

        Open a file descriptor to the PipeWire remote where the screen cast
        streams are available. The file descriptor should be used to create a
        <classname>pw_remote</classname> object, by using
        <function>pw_remote_connect_fd</function>. Only the screen cast stream
        nodes will be available from this PipeWire node.
    -->
    <method name="OpenPipeWireRemote">
      <annotation name="org.gtk.GDBus.C.Name" value="open_pipewire_remote"/>
      <annotation name="org.gtk.GDBus.C.UnixFD" value="true"/>
      <arg type="o" name="session_handle" direction="in"/>
      <arg type="a{sv}" name="options" direction="in"/>
      <annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
      <arg type="h" name="fd" direction="out"/>
    </method>
    <!--
        AvailableSourceTypes:

        A bitmask of available source types. Currently defined types are:

        <simplelist>
          <member>1: MONITOR</member>
          <member>2: WINDOW</member>
        </simplelist>
    -->
    <property name="AvailableSourceTypes" type="u" access="read"/>
    <property name="version" type="u" access="read"/>
  </interface>
</node>
