Commit a8cfb02d authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

xdg-shell: Rewrite wrappers for the xdg-shell protocol

The current xdg-shell wrappers don't match existing abstractions in the
xdg-shell protocol well, which makes it more difficult to refactor code
that is responsible for managing configure events and geometry in kwin.

Given that the xdg_decoration and the xdg_shell protocols are tightly
coupled together, I had to rewrite our wrappers for the xdg_decoration
protocol as well.
parent 1f20e1b8
......@@ -343,16 +343,13 @@ add_test(NAME kwayland-testXdgForeign COMMAND testXdgForeign)
ecm_mark_as_test(testXdgForeign)
########################################################
# Test XdgShellStable
# Test XdgShell
########################################################
set( testXdgShellStable_SRCS
test_xdg_shell.cpp
test_xdg_shell_stable.cpp
)
add_executable(testXdgShellStable ${testXdgShellStable_SRCS})
target_link_libraries( testXdgShellStable Qt5::Test Qt5::Gui Plasma::KWaylandServer KF5::WaylandClient Wayland::Client)
add_test(NAME kwayland-testXdgShellStable COMMAND testXdgShellStable)
ecm_mark_as_test(testXdgShellStable)
set(testXdgShell_SRCS test_xdg_shell.cpp)
add_executable(testXdgShell ${testXdgShell_SRCS})
target_link_libraries( testXdgShell Qt5::Test Qt5::Gui Plasma::KWaylandServer KF5::WaylandClient Wayland::Client)
add_test(NAME kwayland-testXdgShell COMMAND testXdgShell)
ecm_mark_as_test(testXdgShell)
########################################################
# Test Pointer Constraints
......
......@@ -16,7 +16,7 @@
#include "../../src/server/display.h"
#include "../../src/server/compositor_interface.h"
#include "../../src/server/xdgshell_interface.h"
#include "../../src/server/xdgdecoration_interface.h"
#include "../../src/server/xdgdecoration_v1_interface.h"
class TestXdgDecoration : public QObject
{
......@@ -34,7 +34,7 @@ private:
KWaylandServer::Display *m_display = nullptr;
KWaylandServer::CompositorInterface *m_compositorInterface = nullptr;
KWaylandServer::XdgShellInterface *m_xdgShellInterface = nullptr;
KWaylandServer::XdgDecorationManagerInterface *m_xdgDecorationManagerInterface = nullptr;
KWaylandServer::XdgDecorationManagerV1Interface *m_xdgDecorationManagerInterface = nullptr;
KWayland::Client::ConnectionThread *m_connection = nullptr;
KWayland::Client::Compositor *m_compositor = nullptr;
......@@ -59,7 +59,7 @@ void TestXdgDecoration::init()
using namespace KWayland::Client;
qRegisterMetaType<XdgDecoration::Mode>();
qRegisterMetaType<XdgDecorationInterface::Mode>();
qRegisterMetaType<XdgToplevelDecorationV1Interface::Mode>();
delete m_display;
m_display = new Display(this);
......@@ -104,16 +104,12 @@ void TestXdgDecoration::init()
QVERIFY(compositorSpy.wait());
m_compositor = m_registry->createCompositor(compositorSpy.first().first().value<quint32>(), compositorSpy.first().last().value<quint32>(), this);
m_xdgShellInterface = m_display->createXdgShell(XdgShellInterfaceVersion::Stable, m_display);
m_xdgShellInterface->create();
QVERIFY(m_xdgShellInterface->isValid());
m_xdgShellInterface = m_display->createXdgShell(m_display);
QVERIFY(xdgShellSpy.wait());
m_xdgShell = m_registry->createXdgShell(xdgShellSpy.first().first().value<quint32>(),
xdgShellSpy.first().last().value<quint32>(), this);
m_xdgDecorationManagerInterface = m_display->createXdgDecorationManager(m_xdgShellInterface, m_display);
m_xdgDecorationManagerInterface->create();
QVERIFY(m_xdgDecorationManagerInterface->isValid());
m_xdgDecorationManagerInterface = m_display->createXdgDecorationManagerV1(m_display);
QVERIFY(xdgDecorationManagerSpy.wait());
m_xdgDecorationManager = m_registry->createXdgDecorationManager(xdgDecorationManagerSpy.first().first().value<quint32>(),
......@@ -160,13 +156,13 @@ void TestXdgDecoration::testDecoration_data()
{
using namespace KWayland::Client;
using namespace KWaylandServer;
QTest::addColumn<KWaylandServer::XdgDecorationInterface::Mode>("configuredMode");
QTest::addColumn<KWaylandServer::XdgToplevelDecorationV1Interface::Mode>("configuredMode");
QTest::addColumn<KWayland::Client::XdgDecoration::Mode>("configuredModeExp");
QTest::addColumn<KWayland::Client::XdgDecoration::Mode>("setMode");
QTest::addColumn<KWaylandServer::XdgDecorationInterface::Mode>("setModeExp");
QTest::addColumn<KWaylandServer::XdgToplevelDecorationV1Interface::Mode>("setModeExp");
const auto serverClient = XdgDecorationInterface::Mode::ClientSide;
const auto serverServer = XdgDecorationInterface::Mode::ServerSide;
const auto serverClient = XdgToplevelDecorationV1Interface::Mode::Client;
const auto serverServer = XdgToplevelDecorationV1Interface::Mode::Server;
const auto clientClient = XdgDecoration::Mode::ClientSide;
const auto clientServer = XdgDecoration::Mode::ServerSide;
......@@ -181,15 +177,14 @@ void TestXdgDecoration::testDecoration()
using namespace KWayland::Client;
using namespace KWaylandServer;
QFETCH(KWaylandServer::XdgDecorationInterface::Mode, configuredMode);
QFETCH(KWaylandServer::XdgToplevelDecorationV1Interface::Mode, configuredMode);
QFETCH(KWayland::Client::XdgDecoration::Mode, configuredModeExp);
QFETCH(KWayland::Client::XdgDecoration::Mode, setMode);
QFETCH(KWaylandServer::XdgDecorationInterface::Mode, setModeExp);
QFETCH(KWaylandServer::XdgToplevelDecorationV1Interface::Mode, setModeExp);
QSignalSpy surfaceCreatedSpy(m_compositorInterface, &CompositorInterface::surfaceCreated);
QSignalSpy shellSurfaceCreatedSpy(m_xdgShellInterface, &XdgShellInterface::surfaceCreated);
QSignalSpy decorationCreatedSpy(m_xdgDecorationManagerInterface, &XdgDecorationManagerInterface::xdgDecorationInterfaceCreated);
QSignalSpy shellSurfaceCreatedSpy(m_xdgShellInterface, &XdgShellInterface::toplevelCreated);
QSignalSpy decorationCreatedSpy(m_xdgDecorationManagerInterface, &XdgDecorationManagerV1Interface::decorationCreated);
// create shell surface and deco object
QScopedPointer<Surface> surface(m_compositor->createSurface());
......@@ -201,20 +196,20 @@ void TestXdgDecoration::testDecoration()
QVERIFY(shellSurfaceCreatedSpy.count() || shellSurfaceCreatedSpy.wait());
QVERIFY(decorationCreatedSpy.count() || decorationCreatedSpy.wait());
auto shellSurfaceIface = shellSurfaceCreatedSpy.first().first().value<XdgShellSurfaceInterface*>();
auto decorationIface = decorationCreatedSpy.first().first().value<XdgDecorationInterface*>();
auto shellSurfaceIface = shellSurfaceCreatedSpy.first().first().value<XdgToplevelInterface *>();
auto decorationIface = decorationCreatedSpy.first().first().value<XdgToplevelDecorationV1Interface *>();
QVERIFY(decorationIface);
QVERIFY(shellSurfaceIface);
QCOMPARE(decorationIface->surface(), shellSurfaceIface);
QCOMPARE(decorationIface->requestedMode(), XdgDecorationInterface::Mode::Undefined);
QCOMPARE(decorationIface->toplevel(), shellSurfaceIface);
QCOMPARE(decorationIface->preferredMode(), XdgToplevelDecorationV1Interface::Mode::Undefined);
QSignalSpy clientConfiguredSpy(decoration.data(), &XdgDecoration::modeChanged);
QSignalSpy modeRequestedSpy(decorationIface, &XdgDecorationInterface::modeRequested);
QSignalSpy modeRequestedSpy(decorationIface, &XdgToplevelDecorationV1Interface::preferredModeChanged);
//server configuring a client
decorationIface->configure(configuredMode);
quint32 serial = shellSurfaceIface->configure({});
decorationIface->sendConfigure(configuredMode);
quint32 serial = shellSurfaceIface->sendConfigure(QSize(0, 0), {});
QVERIFY(clientConfiguredSpy.wait());
QCOMPARE(clientConfiguredSpy.first().first().value<XdgDecoration::Mode>(), configuredModeExp);
......@@ -223,13 +218,14 @@ void TestXdgDecoration::testDecoration()
//client requesting another mode
decoration->setMode(setMode);
QVERIFY(modeRequestedSpy.wait());
QCOMPARE(modeRequestedSpy.first().first().value<XdgDecorationInterface::Mode>(), setModeExp);
QCOMPARE(decorationIface->requestedMode(), setModeExp);
QCOMPARE(modeRequestedSpy.first().first().value<XdgToplevelDecorationV1Interface::Mode>(), setModeExp);
QCOMPARE(decorationIface->preferredMode(), setModeExp);
modeRequestedSpy.clear();
decoration->unsetMode();
QVERIFY(modeRequestedSpy.wait());
QCOMPARE(modeRequestedSpy.first().first().value<XdgDecorationInterface::Mode>(), XdgDecorationInterface::Mode::Undefined);
QCOMPARE(modeRequestedSpy.first().first().value<XdgToplevelDecorationV1Interface::Mode>(),
XdgToplevelDecorationV1Interface::Mode::Undefined);
}
QTEST_GUILESS_MAIN(TestXdgDecoration)
......
This diff is collapsed.
/*
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#ifndef TEST_XDG_SHELL_H
#define TEST_XDG_SHELL_H
// Qt
#include <QtTest>
// client
#include "KWayland/Client/xdgshell.h"
#include "KWayland/Client/connection_thread.h"
#include "KWayland/Client/compositor.h"
#include "KWayland/Client/event_queue.h"
#include "KWayland/Client/registry.h"
#include "KWayland/Client/output.h"
#include "KWayland/Client/seat.h"
#include "KWayland/Client/shm_pool.h"
#include "KWayland/Client/surface.h"
// server
#include "../../src/server/display.h"
#include "../../src/server/compositor_interface.h"
#include "../../src/server/output_interface.h"
#include "../../src/server/seat_interface.h"
#include "../../src/server/surface_interface.h"
#include "../../src/server/xdgshell_interface.h"
using namespace KWayland::Client;
using namespace KWaylandServer;
Q_DECLARE_METATYPE(Qt::MouseButton)
class XdgShellTest : public QObject
{
Q_OBJECT
protected:
XdgShellTest(XdgShellInterfaceVersion version);
private Q_SLOTS:
void init();
void cleanup();
void testCreateSurface();
void testTitle();
void testWindowClass();
void testMaximize();
void testMinimize();
void testFullscreen();
void testShowWindowMenu();
void testMove();
void testResize_data();
void testResize();
void testTransient();
void testPing();
void testClose();
void testConfigureStates_data();
void testConfigureStates();
void testConfigureMultipleAcks();
protected:
XdgShellInterface *m_xdgShellInterface = nullptr;
Compositor *m_compositor = nullptr;
XdgShell *m_xdgShell = nullptr;
Display *m_display = nullptr;
CompositorInterface *m_compositorInterface = nullptr;
OutputInterface *m_o1Interface = nullptr;
OutputInterface *m_o2Interface = nullptr;
SeatInterface *m_seatInterface = nullptr;
ConnectionThread *m_connection = nullptr;
QThread *m_thread = nullptr;
EventQueue *m_queue = nullptr;
ShmPool *m_shmPool = nullptr;
Output *m_output1 = nullptr;
Output *m_output2 = nullptr;
Seat *m_seat = nullptr;
private:
XdgShellInterfaceVersion m_version;
};
#define SURFACE \
QSignalSpy xdgSurfaceCreatedSpy(m_xdgShellInterface, &XdgShellInterface::surfaceCreated); \
QVERIFY(xdgSurfaceCreatedSpy.isValid()); \
QScopedPointer<Surface> surface(m_compositor->createSurface()); \
QScopedPointer<XdgShellSurface> xdgSurface(m_xdgShell->createSurface(surface.data())); \
QCOMPARE(xdgSurface->size(), QSize()); \
QVERIFY(xdgSurfaceCreatedSpy.wait()); \
auto serverXdgSurface = xdgSurfaceCreatedSpy.first().first().value<XdgShellSurfaceInterface*>(); \
QVERIFY(serverXdgSurface);
#endif
/*
SPDX-FileCopyrightText: 2016 Martin Gräßlin <mgraesslin@kde.org>
SPDX-FileCopyrightText: 2017 David Edmundson <davidedmundson@kde.org>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#include "test_xdg_shell.h"
#include <wayland-xdg-shell-client-protocol.h>
class XdgShellTestStable : public XdgShellTest {
Q_OBJECT
public:
XdgShellTestStable() :
XdgShellTest(KWaylandServer::XdgShellInterfaceVersion::Stable) {}
private Q_SLOTS:
void testMaxSize();
void testMinSize();
void testPopup_data();
void testPopup();
void testMultipleRoles1();
void testMultipleRoles2();
void testWindowGeometry();
};
void XdgShellTestStable::testMaxSize()
{
qRegisterMetaType<OutputInterface*>();
// this test verifies changing the window maxSize
QSignalSpy xdgSurfaceCreatedSpy(m_xdgShellInterface, &XdgShellInterface::surfaceCreated);
QVERIFY(xdgSurfaceCreatedSpy.isValid());
QScopedPointer<Surface> surface(m_compositor->createSurface());
QScopedPointer<XdgShellSurface> xdgSurface(m_xdgShell->createSurface(surface.data()));
QVERIFY(xdgSurfaceCreatedSpy.wait());
auto serverXdgSurface = xdgSurfaceCreatedSpy.first().first().value<XdgShellSurfaceInterface*>();
QVERIFY(serverXdgSurface);
QSignalSpy maxSizeSpy(serverXdgSurface, &XdgShellSurfaceInterface::maxSizeChanged);
QVERIFY(maxSizeSpy.isValid());
xdgSurface->setMaxSize(QSize(100, 100));
surface->commit(Surface::CommitFlag::None);
QVERIFY(maxSizeSpy.wait());
QCOMPARE(maxSizeSpy.count(), 1);
QCOMPARE(maxSizeSpy.last().at(0).value<QSize>(), QSize(100,100));
QCOMPARE(serverXdgSurface->maximumSize(), QSize(100, 100));
xdgSurface->setMaxSize(QSize(200, 200));
surface->commit(Surface::CommitFlag::None);
QVERIFY(maxSizeSpy.wait());
QCOMPARE(maxSizeSpy.count(), 2);
QCOMPARE(maxSizeSpy.last().at(0).value<QSize>(), QSize(200,200));
QCOMPARE(serverXdgSurface->maximumSize(), QSize(200, 200));
}
void XdgShellTestStable::testPopup_data()
{
QTest::addColumn<XdgPositioner>("positioner");
XdgPositioner positioner(QSize(10,10), QRect(100,100,50,50));
QTest::newRow("default") << positioner;
XdgPositioner positioner2(QSize(20,20), QRect(101,102,51,52));
QTest::newRow("sizeAndAnchorRect") << positioner2;
positioner.setAnchorEdge(Qt::TopEdge | Qt::RightEdge);
QTest::newRow("anchorEdge") << positioner;
positioner.setGravity(Qt::BottomEdge);
QTest::newRow("gravity") << positioner;
positioner.setGravity(Qt::TopEdge | Qt::RightEdge);
QTest::newRow("gravity2") << positioner;
positioner.setConstraints(XdgPositioner::Constraint::SlideX | XdgPositioner::Constraint::FlipY);
QTest::newRow("constraints") << positioner;
positioner.setConstraints(XdgPositioner::Constraint::SlideX | XdgPositioner::Constraint::SlideY | XdgPositioner::Constraint::FlipX | XdgPositioner::Constraint::FlipY | XdgPositioner::Constraint::ResizeX | XdgPositioner::Constraint::ResizeY);
QTest::newRow("constraints2") << positioner;
positioner.setAnchorOffset(QPoint(4,5));
QTest::newRow("offset") << positioner;
}
void XdgShellTestStable::testPopup()
{
QSignalSpy xdgTopLevelCreatedSpy(m_xdgShellInterface, &XdgShellInterface::surfaceCreated);
QSignalSpy xdgPopupCreatedSpy(m_xdgShellInterface, &XdgShellInterface::xdgPopupCreated);
QScopedPointer<Surface> parentSurface(m_compositor->createSurface());
QScopedPointer<XdgShellSurface> xdgParentSurface(m_xdgShell->createSurface(parentSurface.data()));
QVERIFY(xdgTopLevelCreatedSpy.wait());
auto serverXdgTopLevel = xdgTopLevelCreatedSpy.first().first().value<XdgShellSurfaceInterface*>();
QFETCH(XdgPositioner, positioner);
QScopedPointer<Surface> surface(m_compositor->createSurface());
QScopedPointer<XdgShellPopup> xdgSurface(m_xdgShell->createPopup(surface.data(), xdgParentSurface.data(), positioner));
QVERIFY(xdgPopupCreatedSpy.wait());
auto serverXdgPopup = xdgPopupCreatedSpy.first().first().value<XdgShellPopupInterface*>();
QVERIFY(serverXdgPopup);
QCOMPARE(serverXdgPopup->initialSize(), positioner.initialSize());
QCOMPARE(serverXdgPopup->anchorRect(), positioner.anchorRect());
QCOMPARE(serverXdgPopup->anchorEdge(), positioner.anchorEdge());
QCOMPARE(serverXdgPopup->gravity(), positioner.gravity());
QCOMPARE(serverXdgPopup->anchorOffset(), positioner.anchorOffset());
//we have different enums for client server, but they share the same values
QCOMPARE((int)serverXdgPopup->constraintAdjustments(), (int)positioner.constraints());
QCOMPARE(serverXdgPopup->transientFor().data(), serverXdgTopLevel->surface());
}
void XdgShellTestStable::testMinSize()
{
qRegisterMetaType<OutputInterface*>();
// this test verifies changing the window minSize
QSignalSpy xdgSurfaceCreatedSpy(m_xdgShellInterface, &XdgShellInterface::surfaceCreated);
QVERIFY(xdgSurfaceCreatedSpy.isValid());
QScopedPointer<Surface> surface(m_compositor->createSurface());
QScopedPointer<XdgShellSurface> xdgSurface(m_xdgShell->createSurface(surface.data()));
QVERIFY(xdgSurfaceCreatedSpy.wait());
auto serverXdgSurface = xdgSurfaceCreatedSpy.first().first().value<XdgShellSurfaceInterface*>();
QVERIFY(serverXdgSurface);
QSignalSpy minSizeSpy(serverXdgSurface, &XdgShellSurfaceInterface::minSizeChanged);
QVERIFY(minSizeSpy.isValid());
xdgSurface->setMinSize(QSize(200, 200));
surface->commit(Surface::CommitFlag::None);
QVERIFY(minSizeSpy.wait());
QCOMPARE(minSizeSpy.count(), 1);
QCOMPARE(minSizeSpy.last().at(0).value<QSize>(), QSize(200,200));
QCOMPARE(serverXdgSurface->minimumSize(), QSize(200, 200));
xdgSurface->setMinSize(QSize(100, 100));
surface->commit(Surface::CommitFlag::None);
QVERIFY(minSizeSpy.wait());
QCOMPARE(minSizeSpy.count(), 2);
QCOMPARE(minSizeSpy.last().at(0).value<QSize>(), QSize(100,100));
QCOMPARE(serverXdgSurface->minimumSize(), QSize(100, 100));
}
//top level then toplevel
void XdgShellTestStable::testMultipleRoles1()
{
//setting multiple roles on an xdg surface should fail
QSignalSpy xdgSurfaceCreatedSpy(m_xdgShellInterface, &XdgShellInterface::surfaceCreated);
QSignalSpy xdgPopupCreatedSpy(m_xdgShellInterface, &XdgShellInterface::xdgPopupCreated);
QVERIFY(xdgSurfaceCreatedSpy.isValid());
QVERIFY(xdgPopupCreatedSpy.isValid());
QScopedPointer<Surface> surface(m_compositor->createSurface());
//This is testing we work when a client does something stupid
//we can't use KWayland API here because by design that stops you from doing anything stupid
qDebug() << (xdg_wm_base*)*m_xdgShell;
auto xdgSurface = xdg_wm_base_get_xdg_surface(*m_xdgShell, *surface.data());
//create a top level
auto xdgTopLevel1 = xdg_surface_get_toplevel(xdgSurface);
QVERIFY(xdgSurfaceCreatedSpy.wait());
//now try to create another top level for the same xdg surface. It should fail
auto xdgTopLevel2 = xdg_surface_get_toplevel(xdgSurface);
QVERIFY(!xdgSurfaceCreatedSpy.wait(10));
xdg_toplevel_destroy(xdgTopLevel1);
xdg_toplevel_destroy(xdgTopLevel2);
xdg_surface_destroy(xdgSurface);
}
//toplevel then popup
void XdgShellTestStable::testMultipleRoles2()
{
QSignalSpy xdgSurfaceCreatedSpy(m_xdgShellInterface, &XdgShellInterface::surfaceCreated);
QSignalSpy xdgPopupCreatedSpy(m_xdgShellInterface, &XdgShellInterface::xdgPopupCreated);
QVERIFY(xdgSurfaceCreatedSpy.isValid());
QVERIFY(xdgPopupCreatedSpy.isValid());
QScopedPointer<Surface> surface(m_compositor->createSurface());
QScopedPointer<Surface> parentSurface(m_compositor->createSurface());
auto parentXdgSurface = xdg_wm_base_get_xdg_surface(*m_xdgShell, *parentSurface.data());
auto xdgTopLevelParent = xdg_surface_get_toplevel(parentXdgSurface);
QVERIFY(xdgSurfaceCreatedSpy.wait());
auto xdgSurface = xdg_wm_base_get_xdg_surface(*m_xdgShell, *surface.data());
//create a top level
auto xdgTopLevel1 = xdg_surface_get_toplevel(xdgSurface);
QVERIFY(xdgSurfaceCreatedSpy.wait());
//now try to create a popup on the same xdg surface. It should fail
auto positioner = xdg_wm_base_create_positioner(*m_xdgShell);
xdg_positioner_set_anchor_rect(positioner,10, 10, 10, 10);
xdg_positioner_set_size(positioner,10, 100);
auto xdgPopup2 = xdg_surface_get_popup(xdgSurface, parentXdgSurface, positioner);
QVERIFY(!xdgPopupCreatedSpy.wait(10));
xdg_positioner_destroy(positioner);
xdg_toplevel_destroy(xdgTopLevel1);
xdg_toplevel_destroy(xdgTopLevelParent);
xdg_popup_destroy(xdgPopup2);
xdg_surface_destroy(xdgSurface);
}
void XdgShellTestStable::testWindowGeometry()
{
SURFACE
QSignalSpy windowGeometryChangedSpy(serverXdgSurface, &XdgShellSurfaceInterface::windowGeometryChanged);
xdgSurface->setWindowGeometry(QRect(50, 50, 400, 400));
surface->commit(Surface::CommitFlag::None);
QVERIFY(windowGeometryChangedSpy.wait());
QCOMPARE(serverXdgSurface->windowGeometry(), QRect(50, 50, 400, 400));
//add a popup to this surface
XdgPositioner positioner(QSize(10,10), QRect(100,100,50,50));
QSignalSpy xdgPopupCreatedSpy(m_xdgShellInterface, &XdgShellInterface::xdgPopupCreated);
QScopedPointer<Surface> popupSurface(m_compositor->createSurface());
QScopedPointer<XdgShellPopup> xdgPopupSurface(m_xdgShell->createPopup(popupSurface.data(), xdgSurface.data(), positioner));
QVERIFY(xdgPopupCreatedSpy.wait());
auto serverXdgPopup = xdgPopupCreatedSpy.first().first().value<XdgShellPopupInterface*>();
QVERIFY(serverXdgPopup);
QSignalSpy popupWindowGeometryChangedSpy(serverXdgPopup, &XdgShellPopupInterface::windowGeometryChanged);
xdgPopupSurface->setWindowGeometry(QRect(60, 60, 300, 300));
popupSurface->commit(Surface::CommitFlag::None);
QVERIFY(popupWindowGeometryChangedSpy.wait());
QCOMPARE(serverXdgPopup->windowGeometry(), QRect(60, 60, 300, 300));
}
QTEST_GUILESS_MAIN(XdgShellTestStable)
#include "test_xdg_shell_stable.moc"
......@@ -58,12 +58,11 @@ set(SERVER_LIB_SRCS
textinput_interface_v0.cpp
textinput_interface_v2.cpp
touch_interface.cpp
xdgdecoration_interface.cpp
xdgdecoration_v1_interface.cpp
xdgforeign_interface.cpp
xdgforeign_v2_interface.cpp
xdgoutput_interface.cpp
xdgshell_interface.cpp
xdgshell_stable_interface.cpp
)
ecm_qt_declare_logging_category(SERVER_LIB_SRCS
......@@ -199,14 +198,14 @@ ecm_add_wayland_server_protocol(SERVER_LIB_SRCS
BASENAME xdg-output
)
ecm_add_wayland_server_protocol(SERVER_LIB_SRCS
ecm_add_qtwayland_server_protocol(SERVER_LIB_SRCS
PROTOCOL ${WaylandProtocols_DATADIR}/stable/xdg-shell/xdg-shell.xml
BASENAME xdg-shell
)
ecm_add_wayland_server_protocol(SERVER_LIB_SRCS
ecm_add_qtwayland_server_protocol(SERVER_LIB_SRCS
PROTOCOL ${WaylandProtocols_DATADIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
BASENAME xdg-decoration
BASENAME xdg-decoration-unstable-v1
)
ecm_add_wayland_server_protocol(SERVER_LIB_SRCS
......@@ -387,7 +386,7 @@ set(SERVER_LIB_HEADERS
tablet_interface.h
textinput_interface.h
touch_interface.h
xdgdecoration_interface.h
xdgdecoration_v1_interface.h
xdgforeign_interface.h
xdgoutput_interface.h
xdgshell_interface.h
......
......@@ -39,10 +39,10 @@
#include "subcompositor_interface.h"
#include "tablet_interface.h"
#include "textinput_interface_p.h"
#include "xdgdecoration_interface.h"
#include "xdgdecoration_v1_interface.h"
#include "xdgforeign_interface.h"
#include "xdgoutput_interface.h"
#include "xdgshell_stable_interface_p.h"
#include "xdgshell_interface.h"
#include <QCoreApplication>
#include <QDebug>
......@@ -377,20 +377,11 @@ TextInputManagerInterface *Display::createTextInputManager(const TextInputInterf
return t;
}
XdgShellInterface *Display::createXdgShell(const XdgShellInterfaceVersion &version, QObject *parent)
XdgShellInterface *Display::createXdgShell(QObject *parent)
{
XdgShellInterface *x = nullptr;
switch (version) {
case XdgShellInterfaceVersion::UnstableV5:
return nullptr;
case XdgShellInterfaceVersion::UnstableV6:
return nullptr;
case XdgShellInterfaceVersion::Stable:
x = new XdgShellStableInterface(this, parent);
break;
}
connect(this, &Display::aboutToTerminate, x, [x] { delete x; });
return x;
XdgShellInterface *shell = new XdgShellInterface(this, parent);
connect(this, &Display::aboutToTerminate, shell, [shell] { delete shell; });
return shell;
}
RelativePointerManagerInterface *Display::createRelativePointerManager(const RelativePointerInterfaceVersion &version, QObject *parent)
......@@ -483,9 +474,9 @@ XdgOutputManagerInterface *Display::createXdgOutputManager(QObject *parent)
return b;
}
XdgDecorationManagerInterface *Display::createXdgDecorationManager(XdgShellInterface *shellInterface, QObject *parent)
XdgDecorationManagerV1Interface *Display::createXdgDecorationManagerV1(QObject *parent)
{
auto d = new XdgDecorationManagerInterface(this, shellInterface, parent);
auto d = new XdgDecorationManagerV1Interface(this, parent);
connect(this, &Display::aboutToTerminate, d, [d] { delete d; });
return d;
}
......
......@@ -72,7 +72,7 @@ class AppMenuManagerInterface;
class ServerSideDecorationPaletteManagerInterface;
class PlasmaVirtualDesktopManagementInterface;
class XdgOutputManagerInterface;
class XdgDecorationManagerInterface;
class XdgDecorationManagerV1Interface;
class EglStreamControllerInterface;
class KeyStateInterface;
class LinuxDmabufUnstableV1Interface;
......@@ -210,7 +210,7 @@ public:
*