Unverified Commit 5116fe0c authored by Oleg Chernovskiy's avatar Oleg Chernovskiy
Browse files

Add Remote Access interface to KWayland

Summary:
This commit adds an interface bridge from KWin to KRfb. The purpose of
this protocol is to pass a GBM fd of currently displayed buffer from
KWin. The buffer is expected to be fully drawn once it is passed.

Related to D1230

Test Plan:
********* Start testing of RemoteAccessTest *********
Config: Using QtTest library 5.6.0, Qt 5.6.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 6.1.1 20160501)
PASS   : RemoteAccessTest::initTestCase()
QDEBUG : RemoteAccessTest::testSendReleaseSingle() kwayland-client: Connected to Wayland server at: "kwayland-test-remote-access-0"
QDEBUG : RemoteAccessTest::testSendReleaseSingle() kwayland-client: Wayland Interface:  wl_shm / 1 / 1
QDEBUG : RemoteAccessTest::testSendReleaseSingle() kwayland-client: Wayland Interface:  org_kde_kwin_remote_access_manager / 2 / 1
QDEBUG : RemoteAccessTest::testSendReleaseSingle() kwayland-server: Server buffer sent: fd 15
QDEBUG : RemoteAccessTest::testSendReleaseSingle() kwayland-client: Got buffer, server fd: 15
QDEBUG : RemoteAccessTest::testSendReleaseSingle() kwayland-server: Remote buffer returned, client 4 , id 0 , fd 15
QDEBUG : RemoteAccessTest::testSendReleaseSingle() kwayland-server: Buffer released, fd 15
QDEBUG : RemoteAccessTest::testSendReleaseSingle() kwayland-client: Buffer released
PASS   : RemoteAccessTest::testSendReleaseSingle()
QDEBUG : RemoteAccessTest::testSendReleaseMultiple() kwayland-client: Connected to Wayland server at: "kwayland-test-remote-access-0"
QDEBUG : RemoteAccessTest::testSendReleaseMultiple() kwayland-client: Wayland Interface:  wl_shm / 1 / 1
QDEBUG : RemoteAccessTest::testSendReleaseMultiple() kwayland-client: Wayland Interface:  org_kde_kwin_remote_access_manager / 2 / 1
QDEBUG : RemoteAccessTest::testSendReleaseMultiple() kwayland-server: Server buffer sent: fd 15
QDEBUG : RemoteAccessTest::testSendReleaseMultiple() kwayland-client: Got buffer, server fd: 15
QDEBUG : RemoteAccessTest::testSendReleaseMultiple() kwayland-client: Got buffer, server fd: 15
QDEBUG : RemoteAccessTest::testSendReleaseMultiple() kwayland-server: Remote buffer returned, client 4 , id 0 , fd 15
QDEBUG : RemoteAccessTest::testSendReleaseMultiple() kwayland-server: Remote buffer returned, client 5 , id 0 , fd 15
QDEBUG : RemoteAccessTest::testSendReleaseMultiple() kwayland-server: Buffer released, fd 15
QDEBUG : RemoteAccessTest::testSendReleaseMultiple() kwayland-client: Buffer released
QDEBUG : RemoteAccessTest::testSendReleaseMultiple() kwayland-client: Buffer released
PASS   : RemoteAccessTest::testSendReleaseMultiple()
QDEBUG : RemoteAccessTest::testSendClientGone() kwayland-client: Connected to Wayland server at: "kwayland-test-remote-access-0"
QDEBUG : RemoteAccessTest::testSendClientGone() kwayland-client: Wayland Interface:  wl_shm / 1 / 1
QDEBUG : RemoteAccessTest::testSendClientGone() kwayland-client: Wayland Interface:  org_kde_kwin_remote_access_manager / 2 / 1
QDEBUG : RemoteAccessTest::testSendClientGone() kwayland-server: Server buffer sent: fd 15
QDEBUG : RemoteAccessTest::testSendClientGone() kwayland-server: Buffer released, fd 15
PASS   : RemoteAccessTest::testSendClientGone()
QDEBUG : RemoteAccessTest::testSendReceiveClientGone() kwayland-client: Connected to Wayland server at: "kwayland-test-remote-access-0"
QDEBUG : RemoteAccessTest::testSendReceiveClientGone() kwayland-client: Wayland Interface:  wl_shm / 1 / 1
QDEBUG : RemoteAccessTest::testSendReceiveClientGone() kwayland-client: Wayland Interface:  org_kde_kwin_remote_access_manager / 2 / 1
QDEBUG : RemoteAccessTest::testSendReceiveClientGone() kwayland-server: Server buffer sent: fd 15
QDEBUG : RemoteAccessTest::testSendReceiveClientGone() kwayland-client: Got buffer, server fd: 15
QDEBUG : RemoteAccessTest::testSendReceiveClientGone() kwayland-client: Buffer released
QDEBUG : RemoteAccessTest::testSendReceiveClientGone() kwayland-server: Buffer released, fd 15
PASS   : RemoteAccessTest::testSendReceiveClientGone()
PASS   : RemoteAccessTest::cleanupTestCase()
Totals: 6 passed, 0 failed, 0 skipped, 0 blacklisted
********* Finished testing of RemoteAccessTest *********

