Use the RemoteDesktop portal to input from wayland

Cross-desktop approach to moving the cursor remotely on wayland. Should
work on X11 too, so we can consider drop the other one as well.

It adds support for receiving full text as well, which didn't use to be
possible.
This commit is contained in:
Aleix Pol 2020-01-23 16:57:08 +01:00
parent 2825342ede
commit 851e456210
8 changed files with 599 additions and 48 deletions

View file

@ -85,6 +85,7 @@ else()
find_package(Qt${QT_MAJOR_VERSION} REQUIRED COMPONENTS WaylandClient) find_package(Qt${QT_MAJOR_VERSION} REQUIRED COMPONENTS WaylandClient)
find_package(PlasmaWaylandProtocols REQUIRED) find_package(PlasmaWaylandProtocols REQUIRED)
find_package(WaylandProtocols REQUIRED) find_package(WaylandProtocols REQUIRED)
pkg_check_modules(XkbCommon IMPORTED_TARGET xkbcommon)
endif() endif()
find_package(KF5PeopleVCard) find_package(KF5PeopleVCard)

View file

@ -3,7 +3,6 @@ Type=Application
Exec=${KDE_INSTALL_FULL_LIBEXECDIR}/kdeconnectd Exec=${KDE_INSTALL_FULL_LIBEXECDIR}/kdeconnectd
X-KDE-StartupNotify=false X-KDE-StartupNotify=false
X-KDE-autostart-phase=1 X-KDE-autostart-phase=1
X-KDE-Wayland-Interfaces=org_kde_kwin_fake_input
X-GNOME-Autostart-enabled=true X-GNOME-Autostart-enabled=true
NoDisplay=true NoDisplay=true
Icon=kdeconnect Icon=kdeconnect

View file

