Commit 8e86b7a1 authored by David Edmundson's avatar David Edmundson
Browse files

Port PlasmaShellSurface to the new approach

This gets rid of some boiler plate and simplifies some code.
parent d70552f6
......@@ -56,7 +56,6 @@ void ErrorTest::init()
m_display->createShm();
m_ci = m_display->createCompositor(m_display);
m_psi = m_display->createPlasmaShell(m_display);
m_psi->create();
// setup connection
m_connection = new KWayland::Client::ConnectionThread;
......
......@@ -68,7 +68,6 @@ void TestPlasmaShell::init()
m_display->createShm();
m_plasmaShellInterface = m_display->createPlasmaShell(m_display);
m_plasmaShellInterface->create();
// setup connection
m_connection = new KWayland::Client::ConnectionThread;
......@@ -181,9 +180,6 @@ void TestPlasmaShell::testRole()
QVERIFY(sps);
QVERIFY(sps->surface());
QCOMPARE(sps->surface(), surfaceCreatedSpy.first().first().value<SurfaceInterface*>());
QCOMPARE(sps->shell(), m_plasmaShellInterface);
QCOMPARE(PlasmaShellSurfaceInterface::get(sps->resource()), sps);
QVERIFY(!PlasmaShellSurfaceInterface::get(nullptr));
// default role should be normal
QCOMPARE(sps->role(), PlasmaShellSurfaceInterface::Role::Normal);
......@@ -465,16 +461,12 @@ void TestPlasmaShell::testDisconnect()
QVERIFY(sps);
// disconnect
QSignalSpy clientDisconnectedSpy(sps->client(), &ClientConnection::disconnected);
QVERIFY(clientDisconnectedSpy.isValid());
QSignalSpy surfaceDestroyedSpy(sps, &QObject::destroyed);
QVERIFY(surfaceDestroyedSpy.isValid());
if (m_connection) {
m_connection->deleteLater();
m_connection = nullptr;
}
QVERIFY(clientDisconnectedSpy.wait());
QCOMPARE(clientDisconnectedSpy.count(), 1);
QCOMPARE(surfaceDestroyedSpy.count(), 0);
QVERIFY(surfaceDestroyedSpy.wait());
QCOMPARE(surfaceDestroyedSpy.count(), 1);
......
......@@ -90,7 +90,7 @@ ecm_add_wayland_server_protocol(SERVER_LIB_SRCS
BASENAME org_kde_kwin_outputdevice
)
ecm_add_wayland_server_protocol(SERVER_LIB_SRCS
ecm_add_qtwayland_server_protocol(SERVER_LIB_SRCS
PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/plasma-shell.xml
BASENAME plasma-shell
)
......
This diff is collapsed.
/*
SPDX-FileCopyrightText: 2015 Martin Gräßlin <mgraesslin@kde.org>
SPDX-FileCopyrightText: 2020 David Edmundson <davidedmundson@kde.org>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
......@@ -10,9 +11,6 @@
#include <KWaylandServer/kwaylandserver_export.h>
#include "global.h"
#include "resource.h"
class QSize;
struct wl_resource;
......@@ -23,6 +21,9 @@ class Display;
class SurfaceInterface;
class PlasmaShellSurfaceInterface;
class PlasmaShellInterfacePrivate;
class PlasmaShellSurfaceInterfacePrivate;
/**
* @brief Global for the org_kde_plasma_shell interface.
*
......@@ -35,7 +36,7 @@ class PlasmaShellSurfaceInterface;
*
* @since 5.4
**/
class KWAYLANDSERVER_EXPORT PlasmaShellInterface : public Global
class KWAYLANDSERVER_EXPORT PlasmaShellInterface : public QObject
{
Q_OBJECT
public:
......@@ -50,7 +51,7 @@ Q_SIGNALS:
private:
friend class Display;
explicit PlasmaShellInterface(Display *display, QObject *parent);
class Private;
QScopedPointer<PlasmaShellInterfacePrivate> d;
};
/**
......@@ -60,7 +61,7 @@ private:
*
* @since 5.4
**/
class KWAYLANDSERVER_EXPORT PlasmaShellSurfaceInterface : public Resource
class KWAYLANDSERVER_EXPORT PlasmaShellSurfaceInterface : public QObject
{
Q_OBJECT
public:
......@@ -70,11 +71,6 @@ public:
* @returns the SurfaceInterface this PlasmaShellSurfaceInterface got created for
**/
SurfaceInterface *surface() const;
/**
* @returns The PlasmaShellInterface which created this PlasmaShellSurfaceInterface.
**/
PlasmaShellInterface *shell() const;
/**
* @returns the requested position in global coordinates.
**/
......@@ -227,10 +223,9 @@ Q_SIGNALS:
void panelTakesFocusChanged();
private:
friend class PlasmaShellInterface;
explicit PlasmaShellSurfaceInterface(PlasmaShellInterface *shell, SurfaceInterface *parent, wl_resource *parentResource);
class Private;
Private *d_func() const;
friend class PlasmaShellInterfacePrivate;
explicit PlasmaShellSurfaceInterface(SurfaceInterface *surface, wl_resource *resource);
QScopedPointer<PlasmaShellSurfaceInterfacePrivate> d;
};
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment