mirror of
https://invent.kde.org/network/krfb
synced 2024-07-03 08:28:35 +00:00
wayland: Add support for the persistence feature of the remote desktop portal
Same idea as https://invent.kde.org/network/kdeconnect-kde/-/merge_requests/639, v2 of the remote desktop portal can accept and return a restore token that we can use to avoid constantly asking the user for permission every time Krfb is started.
Note that there's a bug in `xdg-desktop-portal-kde` that breaks persistence if it's restarted for whatever reason, for example when rebooting (see https://bugs.kde.org/show_bug.cgi?id=480235 and https://invent.kde.org/network/kdeconnect-kde/-/merge_requests/639#note_859651 for more details), so at the moment this only works when restarting Krfb in the same session.
(cherry picked from commit f071ad4eba
)
This commit is contained in:
parent
cf66fd5358
commit
01739fbf31
|
@ -1,14 +1,17 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<!--
|
<!--
|
||||||
Copyright (C) 2017-2018 Red Hat, Inc.
|
Copyright (C) 2017-2018 Red Hat, Inc.
|
||||||
|
|
||||||
This library is free software; you can redistribute it and/or
|
This library is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU Lesser General Public
|
modify it under the terms of the GNU Lesser General Public
|
||||||
License as published by the Free Software Foundation; either
|
License as published by the Free Software Foundation; either
|
||||||
version 2 of the License, or (at your option) any later version.
|
version 2 of the License, or (at your option) any later version.
|
||||||
|
|
||||||
This library is distributed in the hope that it will be useful,
|
This library is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
Lesser General Public License for more details.
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
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/>.
|
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
-->
|
-->
|
||||||
|
@ -17,22 +20,34 @@
|
||||||
<!--
|
<!--
|
||||||
org.freedesktop.portal.RemoteDesktop:
|
org.freedesktop.portal.RemoteDesktop:
|
||||||
@short_description: Remote desktop portal
|
@short_description: Remote desktop portal
|
||||||
|
|
||||||
The Remote desktop portal allows to create remote desktop sessions.
|
The Remote desktop portal allows to create remote desktop sessions.
|
||||||
This documentation describes version 1 of this interface.
|
|
||||||
|
This documentation describes version 2 of this interface.
|
||||||
-->
|
-->
|
||||||
<interface name="org.freedesktop.portal.RemoteDesktop">
|
<interface name="org.freedesktop.portal.RemoteDesktop">
|
||||||
<!--
|
<!--
|
||||||
CreateSession:
|
CreateSession:
|
||||||
@options: Vardict with optional further information
|
@options: Vardict with optional further information
|
||||||
@handle: Object path for the #org.freedesktop.portal.Request object representing this call
|
@handle: Object path for the #org.freedesktop.portal.Request object representing this call
|
||||||
|
|
||||||
Create a remote desktop session.
|
Create a remote desktop session.
|
||||||
|
|
||||||
A remote desktop session is used to allow remote controlling a desktop
|
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
|
session.
|
||||||
org.freedesktop.portal.ScreenCast), but may only be started and stopped
|
|
||||||
with this interface.
|
A remote desktop session may only be started and stopped with this interface,
|
||||||
To also get a screen content, call the
|
but you can use the #org.freedesktop.portal.Session object created with this
|
||||||
#org.freedesktop.ScreenCast.SelectSources with the
|
method together with certain methods on the #org.freedesktop.portal.ScreenCast and
|
||||||
#org.freedesktop.Session object created with this method.
|
#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
|
||||||
|
more information on how to use those methods. To capture clipboard content,
|
||||||
|
you can call org.freedesktop.portal.Clipboard.RequestClipboard(). See
|
||||||
|
#org.freedesktop.portal.Clipboard for more information on the clipboard
|
||||||
|
integration.
|
||||||
|
|
||||||
Supported keys in the @options vardict include:
|
Supported keys in the @options vardict include:
|
||||||
<variablelist>
|
<variablelist>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
@ -75,7 +90,9 @@
|
||||||
@session_handle: Object path for the #org.freedesktop.portal.Session object
|
@session_handle: Object path for the #org.freedesktop.portal.Session object
|
||||||
@options: Vardict with optional further information
|
@options: Vardict with optional further information
|
||||||
@handle: Object path for the #org.freedesktop.portal.Request object representing this call
|
@handle: Object path for the #org.freedesktop.portal.Request object representing this call
|
||||||
|
|
||||||
Select input devices to remote control.
|
Select input devices to remote control.
|
||||||
|
|
||||||
Supported keys in the @options vardict include:
|
Supported keys in the @options vardict include:
|
||||||
<variablelist>
|
<variablelist>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
@ -87,14 +104,50 @@
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>type u</term>
|
<term>types u</term>
|
||||||
<listitem><para>
|
<listitem><para>
|
||||||
Bitmask of what device types to request remote controlling of.
|
Bitmask of what device types to request remote controlling of.
|
||||||
Default is all.
|
Default is all.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>restore_token s</term>
|
||||||
|
<listitem><para>
|
||||||
|
The token to restore a previous session.
|
||||||
|
|
||||||
|
If the stored session cannot be restored, this value is ignored
|
||||||
|
and the user will be prompted normally. This may happen when, for
|
||||||
|
example, the session contains a monitor or a window that is not
|
||||||
|
available anymore, or when the stored permissions are withdrawn.
|
||||||
|
|
||||||
|
The restore token is invalidated after using it once. To restore
|
||||||
|
the same session again, use the new restore token sent in response
|
||||||
|
to starting this session.
|
||||||
|
|
||||||
|
This option was added in version 2 of this interface.
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>persist_mode u</term>
|
||||||
|
<listitem><para>
|
||||||
|
How this session should persist. Default is 0. Accepted values are:
|
||||||
|
|
||||||
|
<simplelist>
|
||||||
|
<member>0: Do not persist (default)</member>
|
||||||
|
<member>1: Permissions persist as long as the application is running</member>
|
||||||
|
<member>2: Permissions persist until explicitly revoked</member>
|
||||||
|
</simplelist>
|
||||||
|
|
||||||
|
If the permission for the session to persist is granted, a restore token will
|
||||||
|
be returned via the #org.freedesktop.portal.Request::Response signal of the
|
||||||
|
start method used to start the session.
|
||||||
|
|
||||||
|
This option was added in version 2 of this interface.
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
For available source types, see the AvailableDeviceTypes property.
|
|
||||||
|
For available device types, see the AvailableDeviceTypes property.
|
||||||
-->
|
-->
|
||||||
<method name="SelectDevices">
|
<method name="SelectDevices">
|
||||||
<arg type="o" name="session_handle" direction="in"/>
|
<arg type="o" name="session_handle" direction="in"/>
|
||||||
|
@ -108,10 +161,12 @@
|
||||||
@parent_window: Identifier for the application window, see <link linkend="parent_window">Common Conventions</link>
|
@parent_window: Identifier for the application window, see <link linkend="parent_window">Common Conventions</link>
|
||||||
@options: Vardict with optional further information
|
@options: Vardict with optional further information
|
||||||
@handle: Object path for the #org.freedesktop.portal.Request object representing this call
|
@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
|
Start the remote desktop session. This will typically result in the portal
|
||||||
presenting a dialog letting the user select what to share, including
|
presenting a dialog letting the user select what to share, including
|
||||||
devices and optionally screen content if screen cast sources was
|
devices and optionally screen content if screen cast sources was
|
||||||
selected.
|
selected.
|
||||||
|
|
||||||
Supported keys in the @options vardict include:
|
Supported keys in the @options vardict include:
|
||||||
<variablelist>
|
<variablelist>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
@ -123,6 +178,7 @@
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
The following results get returned via the
|
The following results get returned via the
|
||||||
#org.freedesktop.portal.Request::Response signal:
|
#org.freedesktop.portal.Request::Response signal:
|
||||||
<variablelist>
|
<variablelist>
|
||||||
|
@ -132,7 +188,26 @@
|
||||||
A bitmask of the devices selected by the user.
|
A bitmask of the devices selected by the user.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>clipboard_enabled b</term>
|
||||||
|
<listitem><para>
|
||||||
|
A boolean for whether the clipboard was enabled ('true') or not ('false').
|
||||||
|
See the #org.freedesktop.portal.Clipboard documentation for more information.
|
||||||
|
Since version 2.
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>restore_token s</term>
|
||||||
|
<listitem><para>
|
||||||
|
The restore token. This token is a single use token that can later
|
||||||
|
be used to restore a session. See
|
||||||
|
org.freedesktop.portal.RemoteDesktop.SelectDevices() for details.
|
||||||
|
|
||||||
|
This response option was added in version 2 of this interface.
|
||||||
|
</para></listitem>
|
||||||
|
</varlistentry>
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
If a screen cast source was selected, the results of the
|
If a screen cast source was selected, the results of the
|
||||||
#org.freedesktop.portal.ScreenCast.Start response signal may be
|
#org.freedesktop.portal.ScreenCast.Start response signal may be
|
||||||
included.
|
included.
|
||||||
|
@ -150,6 +225,7 @@
|
||||||
@options: Vardict with optional further information
|
@options: Vardict with optional further information
|
||||||
@dx: Relative movement on the x axis
|
@dx: Relative movement on the x axis
|
||||||
@dy: Relative movement on the y axis
|
@dy: Relative movement on the y axis
|
||||||
|
|
||||||
Notify about a new relative pointer motion event. The (dx, dy) vector
|
Notify about a new relative pointer motion event. The (dx, dy) vector
|
||||||
represents the new pointer position in the streams logical coordinate
|
represents the new pointer position in the streams logical coordinate
|
||||||
space.
|
space.
|
||||||
|
@ -168,6 +244,7 @@
|
||||||
@stream: The PipeWire stream node the coordinate is relative to
|
@stream: The PipeWire stream node the coordinate is relative to
|
||||||
@x: Pointer motion x coordinate
|
@x: Pointer motion x coordinate
|
||||||
@y: Pointer motion y coordinate
|
@y: Pointer motion y coordinate
|
||||||
|
|
||||||
Notify about a new absolute pointer motion event. The (x, y) position
|
Notify about a new absolute pointer motion event. The (x, y) position
|
||||||
represents the new pointer position in the streams logical coordinate
|
represents the new pointer position in the streams logical coordinate
|
||||||
space (see the logical_size stream property in
|
space (see the logical_size stream property in
|
||||||
|
@ -187,9 +264,12 @@
|
||||||
@options: Vardict with optional further information
|
@options: Vardict with optional further information
|
||||||
@button: The pointer button was pressed or released
|
@button: The pointer button was pressed or released
|
||||||
@state: The new state of the button
|
@state: The new state of the button
|
||||||
|
|
||||||
The pointer button is encoded according to Linux Evdev button codes.
|
The pointer button is encoded according to Linux Evdev button codes.
|
||||||
|
|
||||||
May only be called if POINTER access was provided after starting the
|
May only be called if POINTER access was provided after starting the
|
||||||
session.
|
session.
|
||||||
|
|
||||||
Available button states:
|
Available button states:
|
||||||
<simplelist>
|
<simplelist>
|
||||||
<member>0: Released</member>
|
<member>0: Released</member>
|
||||||
|
@ -209,11 +289,14 @@
|
||||||
@options: Vardict with optional further information
|
@options: Vardict with optional further information
|
||||||
@dx: Relative axis movement on the x axis
|
@dx: Relative axis movement on the x axis
|
||||||
@dy: Relative axis movement on the y axis
|
@dy: Relative axis movement on the y axis
|
||||||
|
|
||||||
The axis movement from a 'smooth scroll' device, such as a touchpad.
|
The axis movement from a 'smooth scroll' device, such as a touchpad.
|
||||||
When applicable, the size of the motion delta should be equivalent to
|
When applicable, the size of the motion delta should be equivalent to
|
||||||
the motion vector of a pointer motion done using the same advice.
|
the motion vector of a pointer motion done using the same advice.
|
||||||
|
|
||||||
May only be called if POINTER access was provided after starting the
|
May only be called if POINTER access was provided after starting the
|
||||||
session.
|
session.
|
||||||
|
|
||||||
Supported keys in the @options vardict include:
|
Supported keys in the @options vardict include:
|
||||||
<variablelist>
|
<variablelist>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
@ -239,8 +322,10 @@
|
||||||
@options: Vardict with optional further information
|
@options: Vardict with optional further information
|
||||||
@axis: The axis that was scrolled
|
@axis: The axis that was scrolled
|
||||||
@steps: The number of steps scrolled
|
@steps: The number of steps scrolled
|
||||||
|
|
||||||
May only be called if POINTER access was provided after starting the
|
May only be called if POINTER access was provided after starting the
|
||||||
session.
|
session.
|
||||||
|
|
||||||
Available axes:
|
Available axes:
|
||||||
<simplelist>
|
<simplelist>
|
||||||
<member>0: Vertical scroll</member>
|
<member>0: Vertical scroll</member>
|
||||||
|
@ -259,10 +344,12 @@
|
||||||
@session_handle: Object path for the #org.freedesktop.portal.Session object
|
@session_handle: Object path for the #org.freedesktop.portal.Session object
|
||||||
@options: Vardict with optional further information
|
@options: Vardict with optional further information
|
||||||
@keycode: Keyboard code that was pressed or released
|
@keycode: Keyboard code that was pressed or released
|
||||||
@state: New state of keyboard keysym
|
@state: New state of keyboard keycode
|
||||||
|
|
||||||
May only be called if KEYBOARD access was provided after starting the
|
May only be called if KEYBOARD access was provided after starting the
|
||||||
session.
|
session.
|
||||||
Available keyboard keysym states:
|
|
||||||
|
Available keyboard keycode states:
|
||||||
<simplelist>
|
<simplelist>
|
||||||
<member>0: Released</member>
|
<member>0: Released</member>
|
||||||
<member>1: Pressed</member>
|
<member>1: Pressed</member>
|
||||||
|
@ -281,8 +368,10 @@
|
||||||
@options: Vardict with optional further information
|
@options: Vardict with optional further information
|
||||||
@keysym: Keyboard symbol that was pressed or released
|
@keysym: Keyboard symbol that was pressed or released
|
||||||
@state: New state of keyboard keysym
|
@state: New state of keyboard keysym
|
||||||
|
|
||||||
May only be called if KEYBOARD access was provided after starting the
|
May only be called if KEYBOARD access was provided after starting the
|
||||||
session.
|
session.
|
||||||
|
|
||||||
Available keyboard keysym states:
|
Available keyboard keysym states:
|
||||||
<simplelist>
|
<simplelist>
|
||||||
<member>0: Released</member>
|
<member>0: Released</member>
|
||||||
|
@ -304,8 +393,10 @@
|
||||||
@slot: Touch slot where touch point appeared
|
@slot: Touch slot where touch point appeared
|
||||||
@x: Touch down x coordinate
|
@x: Touch down x coordinate
|
||||||
@y: Touch down y coordinate
|
@y: Touch down y coordinate
|
||||||
|
|
||||||
May only be called if TOUCHSCREEN access was provided after starting the
|
May only be called if TOUCHSCREEN access was provided after starting the
|
||||||
session.
|
session.
|
||||||
|
|
||||||
Notify about a new touch down event. The (x, y) position
|
Notify about a new touch down event. The (x, y) position
|
||||||
represents the new touch point position in the streams logical
|
represents the new touch point position in the streams logical
|
||||||
coordinate space (see the logical_size stream property in
|
coordinate space (see the logical_size stream property in
|
||||||
|
@ -328,8 +419,10 @@
|
||||||
@slot: Touch slot where touch point appeared
|
@slot: Touch slot where touch point appeared
|
||||||
@x: Touch motion x coordinate
|
@x: Touch motion x coordinate
|
||||||
@y: Touch motion y coordinate
|
@y: Touch motion y coordinate
|
||||||
|
|
||||||
May only be called if TOUCHSCREEN access was provided after starting the
|
May only be called if TOUCHSCREEN access was provided after starting the
|
||||||
session.
|
session.
|
||||||
|
|
||||||
Notify about a new touch motion event. The (x, y) position
|
Notify about a new touch motion event. The (x, y) position
|
||||||
represents where the touch point position in the streams logical
|
represents where the touch point position in the streams logical
|
||||||
coordinate space moved (see the logical_size stream property in
|
coordinate space moved (see the logical_size stream property in
|
||||||
|
@ -349,8 +442,10 @@
|
||||||
@session_handle: Object path for the #org.freedesktop.portal.Session object
|
@session_handle: Object path for the #org.freedesktop.portal.Session object
|
||||||
@options: Vardict with optional further information
|
@options: Vardict with optional further information
|
||||||
@slot: Touch slot where touch point appeared
|
@slot: Touch slot where touch point appeared
|
||||||
|
|
||||||
May only be called if TOUCHSCREEN access was provided after starting the
|
May only be called if TOUCHSCREEN access was provided after starting the
|
||||||
session.
|
session.
|
||||||
|
|
||||||
Notify about a new touch up event.
|
Notify about a new touch up event.
|
||||||
-->
|
-->
|
||||||
<method name="NotifyTouchUp">
|
<method name="NotifyTouchUp">
|
||||||
|
@ -359,9 +454,47 @@
|
||||||
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
|
<annotation name="org.qtproject.QtDBus.QtTypeName.In1" value="QVariantMap"/>
|
||||||
<arg type="u" name="slot" direction="in"/>
|
<arg type="u" name="slot" direction="in"/>
|
||||||
</method>
|
</method>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
ConnectToEIS:
|
||||||
|
@session_handle: Object path for the #org.freedesktop.portal.Session object
|
||||||
|
@options: Vardict with optional further information
|
||||||
|
@fd: A file descriptor to an EIS implementation that can be passed to a libei sender context
|
||||||
|
|
||||||
|
Request a connection to an EIS implementation. The returned handle can
|
||||||
|
be passed to ei_setup_backend_fd() for a libei sender context to
|
||||||
|
complete the connection. All information about available devices and the
|
||||||
|
event flow is subject to libei. Please see the libei documentation for details.
|
||||||
|
|
||||||
|
This method may only be called once per session, where the EIS
|
||||||
|
implementation disconnects the session should be closed.
|
||||||
|
|
||||||
|
This method must be called after #org.freedesktop.portal.RemoteDesktop.Start()
|
||||||
|
|
||||||
|
Once an EIS connection is established, input events must be sent exclusively via
|
||||||
|
the EIS connection. Any events submitted via NotifyPointerMotion,
|
||||||
|
NotifyKeyboardKeycode and other Notify* methods will return an error.
|
||||||
|
|
||||||
|
To see how to pair a PipeWire stream with a libei device region, see the
|
||||||
|
documentation for the mapping_id stream property in
|
||||||
|
#org.freedesktop.portal.RemoteDesktop.Start().
|
||||||
|
|
||||||
|
This method was added in version 2 of this interface.
|
||||||
|
-->
|
||||||
|
<method name="ConnectToEIS">
|
||||||
|
<annotation name="org.gtk.GDBus.C.Name" value="connect_to_eis"/>
|
||||||
|
<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>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
AvailableDeviceTypes:
|
AvailableDeviceTypes:
|
||||||
|
|
||||||
A bitmask of available source types. Currently defined types are:
|
A bitmask of available source types. Currently defined types are:
|
||||||
|
|
||||||
<simplelist>
|
<simplelist>
|
||||||
<member>1: KEYBOARD</member>
|
<member>1: KEYBOARD</member>
|
||||||
<member>2: POINTER</member>
|
<member>2: POINTER</member>
|
||||||
|
|
|
@ -57,6 +57,7 @@ target_link_libraries(krfb_framebuffer_pw
|
||||||
Qt::Gui
|
Qt::Gui
|
||||||
Qt::DBus
|
Qt::DBus
|
||||||
KF6::CoreAddons
|
KF6::CoreAddons
|
||||||
|
KF6::ConfigCore
|
||||||
PkgConfig::PipeWire
|
PkgConfig::PipeWire
|
||||||
Plasma::KWaylandClient
|
Plasma::KWaylandClient
|
||||||
Wayland::Client
|
Wayland::Client
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QRandomGenerator>
|
#include <QRandomGenerator>
|
||||||
|
|
||||||
|
#include <KConfigGroup>
|
||||||
|
#include <KSharedConfig>
|
||||||
|
|
||||||
#include <KWayland/Client/connection_thread.h>
|
#include <KWayland/Client/connection_thread.h>
|
||||||
#include <KWayland/Client/registry.h>
|
#include <KWayland/Client/registry.h>
|
||||||
|
|
||||||
|
@ -185,8 +188,16 @@ void PWFrameBuffer::Private::handleSessionCreated(quint32 code, const QVariantMa
|
||||||
auto selectionOptions = QVariantMap {
|
auto selectionOptions = QVariantMap {
|
||||||
// We have to specify it's an uint, otherwise xdg-desktop-portal will not forward it to backend implementation
|
// We have to specify it's an uint, otherwise xdg-desktop-portal will not forward it to backend implementation
|
||||||
{ QStringLiteral("types"), QVariant::fromValue<uint>(7) }, // request all (KeyBoard, Pointer, TouchScreen)
|
{ QStringLiteral("types"), QVariant::fromValue<uint>(7) }, // request all (KeyBoard, Pointer, TouchScreen)
|
||||||
{ QStringLiteral("handle_token"), QStringLiteral("krfb%1").arg(QRandomGenerator::global()->generate()) }
|
{ QStringLiteral("handle_token"), QStringLiteral("krfb%1").arg(QRandomGenerator::global()->generate()) },
|
||||||
|
{ QStringLiteral("persist_mode"), QVariant::fromValue<uint>(2) }, // Persist permission until explicitly revoked by user
|
||||||
};
|
};
|
||||||
|
|
||||||
|
KConfigGroup stateConfig = KSharedConfig::openStateConfig()->group(QStringLiteral("XdgPortal"));
|
||||||
|
const QString restoreToken = stateConfig.readEntry(QStringLiteral("RestoreToken"), QString());
|
||||||
|
if (!restoreToken.isEmpty()) {
|
||||||
|
selectionOptions[QStringLiteral("restore_token")] = restoreToken;
|
||||||
|
}
|
||||||
|
|
||||||
auto selectorReply = dbusXdpRemoteDesktopService->SelectDevices(sessionPath, selectionOptions);
|
auto selectorReply = dbusXdpRemoteDesktopService->SelectDevices(sessionPath, selectionOptions);
|
||||||
selectorReply.waitForFinished();
|
selectorReply.waitForFinished();
|
||||||
if (!selectorReply.isValid()) {
|
if (!selectorReply.isValid()) {
|
||||||
|
@ -334,6 +345,10 @@ void PWFrameBuffer::Private::handleRemoteDesktopStarted(quint32 code, const QVar
|
||||||
isValid = false;
|
isValid = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// save restore token
|
||||||
|
KConfigGroup stateConfig = KSharedConfig::openStateConfig()->group(QStringLiteral("XdgPortal"));
|
||||||
|
stateConfig.writeEntry(QStringLiteral("RestoreToken"), results[QStringLiteral("restore_token")].toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PWFrameBuffer::Private::handleFrame(const PipeWireFrame &frame)
|
void PWFrameBuffer::Private::handleFrame(const PipeWireFrame &frame)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user