2020-03-15 15:19:28 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2014 Martin Gräßlin <mgraesslin@kde.org>
|
|
|
|
SPDX-FileCopyrightText: 2018 David Edmundson <davidedmundson@kde.org>
|
2014-08-26 14:07:39 +00:00
|
|
|
|
2020-03-15 15:19:28 +00:00
|
|
|
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
|
|
|
|
*/
|
2014-08-26 14:07:39 +00:00
|
|
|
#include "display.h"
|
2020-02-12 15:20:38 +00:00
|
|
|
#include "appmenu_interface.h"
|
|
|
|
#include "blur_interface.h"
|
2014-08-28 07:52:35 +00:00
|
|
|
#include "compositor_interface.h"
|
2020-02-12 15:20:38 +00:00
|
|
|
#include "contrast_interface.h"
|
2020-05-05 07:41:12 +00:00
|
|
|
#include "datacontroldevicemanager_v1_interface.h"
|
2014-11-04 14:10:22 +00:00
|
|
|
#include "datadevicemanager_interface.h"
|
2015-08-31 14:08:58 +00:00
|
|
|
#include "dpms_interface.h"
|
2020-02-12 15:20:38 +00:00
|
|
|
#include "eglstream_controller_interface.h"
|
|
|
|
#include "fakeinput_interface.h"
|
2015-07-02 09:35:16 +00:00
|
|
|
#include "idle_interface.h"
|
2017-10-20 16:28:25 +00:00
|
|
|
#include "idleinhibit_interface_p.h"
|
2020-05-29 09:16:06 +00:00
|
|
|
#include "keyboard_shortcuts_inhibit_v1_interface.h"
|
2020-02-12 15:20:38 +00:00
|
|
|
#include "keystate_interface.h"
|
|
|
|
#include "linuxdmabuf_v1_interface.h"
|
2018-11-20 07:13:42 +00:00
|
|
|
#include "logging.h"
|
2014-08-26 14:07:39 +00:00
|
|
|
#include "output_interface.h"
|
2020-02-12 15:20:38 +00:00
|
|
|
#include "outputconfiguration_interface.h"
|
|
|
|
#include "outputdevice_interface.h"
|
|
|
|
#include "outputmanagement_interface.h"
|
2015-06-09 00:48:56 +00:00
|
|
|
#include "plasmashell_interface.h"
|
2020-02-12 15:20:38 +00:00
|
|
|
#include "plasmavirtualdesktop_interface.h"
|
2015-06-12 01:05:14 +00:00
|
|
|
#include "plasmawindowmanagement_interface.h"
|
2016-11-08 13:17:15 +00:00
|
|
|
#include "pointerconstraints_interface_p.h"
|
2016-10-26 08:27:14 +00:00
|
|
|
#include "pointergestures_interface_p.h"
|
2020-06-01 22:29:53 +00:00
|
|
|
#include "primaryselectiondevicemanager_v1_interface.h"
|
2016-10-07 07:07:34 +00:00
|
|
|
#include "relativepointer_interface_p.h"
|
2020-02-12 15:20:38 +00:00
|
|
|
#include "remote_access_interface.h"
|
|
|
|
#include "seat_interface.h"
|
2015-12-10 08:39:24 +00:00
|
|
|
#include "server_decoration_interface.h"
|
2020-02-12 15:20:38 +00:00
|
|
|
#include "server_decoration_palette_interface.h"
|
|
|
|
#include "shadow_interface.h"
|
|
|
|
#include "slide_interface.h"
|
2014-10-14 12:04:35 +00:00
|
|
|
#include "subcompositor_interface.h"
|
2020-02-12 15:20:38 +00:00
|
|
|
#include "tablet_interface.h"
|
2016-05-02 12:28:26 +00:00
|
|
|
#include "textinput_interface_p.h"
|
2020-05-24 10:46:27 +00:00
|
|
|
#include "viewporter_interface.h"
|
2020-05-04 13:32:23 +00:00
|
|
|
#include "xdgdecoration_v1_interface.h"
|
Wayland foreign protocol
Summary:
Implement the "foreign" wayland protocol.
A client can export a surface with an unique string as handle,
then another client can refer to that surface and set an own surface as
child of that surface.
Potential use cases are out-of-process dialogs, such as file dialogs,
meant to be used by sandboxed processes that may not have the access
it needs to implement such dialogs.
The handle needs to be shared between the processes with other means,
such as dbus or command line paramenters.
The public api of the server side only tracks parent/child relationships as this is the only data kwin would need it for, the rest of the api is not exported so should be safer from eventual protocol changes
Test Plan:
the autotest works, but has a lot of random crashes when deleting surfaces,
unfortunately backtraces don't tell much and the crashes never occur when running into valgrind
behavior may still be wrong, depending on how the protocol is supposed
to work if more clients try to set the same exported surface as parent
Reviewers: #plasma, #kwin, davidedmundson, graesslin
Reviewed By: #plasma, #kwin, graesslin
Subscribers: davidedmundson, graesslin, plasma-devel, #frameworks
Tags: #frameworks, #plasma_on_wayland
Differential Revision: https://phabricator.kde.org/D7369
2017-10-13 09:29:17 +00:00
|
|
|
#include "xdgforeign_interface.h"
|
2018-05-15 09:45:17 +00:00
|
|
|
#include "xdgoutput_interface.h"
|
2020-05-04 13:32:23 +00:00
|
|
|
#include "xdgshell_interface.h"
|
2014-08-26 14:07:39 +00:00
|
|
|
|
|
|
|
#include <QCoreApplication>
|
|
|
|
#include <QDebug>
|
|
|
|
#include <QAbstractEventDispatcher>
|
|
|
|
#include <QSocketNotifier>
|
2015-02-18 08:32:40 +00:00
|
|
|
#include <QThread>
|
2014-08-26 14:07:39 +00:00
|
|
|
|
|
|
|
#include <wayland-server.h>
|
|
|
|
|
2015-03-03 08:43:30 +00:00
|
|
|
#include <EGL/egl.h>
|
|
|
|
|
2020-04-29 14:56:38 +00:00
|
|
|
namespace KWaylandServer
|
2014-08-26 14:07:39 +00:00
|
|
|
{
|
|
|
|
|
2014-09-18 13:40:22 +00:00
|
|
|
class Display::Private
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Private(Display *q);
|
|
|
|
void flush();
|
2015-04-21 06:56:19 +00:00
|
|
|
void dispatch();
|
2014-09-18 13:40:22 +00:00
|
|
|
void setRunning(bool running);
|
2014-11-07 10:41:37 +00:00
|
|
|
void installSocketNotifier();
|
2014-09-18 13:40:22 +00:00
|
|
|
|
|
|
|
wl_display *display = nullptr;
|
|
|
|
wl_event_loop *loop = nullptr;
|
|
|
|
QString socketName = QStringLiteral("wayland-0");
|
|
|
|
bool running = false;
|
2018-11-23 13:42:18 +00:00
|
|
|
bool automaticSocketNaming = false;
|
2014-09-18 13:40:22 +00:00
|
|
|
QList<OutputInterface*> outputs;
|
server side of new outputmanagement protocol
This implements the server part of the screen management protocol. The
protocol is implemented as a wayland protocol.
It provides the following mechanisms:
- a list of outputs, close to wl_output, with additional properties for
enabled, uuid, edid, etc.. These OutputDevices correspond to a
connected output that can be enabled by the compositor, but is not
necessarily currently used for rendering.
- a global OutputManagement, which allows creating config objects, one
per client. The client can make changes to the outputs through
setScale(outputdevice*, scale) for example.
- an OutputConfiguration resource, that can be handed to a client and
used for configuration. Changes are double buffered here. Only after
OutputConfiguration.apply() has been called, the changes are relayed
over the global OutputManagement.
The compositor is responsible to handle changes.
For a more detailed description, see the API docs in especially
outputconfiguration.h.
REVIEW:125942
2015-11-04 14:36:52 +00:00
|
|
|
QList<OutputDeviceInterface*> outputdevices;
|
2015-12-15 14:47:19 +00:00
|
|
|
QVector<SeatInterface*> seats;
|
2014-11-17 15:01:18 +00:00
|
|
|
QVector<ClientConnection*> clients;
|
2015-03-03 08:43:30 +00:00
|
|
|
EGLDisplay eglDisplay = EGL_NO_DISPLAY;
|
2014-09-18 13:40:22 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
Display *q;
|
|
|
|
};
|
|
|
|
|
|
|
|
Display::Private::Private(Display *q)
|
|
|
|
: q(q)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-11-07 10:41:37 +00:00
|
|
|
void Display::Private::installSocketNotifier()
|
|
|
|
{
|
2015-02-18 08:32:40 +00:00
|
|
|
if (!QThread::currentThread()) {
|
2014-11-07 10:41:37 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
int fd = wl_event_loop_get_fd(loop);
|
|
|
|
if (fd == -1) {
|
2015-01-20 08:42:26 +00:00
|
|
|
qCWarning(KWAYLAND_SERVER) << "Did not get the file descriptor for the event loop";
|
2014-11-07 10:41:37 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
QSocketNotifier *m_notifier = new QSocketNotifier(fd, QSocketNotifier::Read, q);
|
2015-04-21 06:56:19 +00:00
|
|
|
QObject::connect(m_notifier, &QSocketNotifier::activated, q, [this] { dispatch(); } );
|
2015-02-18 08:32:40 +00:00
|
|
|
QObject::connect(QThread::currentThread()->eventDispatcher(), &QAbstractEventDispatcher::aboutToBlock, q, [this] { flush(); });
|
2014-11-07 10:41:37 +00:00
|
|
|
setRunning(true);
|
|
|
|
}
|
|
|
|
|
2014-08-26 14:07:39 +00:00
|
|
|
Display::Display(QObject *parent)
|
|
|
|
: QObject(parent)
|
2014-09-18 13:40:22 +00:00
|
|
|
, d(new Private(this))
|
2014-08-26 14:07:39 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
Display::~Display()
|
|
|
|
{
|
|
|
|
terminate();
|
2016-07-04 06:48:43 +00:00
|
|
|
if (d->display) {
|
|
|
|
wl_display_destroy(d->display);
|
|
|
|
}
|
2014-08-26 14:07:39 +00:00
|
|
|
}
|
|
|
|
|
2014-09-18 13:40:22 +00:00
|
|
|
void Display::Private::flush()
|
2015-04-21 06:56:19 +00:00
|
|
|
{
|
|
|
|
if (!display || !loop) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
wl_display_flush_clients(display);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Display::Private::dispatch()
|
2014-08-26 14:07:39 +00:00
|
|
|
{
|
2014-09-18 13:40:22 +00:00
|
|
|
if (!display || !loop) {
|
2014-08-26 14:07:39 +00:00
|
|
|
return;
|
|
|
|
}
|
2014-09-18 13:40:22 +00:00
|
|
|
if (wl_event_loop_dispatch(loop, 0) != 0) {
|
2015-01-20 08:42:26 +00:00
|
|
|
qCWarning(KWAYLAND_SERVER) << "Error on dispatching Wayland event loop";
|
2014-08-26 14:07:39 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Display::setSocketName(const QString &name)
|
|
|
|
{
|
2014-09-18 13:40:22 +00:00
|
|
|
if (d->socketName == name) {
|
2014-08-26 14:07:39 +00:00
|
|
|
return;
|
|
|
|
}
|
2014-09-18 13:40:22 +00:00
|
|
|
d->socketName = name;
|
|
|
|
emit socketNameChanged(d->socketName);
|
2014-08-26 14:07:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QString Display::socketName() const
|
|
|
|
{
|
2014-09-18 13:40:22 +00:00
|
|
|
return d->socketName;
|
2014-08-26 14:07:39 +00:00
|
|
|
}
|
|
|
|
|
2018-11-23 13:42:18 +00:00
|
|
|
void Display::setAutomaticSocketNaming(bool automaticSocketNaming)
|
|
|
|
{
|
|
|
|
if (d->automaticSocketNaming == automaticSocketNaming) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
d->automaticSocketNaming = automaticSocketNaming;
|
|
|
|
emit automaticSocketNamingChanged(automaticSocketNaming);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Display::automaticSocketNaming() const
|
|
|
|
{
|
|
|
|
return d->automaticSocketNaming;
|
|
|
|
}
|
|
|
|
|
2014-11-27 15:42:16 +00:00
|
|
|
void Display::start(StartMode mode)
|
2014-08-26 14:07:39 +00:00
|
|
|
{
|
2014-09-18 13:40:22 +00:00
|
|
|
Q_ASSERT(!d->running);
|
|
|
|
Q_ASSERT(!d->display);
|
|
|
|
d->display = wl_display_create();
|
2014-11-27 15:42:16 +00:00
|
|
|
if (mode == StartMode::ConnectToSocket) {
|
2018-11-23 13:42:18 +00:00
|
|
|
if (d->automaticSocketNaming) {
|
|
|
|
const char *socket = wl_display_add_socket_auto(d->display);
|
|
|
|
if (socket == nullptr) {
|
|
|
|
qCWarning(KWAYLAND_SERVER) << "Failed to create Wayland socket";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const QString newEffectiveSocketName = QString::fromUtf8(socket);
|
|
|
|
if (d->socketName != newEffectiveSocketName) {
|
|
|
|
d->socketName = newEffectiveSocketName;
|
|
|
|
emit socketNameChanged(d->socketName);
|
|
|
|
}
|
|
|
|
} else if (wl_display_add_socket(d->display, qPrintable(d->socketName)) != 0) {
|
2016-07-04 06:48:43 +00:00
|
|
|
qCWarning(KWAYLAND_SERVER) << "Failed to create Wayland socket";
|
2014-11-27 15:42:16 +00:00
|
|
|
return;
|
|
|
|
}
|
2014-08-26 14:07:39 +00:00
|
|
|
}
|
|
|
|
|
2014-09-18 13:40:22 +00:00
|
|
|
d->loop = wl_display_get_event_loop(d->display);
|
2014-11-07 10:41:37 +00:00
|
|
|
d->installSocketNotifier();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Display::startLoop()
|
|
|
|
{
|
|
|
|
Q_ASSERT(!d->running);
|
|
|
|
Q_ASSERT(d->display);
|
|
|
|
d->installSocketNotifier();
|
|
|
|
}
|
|
|
|
|
|
|
|
void Display::dispatchEvents(int msecTimeout)
|
|
|
|
{
|
|
|
|
Q_ASSERT(d->display);
|
2015-05-18 08:27:44 +00:00
|
|
|
if (d->running) {
|
|
|
|
d->dispatch();
|
2016-07-04 06:48:43 +00:00
|
|
|
} else if (d->loop) {
|
2015-05-18 08:27:44 +00:00
|
|
|
wl_event_loop_dispatch(d->loop, msecTimeout);
|
|
|
|
wl_display_flush_clients(d->display);
|
|
|
|
}
|
2014-08-26 14:07:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Display::terminate()
|
|
|
|
{
|
2014-09-18 13:40:22 +00:00
|
|
|
if (!d->running) {
|
2014-08-26 14:07:39 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
emit aboutToTerminate();
|
2014-09-18 13:40:22 +00:00
|
|
|
wl_display_terminate(d->display);
|
|
|
|
wl_display_destroy(d->display);
|
|
|
|
d->display = nullptr;
|
|
|
|
d->loop = nullptr;
|
|
|
|
d->setRunning(false);
|
2014-08-26 14:07:39 +00:00
|
|
|
}
|
|
|
|
|
2014-09-18 13:40:22 +00:00
|
|
|
void Display::Private::setRunning(bool r)
|
2014-08-26 14:07:39 +00:00
|
|
|
{
|
2014-09-18 13:40:22 +00:00
|
|
|
Q_ASSERT(running != r);
|
|
|
|
running = r;
|
|
|
|
emit q->runningChanged(running);
|
2014-08-26 14:07:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
OutputInterface *Display::createOutput(QObject *parent)
|
|
|
|
{
|
|
|
|
OutputInterface *output = new OutputInterface(this, parent);
|
2014-09-18 13:40:22 +00:00
|
|
|
connect(output, &QObject::destroyed, this, [this,output] { d->outputs.removeAll(output); });
|
2014-08-26 14:07:39 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, output, [this,output] { removeOutput(output); });
|
2014-09-18 13:40:22 +00:00
|
|
|
d->outputs << output;
|
2014-08-26 14:07:39 +00:00
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
2014-08-28 07:52:35 +00:00
|
|
|
CompositorInterface *Display::createCompositor(QObject *parent)
|
|
|
|
{
|
|
|
|
CompositorInterface *compositor = new CompositorInterface(this, parent);
|
2020-03-30 15:24:21 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, compositor, [compositor] { delete compositor; });
|
2014-08-28 07:52:35 +00:00
|
|
|
return compositor;
|
|
|
|
}
|
|
|
|
|
server side of new outputmanagement protocol
This implements the server part of the screen management protocol. The
protocol is implemented as a wayland protocol.
It provides the following mechanisms:
- a list of outputs, close to wl_output, with additional properties for
enabled, uuid, edid, etc.. These OutputDevices correspond to a
connected output that can be enabled by the compositor, but is not
necessarily currently used for rendering.
- a global OutputManagement, which allows creating config objects, one
per client. The client can make changes to the outputs through
setScale(outputdevice*, scale) for example.
- an OutputConfiguration resource, that can be handed to a client and
used for configuration. Changes are double buffered here. Only after
OutputConfiguration.apply() has been called, the changes are relayed
over the global OutputManagement.
The compositor is responsible to handle changes.
For a more detailed description, see the API docs in especially
outputconfiguration.h.
REVIEW:125942
2015-11-04 14:36:52 +00:00
|
|
|
OutputDeviceInterface *Display::createOutputDevice(QObject *parent)
|
|
|
|
{
|
|
|
|
OutputDeviceInterface *output = new OutputDeviceInterface(this, parent);
|
|
|
|
connect(output, &QObject::destroyed, this, [this,output] { d->outputdevices.removeAll(output); });
|
|
|
|
connect(this, &Display::aboutToTerminate, output, [this,output] { removeOutputDevice(output); });
|
|
|
|
d->outputdevices << output;
|
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
|
|
|
OutputManagementInterface *Display::createOutputManagement(QObject *parent)
|
|
|
|
{
|
|
|
|
OutputManagementInterface *om = new OutputManagementInterface(this, parent);
|
2020-03-30 15:24:21 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, om, [om] { delete om; });
|
server side of new outputmanagement protocol
This implements the server part of the screen management protocol. The
protocol is implemented as a wayland protocol.
It provides the following mechanisms:
- a list of outputs, close to wl_output, with additional properties for
enabled, uuid, edid, etc.. These OutputDevices correspond to a
connected output that can be enabled by the compositor, but is not
necessarily currently used for rendering.
- a global OutputManagement, which allows creating config objects, one
per client. The client can make changes to the outputs through
setScale(outputdevice*, scale) for example.
- an OutputConfiguration resource, that can be handed to a client and
used for configuration. Changes are double buffered here. Only after
OutputConfiguration.apply() has been called, the changes are relayed
over the global OutputManagement.
The compositor is responsible to handle changes.
For a more detailed description, see the API docs in especially
outputconfiguration.h.
REVIEW:125942
2015-11-04 14:36:52 +00:00
|
|
|
return om;
|
|
|
|
}
|
|
|
|
|
2014-09-02 07:34:31 +00:00
|
|
|
SeatInterface *Display::createSeat(QObject *parent)
|
|
|
|
{
|
|
|
|
SeatInterface *seat = new SeatInterface(this, parent);
|
2015-12-15 14:47:19 +00:00
|
|
|
connect(seat, &QObject::destroyed, this, [this, seat] { d->seats.removeAll(seat); });
|
2020-03-30 15:24:21 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, seat, [seat] { delete seat; });
|
2015-12-15 14:47:19 +00:00
|
|
|
d->seats << seat;
|
2014-09-02 07:34:31 +00:00
|
|
|
return seat;
|
|
|
|
}
|
|
|
|
|
2014-10-14 12:04:35 +00:00
|
|
|
SubCompositorInterface *Display::createSubCompositor(QObject *parent)
|
|
|
|
{
|
|
|
|
auto c = new SubCompositorInterface(this, parent);
|
2020-03-30 15:24:21 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, c, [c] { delete c; });
|
2014-10-14 12:04:35 +00:00
|
|
|
return c;
|
|
|
|
}
|
|
|
|
|
2014-11-04 14:10:22 +00:00
|
|
|
DataDeviceManagerInterface *Display::createDataDeviceManager(QObject *parent)
|
|
|
|
{
|
|
|
|
auto m = new DataDeviceManagerInterface(this, parent);
|
2020-03-30 15:24:21 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, m, [m] { delete m; });
|
2014-11-04 14:10:22 +00:00
|
|
|
return m;
|
|
|
|
}
|
|
|
|
|
2015-06-09 00:48:56 +00:00
|
|
|
PlasmaShellInterface *Display::createPlasmaShell(QObject* parent)
|
|
|
|
{
|
|
|
|
auto s = new PlasmaShellInterface(this, parent);
|
2020-03-30 15:24:21 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, s, [s] { delete s; });
|
2015-06-09 00:48:56 +00:00
|
|
|
return s;
|
2015-06-09 22:56:31 +00:00
|
|
|
}
|
|
|
|
|
2015-06-12 01:05:14 +00:00
|
|
|
PlasmaWindowManagementInterface *Display::createPlasmaWindowManagement(QObject *parent)
|
|
|
|
{
|
|
|
|
auto wm = new PlasmaWindowManagementInterface(this, parent);
|
2020-03-30 15:24:21 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, wm, [wm] { delete wm; });
|
2015-06-12 01:05:14 +00:00
|
|
|
return wm;
|
|
|
|
}
|
|
|
|
|
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
2018-03-25 17:14:42 +00:00
|
|
|
RemoteAccessManagerInterface *Display::createRemoteAccessManager(QObject *parent)
|
|
|
|
{
|
|
|
|
auto i = new RemoteAccessManagerInterface(this, parent);
|
2020-03-30 15:24:21 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, i, [i] { delete i; });
|
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
2018-03-25 17:14:42 +00:00
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
2015-07-02 09:35:16 +00:00
|
|
|
IdleInterface *Display::createIdle(QObject *parent)
|
|
|
|
{
|
|
|
|
auto i = new IdleInterface(this, parent);
|
2020-03-30 15:24:21 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, i, [i] { delete i; });
|
2015-07-02 09:35:16 +00:00
|
|
|
return i;
|
2015-07-02 19:21:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FakeInputInterface *Display::createFakeInput(QObject *parent)
|
|
|
|
{
|
|
|
|
auto i = new FakeInputInterface(this, parent);
|
2020-03-30 15:24:21 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, i, [i] { delete i; });
|
2015-07-02 19:21:57 +00:00
|
|
|
return i;
|
2015-07-02 09:35:16 +00:00
|
|
|
}
|
|
|
|
|
2015-07-15 09:07:50 +00:00
|
|
|
ShadowManagerInterface *Display::createShadowManager(QObject *parent)
|
|
|
|
{
|
|
|
|
auto s = new ShadowManagerInterface(this, parent);
|
2020-03-30 15:24:21 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, s, [s] { delete s; });
|
2015-07-15 09:07:50 +00:00
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2015-08-26 12:42:58 +00:00
|
|
|
BlurManagerInterface *Display::createBlurManager(QObject *parent)
|
|
|
|
{
|
|
|
|
auto b = new BlurManagerInterface(this, parent);
|
2020-03-30 15:24:21 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, b, [b] { delete b; });
|
2015-08-26 12:42:58 +00:00
|
|
|
return b;
|
2015-09-02 16:13:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ContrastManagerInterface *Display::createContrastManager(QObject *parent)
|
|
|
|
{
|
|
|
|
auto b = new ContrastManagerInterface(this, parent);
|
2020-03-30 15:24:21 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, b, [b] { delete b; });
|
2015-09-02 16:13:25 +00:00
|
|
|
return b;
|
2015-09-09 11:04:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SlideManagerInterface *Display::createSlideManager(QObject *parent)
|
|
|
|
{
|
|
|
|
auto b = new SlideManagerInterface(this, parent);
|
2020-03-30 15:24:21 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, b, [b] { delete b; });
|
2015-09-09 11:04:11 +00:00
|
|
|
return b;
|
2015-08-26 12:42:58 +00:00
|
|
|
}
|
|
|
|
|
2015-08-31 14:08:58 +00:00
|
|
|
DpmsManagerInterface *Display::createDpmsManager(QObject *parent)
|
|
|
|
{
|
|
|
|
auto d = new DpmsManagerInterface(this, parent);
|
2020-03-30 15:24:21 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, d, [d] { delete d; });
|
2015-08-31 14:08:58 +00:00
|
|
|
return d;
|
|
|
|
}
|
|
|
|
|
2015-12-10 08:39:24 +00:00
|
|
|
ServerSideDecorationManagerInterface *Display::createServerSideDecorationManager(QObject *parent)
|
|
|
|
{
|
|
|
|
auto d = new ServerSideDecorationManagerInterface(this, parent);
|
|
|
|
connect(this, &Display::aboutToTerminate, d, [d] { delete d; });
|
|
|
|
return d;
|
|
|
|
}
|
|
|
|
|
2016-05-02 12:28:26 +00:00
|
|
|
TextInputManagerInterface *Display::createTextInputManager(const TextInputInterfaceVersion &version, QObject *parent)
|
|
|
|
{
|
|
|
|
TextInputManagerInterface *t = nullptr;
|
|
|
|
switch (version) {
|
|
|
|
case TextInputInterfaceVersion::UnstableV0:
|
|
|
|
t = new TextInputManagerUnstableV0Interface(this, parent);
|
|
|
|
break;
|
|
|
|
case TextInputInterfaceVersion::UnstableV1:
|
|
|
|
// unsupported
|
|
|
|
return nullptr;
|
|
|
|
case TextInputInterfaceVersion::UnstableV2:
|
|
|
|
t = new TextInputManagerUnstableV2Interface(this, parent);
|
|
|
|
}
|
|
|
|
connect(this, &Display::aboutToTerminate, t, [t] { delete t; });
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
2020-05-04 13:32:23 +00:00
|
|
|
XdgShellInterface *Display::createXdgShell(QObject *parent)
|
2016-04-21 10:56:02 +00:00
|
|
|
{
|
2020-05-04 13:32:23 +00:00
|
|
|
XdgShellInterface *shell = new XdgShellInterface(this, parent);
|
|
|
|
connect(this, &Display::aboutToTerminate, shell, [shell] { delete shell; });
|
|
|
|
return shell;
|
2016-04-21 10:56:02 +00:00
|
|
|
}
|
|
|
|
|
2016-10-07 07:07:34 +00:00
|
|
|
RelativePointerManagerInterface *Display::createRelativePointerManager(const RelativePointerInterfaceVersion &version, QObject *parent)
|
|
|
|
{
|
|
|
|
RelativePointerManagerInterface *r = nullptr;
|
|
|
|
switch (version) {
|
|
|
|
case RelativePointerInterfaceVersion::UnstableV1:
|
|
|
|
r = new RelativePointerManagerUnstableV1Interface(this, parent);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
connect(this, &Display::aboutToTerminate, r, [r] { delete r; });
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2016-10-26 08:27:14 +00:00
|
|
|
PointerGesturesInterface *Display::createPointerGestures(const PointerGesturesInterfaceVersion &version, QObject *parent)
|
|
|
|
{
|
|
|
|
PointerGesturesInterface *p = nullptr;
|
|
|
|
switch (version) {
|
|
|
|
case PointerGesturesInterfaceVersion::UnstableV1:
|
|
|
|
p = new PointerGesturesUnstableV1Interface(this, parent);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
connect(this, &Display::aboutToTerminate, p, [p] { delete p; });
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
2016-11-08 13:17:15 +00:00
|
|
|
PointerConstraintsInterface *Display::createPointerConstraints(const PointerConstraintsInterfaceVersion &version, QObject *parent)
|
|
|
|
{
|
|
|
|
PointerConstraintsInterface *p = nullptr;
|
|
|
|
switch (version) {
|
|
|
|
case PointerConstraintsInterfaceVersion::UnstableV1:
|
|
|
|
p = new PointerConstraintsUnstableV1Interface(this, parent);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
connect(this, &Display::aboutToTerminate, p, [p] { delete p; });
|
|
|
|
return p;
|
|
|
|
}
|
|
|
|
|
Wayland foreign protocol
Summary:
Implement the "foreign" wayland protocol.
A client can export a surface with an unique string as handle,
then another client can refer to that surface and set an own surface as
child of that surface.
Potential use cases are out-of-process dialogs, such as file dialogs,
meant to be used by sandboxed processes that may not have the access
it needs to implement such dialogs.
The handle needs to be shared between the processes with other means,
such as dbus or command line paramenters.
The public api of the server side only tracks parent/child relationships as this is the only data kwin would need it for, the rest of the api is not exported so should be safer from eventual protocol changes
Test Plan:
the autotest works, but has a lot of random crashes when deleting surfaces,
unfortunately backtraces don't tell much and the crashes never occur when running into valgrind
behavior may still be wrong, depending on how the protocol is supposed
to work if more clients try to set the same exported surface as parent
Reviewers: #plasma, #kwin, davidedmundson, graesslin
Reviewed By: #plasma, #kwin, graesslin
Subscribers: davidedmundson, graesslin, plasma-devel, #frameworks
Tags: #frameworks, #plasma_on_wayland
Differential Revision: https://phabricator.kde.org/D7369
2017-10-13 09:29:17 +00:00
|
|
|
XdgForeignInterface *Display::createXdgForeignInterface(QObject *parent)
|
|
|
|
{
|
|
|
|
XdgForeignInterface *foreign = new XdgForeignInterface(this, parent);
|
2020-03-30 15:24:21 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, foreign, [foreign] { delete foreign; });
|
Wayland foreign protocol
Summary:
Implement the "foreign" wayland protocol.
A client can export a surface with an unique string as handle,
then another client can refer to that surface and set an own surface as
child of that surface.
Potential use cases are out-of-process dialogs, such as file dialogs,
meant to be used by sandboxed processes that may not have the access
it needs to implement such dialogs.
The handle needs to be shared between the processes with other means,
such as dbus or command line paramenters.
The public api of the server side only tracks parent/child relationships as this is the only data kwin would need it for, the rest of the api is not exported so should be safer from eventual protocol changes
Test Plan:
the autotest works, but has a lot of random crashes when deleting surfaces,
unfortunately backtraces don't tell much and the crashes never occur when running into valgrind
behavior may still be wrong, depending on how the protocol is supposed
to work if more clients try to set the same exported surface as parent
Reviewers: #plasma, #kwin, davidedmundson, graesslin
Reviewed By: #plasma, #kwin, graesslin
Subscribers: davidedmundson, graesslin, plasma-devel, #frameworks
Tags: #frameworks, #plasma_on_wayland
Differential Revision: https://phabricator.kde.org/D7369
2017-10-13 09:29:17 +00:00
|
|
|
return foreign;
|
|
|
|
}
|
|
|
|
|
2017-10-20 16:28:25 +00:00
|
|
|
IdleInhibitManagerInterface *Display::createIdleInhibitManager(const IdleInhibitManagerInterfaceVersion &version, QObject *parent)
|
|
|
|
{
|
|
|
|
IdleInhibitManagerInterface *i = nullptr;
|
|
|
|
switch (version) {
|
|
|
|
case IdleInhibitManagerInterfaceVersion::UnstableV1:
|
|
|
|
i = new IdleInhibitManagerUnstableV1Interface(this, parent);
|
|
|
|
break;
|
|
|
|
}
|
2020-03-30 15:24:21 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, i, [i] { delete i; });
|
2017-10-20 16:28:25 +00:00
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
2017-12-18 21:50:31 +00:00
|
|
|
AppMenuManagerInterface *Display::createAppMenuManagerInterface(QObject *parent)
|
|
|
|
{
|
|
|
|
auto b = new AppMenuManagerInterface(this, parent);
|
2020-03-30 15:24:21 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, b, [b] { delete b; });
|
2017-12-18 21:50:31 +00:00
|
|
|
return b;
|
|
|
|
}
|
|
|
|
|
2018-01-03 10:24:57 +00:00
|
|
|
ServerSideDecorationPaletteManagerInterface *Display::createServerSideDecorationPaletteManager(QObject *parent)
|
|
|
|
{
|
|
|
|
auto b = new ServerSideDecorationPaletteManagerInterface(this, parent);
|
2020-03-30 15:24:21 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, b, [b] { delete b; });
|
2018-01-03 10:24:57 +00:00
|
|
|
return b;
|
|
|
|
}
|
|
|
|
|
2019-07-17 13:48:07 +00:00
|
|
|
LinuxDmabufUnstableV1Interface *Display::createLinuxDmabufInterface(QObject *parent)
|
|
|
|
{
|
|
|
|
auto b = new LinuxDmabufUnstableV1Interface(this, parent);
|
2020-03-30 15:24:21 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, b, [b] { delete b; });
|
2019-07-17 13:48:07 +00:00
|
|
|
return b;
|
|
|
|
}
|
Add KWayland virtual desktop protocol
Summary:
Implement the virtual desktop protocol discussed in
T4457 xml protocol, client and server part.
The PlasmaVirtualDesktopManagement interface manages the desktops
instantiation and layout, each desktop is a PlasmaVirtualDesktop
instance which contains unique id, name and position.
PlasmaWindow has new events: plasmaVirtualDesktopEntered
and plasmaVirtualDesktopLeft when a window enters or leaves a desktop,
and desktops as the list of desktops is in. A window can be on
any subset of desktops, if the list is empty, it's considered on all desktops.
Test Plan: Autotest
Reviewers: #kwin, #plasma, graesslin, hein, davidedmundson
Reviewed By: #kwin, #plasma, davidedmundson
Subscribers: davidedmundson, zzag, bshah, romangg, kde-frameworks-devel
Tags: #frameworks
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D12820
2018-07-19 16:36:32 +00:00
|
|
|
|
|
|
|
PlasmaVirtualDesktopManagementInterface *Display::createPlasmaVirtualDesktopManagement(QObject *parent)
|
|
|
|
{
|
|
|
|
auto b = new PlasmaVirtualDesktopManagementInterface(this, parent);
|
2020-03-30 15:24:21 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, b, [b] { delete b; });
|
Add KWayland virtual desktop protocol
Summary:
Implement the virtual desktop protocol discussed in
T4457 xml protocol, client and server part.
The PlasmaVirtualDesktopManagement interface manages the desktops
instantiation and layout, each desktop is a PlasmaVirtualDesktop
instance which contains unique id, name and position.
PlasmaWindow has new events: plasmaVirtualDesktopEntered
and plasmaVirtualDesktopLeft when a window enters or leaves a desktop,
and desktops as the list of desktops is in. A window can be on
any subset of desktops, if the list is empty, it's considered on all desktops.
Test Plan: Autotest
Reviewers: #kwin, #plasma, graesslin, hein, davidedmundson
Reviewed By: #kwin, #plasma, davidedmundson
Subscribers: davidedmundson, zzag, bshah, romangg, kde-frameworks-devel
Tags: #frameworks
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D12820
2018-07-19 16:36:32 +00:00
|
|
|
return b;
|
|
|
|
}
|
|
|
|
|
2018-05-15 09:45:17 +00:00
|
|
|
XdgOutputManagerInterface *Display::createXdgOutputManager(QObject *parent)
|
|
|
|
{
|
|
|
|
auto b = new XdgOutputManagerInterface(this, parent);
|
2020-03-30 15:24:21 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, b, [b] { delete b; });
|
2018-05-15 09:45:17 +00:00
|
|
|
return b;
|
|
|
|
}
|
|
|
|
|
2020-05-04 13:32:23 +00:00
|
|
|
XdgDecorationManagerV1Interface *Display::createXdgDecorationManagerV1(QObject *parent)
|
2018-12-21 13:07:52 +00:00
|
|
|
{
|
2020-05-04 13:32:23 +00:00
|
|
|
auto d = new XdgDecorationManagerV1Interface(this, parent);
|
2018-12-21 13:07:52 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, d, [d] { delete d; });
|
|
|
|
return d;
|
|
|
|
}
|
|
|
|
|
2019-04-15 14:21:01 +00:00
|
|
|
EglStreamControllerInterface *Display::createEglStreamControllerInterface(QObject *parent)
|
|
|
|
{
|
|
|
|
EglStreamControllerInterface *e = new EglStreamControllerInterface(this, parent);
|
|
|
|
connect(this, &Display::aboutToTerminate, e, [e] { delete e; });
|
|
|
|
return e;
|
|
|
|
}
|
|
|
|
|
2019-06-21 14:02:27 +00:00
|
|
|
KeyStateInterface *Display::createKeyStateInterface(QObject *parent)
|
|
|
|
{
|
|
|
|
auto d = new KeyStateInterface(this, parent);
|
|
|
|
connect(this, &Display::aboutToTerminate, d, [d] { delete d; });
|
|
|
|
return d;
|
|
|
|
}
|
|
|
|
|
2020-02-12 15:20:38 +00:00
|
|
|
TabletManagerInterface *Display::createTabletManagerInterface(QObject *parent)
|
|
|
|
{
|
|
|
|
auto d = new TabletManagerInterface(this, parent);
|
|
|
|
connect(this, &Display::aboutToTerminate, d, [d] { delete d; });
|
|
|
|
return d;
|
|
|
|
}
|
|
|
|
|
2020-05-28 07:25:56 +00:00
|
|
|
DataControlDeviceManagerV1Interface *Display::createDataControlDeviceManagerV1(QObject *parent)
|
2020-05-12 11:26:57 +00:00
|
|
|
{
|
2020-05-28 07:25:56 +00:00
|
|
|
auto m = new DataControlDeviceManagerV1Interface(this, parent);
|
2020-05-12 11:26:57 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, m, [m] { delete m; });
|
|
|
|
return m;
|
|
|
|
}
|
|
|
|
|
2020-05-29 09:16:06 +00:00
|
|
|
KeyboardShortcutsInhibitManagerV1Interface *Display::createKeyboardShortcutsInhibitManagerV1(QObject *parent)
|
2020-05-04 09:45:15 +00:00
|
|
|
{
|
2020-05-29 09:16:06 +00:00
|
|
|
auto d = new KeyboardShortcutsInhibitManagerV1Interface(this, parent);
|
2020-05-04 09:45:15 +00:00
|
|
|
connect(this, &Display::aboutToTerminate, d, [d] { delete d; });
|
|
|
|
return d;
|
|
|
|
}
|
|
|
|
|
2020-05-24 10:46:27 +00:00
|
|
|
ViewporterInterface *Display::createViewporter(QObject *parent)
|
|
|
|
{
|
|
|
|
auto viewporter = new ViewporterInterface(this, parent);
|
|
|
|
connect(this, &Display::aboutToTerminate, viewporter, [viewporter] { delete viewporter; });
|
|
|
|
return viewporter;
|
|
|
|
}
|
|
|
|
|
2020-06-01 22:29:53 +00:00
|
|
|
PrimarySelectionDeviceManagerV1Interface *Display::createPrimarySelectionDeviceManagerV1(QObject *parent)
|
|
|
|
{
|
|
|
|
auto primarySelection = new PrimarySelectionDeviceManagerV1Interface(this, parent);
|
|
|
|
connect(this, &Display::aboutToTerminate, primarySelection, [primarySelection] { delete primarySelection; });
|
|
|
|
return primarySelection;
|
|
|
|
}
|
|
|
|
|
2014-08-28 12:22:53 +00:00
|
|
|
void Display::createShm()
|
|
|
|
{
|
2015-02-09 16:13:20 +00:00
|
|
|
Q_ASSERT(d->display);
|
2014-09-18 13:40:22 +00:00
|
|
|
wl_display_init_shm(d->display);
|
2014-08-28 12:22:53 +00:00
|
|
|
}
|
|
|
|
|
2014-08-26 14:07:39 +00:00
|
|
|
void Display::removeOutput(OutputInterface *output)
|
|
|
|
{
|
2014-09-18 13:40:22 +00:00
|
|
|
d->outputs.removeAll(output);
|
2014-08-26 14:07:39 +00:00
|
|
|
delete output;
|
|
|
|
}
|
|
|
|
|
server side of new outputmanagement protocol
This implements the server part of the screen management protocol. The
protocol is implemented as a wayland protocol.
It provides the following mechanisms:
- a list of outputs, close to wl_output, with additional properties for
enabled, uuid, edid, etc.. These OutputDevices correspond to a
connected output that can be enabled by the compositor, but is not
necessarily currently used for rendering.
- a global OutputManagement, which allows creating config objects, one
per client. The client can make changes to the outputs through
setScale(outputdevice*, scale) for example.
- an OutputConfiguration resource, that can be handed to a client and
used for configuration. Changes are double buffered here. Only after
OutputConfiguration.apply() has been called, the changes are relayed
over the global OutputManagement.
The compositor is responsible to handle changes.
For a more detailed description, see the API docs in especially
outputconfiguration.h.
REVIEW:125942
2015-11-04 14:36:52 +00:00
|
|
|
void Display::removeOutputDevice(OutputDeviceInterface *output)
|
|
|
|
{
|
|
|
|
d->outputdevices.removeAll(output);
|
|
|
|
delete output;
|
|
|
|
}
|
|
|
|
|
2014-08-29 09:42:57 +00:00
|
|
|
quint32 Display::nextSerial()
|
|
|
|
{
|
2014-09-18 13:40:22 +00:00
|
|
|
return wl_display_next_serial(d->display);
|
2014-08-29 09:42:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
quint32 Display::serial()
|
|
|
|
{
|
2014-09-18 13:40:22 +00:00
|
|
|
return wl_display_get_serial(d->display);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Display::isRunning() const
|
|
|
|
{
|
|
|
|
return d->running;
|
2014-08-29 09:42:57 +00:00
|
|
|
}
|
|
|
|
|
2014-09-18 13:40:22 +00:00
|
|
|
Display::operator wl_display*()
|
|
|
|
{
|
|
|
|
return d->display;
|
|
|
|
}
|
|
|
|
|
|
|
|
Display::operator wl_display*() const
|
|
|
|
{
|
|
|
|
return d->display;
|
|
|
|
}
|
|
|
|
|
|
|
|
QList< OutputInterface* > Display::outputs() const
|
|
|
|
{
|
|
|
|
return d->outputs;
|
|
|
|
}
|
|
|
|
|
server side of new outputmanagement protocol
This implements the server part of the screen management protocol. The
protocol is implemented as a wayland protocol.
It provides the following mechanisms:
- a list of outputs, close to wl_output, with additional properties for
enabled, uuid, edid, etc.. These OutputDevices correspond to a
connected output that can be enabled by the compositor, but is not
necessarily currently used for rendering.
- a global OutputManagement, which allows creating config objects, one
per client. The client can make changes to the outputs through
setScale(outputdevice*, scale) for example.
- an OutputConfiguration resource, that can be handed to a client and
used for configuration. Changes are double buffered here. Only after
OutputConfiguration.apply() has been called, the changes are relayed
over the global OutputManagement.
The compositor is responsible to handle changes.
For a more detailed description, see the API docs in especially
outputconfiguration.h.
REVIEW:125942
2015-11-04 14:36:52 +00:00
|
|
|
QList< OutputDeviceInterface* > Display::outputDevices() const
|
|
|
|
{
|
|
|
|
return d->outputdevices;
|
|
|
|
}
|
|
|
|
|
2015-12-15 14:47:19 +00:00
|
|
|
QVector<SeatInterface*> Display::seats() const
|
|
|
|
{
|
|
|
|
return d->seats;
|
|
|
|
}
|
|
|
|
|
2014-11-17 15:01:18 +00:00
|
|
|
ClientConnection *Display::getConnection(wl_client *client)
|
|
|
|
{
|
|
|
|
Q_ASSERT(client);
|
|
|
|
auto it = std::find_if(d->clients.constBegin(), d->clients.constEnd(),
|
|
|
|
[client](ClientConnection *c) {
|
|
|
|
return c->client() == client;
|
|
|
|
}
|
|
|
|
);
|
|
|
|
if (it != d->clients.constEnd()) {
|
|
|
|
return *it;
|
|
|
|
}
|
|
|
|
// no ConnectionData yet, create it
|
|
|
|
auto c = new ClientConnection(client, this);
|
|
|
|
d->clients << c;
|
|
|
|
connect(c, &ClientConnection::disconnected, this,
|
|
|
|
[this] (ClientConnection *c) {
|
|
|
|
const int index = d->clients.indexOf(c);
|
|
|
|
Q_ASSERT(index != -1);
|
|
|
|
d->clients.remove(index);
|
|
|
|
Q_ASSERT(d->clients.indexOf(c) == -1);
|
|
|
|
emit clientDisconnected(c);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
emit clientConnected(c);
|
|
|
|
return c;
|
|
|
|
}
|
2014-09-18 13:40:22 +00:00
|
|
|
|
2014-11-17 17:13:28 +00:00
|
|
|
QVector< ClientConnection* > Display::connections() const
|
|
|
|
{
|
|
|
|
return d->clients;
|
|
|
|
}
|
|
|
|
|
2014-11-27 15:16:54 +00:00
|
|
|
ClientConnection *Display::createClient(int fd)
|
|
|
|
{
|
|
|
|
Q_ASSERT(fd != -1);
|
|
|
|
Q_ASSERT(d->display);
|
|
|
|
wl_client *c = wl_client_create(d->display, fd);
|
|
|
|
if (!c) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return getConnection(c);
|
|
|
|
}
|
|
|
|
|
2015-03-03 08:43:30 +00:00
|
|
|
void Display::setEglDisplay(void *display)
|
|
|
|
{
|
|
|
|
if (d->eglDisplay != EGL_NO_DISPLAY) {
|
|
|
|
qCWarning(KWAYLAND_SERVER) << "EGLDisplay cannot be changed";
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
d->eglDisplay = (EGLDisplay)display;
|
|
|
|
}
|
|
|
|
|
|
|
|
void *Display::eglDisplay() const
|
|
|
|
{
|
|
|
|
return d->eglDisplay;
|
|
|
|
}
|
|
|
|
|
2014-08-26 14:07:39 +00:00
|
|
|
}
|