Migrate Window Management to new approach

This commit is contained in:
adrien faveraux 2020-09-28 11:40:51 +00:00 committed by Vlad Zahorodnii
parent feeafa93ed
commit af16210c95
6 changed files with 295 additions and 376 deletions

View file

@ -102,7 +102,7 @@ ecm_add_qtwayland_server_protocol(SERVER_LIB_SRCS
BASENAME org-kde-plasma-virtual-desktop
)
ecm_add_wayland_server_protocol(SERVER_LIB_SRCS
ecm_add_qtwayland_server_protocol(SERVER_LIB_SRCS
PROTOCOL ${PLASMA_WAYLAND_PROTOCOLS_DIR}/plasma-window-management.xml
BASENAME plasma-window-management
)

View file

@ -126,8 +126,6 @@ void TestVirtualDesktop::init()
m_plasmaVirtualDesktopManagement = registry.createPlasmaVirtualDesktopManagement(plasmaVirtualDesktopManagementSpy.first().first().value<quint32>(), plasmaVirtualDesktopManagementSpy.first().last().value<quint32>(), this);
m_windowManagementInterface = m_display->createPlasmaWindowManagement(m_display);
m_windowManagementInterface->create();
QVERIFY(m_windowManagementInterface->isValid());
m_windowManagementInterface->setPlasmaVirtualDesktopManagementInterface(m_plasmaVirtualDesktopManagementInterface);
QVERIFY(windowManagementSpy.wait());

View file

@ -101,7 +101,6 @@ void PlasmaWindowModelTest::init()
QVERIFY(m_display->isRunning());
m_display->createShm();
m_pwInterface = m_display->createPlasmaWindowManagement();
m_pwInterface->create();
m_plasmaVirtualDesktopManagementInterface = m_display->createPlasmaVirtualDesktopManagement(m_display);
m_plasmaVirtualDesktopManagementInterface->createDesktop("desktop1");
m_plasmaVirtualDesktopManagementInterface->createDesktop("desktop2");
@ -870,7 +869,7 @@ void PlasmaWindowModelTest::testChangeWindowAfterModelDestroy_data()
#if KWAYLANDSERVER_ENABLE_DEPRECATED_SINCE(5, 28)
QTest::newRow("iconname" ) << &PlasmaWindow::iconChanged << QVariant::fromValue(&PlasmaWindowInterface::setThemedIconName) << QVariant(QStringLiteral("foo"));
#endif
QTest::newRow("icon" ) << &PlasmaWindow::iconChanged << QVariant::fromValue(&PlasmaWindowInterface::setIcon) << QVariant::fromValue(QIcon::fromTheme(QStringLiteral("foo")));
QTest::newRow("icon" ) << &PlasmaWindow::iconChanged << QVariant::fromValue(&PlasmaWindowInterface::setIcon) << QVariant(QIcon::fromTheme(QStringLiteral("foo")));
QTest::newRow("vd") << &PlasmaWindow::virtualDesktopChanged << QVariant::fromValue(&PlasmaWindowInterface::setVirtualDesktop) << QVariant(2u);
QTest::newRow("unmapped") << &PlasmaWindow::unmapped << QVariant::fromValue(&PlasmaWindowInterface::unmap) << QVariant();
}
@ -901,6 +900,8 @@ void PlasmaWindowModelTest::testChangeWindowAfterModelDestroy()
(w->*(setter.value<ServerWindowStringSetter>()))(value.toString());
} else if (QMetaType::Type(value.type()) == QMetaType::UInt) {
(w->*(setter.value<ServerWindowQuint32Setter>()))(value.toUInt());
} else if (QMetaType::Type(value.type()) == QMetaType::QIcon) {
(w->*(setter.value<ServerWindowIconSetter>()))(value.value<QIcon>());
} else if (!value.isValid()) {
(w->*(setter.value<ServerWindowVoidSetter>()))();
}

View file

@ -137,8 +137,6 @@ void TestWindowManagement::init()
m_windowManagementInterface = m_display->createPlasmaWindowManagement(m_display);
m_windowManagementInterface->create();
QVERIFY(m_windowManagementInterface->isValid());
QVERIFY(windowManagementSpy.wait());
m_windowManagement = m_registry->createPlasmaWindowManagement(windowManagementSpy.first().first().value<quint32>(), windowManagementSpy.first().last().value<quint32>(), this);

File diff suppressed because it is too large Load diff

View file

@ -10,9 +10,6 @@
#include <KWaylandServer/kwaylandserver_export.h>
#include "global.h"
#include "resource.h"
class QSize;
namespace KWaylandServer
@ -22,15 +19,17 @@ class Display;
class PlasmaWindowInterface;
class SurfaceInterface;
class PlasmaVirtualDesktopManagementInterface;
class PlasmaWindowManagementInterfacePrivate;
class PlasmaWindowInterfacePrivate;
/**
* @todo Add documentation
*/
class KWAYLANDSERVER_EXPORT PlasmaWindowManagementInterface : public Global
class KWAYLANDSERVER_EXPORT PlasmaWindowManagementInterface : public QObject
{
Q_OBJECT
public:
virtual ~PlasmaWindowManagementInterface();
~PlasmaWindowManagementInterface() override;
enum class ShowingDesktopState {
Disabled,
Enabled
@ -84,8 +83,7 @@ Q_SIGNALS:
private:
friend class Display;
explicit PlasmaWindowManagementInterface(Display *display, QObject *parent);
class Private;
Private *d_func() const;
QScopedPointer<PlasmaWindowManagementInterfacePrivate> d;
};
/**
@ -95,7 +93,7 @@ class KWAYLANDSERVER_EXPORT PlasmaWindowInterface : public QObject
{
Q_OBJECT
public:
virtual ~PlasmaWindowInterface();
~PlasmaWindowInterface() override;
void setTitle(const QString &title);
void setAppId(const QString &appId);
@ -317,10 +315,11 @@ Q_SIGNALS:
private:
friend class PlasmaWindowManagementInterface;
friend class PlasmaWindowInterfacePrivate;
friend class PlasmaWindowManagementInterfacePrivate;
explicit PlasmaWindowInterface(PlasmaWindowManagementInterface *wm, QObject *parent);
class Private;
const QScopedPointer<Private> d;
QScopedPointer<PlasmaWindowInterfacePrivate> d;
};
}