2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2018-12-08 16:06:51 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2018 Martin Flöser <mgraesslin@kde.org>
|
2020-08-02 22:10:35 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
|
|
|
|
*/
|
2018-12-08 16:06:51 +00:00
|
|
|
#include "kwin_wayland_test.h"
|
2020-03-04 07:55:26 +00:00
|
|
|
#include "abstract_client.h"
|
2018-12-08 16:06:51 +00:00
|
|
|
#include "atoms.h"
|
2019-09-24 08:48:08 +00:00
|
|
|
#include "x11client.h"
|
2018-12-08 16:06:51 +00:00
|
|
|
#include "deleted.h"
|
|
|
|
#include "platform.h"
|
|
|
|
#include "rules.h"
|
|
|
|
#include "screens.h"
|
|
|
|
#include "virtualdesktops.h"
|
|
|
|
#include "wayland_server.h"
|
|
|
|
#include "workspace.h"
|
|
|
|
|
|
|
|
#include <KWayland/Client/surface.h>
|
|
|
|
|
|
|
|
#include <QDBusArgument>
|
|
|
|
#include <QDBusConnection>
|
|
|
|
#include <QDBusMessage>
|
|
|
|
#include <QDBusPendingReply>
|
|
|
|
#include <QUuid>
|
|
|
|
|
|
|
|
#include <netwm.h>
|
|
|
|
#include <xcb/xcb_icccm.h>
|
|
|
|
|
|
|
|
using namespace KWin;
|
|
|
|
using namespace KWayland::Client;
|
|
|
|
|
|
|
|
static const QString s_socketName = QStringLiteral("wayland_test_kwin_dbus_interface-0");
|
|
|
|
|
|
|
|
const QString s_destination{QStringLiteral("org.kde.KWin")};
|
|
|
|
const QString s_path{QStringLiteral("/KWin")};
|
|
|
|
const QString s_interface{QStringLiteral("org.kde.KWin")};
|
|
|
|
|
|
|
|
class TestDbusInterface : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
private Q_SLOTS:
|
|
|
|
void initTestCase();
|
|
|
|
void init();
|
|
|
|
void cleanup();
|
|
|
|
|
|
|
|
void testGetWindowInfoInvalidUuid();
|
2019-08-30 21:36:58 +00:00
|
|
|
void testGetWindowInfoXdgShellClient();
|
2018-12-08 16:06:51 +00:00
|
|
|
void testGetWindowInfoX11Client();
|
|
|
|
};
|
|
|
|
|
|
|
|
void TestDbusInterface::initTestCase()
|
|
|
|
{
|
|
|
|
qRegisterMetaType<KWin::Deleted*>();
|
|
|
|
qRegisterMetaType<KWin::AbstractClient*>();
|
|
|
|
|
2020-07-07 09:32:29 +00:00
|
|
|
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
|
|
|
QVERIFY(applicationStartedSpy.isValid());
|
2018-12-08 16:06:51 +00:00
|
|
|
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
2020-12-09 13:06:15 +00:00
|
|
|
QVERIFY(waylandServer()->init(s_socketName));
|
2018-12-08 16:06:51 +00:00
|
|
|
|
|
|
|
kwinApp()->start();
|
2020-07-07 09:32:29 +00:00
|
|
|
QVERIFY(applicationStartedSpy.wait());
|
2021-05-08 00:08:22 +00:00
|
|
|
Test::initWaylandWorkspace();
|
2018-12-08 16:06:51 +00:00
|
|
|
VirtualDesktopManager::self()->setCount(4);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestDbusInterface::init()
|
|
|
|
{
|
|
|
|
QVERIFY(Test::setupWaylandConnection());
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestDbusInterface::cleanup()
|
|
|
|
{
|
|
|
|
Test::destroyWaylandConnection();
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
QDBusPendingCall getWindowInfo(const QUuid &uuid)
|
|
|
|
{
|
|
|
|
auto msg = QDBusMessage::createMethodCall(s_destination, s_path, s_interface, QStringLiteral("getWindowInfo"));
|
|
|
|
msg.setArguments({uuid.toString()});
|
|
|
|
return QDBusConnection::sessionBus().asyncCall(msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void TestDbusInterface::testGetWindowInfoInvalidUuid()
|
|
|
|
{
|
|
|
|
QDBusPendingReply<QVariantMap> reply{getWindowInfo(QUuid::createUuid())};
|
|
|
|
reply.waitForFinished();
|
|
|
|
QVERIFY(reply.isValid());
|
|
|
|
QVERIFY(!reply.isError());
|
|
|
|
const auto windowData = reply.value();
|
|
|
|
QVERIFY(windowData.empty());
|
|
|
|
}
|
|
|
|
|
2019-08-30 21:36:58 +00:00
|
|
|
void TestDbusInterface::testGetWindowInfoXdgShellClient()
|
2018-12-08 16:06:51 +00:00
|
|
|
{
|
2020-07-22 18:35:41 +00:00
|
|
|
QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded);
|
2018-12-08 16:06:51 +00:00
|
|
|
QVERIFY(clientAddedSpy.isValid());
|
|
|
|
|
2021-09-03 17:54:03 +00:00
|
|
|
QScopedPointer<KWayland::Client::Surface> surface(Test::createSurface());
|
2021-05-11 05:26:51 +00:00
|
|
|
QScopedPointer<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.data()));
|
|
|
|
shellSurface->set_app_id(QStringLiteral("org.kde.foo"));
|
|
|
|
shellSurface->set_title(QStringLiteral("Test window"));
|
2018-12-08 16:06:51 +00:00
|
|
|
|
|
|
|
// now let's render
|
|
|
|
Test::render(surface.data(), QSize(100, 50), Qt::blue);
|
|
|
|
QVERIFY(clientAddedSpy.isEmpty());
|
|
|
|
QVERIFY(clientAddedSpy.wait());
|
2020-03-04 07:55:26 +00:00
|
|
|
auto client = clientAddedSpy.first().first().value<AbstractClient *>();
|
2018-12-08 16:06:51 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
|
|
|
|
// let's get the window info
|
|
|
|
QDBusPendingReply<QVariantMap> reply{getWindowInfo(client->internalId())};
|
|
|
|
reply.waitForFinished();
|
|
|
|
QVERIFY(reply.isValid());
|
|
|
|
QVERIFY(!reply.isError());
|
|
|
|
auto windowData = reply.value();
|
|
|
|
QVERIFY(!windowData.isEmpty());
|
2021-02-01 07:30:58 +00:00
|
|
|
QCOMPARE(windowData.size(), 25);
|
2018-12-08 16:06:51 +00:00
|
|
|
QCOMPARE(windowData.value(QStringLiteral("type")).toInt(), NET::Normal);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("x")).toInt(), client->x());
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("y")).toInt(), client->y());
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("width")).toInt(), client->width());
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("height")).toInt(), client->height());
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("x11DesktopNumber")).toInt(), 1);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("minimized")).toBool(), false);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("shaded")).toBool(), false);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("fullscreen")).toBool(), false);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("keepAbove")).toBool(), false);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("keepBelow")).toBool(), false);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("skipTaskbar")).toBool(), false);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("skipPager")).toBool(), false);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("skipSwitcher")).toBool(), false);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("maximizeHorizontal")).toBool(), false);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("maximizeVertical")).toBool(), false);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("noBorder")).toBool(), true);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("clientMachine")).toString(), QString());
|
2018-12-23 07:56:15 +00:00
|
|
|
QCOMPARE(windowData.value(QStringLiteral("localhost")).toBool(), true);
|
2018-12-08 16:06:51 +00:00
|
|
|
QCOMPARE(windowData.value(QStringLiteral("role")).toString(), QString());
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("resourceName")).toString(), QStringLiteral("testDbusInterface"));
|
2019-08-27 15:01:14 +00:00
|
|
|
QCOMPARE(windowData.value(QStringLiteral("resourceClass")).toString(), QStringLiteral("org.kde.foo"));
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("desktopFile")).toString(), QStringLiteral("org.kde.foo"));
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("caption")).toString(), QStringLiteral("Test window"));
|
2021-02-01 07:30:58 +00:00
|
|
|
QCOMPARE(windowData.value(QStringLiteral("activities")), QStringList());
|
2018-12-08 16:06:51 +00:00
|
|
|
|
|
|
|
auto verifyProperty = [client] (const QString &name) {
|
|
|
|
QDBusPendingReply<QVariantMap> reply{getWindowInfo(client->internalId())};
|
|
|
|
reply.waitForFinished();
|
|
|
|
return reply.value().value(name).toBool();
|
|
|
|
};
|
|
|
|
|
|
|
|
QVERIFY(!client->isMinimized());
|
|
|
|
client->setMinimized(true);
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("minimized")), true);
|
|
|
|
|
|
|
|
QVERIFY(!client->keepAbove());
|
|
|
|
client->setKeepAbove(true);
|
|
|
|
QVERIFY(client->keepAbove());
|
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("keepAbove")), true);
|
|
|
|
|
|
|
|
QVERIFY(!client->keepBelow());
|
|
|
|
client->setKeepBelow(true);
|
|
|
|
QVERIFY(client->keepBelow());
|
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("keepBelow")), true);
|
|
|
|
|
|
|
|
QVERIFY(!client->skipTaskbar());
|
|
|
|
client->setSkipTaskbar(true);
|
|
|
|
QVERIFY(client->skipTaskbar());
|
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("skipTaskbar")), true);
|
|
|
|
|
|
|
|
QVERIFY(!client->skipPager());
|
|
|
|
client->setSkipPager(true);
|
|
|
|
QVERIFY(client->skipPager());
|
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("skipPager")), true);
|
|
|
|
|
|
|
|
QVERIFY(!client->skipSwitcher());
|
|
|
|
client->setSkipSwitcher(true);
|
|
|
|
QVERIFY(client->skipSwitcher());
|
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("skipSwitcher")), true);
|
|
|
|
|
|
|
|
// not testing shaded as that's X11
|
|
|
|
// not testing fullscreen, maximizeHorizontal, maximizeVertical and noBorder as those require window geometry changes
|
|
|
|
|
|
|
|
QCOMPARE(client->desktop(), 1);
|
|
|
|
workspace()->sendClientToDesktop(client, 2, false);
|
|
|
|
QCOMPARE(client->desktop(), 2);
|
|
|
|
reply = getWindowInfo(client->internalId());
|
|
|
|
reply.waitForFinished();
|
|
|
|
QCOMPARE(reply.value().value(QStringLiteral("x11DesktopNumber")).toInt(), 2);
|
|
|
|
|
Rework async geometry updates
Window management features were written with synchronous geometry
updates in mind. Currently, this poses a big problem on Wayland because
geometry updates are done in asynchronous fashion there.
At the moment, geometry is updated in a so called pseudo-asynchronous
fashion, meaning that the frame geometry will be reset to the old value
once geometry updates are unblocked. The main drawback of this approach
is that it is too error prone, the data flow is hard to comprehend, etc.
It is worth noting that there is already a machinery to perform async
geometry which is used during interactive move/resize operations.
This change extends the move/resize geometry usage beyond interactive
move/resize to make asynchronous geometry updates less error prone and
easier to comprehend.
With the proposed solution, all geometry updates must be done on the
move/resize geometry first. After that, the new geometry is passed on to
the Client-specific implementation of moveResizeInternal().
To be more specific, the frameGeometry() returns the current frame
geometry, it is primarily useful only to the scene. If you want to move
or resize a window, you need to use moveResizeGeometry() because it
corresponds to the last requested frame geometry.
It is worth noting that the moveResizeGeometry() returns the desired
bounding geometry. The client may commit the xdg_toplevel surface with a
slightly smaller window geometry, for example to enforce a specific
aspect ratio. The client is not allowed to resize beyond the size as
indicated in moveResizeGeometry().
The data flow is very simple: moveResize() updates the move/resize
geometry and calls the client-specific implementation of the
moveResizeInternal() method. Based on whether a configure event is
needed, moveResizeInternal() will update the frameGeometry() either
immediately or after the client commits a new buffer.
Unfortunately, both the compositor and xdg-shell clients try to update
the window geometry. It means that it's possible to have conflicts
between the two. With this change, the compositor's move resize geometry
will be synced only if there are no pending configure events, meaning
that the user doesn't try to resize the window.
2021-04-30 18:26:09 +00:00
|
|
|
client->move(QPoint(10, 20));
|
2018-12-08 16:06:51 +00:00
|
|
|
reply = getWindowInfo(client->internalId());
|
|
|
|
reply.waitForFinished();
|
|
|
|
QCOMPARE(reply.value().value(QStringLiteral("x")).toInt(), client->x());
|
|
|
|
QCOMPARE(reply.value().value(QStringLiteral("y")).toInt(), client->y());
|
|
|
|
// not testing width, height as that would require window geometry change
|
|
|
|
|
|
|
|
// finally close window
|
|
|
|
const auto id = client->internalId();
|
2020-03-04 07:55:26 +00:00
|
|
|
QSignalSpy windowClosedSpy(client, &AbstractClient::windowClosed);
|
2018-12-08 16:06:51 +00:00
|
|
|
QVERIFY(windowClosedSpy.isValid());
|
|
|
|
shellSurface.reset();
|
|
|
|
surface.reset();
|
|
|
|
QVERIFY(windowClosedSpy.wait());
|
|
|
|
QCOMPARE(windowClosedSpy.count(), 1);
|
|
|
|
|
|
|
|
reply = getWindowInfo(id);
|
|
|
|
reply.waitForFinished();
|
|
|
|
QVERIFY(reply.value().empty());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct XcbConnectionDeleter
|
|
|
|
{
|
|
|
|
static inline void cleanup(xcb_connection_t *pointer)
|
|
|
|
{
|
|
|
|
xcb_disconnect(pointer);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
void TestDbusInterface::testGetWindowInfoX11Client()
|
|
|
|
{
|
|
|
|
QScopedPointer<xcb_connection_t, XcbConnectionDeleter> c(xcb_connect(nullptr, nullptr));
|
|
|
|
QVERIFY(!xcb_connection_has_error(c.data()));
|
|
|
|
const QRect windowGeometry(0, 0, 600, 400);
|
|
|
|
xcb_window_t w = xcb_generate_id(c.data());
|
|
|
|
xcb_create_window(c.data(), XCB_COPY_FROM_PARENT, w, rootWindow(),
|
|
|
|
windowGeometry.x(),
|
|
|
|
windowGeometry.y(),
|
|
|
|
windowGeometry.width(),
|
|
|
|
windowGeometry.height(),
|
|
|
|
0, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_COPY_FROM_PARENT, 0, nullptr);
|
|
|
|
xcb_size_hints_t hints;
|
|
|
|
memset(&hints, 0, sizeof(hints));
|
|
|
|
xcb_icccm_size_hints_set_position(&hints, 1, windowGeometry.x(), windowGeometry.y());
|
|
|
|
xcb_icccm_size_hints_set_size(&hints, 1, windowGeometry.width(), windowGeometry.height());
|
|
|
|
xcb_icccm_set_wm_normal_hints(c.data(), w, &hints);
|
|
|
|
xcb_icccm_set_wm_class(c.data(), w, 7, "foo\0bar");
|
|
|
|
NETWinInfo winInfo(c.data(), w, rootWindow(), NET::Properties(), NET::Properties2());
|
|
|
|
winInfo.setName("Some caption");
|
|
|
|
winInfo.setDesktopFileName("org.kde.foo");
|
|
|
|
xcb_map_window(c.data(), w);
|
|
|
|
xcb_flush(c.data());
|
|
|
|
|
|
|
|
// we should get a client for it
|
|
|
|
QSignalSpy windowCreatedSpy(workspace(), &Workspace::clientAdded);
|
|
|
|
QVERIFY(windowCreatedSpy.isValid());
|
|
|
|
QVERIFY(windowCreatedSpy.wait());
|
2019-09-24 08:48:08 +00:00
|
|
|
X11Client *client = windowCreatedSpy.first().first().value<X11Client *>();
|
2018-12-08 16:06:51 +00:00
|
|
|
QVERIFY(client);
|
|
|
|
QCOMPARE(client->window(), w);
|
|
|
|
QCOMPARE(client->clientSize(), windowGeometry.size());
|
|
|
|
|
|
|
|
// let's get the window info
|
|
|
|
QDBusPendingReply<QVariantMap> reply{getWindowInfo(client->internalId())};
|
|
|
|
reply.waitForFinished();
|
|
|
|
QVERIFY(reply.isValid());
|
|
|
|
QVERIFY(!reply.isError());
|
|
|
|
auto windowData = reply.value();
|
|
|
|
QVERIFY(!windowData.isEmpty());
|
2021-02-01 07:30:58 +00:00
|
|
|
QCOMPARE(windowData.size(), 25);
|
2018-12-08 16:06:51 +00:00
|
|
|
QCOMPARE(windowData.value(QStringLiteral("type")).toInt(), NET::Normal);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("x")).toInt(), client->x());
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("y")).toInt(), client->y());
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("width")).toInt(), client->width());
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("height")).toInt(), client->height());
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("x11DesktopNumber")).toInt(), 1);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("minimized")).toBool(), false);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("shaded")).toBool(), false);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("fullscreen")).toBool(), false);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("keepAbove")).toBool(), false);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("keepBelow")).toBool(), false);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("skipTaskbar")).toBool(), false);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("skipPager")).toBool(), false);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("skipSwitcher")).toBool(), false);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("maximizeHorizontal")).toBool(), false);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("maximizeVertical")).toBool(), false);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("noBorder")).toBool(), false);
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("role")).toString(), QString());
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("resourceName")).toString(), QStringLiteral("foo"));
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("resourceClass")).toString(), QStringLiteral("bar"));
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("desktopFile")).toString(), QStringLiteral("org.kde.foo"));
|
|
|
|
QCOMPARE(windowData.value(QStringLiteral("caption")).toString(), QStringLiteral("Some caption"));
|
2021-02-01 07:30:58 +00:00
|
|
|
QCOMPARE(windowData.value(QStringLiteral("activities")), QStringList());
|
2018-12-08 16:06:51 +00:00
|
|
|
// not testing clientmachine as that is system dependent
|
2018-12-23 07:56:15 +00:00
|
|
|
// due to that also not testing localhost
|
2018-12-08 16:06:51 +00:00
|
|
|
|
|
|
|
auto verifyProperty = [client] (const QString &name) {
|
|
|
|
QDBusPendingReply<QVariantMap> reply{getWindowInfo(client->internalId())};
|
|
|
|
reply.waitForFinished();
|
|
|
|
return reply.value().value(name).toBool();
|
|
|
|
};
|
|
|
|
|
|
|
|
QVERIFY(!client->isMinimized());
|
|
|
|
client->setMinimized(true);
|
|
|
|
QVERIFY(client->isMinimized());
|
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("minimized")), true);
|
|
|
|
|
|
|
|
QVERIFY(!client->keepAbove());
|
|
|
|
client->setKeepAbove(true);
|
|
|
|
QVERIFY(client->keepAbove());
|
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("keepAbove")), true);
|
|
|
|
|
|
|
|
QVERIFY(!client->keepBelow());
|
|
|
|
client->setKeepBelow(true);
|
|
|
|
QVERIFY(client->keepBelow());
|
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("keepBelow")), true);
|
|
|
|
|
|
|
|
QVERIFY(!client->skipTaskbar());
|
|
|
|
client->setSkipTaskbar(true);
|
|
|
|
QVERIFY(client->skipTaskbar());
|
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("skipTaskbar")), true);
|
|
|
|
|
|
|
|
QVERIFY(!client->skipPager());
|
|
|
|
client->setSkipPager(true);
|
|
|
|
QVERIFY(client->skipPager());
|
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("skipPager")), true);
|
|
|
|
|
|
|
|
QVERIFY(!client->skipSwitcher());
|
|
|
|
client->setSkipSwitcher(true);
|
|
|
|
QVERIFY(client->skipSwitcher());
|
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("skipSwitcher")), true);
|
|
|
|
|
|
|
|
QVERIFY(!client->isShade());
|
|
|
|
client->setShade(ShadeNormal);
|
|
|
|
QVERIFY(client->isShade());
|
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("shaded")), true);
|
|
|
|
client->setShade(ShadeNone);
|
|
|
|
QVERIFY(!client->isShade());
|
|
|
|
|
|
|
|
QVERIFY(!client->noBorder());
|
|
|
|
client->setNoBorder(true);
|
|
|
|
QVERIFY(client->noBorder());
|
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("noBorder")), true);
|
|
|
|
client->setNoBorder(false);
|
|
|
|
QVERIFY(!client->noBorder());
|
|
|
|
|
|
|
|
QVERIFY(!client->isFullScreen());
|
|
|
|
client->setFullScreen(true);
|
|
|
|
QVERIFY(client->isFullScreen());
|
|
|
|
QVERIFY(client->clientSize() != windowGeometry.size());
|
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("fullscreen")), true);
|
|
|
|
reply = getWindowInfo(client->internalId());
|
|
|
|
reply.waitForFinished();
|
|
|
|
QCOMPARE(reply.value().value(QStringLiteral("width")).toInt(), client->width());
|
|
|
|
QCOMPARE(reply.value().value(QStringLiteral("height")).toInt(), client->height());
|
|
|
|
client->setFullScreen(false);
|
|
|
|
QVERIFY(!client->isFullScreen());
|
|
|
|
|
|
|
|
// maximize
|
|
|
|
client->setMaximize(true, false);
|
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("maximizeVertical")), true);
|
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("maximizeHorizontal")), false);
|
|
|
|
client->setMaximize(false, true);
|
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("maximizeVertical")), false);
|
|
|
|
QCOMPARE(verifyProperty(QStringLiteral("maximizeHorizontal")), true);
|
|
|
|
|
|
|
|
const auto id = client->internalId();
|
|
|
|
// destroy the window
|
|
|
|
xcb_unmap_window(c.data(), w);
|
|
|
|
xcb_flush(c.data());
|
|
|
|
|
2019-09-24 08:48:08 +00:00
|
|
|
QSignalSpy windowClosedSpy(client, &X11Client::windowClosed);
|
2018-12-08 16:06:51 +00:00
|
|
|
QVERIFY(windowClosedSpy.isValid());
|
|
|
|
QVERIFY(windowClosedSpy.wait());
|
|
|
|
xcb_destroy_window(c.data(), w);
|
|
|
|
c.reset();
|
|
|
|
|
|
|
|
reply = getWindowInfo(id);
|
|
|
|
reply.waitForFinished();
|
|
|
|
QVERIFY(reply.value().empty());
|
|
|
|
}
|
|
|
|
|
|
|
|
WAYLANDTEST_MAIN(TestDbusInterface)
|
|
|
|
#include "dbus_interface_test.moc"
|