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"
|
2020-07-23 20:09:20 +00:00
|
|
|
#include "idleinhibit_v1_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"
|
2020-08-07 18:41:52 +00:00
|
|
|
#include "layershell_v1_interface.h"
|
2020-02-12 15:20:38 +00:00
|
|
|
#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"
|
2020-11-03 18:44:32 +00:00
|
|
|
#include "pointerconstraints_v1_interface_p.h"
|
2020-11-03 17:24:57 +00:00
|
|
|
#include "pointergestures_v1_interface.h"
|
2020-06-01 22:29:53 +00:00
|
|
|
#include "primaryselectiondevicemanager_v1_interface.h"
|
2020-11-03 16:24:03 +00:00
|
|
|
#include "relativepointer_v1_interface.h"
|
2020-02-12 15:20:38 +00:00
|
|
|
#include "seat_interface.h"
|
2020-09-04 14:45:47 +00:00
|
|
|
#include "screencast_v1_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-11-04 17:17:26 +00:00
|
|
|
#include "tablet_v2_interface.h"
|
2020-07-28 15:39:13 +00:00
|
|
|
#include "textinput_v2_interface_p.h"
|
2020-09-15 07:27:46 +00:00
|
|
|
#include "textinput_v3_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"
|
2020-07-28 11:21:29 +00:00
|
|
|
#include "xdgforeign_v2_interface.h"
|
2020-08-20 11:26:19 +00:00
|
|
|
#include "xdgoutput_v1_interface.h"
|
2020-05-04 13:32:23 +00:00
|
|
|
#include "xdgshell_interface.h"
|
2020-07-23 14:36:01 +00:00
|
|
|
#include "inputmethod_v1_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);
|
|
|
|
|
2020-10-19 15:52:56 +00:00
|
|
|
void registerSocketName(const QString &socketName);
|
|
|
|
|
|
|
|
QSocketNotifier *socketNotifier = nullptr;
|
2014-09-18 13:40:22 +00:00
|
|
|
wl_display *display = nullptr;
|
|
|
|
wl_event_loop *loop = nullptr;
|
|
|
|
bool running = false;
|
|
|
|
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;
|
2020-10-19 15:52:56 +00:00
|
|
|
QStringList socketNames;
|
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)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-10-19 15:52:56 +00:00
|
|
|
void Display::Private::registerSocketName(const QString &socketName)
|
2014-11-07 10:41:37 +00:00
|
|
|
{
|
2020-10-19 15:52:56 +00:00
|
|
|
socketNames.append(socketName);
|
|
|
|
emit q->socketNamesChanged();
|
2014-11-07 10:41:37 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2020-07-06 09:36:25 +00:00
|
|
|
d->display = wl_display_create();
|
2020-10-19 15:52:56 +00:00
|
|
|
d->loop = wl_display_get_event_loop(d->display);
|
2014-08-26 14:07:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
Display::~Display()
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
wl_display_destroy_clients(d->display);
|
2020-07-06 09:36:25 +00:00
|
|
|
wl_display_destroy(d->display);
|
2014-08-26 14:07:39 +00:00
|
|
|
}
|
|
|
|
|
2020-10-19 15:52:56 +00:00
|
|
|
bool Display::addSocketFileDescriptor(int fileDescriptor)
|
2015-04-21 06:56:19 +00:00
|
|
|
{
|
2020-10-19 15:52:56 +00:00
|
|
|
if (wl_display_add_socket_fd(d->display, fileDescriptor)) {
|
|
|
|
qCWarning(KWAYLAND_SERVER, "Failed to add %d fd to display", fileDescriptor);
|
|
|
|
return false;
|
2015-04-21 06:56:19 +00:00
|
|
|
}
|
2020-10-19 15:52:56 +00:00
|
|
|
return true;
|
2015-04-21 06:56:19 +00:00
|
|
|
}
|
|
|
|
|
2020-10-19 15:52:56 +00:00
|
|
|
bool Display::addSocketName(const QString &name)
|
2014-08-26 14:07:39 +00:00
|
|
|
{
|
2020-10-19 15:52:56 +00:00
|
|
|
if (name.isEmpty()) {
|
|
|
|
const char *socket = wl_display_add_socket_auto(d->display);
|
|
|
|
if (!socket) {
|
|
|
|
qCWarning(KWAYLAND_SERVER, "Failed to find a free display socket");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
d->registerSocketName(QString::fromUtf8(socket));
|
|
|
|
} else {
|
|
|
|
if (wl_display_add_socket(d->display, qPrintable(name))) {
|
|
|
|
qCWarning(KWAYLAND_SERVER, "Failed to add %s socket to display", qPrintable(name));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
d->registerSocketName(name);
|
2014-08-26 14:07:39 +00:00
|
|
|
}
|
2020-10-19 15:52:56 +00:00
|
|
|
return true;
|
2014-08-26 14:07:39 +00:00
|
|
|
}
|
|
|
|
|
2020-10-19 15:52:56 +00:00
|
|
|
QStringList Display::socketNames() const
|
2014-08-26 14:07:39 +00:00
|
|
|
{
|
2020-10-19 15:52:56 +00:00
|
|
|
return d->socketNames;
|
2014-08-26 14:07:39 +00:00
|
|
|
}
|
|
|
|
|
2020-10-19 15:52:56 +00:00
|
|
|
bool Display::start()
|
2014-08-26 14:07:39 +00:00
|
|
|
{
|
2020-10-19 15:52:56 +00:00
|
|
|
if (d->running) {
|
|
|
|
return true;
|
|
|
|
}
|
2014-08-26 14:07:39 +00:00
|
|
|
|
2020-10-19 15:52:56 +00:00
|
|
|
const int fileDescriptor = wl_event_loop_get_fd(d->loop);
|
|
|
|
if (fileDescriptor == -1) {
|
|
|
|
qCWarning(KWAYLAND_SERVER) << "Did not get the file descriptor for the event loop";
|
|
|
|
return false;
|
2018-11-23 13:42:18 +00:00
|
|
|
}
|
|
|
|
|
2020-10-19 15:52:56 +00:00
|
|
|
d->socketNotifier = new QSocketNotifier(fileDescriptor, QSocketNotifier::Read, this);
|
|
|
|
connect(d->socketNotifier, &QSocketNotifier::activated, this, &Display::dispatchEvents);
|
2018-11-23 13:42:18 +00:00
|
|
|
|
2020-10-19 15:52:56 +00:00
|
|
|
QAbstractEventDispatcher *dispatcher = QCoreApplication::eventDispatcher();
|
|
|
|
connect(dispatcher, &QAbstractEventDispatcher::aboutToBlock, this, &Display::flush);
|
2014-08-26 14:07:39 +00:00
|
|
|
|
2020-10-19 15:52:56 +00:00
|
|
|
d->running = true;
|
|
|
|
emit runningChanged(true);
|
2020-07-06 09:36:25 +00:00
|
|
|
|
2020-10-19 15:52:56 +00:00
|
|
|
return true;
|
2014-11-07 10:41:37 +00:00
|
|
|
}
|
|
|
|
|
2020-10-19 15:52:56 +00:00
|
|
|
void Display::dispatchEvents()
|
2014-11-07 10:41:37 +00:00
|
|
|
{
|
2020-10-19 15:52:56 +00:00
|
|
|
if (wl_event_loop_dispatch(d->loop, 0) != 0) {
|
|
|
|
qCWarning(KWAYLAND_SERVER) << "Error on dispatching Wayland event loop";
|
2015-05-18 08:27:44 +00:00
|
|
|
}
|
2014-08-26 14:07:39 +00:00
|
|
|
}
|
|
|
|
|
2020-10-19 15:52:56 +00:00
|
|
|
void Display::flush()
|
2014-08-26 14:07:39 +00:00
|
|
|
{
|
2020-10-19 15:52:56 +00:00
|
|
|
wl_display_flush_clients(d->display);
|
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); });
|
|
|
|
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)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new CompositorInterface(this, parent);
|
2014-08-28 07:52:35 +00:00
|
|
|
}
|
|
|
|
|
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); });
|
|
|
|
d->outputdevices << output;
|
|
|
|
return output;
|
|
|
|
}
|
|
|
|
|
|
|
|
OutputManagementInterface *Display::createOutputManagement(QObject *parent)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new OutputManagementInterface(this, parent);
|
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
|
|
|
}
|
|
|
|
|
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); });
|
|
|
|
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)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new SubCompositorInterface(this, parent);
|
2014-10-14 12:04:35 +00:00
|
|
|
}
|
|
|
|
|
2014-11-04 14:10:22 +00:00
|
|
|
DataDeviceManagerInterface *Display::createDataDeviceManager(QObject *parent)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new DataDeviceManagerInterface(this, parent);
|
2014-11-04 14:10:22 +00:00
|
|
|
}
|
|
|
|
|
2015-06-09 00:48:56 +00:00
|
|
|
PlasmaShellInterface *Display::createPlasmaShell(QObject* parent)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new PlasmaShellInterface(this, parent);
|
2015-06-09 22:56:31 +00:00
|
|
|
}
|
|
|
|
|
2015-06-12 01:05:14 +00:00
|
|
|
PlasmaWindowManagementInterface *Display::createPlasmaWindowManagement(QObject *parent)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new PlasmaWindowManagementInterface(this, parent);
|
2015-06-12 01:05:14 +00:00
|
|
|
}
|
|
|
|
|
2015-07-02 09:35:16 +00:00
|
|
|
IdleInterface *Display::createIdle(QObject *parent)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new IdleInterface(this, parent);
|
2015-07-02 19:21:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
FakeInputInterface *Display::createFakeInput(QObject *parent)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new FakeInputInterface(this, parent);
|
2015-07-02 09:35:16 +00:00
|
|
|
}
|
|
|
|
|
2015-07-15 09:07:50 +00:00
|
|
|
ShadowManagerInterface *Display::createShadowManager(QObject *parent)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new ShadowManagerInterface(this, parent);
|
2015-07-15 09:07:50 +00:00
|
|
|
}
|
|
|
|
|
2015-08-26 12:42:58 +00:00
|
|
|
BlurManagerInterface *Display::createBlurManager(QObject *parent)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new BlurManagerInterface(this, parent);
|
2015-09-02 16:13:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ContrastManagerInterface *Display::createContrastManager(QObject *parent)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new ContrastManagerInterface(this, parent);
|
2015-09-09 11:04:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SlideManagerInterface *Display::createSlideManager(QObject *parent)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new SlideManagerInterface(this, parent);
|
2015-08-26 12:42:58 +00:00
|
|
|
}
|
|
|
|
|
2015-08-31 14:08:58 +00:00
|
|
|
DpmsManagerInterface *Display::createDpmsManager(QObject *parent)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new DpmsManagerInterface(this, parent);
|
2015-08-31 14:08:58 +00:00
|
|
|
}
|
|
|
|
|
2015-12-10 08:39:24 +00:00
|
|
|
ServerSideDecorationManagerInterface *Display::createServerSideDecorationManager(QObject *parent)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new ServerSideDecorationManagerInterface(this, parent);
|
2015-12-10 08:39:24 +00:00
|
|
|
}
|
|
|
|
|
2020-09-04 14:45:47 +00:00
|
|
|
ScreencastV1Interface *Display::createScreencastV1Interface(QObject *parent)
|
2020-06-16 14:58:21 +00:00
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new ScreencastV1Interface(this, parent);
|
2020-06-16 14:58:21 +00:00
|
|
|
}
|
|
|
|
|
2020-07-28 15:39:13 +00:00
|
|
|
TextInputManagerV2Interface *Display::createTextInputManagerV2(QObject *parent)
|
2016-05-02 12:28:26 +00:00
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new TextInputManagerV2Interface(this, parent);
|
2016-05-02 12:28:26 +00:00
|
|
|
}
|
|
|
|
|
2020-09-15 07:27:46 +00:00
|
|
|
TextInputManagerV3Interface *Display::createTextInputManagerV3(QObject *parent)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new TextInputManagerV3Interface(this, parent);
|
2020-09-15 07:27:46 +00:00
|
|
|
}
|
|
|
|
|
2020-05-04 13:32:23 +00:00
|
|
|
XdgShellInterface *Display::createXdgShell(QObject *parent)
|
2016-04-21 10:56:02 +00:00
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new XdgShellInterface(this, parent);
|
2016-04-21 10:56:02 +00:00
|
|
|
}
|
|
|
|
|
2020-11-03 16:24:03 +00:00
|
|
|
RelativePointerManagerV1Interface *Display::createRelativePointerManagerV1(QObject *parent)
|
2016-10-07 07:07:34 +00:00
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new RelativePointerManagerV1Interface(this, parent);
|
2016-10-07 07:07:34 +00:00
|
|
|
}
|
|
|
|
|
2020-11-03 17:24:57 +00:00
|
|
|
PointerGesturesV1Interface *Display::createPointerGesturesV1(QObject *parent)
|
2016-10-26 08:27:14 +00:00
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new PointerGesturesV1Interface(this, parent);
|
2016-10-26 08:27:14 +00:00
|
|
|
}
|
|
|
|
|
2020-11-03 18:44:32 +00:00
|
|
|
PointerConstraintsV1Interface *Display::createPointerConstraintsV1(QObject *parent)
|
2016-11-08 13:17:15 +00:00
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new PointerConstraintsV1Interface(this, parent);
|
2016-11-08 13:17:15 +00:00
|
|
|
}
|
|
|
|
|
2020-07-28 11:21:29 +00:00
|
|
|
XdgForeignV2Interface *Display::createXdgForeignV2Interface(QObject *parent)
|
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
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new XdgForeignV2Interface(this, parent);
|
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
|
|
|
}
|
|
|
|
|
2020-07-23 20:09:20 +00:00
|
|
|
IdleInhibitManagerV1Interface *Display::createIdleInhibitManagerV1(QObject *parent)
|
2017-10-20 16:28:25 +00:00
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new IdleInhibitManagerV1Interface(this, parent);
|
2017-10-20 16:28:25 +00:00
|
|
|
}
|
|
|
|
|
2017-12-18 21:50:31 +00:00
|
|
|
AppMenuManagerInterface *Display::createAppMenuManagerInterface(QObject *parent)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new AppMenuManagerInterface(this, parent);
|
2017-12-18 21:50:31 +00:00
|
|
|
}
|
|
|
|
|
2018-01-03 10:24:57 +00:00
|
|
|
ServerSideDecorationPaletteManagerInterface *Display::createServerSideDecorationPaletteManager(QObject *parent)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new ServerSideDecorationPaletteManagerInterface(this, parent);
|
2018-01-03 10:24:57 +00:00
|
|
|
}
|
|
|
|
|
2019-07-17 13:48:07 +00:00
|
|
|
LinuxDmabufUnstableV1Interface *Display::createLinuxDmabufInterface(QObject *parent)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new LinuxDmabufUnstableV1Interface(this, parent);
|
2019-07-17 13:48:07 +00:00
|
|
|
}
|
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)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new PlasmaVirtualDesktopManagementInterface(this, parent);
|
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
|
|
|
}
|
|
|
|
|
2020-08-20 11:26:19 +00:00
|
|
|
XdgOutputManagerV1Interface *Display::createXdgOutputManagerV1(QObject *parent)
|
2018-05-15 09:45:17 +00:00
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new XdgOutputManagerV1Interface(this, parent);
|
2018-05-15 09:45:17 +00:00
|
|
|
}
|
|
|
|
|
2020-05-04 13:32:23 +00:00
|
|
|
XdgDecorationManagerV1Interface *Display::createXdgDecorationManagerV1(QObject *parent)
|
2018-12-21 13:07:52 +00:00
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new XdgDecorationManagerV1Interface(this, parent);
|
2018-12-21 13:07:52 +00:00
|
|
|
}
|
|
|
|
|
2019-04-15 14:21:01 +00:00
|
|
|
EglStreamControllerInterface *Display::createEglStreamControllerInterface(QObject *parent)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new EglStreamControllerInterface(this, parent);
|
2019-04-15 14:21:01 +00:00
|
|
|
}
|
|
|
|
|
2019-06-21 14:02:27 +00:00
|
|
|
KeyStateInterface *Display::createKeyStateInterface(QObject *parent)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new KeyStateInterface(this, parent);
|
2019-06-21 14:02:27 +00:00
|
|
|
}
|
|
|
|
|
2020-11-04 17:17:26 +00:00
|
|
|
TabletManagerV2Interface *Display::createTabletManagerV2(QObject *parent)
|
2020-02-12 15:20:38 +00:00
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new TabletManagerV2Interface(this, parent);
|
2020-02-12 15:20:38 +00:00
|
|
|
}
|
|
|
|
|
2020-05-28 07:25:56 +00:00
|
|
|
DataControlDeviceManagerV1Interface *Display::createDataControlDeviceManagerV1(QObject *parent)
|
2020-05-12 11:26:57 +00:00
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new DataControlDeviceManagerV1Interface(this, parent);
|
2020-05-12 11:26:57 +00:00
|
|
|
}
|
|
|
|
|
2020-05-29 09:16:06 +00:00
|
|
|
KeyboardShortcutsInhibitManagerV1Interface *Display::createKeyboardShortcutsInhibitManagerV1(QObject *parent)
|
2020-05-04 09:45:15 +00:00
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new KeyboardShortcutsInhibitManagerV1Interface(this, parent);
|
2020-07-23 14:36:01 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
InputMethodV1Interface *Display::createInputMethodInterface(QObject *parent)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new InputMethodV1Interface(this, parent);
|
2020-05-04 09:45:15 +00:00
|
|
|
}
|
|
|
|
|
2020-05-24 10:46:27 +00:00
|
|
|
ViewporterInterface *Display::createViewporter(QObject *parent)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new ViewporterInterface(this, parent);
|
2020-05-24 10:46:27 +00:00
|
|
|
}
|
|
|
|
|
2020-06-01 22:29:53 +00:00
|
|
|
PrimarySelectionDeviceManagerV1Interface *Display::createPrimarySelectionDeviceManagerV1(QObject *parent)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new PrimarySelectionDeviceManagerV1Interface(this, parent);
|
2020-06-01 22:29:53 +00:00
|
|
|
}
|
|
|
|
|
2020-07-23 14:36:01 +00:00
|
|
|
InputPanelV1Interface *Display::createInputPanelInterface(QObject *parent)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new InputPanelV1Interface(this, parent);
|
2020-07-23 14:36:01 +00:00
|
|
|
}
|
|
|
|
|
2020-08-07 18:41:52 +00:00
|
|
|
LayerShellV1Interface *Display::createLayerShellV1(QObject *parent)
|
|
|
|
{
|
2020-10-30 13:36:24 +00:00
|
|
|
return new LayerShellV1Interface(this, parent);
|
2020-08-07 18:41:52 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|