Port wayland code away from factory methods in KWaylandServer::Display

icc-effect-5.26.4
Vlad Zahorodnii 2020-12-09 23:24:41 +02:00
parent 3b1c143881
commit ecac025a2a
12 changed files with 48 additions and 47 deletions

View File

@ -28,8 +28,8 @@ namespace KWin
AbstractWaylandOutput::AbstractWaylandOutput(QObject *parent)
: AbstractOutput(parent)
{
m_waylandOutput = waylandServer()->display()->createOutput(this);
m_waylandOutputDevice = waylandServer()->display()->createOutputDevice(this);
m_waylandOutput = new KWaylandServer::OutputInterface(waylandServer()->display(), this);
m_waylandOutputDevice = new KWaylandServer::OutputDeviceInterface(waylandServer()->display(), this);
m_xdgOutputV1 = waylandServer()->xdgOutputManagerV1()->createXdgOutput(m_waylandOutput, this);
connect(m_waylandOutput, &KWaylandServer::OutputInterface::dpmsModeRequested, this,

View File

@ -34,7 +34,7 @@ ContrastEffect::ContrastEffect()
net_wm_contrast_region = effects->announceSupportProperty(s_contrastAtomName, this);
KWaylandServer::Display *display = effects->waylandDisplay();
if (display) {
m_contrastManager = display->createContrastManager(this);
m_contrastManager = new KWaylandServer::ContrastManagerInterface(display, this);
}
} else {
net_wm_contrast_region = 0;

View File

@ -44,7 +44,7 @@ BlurEffect::BlurEffect()
net_wm_blur_region = effects->announceSupportProperty(s_blurAtomName, this);
KWaylandServer::Display *display = effects->waylandDisplay();
if (display) {
m_blurManager = display->createBlurManager(this);
m_blurManager = new KWaylandServer::BlurManagerInterface(display, this);
}
} else {
net_wm_blur_region = 0;

View File

@ -31,7 +31,7 @@ SlidingPopupsEffect::SlidingPopupsEffect()
initConfig<SlidingPopupsConfig>();
KWaylandServer::Display *display = effects->waylandDisplay();
if (display) {
display->createSlideManager(this);
new KWaylandServer::SlideManagerInterface(display, this);
}
m_slideLength = QFontMetrics(qApp->font()).height() * 8;

View File

@ -1986,7 +1986,7 @@ void InputRedirection::setupWorkspace()
{
if (waylandServer()) {
using namespace KWaylandServer;
FakeInputInterface *fakeInput = waylandServer()->display()->createFakeInput(this);
FakeInputInterface *fakeInput = new FakeInputInterface(waylandServer()->display(), this);
connect(fakeInput, &FakeInputInterface::deviceCreated, this,
[this] (FakeInputDevice *device) {
connect(device, &FakeInputDevice::authenticationRequested, this,
@ -2179,7 +2179,8 @@ void InputRedirection::setupLibInput()
if (waylandServer()) {
// create relative pointer manager
waylandServer()->display()->createRelativePointerManagerV1(waylandServer()->display());
new KWaylandServer::RelativePointerManagerV1Interface(waylandServer()->display(),
waylandServer()->display());
}
conn->setInputConfig(InputConfig::self()->inputConfig());

View File

@ -87,8 +87,8 @@ void InputMethod::init()
connect(input(), &InputRedirection::keyStateChanged, this, &InputMethod::hide);
if (waylandServer()) {
waylandServer()->display()->createTextInputManagerV2();
waylandServer()->display()->createTextInputManagerV3();
new TextInputManagerV2Interface(waylandServer()->display());
new TextInputManagerV3Interface(waylandServer()->display());
connect(workspace(), &Workspace::clientAdded, this, &InputMethod::clientAdded);
connect(waylandServer()->seat(), &SeatInterface::focusedTextInputSurfaceChanged, this, &InputMethod::handleFocusedSurfaceChanged);

View File

@ -19,7 +19,7 @@ namespace KWin
InputPanelV1Integration::InputPanelV1Integration(QObject *parent)
: WaylandShellIntegration(parent)
{
InputPanelV1Interface *shell = waylandServer()->display()->createInputPanelInterface(this);
InputPanelV1Interface *shell = new InputPanelV1Interface(waylandServer()->display(), this);
connect(shell, &InputPanelV1Interface::inputPanelSurfaceAdded,
this, &InputPanelV1Integration::createClient);

View File

@ -28,7 +28,7 @@ static const Qt::Edges AnchorVertical = Qt::TopEdge | Qt::BottomEdge;
LayerShellV1Integration::LayerShellV1Integration(QObject *parent)
: WaylandShellIntegration(parent)
{
LayerShellV1Interface *shell = waylandServer()->display()->createLayerShellV1(this);
LayerShellV1Interface *shell = new LayerShellV1Interface(waylandServer()->display(), this);
connect(shell, &KWaylandServer::LayerShellV1Interface::surfaceCreated,
this, &LayerShellV1Integration::createClient);

View File

@ -22,6 +22,7 @@
#include <QOpenGLContext>
#include <KWaylandServer/buffer_interface.h>
#include <KWaylandServer/display.h>
#include <KWaylandServer/eglstream_controller_interface.h>
#include <KWaylandServer/resource.h>
#include "drm_gpu.h"
@ -252,7 +253,7 @@ void EglStreamBackend::init()
initWayland();
using namespace KWaylandServer;
m_eglStreamControllerInterface = waylandServer()->display()->createEglStreamControllerInterface();
m_eglStreamControllerInterface = new EglStreamControllerInterface(waylandServer()->display());
connect(m_eglStreamControllerInterface, &EglStreamControllerInterface::streamConsumerAttached, this,
&EglStreamBackend::attachStreamConsumer);
}

View File

@ -29,7 +29,7 @@ namespace KWin
ScreencastManager::ScreencastManager(QObject *parent)
: Plugin(parent)
, m_screencast(waylandServer()->display()->createScreencastV1Interface(this))
, m_screencast(new KWaylandServer::ScreencastV1Interface(waylandServer()->display(), this))
{
connect(m_screencast, &KWaylandServer::ScreencastV1Interface::windowScreencastRequested,
this, &ScreencastManager::streamWindow);

View File

@ -61,6 +61,10 @@
#include <KWaylandServer/filtered_display.h>
#include <KWaylandServer/keyboard_shortcuts_inhibit_v1_interface.h>
#include <KWaylandServer/inputmethod_v1_interface.h>
#include <KWaylandServer/tablet_v2_interface.h>
#include <KWaylandServer/viewporter_interface.h>
#include <KWaylandServer/datacontroldevicemanager_v1_interface.h>
#include <KWaylandServer/primaryselectiondevicemanager_v1_interface.h>
// Qt
#include <QCryptographicHash>
@ -334,7 +338,7 @@ bool WaylandServer::init(const QString &socketName, InitializationFlags flags)
if (!m_display->addSocketName(socketName)) {
return false;
}
m_compositor = m_display->createCompositor(m_display);
m_compositor = new CompositorInterface(m_display, m_display);
connect(m_compositor, &CompositorInterface::surfaceCreated, this,
[this] (SurfaceInterface *surface) {
// check whether we have a Toplevel with the Surface's id
@ -368,8 +372,8 @@ bool WaylandServer::init(const QString &socketName, InitializationFlags flags)
}
);
m_tabletManagerV2 = m_display->createTabletManagerV2(m_display);
m_keyboardShortcutsInhibitManager = m_display->createKeyboardShortcutsInhibitManagerV1(m_display);
m_tabletManagerV2 = new TabletManagerV2Interface(m_display, m_display);
m_keyboardShortcutsInhibitManager = new KeyboardShortcutsInhibitManagerV1Interface(m_display, m_display);
auto inputPanelV1Integration = new InputPanelV1Integration(this);
connect(inputPanelV1Integration, &InputPanelV1Integration::clientCreated,
@ -383,7 +387,7 @@ bool WaylandServer::init(const QString &socketName, InitializationFlags flags)
connect(layerShellV1Integration, &LayerShellV1Integration::clientCreated,
this, &WaylandServer::registerShellClient);
m_xdgDecorationManagerV1 = m_display->createXdgDecorationManagerV1(m_display);
m_xdgDecorationManagerV1 = new XdgDecorationManagerV1Interface(m_display, m_display);
connect(m_xdgDecorationManagerV1, &XdgDecorationManagerV1Interface::decorationCreated, this,
[this](XdgToplevelDecorationV1Interface *decoration) {
if (XdgToplevelClient *toplevel = findXdgToplevelClient(decoration->toplevel()->surface())) {
@ -392,20 +396,20 @@ bool WaylandServer::init(const QString &socketName, InitializationFlags flags)
}
);
m_display->createViewporter();
new ViewporterInterface(m_display, m_display);
m_display->createShm();
m_seat = m_display->createSeat(m_display);
m_seat = new SeatInterface(m_display, m_display);
m_seat->create();
m_display->createPointerGesturesV1(m_display);
m_display->createPointerConstraintsV1(m_display);
m_dataDeviceManager = m_display->createDataDeviceManager(m_display);
m_display->createDataControlDeviceManagerV1(m_display);
m_display->createPrimarySelectionDeviceManagerV1(m_display);
m_idle = m_display->createIdle(m_display);
new PointerGesturesV1Interface(m_display, m_display);
new PointerConstraintsV1Interface(m_display, m_display);
m_dataDeviceManager = new DataDeviceManagerInterface(m_display, m_display);
new DataControlDeviceManagerV1Interface(m_display, m_display);
new PrimarySelectionDeviceManagerV1Interface(m_display, m_display);
m_idle = new IdleInterface(m_display, m_display);
auto idleInhibition = new IdleInhibition(m_idle);
connect(this, &WaylandServer::shellClientAdded, idleInhibition, &IdleInhibition::registerClient);
m_display->createIdleInhibitManagerV1(m_display);
m_plasmaShell = m_display->createPlasmaShell(m_display);
new IdleInhibitManagerV1Interface(m_display, m_display);
m_plasmaShell = new PlasmaShellInterface(m_display, m_display);
connect(m_plasmaShell, &PlasmaShellInterface::surfaceCreated,
[this] (PlasmaShellSurfaceInterface *surface) {
if (XdgSurfaceClient *client = findXdgSurfaceClient(surface->surface())) {
@ -419,7 +423,7 @@ bool WaylandServer::init(const QString &socketName, InitializationFlags flags)
});
}
);
m_appMenuManager = m_display->createAppMenuManagerInterface(m_display);
m_appMenuManager = new AppMenuManagerInterface(m_display, m_display);
connect(m_appMenuManager, &AppMenuManagerInterface::appMenuCreated,
[this] (AppMenuInterface *appMenu) {
if (XdgToplevelClient *client = findXdgToplevelClient(appMenu->surface())) {
@ -427,7 +431,7 @@ bool WaylandServer::init(const QString &socketName, InitializationFlags flags)
}
}
);
m_paletteManager = m_display->createServerSideDecorationPaletteManager(m_display);
m_paletteManager = new ServerSideDecorationPaletteManagerInterface(m_display, m_display);
connect(m_paletteManager, &ServerSideDecorationPaletteManagerInterface::paletteCreated,
[this] (ServerSideDecorationPaletteInterface *palette) {
if (XdgToplevelClient *client = findXdgToplevelClient(palette->surface())) {
@ -436,7 +440,7 @@ bool WaylandServer::init(const QString &socketName, InitializationFlags flags)
}
);
m_windowManagement = m_display->createPlasmaWindowManagement(m_display);
m_windowManagement = new PlasmaWindowManagementInterface(m_display, m_display);
m_windowManagement->setShowingDesktopState(PlasmaWindowManagementInterface::ShowingDesktopState::Disabled);
connect(m_windowManagement, &PlasmaWindowManagementInterface::requestChangeShowingDesktop, this,
[] (PlasmaWindowManagementInterface::ShowingDesktopState state) {
@ -462,14 +466,13 @@ bool WaylandServer::init(const QString &socketName, InitializationFlags flags)
}
);
m_virtualDesktopManagement = m_display->createPlasmaVirtualDesktopManagement(m_display);
m_virtualDesktopManagement = new PlasmaVirtualDesktopManagementInterface(m_display, m_display);
m_windowManagement->setPlasmaVirtualDesktopManagementInterface(m_virtualDesktopManagement);
m_display->createShadowManager(m_display);
new ShadowManagerInterface(m_display, m_display);
new DpmsManagerInterface(m_display, m_display);
m_display->createDpmsManager(m_display);
m_decorationManager = m_display->createServerSideDecorationManager(m_display);
m_decorationManager = new ServerSideDecorationManagerInterface(m_display, m_display);
connect(m_decorationManager, &ServerSideDecorationManagerInterface::decorationCreated, this,
[this] (ServerSideDecorationInterface *decoration) {
if (XdgToplevelClient *client = findXdgToplevelClient(decoration->surface())) {
@ -484,22 +487,18 @@ bool WaylandServer::init(const QString &socketName, InitializationFlags flags)
}
);
m_outputManagement = m_display->createOutputManagement(m_display);
m_outputManagement = new OutputManagementInterface(m_display, m_display);
connect(m_outputManagement, &OutputManagementInterface::configurationChangeRequested,
this, [](KWaylandServer::OutputConfigurationInterface *config) {
kwinApp()->platform()->requestOutputsChange(config);
});
m_outputManagement->create();
m_xdgOutputManagerV1 = m_display->createXdgOutputManagerV1(m_display);
m_display->createSubCompositor(m_display);
m_XdgForeign = m_display->createXdgForeignV2Interface(m_display);
m_keyState = m_display->createKeyStateInterface(m_display);
m_inputMethod = m_display->createInputMethodInterface(m_display);
m_xdgOutputManagerV1 = new XdgOutputManagerV1Interface(m_display, m_display);
new SubCompositorInterface(m_display, m_display);
m_XdgForeign = new XdgForeignV2Interface(m_display, m_display);
m_keyState = new KeyStateInterface(m_display, m_display);
m_inputMethod = new InputMethodV1Interface(m_display, m_display);
return true;
}
@ -507,7 +506,7 @@ bool WaylandServer::init(const QString &socketName, InitializationFlags flags)
KWaylandServer::LinuxDmabufUnstableV1Interface *WaylandServer::linuxDmabuf()
{
if (!m_linuxDmabuf) {
m_linuxDmabuf = m_display->createLinuxDmabufInterface(m_display);
m_linuxDmabuf = new LinuxDmabufUnstableV1Interface(m_display, m_display);
m_linuxDmabuf->create();
}
return m_linuxDmabuf;

View File

@ -32,7 +32,7 @@ namespace KWin
XdgShellIntegration::XdgShellIntegration(QObject *parent)
: WaylandShellIntegration(parent)
{
XdgShellInterface *shell = waylandServer()->display()->createXdgShell(this);
XdgShellInterface *shell = new XdgShellInterface(waylandServer()->display(), this);
connect(shell, &XdgShellInterface::toplevelCreated,
this, &XdgShellIntegration::registerXdgToplevel);