@ -1,6 +1,13 @@
kdeconnect_add_plugin(kdeconnect_mousepad SOURCES mousepadplugin.cpp abstractremoteinput.cpp) kdeconnect_add_plugin(kdeconnect_mousepad SOURCES mousepadplugin.cpp abstractremoteinput.cpp)
if(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE)
qt5_add_dbus_interface(
SRCS
${CMAKE_CURRENT_SOURCE_DIR}/xdp_dbus_remotedesktop_interface.xml
xdp_dbus_remotedesktop_interface
)
target_sources(kdeconnect_mousepad PUBLIC waylandremoteinput.cpp ${SRCS})
find_package(LibFakeKey QUIET) find_package(LibFakeKey QUIET)
set_package_properties(LibFakeKey PROPERTIES DESCRIPTION "fake key events" set_package_properties(LibFakeKey PROPERTIES DESCRIPTION "fake key events"
@ -20,7 +27,7 @@ if(UNIX AND NOT APPLE)
endif() endif()
target_sources(kdeconnect_mousepad PRIVATE ${wayland_SRCS}) target_sources(kdeconnect_mousepad PRIVATE ${wayland_SRCS})
target_link_libraries(kdeconnect_mousepad Wayland::Client Qt::WaylandClient) target_link_libraries(kdeconnect_mousepad Wayland::Client Qt::WaylandClient PkgConfig::XkbCommon)
target_sources(kdeconnect_mousepad PUBLIC waylandremoteinput.cpp) target_sources(kdeconnect_mousepad PUBLIC waylandremoteinput.cpp)
set(HAVE_WAYLAND TRUE) set(HAVE_WAYLAND TRUE)
@ -37,7 +44,7 @@ endif()
set(HAVE_WINDOWS ${WIN32}) set(HAVE_WINDOWS ${WIN32})
set(HAVE_X11 ${LibFakeKey_FOUND}) set(HAVE_X11 ${LibFakeKey_FOUND})
set(HAVE_MACOS ${APPLE}) set(HAVE_MACOS ${APPLE})
configure_file(config-mousepad.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-mousepad.h ) configure_file(config-mousepad.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-mousepad.h)
target_link_libraries(kdeconnect_mousepad kdeconnectcore Qt::Gui KF5::I18n) target_link_libraries(kdeconnect_mousepad kdeconnectcore Qt::Gui KF5::I18n)

View file

@ -6,6 +6,7 @@
#include "abstractremoteinput.h" #include "abstractremoteinput.h"
Q_LOGGING_CATEGORY(KDECONNECT_PLUGIN_MOUSEPAD, "kdeconnect.plugin.mousepad")
AbstractRemoteInput::AbstractRemoteInput(QObject *parent) AbstractRemoteInput::AbstractRemoteInput(QObject *parent)
: QObject(parent) : QObject(parent)
{ {

View file

@ -7,10 +7,13 @@
#ifndef ABSTRACTREMOTEINPUT_H #ifndef ABSTRACTREMOTEINPUT_H
#define ABSTRACTREMOTEINPUT_H #define ABSTRACTREMOTEINPUT_H
#include <QLoggingCategory>
#include <QObject> #include <QObject>
#include <core/networkpacket.h> #include <core/networkpacket.h>
Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_PLUGIN_MOUSEPAD)
class AbstractRemoteInput : public QObject class AbstractRemoteInput : public QObject
{ {
Q_OBJECT Q_OBJECT

View file

@ -1,5 +1,6 @@
/** /**
* SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org> * SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
* SPDX-FileCopyrightText: 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
* *
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/ */
@ -10,42 +11,177 @@
#include <QSizeF> #include <QSizeF>
#include <KLocalizedString> #include <KLocalizedString>
#include <QDBusPendingCallWatcher>
#include "qwayland-fake-input.h"
#include <QtWaylandClient/qwaylandclientextension.h>
#include <linux/input.h> #include <linux/input.h>
#include <xkbcommon/xkbcommon.h>
class FakeInput : public QWaylandClientExtensionTemplate<FakeInput>, public QtWayland::org_kde_kwin_fake_input namespace
{ {
public: // Translation table to keep in sync within all the implementations
FakeInput() int SpecialKeysMap[] = {
: QWaylandClientExtensionTemplate<FakeInput>(4) 0, // Invalid
{ KEY_BACKSPACE, // 1
} KEY_TAB, // 2
KEY_LINEFEED, // 3
KEY_LEFT, // 4
KEY_UP, // 5
KEY_RIGHT, // 6
KEY_DOWN, // 7
KEY_PAGEUP, // 8
KEY_PAGEDOWN, // 9
KEY_HOME, // 10
KEY_END, // 11
KEY_ENTER, // 12
KEY_DELETE, // 13
KEY_ESC, // 14
KEY_SYSRQ, // 15
KEY_SCROLLLOCK, // 16
0, // 17
0, // 18
0, // 19
0, // 20
KEY_F1, // 21
KEY_F2, // 22
KEY_F3, // 23
KEY_F4, // 24
KEY_F5, // 25
KEY_F6, // 26
KEY_F7, // 27
KEY_F8, // 28
KEY_F9, // 29
KEY_F10, // 30
KEY_F11, // 31
KEY_F12, // 32
}; };
}
Q_GLOBAL_STATIC(RemoteDesktopSession, s_session);
RemoteDesktopSession::RemoteDesktopSession()
: iface(new OrgFreedesktopPortalRemoteDesktopInterface(QLatin1String("org.freedesktop.portal.Desktop"),
QLatin1String("/org/freedesktop/portal/desktop"),
QDBusConnection::sessionBus(),
this))
{
}
void RemoteDesktopSession::createSession()
{
if (isValid()) {
qCDebug(KDECONNECT_PLUGIN_MOUSEPAD) << "pass, already created";
return;
}
m_connecting = true;
// create session
const auto handleToken = QStringLiteral("kdeconnect%1").arg(QRandomGenerator::global()->generate());
const auto sessionParameters = QVariantMap{{QLatin1String("session_handle_token"), handleToken}, {QLatin1String("handle_token"), handleToken}};
auto sessionReply = iface->CreateSession(sessionParameters);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(sessionReply);
connect(watcher, &QDBusPendingCallWatcher::finished, this, [this, sessionReply](QDBusPendingCallWatcher *self) {
self->deleteLater();
if (sessionReply.isError()) {
qCWarning(KDECONNECT_PLUGIN_MOUSEPAD) << "Could not create the remote control session" << sessionReply.error();
m_connecting = false;
return;
}
bool b = QDBusConnection::sessionBus().connect(QString(),
sessionReply.value().path(),
QLatin1String("org.freedesktop.portal.Request"),
QLatin1String("Response"),
this,
SLOT(handleXdpSessionCreated(uint, QVariantMap)));
Q_ASSERT(b);
qCDebug(KDECONNECT_PLUGIN_MOUSEPAD) << "authenticating" << sessionReply.value().path();
});
}
void RemoteDesktopSession::handleXdpSessionCreated(uint code, const QVariantMap &results)
{
if (code != 0) {
qCWarning(KDECONNECT_PLUGIN_MOUSEPAD) << "Failed to create session with code" << code << results;
return;
}
m_connecting = false;
m_xdpPath = QDBusObjectPath(results.value(QLatin1String("session_handle")).toString());
const QVariantMap startParameters = {
{QLatin1String("handle_token"), QStringLiteral("kdeconnect%1").arg(QRandomGenerator::global()->generate())},
{QStringLiteral("types"), QVariant::fromValue<uint>(7)}, // request all (KeyBoard, Pointer, TouchScreen)
};
QDBusConnection::sessionBus().connect(QString(),
m_xdpPath.path(),
QLatin1String("org.freedesktop.portal.Session"),
QLatin1String("Closed"),
this,
SLOT(handleXdpSessionFinished(uint, QVariantMap)));
auto reply = iface->SelectDevices(m_xdpPath, startParameters);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply);
connect(watcher, &QDBusPendingCallWatcher::finished, this, [this, reply](QDBusPendingCallWatcher *self) {
self->deleteLater();
if (reply.isError()) {
qCWarning(KDECONNECT_PLUGIN_MOUSEPAD) << "Could not start the remote control session" << reply.error();
m_connecting = false;
return;
}
bool b = QDBusConnection::sessionBus().connect(QString(),
reply.value().path(),
QLatin1String("org.freedesktop.portal.Request"),
QLatin1String("Response"),
this,
SLOT(handleXdpSessionConfigured(uint, QVariantMap)));
Q_ASSERT(b);
qCDebug(KDECONNECT_PLUGIN_MOUSEPAD) << "configuring" << reply.value().path();
});
}
void RemoteDesktopSession::handleXdpSessionConfigured(uint code, const QVariantMap &results)
{
if (code != 0) {
qCWarning(KDECONNECT_PLUGIN_MOUSEPAD) << "Failed to configure session with code" << code << results;
m_connecting = false;
return;
}
const QVariantMap startParameters = {
{QLatin1String("handle_token"), QStringLiteral("kdeconnect%1").arg(QRandomGenerator::global()->generate())},
};
auto reply = iface->Start(m_xdpPath, {}, startParameters);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply);
connect(watcher, &QDBusPendingCallWatcher::finished, this, [this, reply](QDBusPendingCallWatcher *self) {
self->deleteLater();
if (reply.isError()) {
qCWarning(KDECONNECT_PLUGIN_MOUSEPAD) << "Could not start the remote control session" << reply.error();
m_connecting = false;
}
});
}
void RemoteDesktopSession::handleXdpSessionFinished(uint /*code*/, const QVariantMap & /*results*/)
{
m_xdpPath = {};
}
WaylandRemoteInput::WaylandRemoteInput(QObject *parent) WaylandRemoteInput::WaylandRemoteInput(QObject *parent)
: AbstractRemoteInput(parent) : AbstractRemoteInput(parent)
, m_waylandAuthenticationRequested(false)
{ {
m_fakeInput = new FakeInput;
} }
WaylandRemoteInput::~WaylandRemoteInput() WaylandRemoteInput::~WaylandRemoteInput()
{ {
delete m_fakeInput;
} }
bool WaylandRemoteInput::handlePacket(const NetworkPacket &np) bool WaylandRemoteInput::handlePacket(const NetworkPacket &np)
{ {
if (!m_fakeInput->isActive()) { if (!s_session->isValid()) {
return true; qCWarning(KDECONNECT_PLUGIN_MOUSEPAD) << "Unable to handle remote input. RemoteDesktop portal not authenticated";
} s_session->createSession();
return false;
if (!m_waylandAuthenticationRequested) {
m_fakeInput->authenticate(i18n("KDE Connect"), i18n("Use your phone as a touchpad and keyboard"));
m_waylandAuthenticationRequested = true;
} }
const float dx = np.get<float>(QStringLiteral("dx"), 0); const float dx = np.get<float>(QStringLiteral("dx"), 0);
@ -63,36 +199,43 @@ bool WaylandRemoteInput::handlePacket(const NetworkPacket &np)
if (isSingleClick || isDoubleClick || isMiddleClick || isRightClick || isSingleHold || isSingleRelease || isScroll || !key.isEmpty() || specialKey) { if (isSingleClick || isDoubleClick || isMiddleClick || isRightClick || isSingleHold || isSingleRelease || isScroll || !key.isEmpty() || specialKey) {
if (isSingleClick) { if (isSingleClick) {
m_fakeInput->button(BTN_LEFT, WL_POINTER_BUTTON_STATE_PRESSED); s_session->iface->NotifyPointerButton(s_session->m_xdpPath, {}, BTN_LEFT, 1);
m_fakeInput->button(BTN_LEFT, WL_POINTER_BUTTON_STATE_RELEASED); s_session->iface->NotifyPointerButton(s_session->m_xdpPath, {}, BTN_LEFT, 0);
} else if (isDoubleClick) { } else if (isDoubleClick) {
m_fakeInput->button(BTN_LEFT, WL_POINTER_BUTTON_STATE_PRESSED); s_session->iface->NotifyPointerButton(s_session->m_xdpPath, {}, BTN_LEFT, 1);
m_fakeInput->button(BTN_LEFT, WL_POINTER_BUTTON_STATE_RELEASED); s_session->iface->NotifyPointerButton(s_session->m_xdpPath, {}, BTN_LEFT, 0);
s_session->iface->NotifyPointerButton(s_session->m_xdpPath, {}, BTN_LEFT, 1);
m_fakeInput->button(BTN_LEFT, WL_POINTER_BUTTON_STATE_PRESSED); s_session->iface->NotifyPointerButton(s_session->m_xdpPath, {}, BTN_LEFT, 0);
m_fakeInput->button(BTN_LEFT, WL_POINTER_BUTTON_STATE_RELEASED);
} else if (isMiddleClick) { } else if (isMiddleClick) {
m_fakeInput->button(BTN_MIDDLE, WL_POINTER_BUTTON_STATE_PRESSED); s_session->iface->NotifyPointerButton(s_session->m_xdpPath, {}, BTN_MIDDLE, 1);
m_fakeInput->button(BTN_MIDDLE, WL_POINTER_BUTTON_STATE_RELEASED); s_session->iface->NotifyPointerButton(s_session->m_xdpPath, {}, BTN_MIDDLE, 0);
} else if (isRightClick) { } else if (isRightClick) {
m_fakeInput->button(BTN_RIGHT, WL_POINTER_BUTTON_STATE_PRESSED); s_session->iface->NotifyPointerButton(s_session->m_xdpPath, {}, BTN_RIGHT, 1);
m_fakeInput->button(BTN_RIGHT, WL_POINTER_BUTTON_STATE_RELEASED); s_session->iface->NotifyPointerButton(s_session->m_xdpPath, {}, BTN_RIGHT, 0);
} else if (isSingleHold) { } else if (isSingleHold) {
// For drag'n drop // For drag'n drop
m_fakeInput->button(BTN_LEFT, WL_POINTER_BUTTON_STATE_PRESSED); s_session->iface->NotifyPointerButton(s_session->m_xdpPath, {}, BTN_LEFT, 1);
} else if (isSingleRelease) { } else if (isSingleRelease) {
// For drag'n drop. NEVER USED (release is done by tapping, which actually triggers a isSingleClick). Kept here for future-proofness. // For drag'n drop. NEVER USED (release is done by tapping, which actually triggers a isSingleClick). Kept here for future-proofness.
m_fakeInput->button(BTN_LEFT, WL_POINTER_BUTTON_STATE_RELEASED); s_session->iface->NotifyPointerButton(s_session->m_xdpPath, {}, BTN_LEFT, 0);
} else if (isScroll) { } else if (isScroll) {
m_fakeInput->axis(WL_POINTER_AXIS_VERTICAL_SCROLL, wl_fixed_from_double(-dy)); s_session->iface->NotifyPointerAxis(s_session->m_xdpPath, {}, dx, dy);
} else if (specialKey) {
} else if (!key.isEmpty() || specialKey) { s_session->iface->NotifyKeyboardKeycode(s_session->m_xdpPath, {}, SpecialKeysMap[specialKey], 1);
// TODO: implement key support s_session->iface->NotifyKeyboardKeycode(s_session->m_xdpPath, {}, SpecialKeysMap[specialKey], 0);
} else if (!key.isEmpty()) {
for (const QChar character : key) {
const auto keysym = xkb_utf32_to_keysym(character.unicode());
if (keysym != XKB_KEY_NoSymbol) {
s_session->iface->NotifyKeyboardKeysym(s_session->m_xdpPath, {}, keysym, 1).waitForFinished();
s_session->iface->NotifyKeyboardKeysym(s_session->m_xdpPath, {}, keysym, 0).waitForFinished();
} else {
qCDebug(KDECONNECT_PLUGIN_MOUSEPAD) << "Cannot send character" << character;
}
}
} }
} else { // Is a mouse move event } else { // Is a mouse move event
m_fakeInput->pointer_motion(wl_fixed_from_double(dx), wl_fixed_from_double(dy)); s_session->iface->NotifyPointerMotion(s_session->m_xdpPath, {}, dx, dy);
} }
return true; return true;
} }

View file

@ -1,5 +1,6 @@
/** /**
* SPDX-FileCopyrightText: 2018 Albert Vaca Cintora <albertvaka@gmail.com> * SPDX-FileCopyrightText: 2018 Albert Vaca Cintora <albertvaka@gmail.com>
* SPDX-FileCopyrightText: 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
* *
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/ */
@ -8,9 +9,33 @@
#define WAYLANDREMOTEINPUT_H #define WAYLANDREMOTEINPUT_H
#include "abstractremoteinput.h" #include "abstractremoteinput.h"
#include "xdp_dbus_remotedesktop_interface.h"
#include <QDBusObjectPath>
class FakeInput; class FakeInput;
class RemoteDesktopSession : public QObject
{
Q_OBJECT
public:
RemoteDesktopSession();
void createSession();
bool isValid() const
{
return m_connecting || !m_xdpPath.path().isEmpty();
}
OrgFreedesktopPortalRemoteDesktopInterface *const iface;
QDBusObjectPath m_xdpPath;
bool m_connecting = false;
private Q_SLOTS:
void handleXdpSessionCreated(uint code, const QVariantMap &results);
void handleXdpSessionConfigured(uint code, const QVariantMap &results);
void handleXdpSessionFinished(uint code, const QVariantMap &results);
private:
};
class WaylandRemoteInput : public AbstractRemoteInput class WaylandRemoteInput : public AbstractRemoteInput
{ {
Q_OBJECT Q_OBJECT
@ -20,12 +45,10 @@ public:
~WaylandRemoteInput(); ~WaylandRemoteInput();
bool handlePacket(const NetworkPacket &np) override; bool handlePacket(const NetworkPacket &np) override;
bool hasKeyboardSupport() override
private: {
void setupWaylandIntegration(); return true;
}
FakeInput *m_fakeInput;
bool m_waylandAuthenticationRequested;
}; };
#endif #endif

View file

@ -0,0 +1,374 @@
<?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.RemoteDesktop:
@short_description: Remote desktop portal
The Remote desktop portal allows to create remote desktop sessions.
This documentation describes version 1 of this interface.
-->
<interface name="org.freedesktop.portal.RemoteDesktop">
<!--
CreateSession:
@options: Vardict with optional further information
@handle: Object path for the #org.freedesktop.portal.Request object representing this call
Create a remote desktop session.
A remote desktop session is used to allow remote controlling a desktop
session. It can also be used together with a screen cast session (see
org.freedesktop.portal.ScreenCast), but may only be started and stopped
with this interface.
To also get a screen content, call the
#org.freedesktop.ScreenCast.SelectSources with the
#org.freedesktop.Session object created with this method.
Supported keys in the @options vardict include:
<variablelist>
<varlistentry>
<term>handle_token s</term>
<listitem><para>
A string that will be used as the last element of the @handle. Must be a valid
object path element. See the #org.freedesktop.portal.Request documentation for
more information about the @handle.
</para></listitem>
</varlistentry>
<varlistentry>
<term>session_handle_token s</term>
<listitem><para>
A string that will be used as the last element of the session handle. Must be a valid
object path element. See the #org.freedesktop.portal.Session documentation for
more information about the session handle.
</para></listitem>
</varlistentry>
</variablelist>
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>
<!--
SelectDevices:
@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
Select input devices to remote control.
Supported keys in the @options vardict include:
<variablelist>
<varlistentry>
<term>handle_token s</term>
<listitem><para>
A string that will be used as the last element of the @handle. Must be a valid
object path element. See the #org.freedesktop.portal.Request documentation for
more information about the @handle.
</para></listitem>
</varlistentry>
<varlistentry>
<term>type u</term>
<listitem><para>
Bitmask of what device types to request remote controlling of.
Default is all.
</para></listitem>
</varlistentry>
</variablelist>
For available source types, see the AvailableDeviceTypes property.
-->
<method name="SelectDevices">
<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, see <link linkend="parent_window">Common Conventions</link>
@options: Vardict with optional further information
@handle: Object path for the #org.freedesktop.portal.Request object representing this call
Start the remote desktop session. This will typically result in the portal
presenting a dialog letting the user select what to share, including
devices and optionally screen content if screen cast sources was
selected.
Supported keys in the @options vardict include:
<variablelist>
<varlistentry>
<term>handle_token s</term>
<listitem><para>
A string that will be used as the last element of the @handle. Must be a valid
object path element. See the #org.freedesktop.portal.Request documentation for
more information about the @handle.
</para></listitem>
</varlistentry>
</variablelist>
The following results get returned via the
#org.freedesktop.portal.Request::Response signal:
<variablelist>
<varlistentry>
<term>devices u</term>
<listitem><para>
A bitmask of the devices selected by the user.
</para></listitem>
</varlistentry>
</variablelist>
If a screen cast source was selected, the results of the
#org.freedesktop.portal.ScreenCast.Start response signal may be
included.
-->
<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>
<!--
NotifyPointerMotion:
@session_handle: Object path for the #org.freedesktop.portal.Session object
@options: Vardict with optional further information
@dx: Relative movement on the x axis
@dy: Relative movement on the y axis
Notify about a new relative pointer motion event. The (dx, dy) vector
represents the new pointer position in the streams logical coordinate
space.
-->
<method name="NotifyPointerMotion">
<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="d" name="dx" direction="in"/>
<arg type="d" name="dy" direction="in"/>
</method>
<!--
NotifyPointerMotionAbsolute:
@session_handle: Object path for the #org.freedesktop.portal.Session object
@options: Vardict with optional further information
@stream: The PipeWire stream node the coordinate is relative to
@x: Pointer motion x coordinate
@y: Pointer motion y coordinate
Notify about a new absolute pointer motion event. The (x, y) position
represents the new pointer position in the streams logical coordinate
space (see the logical_size stream property in
#org.freedesktop.portal.ScreenCast).
-->
<method name="NotifyPointerMotionAbsolute">
<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="u" name="stream" direction="in"/>
<arg type="d" name="x" direction="in"/>
<arg type="d" name="y" direction="in"/>
</method>
<!--
NotifyPointerButton:
@session_handle: Object path for the #org.freedesktop.portal.Session object
@options: Vardict with optional further information
@button: The pointer button was pressed or released
@state: The new state of the button
The pointer button is encoded according to Linux Evdev button codes.
May only be called if POINTER access was provided after starting the
session.
Available button states:
<simplelist>
<member>0: Released</member>
<member>1: Pressed</member>
</simplelist>
-->
<method name="NotifyPointerButton">
<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="i" name="button" direction="in"/>
<arg type="u" name="state" direction="in"/>
</method>
<!--
NotifyPointerAxis:
@session_handle: Object path for the #org.freedesktop.portal.Session object
@options: Vardict with optional further information
@dx: Relative axis movement on the x axis
@dy: Relative axis movement on the y axis
The axis movement from a 'smooth scroll' device, such as a touchpad.
When applicable, the size of the motion delta should be equivalent to
the motion vector of a pointer motion done using the same advice.
May only be called if POINTER access was provided after starting the
session.
Supported keys in the @options vardict include:
<variablelist>
<varlistentry>
<term>finish b</term>
<listitem><para>
If set to true, this is the last axis event in a series, for
example as a result of the fingers being lifted from a touchpad
after a two-finger scroll. Default is false.
</para></listitem>
</varlistentry>
</variablelist>
-->
<method name="NotifyPointerAxis">
<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="d" name="dx" direction="in"/>
<arg type="d" name="dy" direction="in"/>
</method>
<!--
NotifyPointerAxisDiscrete:
@session_handle: Object path for the #org.freedesktop.portal.Session object
@options: Vardict with optional further information
@axis: The axis that was scrolled
@steps: The number of steps scrolled
May only be called if POINTER access was provided after starting the
session.
Available axes:
<simplelist>
<member>0: Vertical scroll</member>
<member>1: Horizontal scroll</member>
</simplelist>
-->
<method name="NotifyPointerAxisDiscrete">
<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="u" name="axis" direction="in"/>
<arg type="i" name="steps" direction="in"/>
</method>
<!--
NotifyKeyboardKeycode:
@session_handle: Object path for the #org.freedesktop.portal.Session object
@options: Vardict with optional further information
@keycode: Keyboard code that was pressed or released
@state: New state of keyboard keysym
May only be called if KEYBOARD access was provided after starting the
session.
Available keyboard keysym states:
<simplelist>
<member>0: Released</member>
<member>1: Pressed</member>
</simplelist>
-->
<method name="NotifyKeyboardKeycode">
<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="i" name="keycode" direction="in"/>
<arg type="u" name="state" direction="in"/>
</method>
<!--
NotifyKeyboardKeysym:
@session_handle: Object path for the #org.freedesktop.portal.Session object
@options: Vardict with optional further information
@keysym: Keyboard symbol that was pressed or released
@state: New state of keyboard keysym
May only be called if KEYBOARD access was provided after starting the
session.
Available keyboard keysym states:
<simplelist>
<member>0: Released</member>
<member>1: Pressed</member>
</simplelist>
-->
<method name="NotifyKeyboardKeysym">
<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="i" name="keysym" direction="in"/>
<arg type="u" name="state" direction="in"/>
</method>
<!--
NotifyTouchDown:
@session_handle: Object path for the #org.freedesktop.portal.Session object
@options: Vardict with optional further information
@stream: The PipeWire stream node the coordinate is relative to
@slot: Touch slot where touch point appeared
@x: Touch down x coordinate
@y: Touch down y coordinate
May only be called if TOUCHSCREEN access was provided after starting the
session.
Notify about a new touch down event. The (x, y) position
represents the new touch point position in the streams logical
coordinate space (see the logical_size stream property in
#org.freedesktop.portal.ScreenCast).
-->
<method name="NotifyTouchDown">
<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="u" name="stream" direction="in"/>
<arg type="u" name="slot" direction="in"/>
<arg type="d" name="x" direction="in"/>
<arg type="d" name="y" direction="in"/>
</method>
<!--
NotifyTouchMotion:
@session_handle: Object path for the #org.freedesktop.portal.Session object
@options: Vardict with optional further information
@stream: The PipeWire stream node the coordinate is relative to
@slot: Touch slot where touch point appeared
@x: Touch motion x coordinate
@y: Touch motion y coordinate
May only be called if TOUCHSCREEN access was provided after starting the
session.
Notify about a new touch motion event. The (x, y) position
represents where the touch point position in the streams logical
coordinate space moved (see the logical_size stream property in
#org.freedesktop.portal.ScreenCast).
-->
<method name="NotifyTouchMotion">
<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="u" name="stream" direction="in"/>
<arg type="u" name="slot" direction="in"/>
<arg type="d" name="x" direction="in"/>
<arg type="d" name="y" direction="in"/>
</method>
<!--
NotifyTouchUp:
@session_handle: Object path for the #org.freedesktop.portal.Session object
@options: Vardict with optional further information
@slot: Touch slot where touch point appeared
May only be called if TOUCHSCREEN access was provided after starting the
session.
Notify about a new touch up event.
-->
<method name="NotifyTouchUp">
<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="u" name="slot" direction="in"/>
</method>
<!--
AvailableDeviceTypes:
A bitmask of available source types. Currently defined types are:
<simplelist>
<member>1: KEYBOARD</member>
<member>2: POINTER</member>
<member>4: TOUCHSCREEN</member>
</simplelist>
-->
<property name="AvailableDeviceTypes" type="u" access="read"/>
<property name="version" type="u" access="read"/>
</interface>
</node>