Reviewers: graesslin, davidedmundson, romangg

Reviewed By: davidedmundson, romangg

Subscribers: jtamate, jgrulich, romangg, ngraham, alexeymin, #frameworks, davidedmundson, plasma-devel

Tags: #plasma_on_wayland, #frameworks

Maniphest Tasks: T5653, T7785

Differential Revision: https://phabricator.kde.org/D1231
parent f04bc191
......@@ -419,3 +419,13 @@ target_link_libraries( testServerSideDecorationPalette Qt5::Test Qt5::Gui KF5::W
add_test(NAME kwayland-testServerSideDecorationPalette COMMAND testServerSideDecorationPalette)
ecm_mark_as_test(testServerSideDecorationPalette)
########################################################
# Test RemoteAccess
########################################################
set( testRemoteAccess_SRCS
test_remote_access.cpp
)
add_executable(testRemoteAccess ${testRemoteAccess_SRCS})
target_link_libraries( testRemoteAccess Qt5::Test Qt5::Gui KF5::WaylandClient KF5::WaylandServer)
add_test(NAME kwayland-testRemoteAccess COMMAND testRemoteAccess)
ecm_mark_as_test(testRemoteAccess)
/********************************************************************
Copyright 2016 Oleg Chernovskiy <kanedias@xaker.ru>
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.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
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/>.
*********************************************************************/
// Qt
#include <QtTest/QtTest>
// client
#include "../../src/client/connection_thread.h"
#include "../../src/client/event_queue.h"
#include "../../src/client/remote_access.h"
#include "../../src/client/registry.h"
#include "../../src/client/output.h"
// server
#include "../../src/server/display.h"
#include "../../src/server/output_interface.h"
#include "../../src/server/remote_access_interface.h"
#include <linux/input.h>
using namespace KWayland::Client;
using namespace KWayland::Server;
Q_DECLARE_METATYPE(const BufferHandle *)
Q_DECLARE_METATYPE(const RemoteBuffer *)
Q_DECLARE_METATYPE(const void *)
class RemoteAccessTest : public QObject
{
Q_OBJECT
private Q_SLOTS:
void init();
void cleanup();
void testSendReleaseSingle();
void testSendReleaseMultiple();
void testSendClientGone();
void testSendReceiveClientGone();
private:
Display *m_display = nullptr;
OutputInterface *m_outputInterface = nullptr;
RemoteAccessManagerInterface *m_remoteAccessInterface = nullptr;
ConnectionThread *m_connection = nullptr;
QThread *m_thread = nullptr;
EventQueue *m_queue = nullptr;
Registry *m_registry = nullptr;
Output *m_output = nullptr;
};
static const QString s_socketName = QStringLiteral("kwayland-test-remote-access-0");
void RemoteAccessTest::init()
{
qRegisterMetaType<const BufferHandle *>();
qRegisterMetaType<const RemoteBuffer *>();
qRegisterMetaType<const void *>();
delete m_display;
m_display = new Display(this);
m_display->setSocketName(s_socketName);
m_display->start();
QVERIFY(m_display->isRunning());
m_display->createShm();
m_outputInterface = m_display->createOutput();
m_outputInterface->create();
m_remoteAccessInterface = m_display->createRemoteAccessManager();
m_remoteAccessInterface->create();
QSignalSpy bufferReleasedSpy(m_remoteAccessInterface, &RemoteAccessManagerInterface::bufferReleased);
QVERIFY(bufferReleasedSpy.isValid());
// setup connection
m_connection = new KWayland::Client::ConnectionThread;
QSignalSpy connectedSpy(m_connection, &ConnectionThread::connected);
QVERIFY(connectedSpy.isValid());
m_connection->setSocketName(s_socketName);
m_thread = new QThread(this);
m_connection->moveToThread(m_thread);
m_thread->start();
m_connection->initConnection();
QVERIFY(connectedSpy.wait());
m_queue = new EventQueue(this);
m_queue->setup(m_connection);
m_registry = new Registry(this);
QSignalSpy interfacesAnnouncedSpy(m_registry, &Registry::interfacesAnnounced);
QVERIFY(interfacesAnnouncedSpy.isValid());
m_registry->setEventQueue(m_queue);
m_registry->create(m_connection);
QVERIFY(m_registry->isValid());
m_registry->setup();
QVERIFY(interfacesAnnouncedSpy.wait());
// client-bound output
m_output = m_registry->createOutput(m_registry->interface(Registry::Interface::Output).name,
m_registry->interface(Registry::Interface::Output).version,
this);
}
void RemoteAccessTest::cleanup()
{
#define CLEANUP(variable) \
if (variable) { \
delete variable; \
variable = nullptr; \
}
CLEANUP(m_output)
CLEANUP(m_queue)
CLEANUP(m_registry)
if (m_thread) {
if (m_connection) {
m_connection->flush();
m_connection->deleteLater();
m_connection = nullptr;
}
m_thread->quit();
m_thread->wait();
delete m_thread;
m_thread = nullptr;
}
CLEANUP(m_remoteAccessInterface)
CLEANUP(m_display)
#undef CLEANUP
}
void RemoteAccessTest::testSendReleaseSingle()
{
// this test verifies that a buffer is sent to client and returned back
// setup
QVERIFY(!m_remoteAccessInterface->isBound());
auto client = m_registry->createRemoteAccessManager(
m_registry->interface(Registry::Interface::RemoteAccessManager).name,
m_registry->interface(Registry::Interface::RemoteAccessManager).version,
this);
QVERIFY(client->isValid());
m_connection->flush();
m_display->dispatchEvents();
QVERIFY(m_remoteAccessInterface->isBound()); // we have one client now
QSignalSpy bufferReadySpy(client, &RemoteAccessManager::bufferReady);
QVERIFY(bufferReadySpy.isValid());
BufferHandle *buf = new BufferHandle();
QTemporaryFile *tmpFile = new QTemporaryFile(this);
tmpFile->open();
buf->setFd(tmpFile->handle());
buf->setSize(50, 50);
buf->setFormat(100500);
buf->setStride(7800);
m_remoteAccessInterface->sendBufferReady(m_outputInterface, buf);
// receive buffer
QVERIFY(bufferReadySpy.wait());
auto rbuf = bufferReadySpy.takeFirst()[1].value<const RemoteBuffer *>();
QSignalSpy paramsObtainedSpy(rbuf, &RemoteBuffer::parametersObtained);
QVERIFY(paramsObtainedSpy.isValid());
// wait for params
QVERIFY(paramsObtainedSpy.wait());
// client fd is different, not subject to check
QCOMPARE(rbuf->width(), 50u);
QCOMPARE(rbuf->height(), 50u);
QCOMPARE(rbuf->format(), 100500u);
QCOMPARE(rbuf->stride(), 7800u);
// release
QSignalSpy bufferReleasedSpy(m_remoteAccessInterface, &RemoteAccessManagerInterface::bufferReleased);
QVERIFY(bufferReleasedSpy.isValid());
delete rbuf;
QVERIFY(bufferReleasedSpy.wait());
// cleanup
delete buf;
delete client;
m_connection->flush();
m_display->dispatchEvents();
QVERIFY(!m_remoteAccessInterface->isBound());
}
void RemoteAccessTest::testSendReleaseMultiple()
{
// this test verifies that a buffer is sent to 2 clients and returned back
// setup
QVERIFY(!m_remoteAccessInterface->isBound());
auto client1 = m_registry->createRemoteAccessManager(
m_registry->interface(Registry::Interface::RemoteAccessManager).name,
m_registry->interface(Registry::Interface::RemoteAccessManager).version,
this);
QVERIFY(client1->isValid());
auto client2 = m_registry->createRemoteAccessManager(
m_registry->interface(Registry::Interface::RemoteAccessManager).name,
m_registry->interface(Registry::Interface::RemoteAccessManager).version,
this);
QVERIFY(client2->isValid());
m_connection->flush();
m_display->dispatchEvents();
QVERIFY(m_remoteAccessInterface->isBound()); // now we have 2 clients
QSignalSpy bufferReadySpy1(client1, &RemoteAccessManager::bufferReady);
QVERIFY(bufferReadySpy1.isValid());
QSignalSpy bufferReadySpy2(client2, &RemoteAccessManager::bufferReady);
QVERIFY(bufferReadySpy2.isValid());
BufferHandle *buf = new BufferHandle();
QTemporaryFile *tmpFile = new QTemporaryFile(this);
tmpFile->open();
buf->setFd(tmpFile->handle());
buf->setSize(50, 50);
buf->setFormat(100500);
buf->setStride(7800);
m_remoteAccessInterface->sendBufferReady(m_outputInterface, buf);
// wait for event loop
QVERIFY(bufferReadySpy1.wait());
// receive buffer at client 1
QCOMPARE(bufferReadySpy1.size(), 1);
auto rbuf1 = bufferReadySpy1.takeFirst()[1].value<const RemoteBuffer *>();
QSignalSpy paramsObtainedSpy1(rbuf1, &RemoteBuffer::parametersObtained);
QVERIFY(paramsObtainedSpy1.isValid());
// receive buffer at client 2
QCOMPARE(bufferReadySpy2.size(), 1);
auto rbuf2 = bufferReadySpy2.takeFirst()[1].value<const RemoteBuffer *>();
QSignalSpy paramsObtainedSpy2(rbuf2, &RemoteBuffer::parametersObtained);
QVERIFY(paramsObtainedSpy2.isValid());
// wait for event loop
QVERIFY(paramsObtainedSpy1.wait());
QCOMPARE(paramsObtainedSpy1.size(), 1);
QCOMPARE(paramsObtainedSpy2.size(), 1);
// release
QSignalSpy bufferReleasedSpy(m_remoteAccessInterface, &RemoteAccessManagerInterface::bufferReleased);
QVERIFY(bufferReleasedSpy.isValid());
delete rbuf1;
QVERIFY(!bufferReleasedSpy.wait(1000)); // one client released, second still holds buffer!
delete rbuf2;
QVERIFY(bufferReleasedSpy.wait()); // all clients released, buffer should be freed
// cleanup
delete buf;
delete client1;
delete client2;
m_connection->flush();
m_display->dispatchEvents();
QVERIFY(!m_remoteAccessInterface->isBound());
}
void RemoteAccessTest::testSendClientGone()
{
// this test verifies that when buffer is sent and client is gone, server will release buffer correctly
QVERIFY(!m_remoteAccessInterface->isBound());
auto client = m_registry->createRemoteAccessManager(
m_registry->interface(Registry::Interface::RemoteAccessManager).name,
m_registry->interface(Registry::Interface::RemoteAccessManager).version,
this);
QVERIFY(client->isValid());
m_connection->flush();
m_display->dispatchEvents();
QVERIFY(m_remoteAccessInterface->isBound()); // we have one client now
QSignalSpy bufferReadySpy(client, &RemoteAccessManager::bufferReady);
QVERIFY(bufferReadySpy.isValid());
BufferHandle *buf = new BufferHandle();
QTemporaryFile *tmpFile = new QTemporaryFile(this);
tmpFile->open();
buf->setFd(tmpFile->handle());
buf->setSize(50, 50);
buf->setFormat(100500);
buf->setStride(7800);
m_remoteAccessInterface->sendBufferReady(m_outputInterface, buf);
// release forcefully
QSignalSpy bufferReleasedSpy(m_remoteAccessInterface, &RemoteAccessManagerInterface::bufferReleased);
QVERIFY(bufferReleasedSpy.isValid());
delete client;
QVERIFY(bufferReleasedSpy.wait());
// cleanup
delete buf;
m_connection->flush();
m_display->dispatchEvents();
QVERIFY(!m_remoteAccessInterface->isBound());
}
void RemoteAccessTest::testSendReceiveClientGone()
{
// this test verifies that when buffer is sent, received and client is gone,
// both client and server will release buffer correctly
QVERIFY(!m_remoteAccessInterface->isBound());
auto client = m_registry->createRemoteAccessManager(
m_registry->interface(Registry::Interface::RemoteAccessManager).name,
m_registry->interface(Registry::Interface::RemoteAccessManager).version,
this);
QVERIFY(client->isValid());
m_connection->flush();
m_display->dispatchEvents();
QVERIFY(m_remoteAccessInterface->isBound()); // we have one client now
QSignalSpy bufferReadySpy(client, &RemoteAccessManager::bufferReady);
QVERIFY(bufferReadySpy.isValid());
BufferHandle *buf = new BufferHandle();
QTemporaryFile *tmpFile = new QTemporaryFile(this);
tmpFile->open();
buf->setFd(tmpFile->handle());
buf->setSize(50, 50);
buf->setFormat(100500);
buf->setStride(7800);
m_remoteAccessInterface->sendBufferReady(m_outputInterface, buf);
// receive buffer
QVERIFY(bufferReadySpy.wait());
auto rbuf = bufferReadySpy.takeFirst()[1].value<const RemoteBuffer *>();
QSignalSpy paramsObtainedSpy(rbuf, &RemoteBuffer::parametersObtained);
QVERIFY(paramsObtainedSpy.isValid());
// wait for params
QVERIFY(paramsObtainedSpy.wait());
// client fd is different, not subject to check
QCOMPARE(rbuf->width(), 50u);
QCOMPARE(rbuf->height(), 50u);
QCOMPARE(rbuf->format(), 100500u);
QCOMPARE(rbuf->stride(), 7800u);
// release forcefully
QSignalSpy bufferReleasedSpy(m_remoteAccessInterface, &RemoteAccessManagerInterface::bufferReleased);
QVERIFY(bufferReleasedSpy.isValid());
delete client;
QVERIFY(bufferReleasedSpy.wait());
// cleanup
delete buf;
m_connection->flush();
m_display->dispatchEvents();
QVERIFY(!m_remoteAccessInterface->isBound());
}
QTEST_GUILESS_MAIN(RemoteAccessTest)
#include "test_remote_access.moc"
......@@ -24,6 +24,7 @@ set(CLIENT_LIB_SRCS
idle.cpp
idleinhibit.cpp
keyboard.cpp
remote_access.cpp
outputconfiguration.cpp
outputmanagement.cpp
outputdevice.cpp
......@@ -193,6 +194,11 @@ set(CLIENT_GENERATED_FILES
set_source_files_properties(${CLIENT_GENERATED_FILES} PROPERTIES SKIP_AUTOMOC ON)
ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS
PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/remote-access.xml
BASENAME remote-access
)
add_library(KF5WaylandClient ${CLIENT_LIB_SRCS})
generate_export_header(KF5WaylandClient
BASE_NAME
......@@ -236,6 +242,7 @@ set(CLIENT_LIB_HEADERS
idle.h
idleinhibit.h
keyboard.h
remote_access.h
outputconfiguration.h
outputmanagement.h
outputdevice.h
......
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="remote_access">
<copyright><![CDATA[
Copyright (C) 2016 Oleg Chernovskiy
This program 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.1 of the License, or
(at your option) any later version.
This program 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 program. If not, see <http://www.gnu.org/licenses/>.
]]></copyright>
<interface name="org_kde_kwin_remote_access_manager" version="1">
<description summary="Protocol for managing rendered GBM buffers passing"/>
<event name="buffer_ready" since="1">
<description summary="Signals about buffer ready to be consumed by clients"/>
<arg name="id" type="int" summary="unique id of created buffer (you can use server-side fd number)"/>
<arg name="output" type="object" interface="wl_output" summary="screen that this buffer belongs to"/>
</event>
<request name="get_buffer" since="1">
<description summary="Answer on buffer_ready event, retrieves new buffer from server"/>
<arg name="buffer" type="new_id" interface="org_kde_kwin_remote_buffer"/>
<arg name="internal_buffer_id" type="int" summary="The internal buffer id of the buffer to create"/>
</request>
<request name="release" type="destructor">
<description summary="release org_kde_kwin_remote_access_manager interface"/>
</request>
</interface>
<interface name="org_kde_kwin_remote_buffer" version="1">
<description summary="This interface allows finer control of remote buffer lifecycle"/>
<event name="gbm_handle" since="1">
<description summary="This is sent after binding to remote access manager" />
<arg name="fd" type="fd"/>
<arg name="width" type="uint"/>
<arg name="height" type="uint"/>
<arg name="stride" type="uint"/>
<arg name="format" type="uint"/>
</event>
<request name="release" type="destructor" since="1">
<description summary="This request comes once client no longer needs this buffer."/>
</request>
</interface>
</protocol>
......@@ -27,6 +27,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
#include "fullscreen_shell.h"
#include "idle.h"
#include "idleinhibit.h"
#include "remote_access.h"
#include "logging_p.h"
#include "outputconfiguration.h"
#include "outputmanagement.h"
......@@ -62,6 +63,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
#include <wayland-plasma-window-management-client-protocol.h>
#include <wayland-idle-client-protocol.h>
#include <wayland-idle-inhibit-unstable-v1-client-protocol.h>
#include <wayland-remote-access-client-protocol.h>
#include <wayland-fake-input-client-protocol.h>
#include <wayland-shadow-client-protocol.h>
#include <wayland-output-management-client-protocol.h>
......@@ -179,6 +181,13 @@ static const QMap<Registry::Interface, SuppertedInterfaceData> s_interfaces = {
&Registry::idleAnnounced,
&Registry::idleRemoved
}},
{Registry::Interface::RemoteAccessManager, {
1,
QByteArrayLiteral("org_kde_kwin_remote_access_manager"),
&org_kde_kwin_remote_access_manager_interface,
&Registry::remoteAccessManagerAnnounced,
&Registry::remoteAccessManagerRemoved
}},
{Registry::Interface::FakeInput, {
2,
QByteArrayLiteral("org_kde_kwin_fake_input"),
......@@ -622,6 +631,7 @@ BIND(DataDeviceManager, wl_data_device_manager)
BIND(PlasmaShell, org_kde_plasma_shell)
BIND(PlasmaWindowManagement, org_kde_plasma_window_management)
BIND(Idle, org_kde_kwin_idle)
BIND(RemoteAccessManager, org_kde_kwin_remote_access_manager)
BIND(FakeInput, org_kde_kwin_fake_input)
BIND(OutputManagement, org_kde_kwin_outputmanagement)
BIND(OutputDevice, org_kde_kwin_outputdevice)
......@@ -682,6 +692,7 @@ CREATE(DataDeviceManager)
CREATE(PlasmaShell)
CREATE(PlasmaWindowManagement)
CREATE(Idle)
CREATE(RemoteAccessManager)
CREATE(FakeInput)
CREATE(OutputManagement)
CREATE(OutputDevice)
......
......@@ -42,6 +42,7 @@ struct org_kde_kwin_outputmanagement;
struct org_kde_kwin_outputdevice;
struct org_kde_kwin_fake_input;
struct org_kde_kwin_idle;
struct org_kde_kwin_remote_access_manager;
struct org_kde_kwin_dpms_manager;
struct org_kde_kwin_shadow_manager;
struct org_kde_kwin_blur_manager;
......@@ -77,6 +78,7 @@ class OutputManagement;
class OutputDevice;
class Idle;
class IdleInhibitManager;
class RemoteAccessManager;
class Output;
class PlasmaShell;
class PlasmaWindowManagement;
......@@ -169,7 +171,8 @@ public:
XdgShellUnstableV6, ///< Refers to zxdg_shell_v6 (unstable version 6), @since 5.39
IdleInhibitManagerUnstableV1, ///< Refers to zwp_idle_inhibit_manager_v1 (unstable version 1), @since 5.41
AppMenu, ///Refers to org_kde_kwin_appmenu @since 5.42
ServerSideDecorationPalette ///Refers to org_kde_kwin_server_decoration_palette_manager @since 5.42
ServerSideDecorationPalette, ///Refers to org_kde_kwin_server_decoration_palette_manager @since 5.42
RemoteAccessManager ///< Refers to org_kde_kwin_remote_access_manager interface, @since 5.45
};
explicit Registry(QObject *parent = nullptr);
virtual ~Registry();
......@@ -404,6 +407,16 @@ public:
* @since 5.4
**/
org_kde_kwin_idle *bindIdle(uint32_t name, uint32_t version) const;
/**
* Binds the org_kde_kwin_remote_access_manager with @p name and @p version.
* If the @p name does not exist or is not for the idle interface,
* @c null will be returned.
*
* Prefer using createRemoteAccessManager instead.
* @see createRemoteAccessManager
* @since 5.45
**/
org_kde_kwin_remote_access_manager *bindRemoteAccessManager(uint32_t name, uint32_t version) const;
/**
* Binds the org_kde_kwin_fake_input with @p name and @p version.
* If the @p name does not exist or is not for the fake input interface,
......@@ -805,6 +818,22 @@ public:
* @since 5.4
**/
Idle *createIdle(quint32 name, quint32 version, QObject *parent = nullptr);
/**
* Creates a RemoteAccessManager and sets it up to manage the interface identified by
* @p name and @p version.
*
* Note: in case @p name is invalid or isn't for the org_kde_kwin_remote_access_manager interface,
* the returned RemoteAccessManager will not be valid. Therefore it's recommended to call
* isValid on the created instance.
*
* @param name The name of the org_kde_kwin_remote_access_manager interface to bind
* @param version The version or the org_kde_kwin_remote_access_manager interface to use
* @param parent The parent for RemoteAccessManager
*
* @returns The created RemoteAccessManager.
* @since 5.45
**/
RemoteAccessManager *createRemoteAccessManager(quint32 name, quint32 version, QObject *parent = nullptr);
/**
* Creates a FakeInput and sets it up to manage the interface identified by
* @p name and @p version.
......@@ -1186,6 +1215,13 @@ Q_SIGNALS:
* @since 5.4
**/
void idleAnnounced(quint32 name, quint32 version);
/**
* Emitted whenever a org_kde_kwin_remote_access_manager interface gets announced.
* @param name The name for the announced interface
* @param version The maximum supported version of the announced interface
* @since 5.45
**/
void remoteAccessManagerAnnounced(quint32 name, quint32 version);
/**
* Emitted whenever a org_kde_kwin_fake_input interface gets announced.
* @param name The name for the announced interface
......@@ -1402,6 +1438,12 @@ Q_SIGNALS:
* @since 5.4
**/
void idleRemoved(quint32 name);
/**
* Emitted whenever a org_kde_kwin_remote_access_manager interface gets removed.
* @param name The name for the removed interface
* @since 5.45
**/
void remoteAccessManagerRemoved(quint32 name);
/**
* Emitted whenever a org_kde_kwin_fake_input interface gets removed.
* @param name The name for the removed interface
......
/****************************************************************************
Copyright 2016 Oleg Chernovskiy <kanedias@xaker.ru>
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.1 of the License, or (at your option) version 3, or any
later version accepted by the membership of KDE e.V. (or its
successor approved by the membership of KDE e.V.), which shall
act as a proxy defined in Section 6 of version 3 of the license.
This library is distributed in the hope that it will be useful,