2020-08-02 22:22:19 +00:00
|
|
|
/*
|
|
|
|
KWin - the KDE window manager
|
|
|
|
This file is part of the KDE project.
|
2017-10-01 09:01:55 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-FileCopyrightText: 2017 Martin Flöser <mgraesslin@kde.org>
|
2017-10-01 09:01:55 +00:00
|
|
|
|
2020-08-02 22:22:19 +00:00
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2017-10-01 09:01:55 +00:00
|
|
|
#include "kwin_wayland_test.h"
|
2022-03-23 10:13:38 +00:00
|
|
|
|
2022-08-29 07:55:49 +00:00
|
|
|
#include "core/platform.h"
|
2017-10-01 09:01:55 +00:00
|
|
|
#include "main.h"
|
|
|
|
#include "virtualdesktops.h"
|
2021-08-28 18:58:29 +00:00
|
|
|
#include "wayland_server.h"
|
2022-04-22 17:39:12 +00:00
|
|
|
#include "window.h"
|
2021-08-28 18:58:29 +00:00
|
|
|
#include "workspace.h"
|
2017-10-01 09:01:55 +00:00
|
|
|
|
|
|
|
#include <KWayland/Client/surface.h>
|
|
|
|
|
|
|
|
using namespace KWin;
|
|
|
|
using namespace KWayland::Client;
|
|
|
|
|
|
|
|
static const QString s_socketName = QStringLiteral("wayland_test_kwin_virtualdesktop-0");
|
|
|
|
|
|
|
|
class VirtualDesktopTest : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
private Q_SLOTS:
|
|
|
|
void initTestCase();
|
|
|
|
void init();
|
|
|
|
void cleanup();
|
|
|
|
|
2018-02-25 16:07:25 +00:00
|
|
|
void testNetCurrentDesktop();
|
2017-10-01 09:01:55 +00:00
|
|
|
void testLastDesktopRemoved();
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
void testWindowOnMultipleDesktops();
|
|
|
|
void testRemoveDesktopWithWindow();
|
2017-10-01 09:01:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
void VirtualDesktopTest::initTestCase()
|
|
|
|
{
|
2022-04-22 17:39:12 +00:00
|
|
|
qRegisterMetaType<KWin::Window *>();
|
2020-07-07 09:32:29 +00:00
|
|
|
QSignalSpy applicationStartedSpy(kwinApp(), &Application::started);
|
|
|
|
QVERIFY(applicationStartedSpy.isValid());
|
2017-10-01 09:01:55 +00:00
|
|
|
kwinApp()->platform()->setInitialWindowSize(QSize(1280, 1024));
|
2020-12-09 13:06:15 +00:00
|
|
|
QVERIFY(waylandServer()->init(s_socketName));
|
2017-10-01 09:01:55 +00:00
|
|
|
|
|
|
|
kwinApp()->setConfig(KSharedConfig::openConfig(QString(), KConfig::SimpleConfig));
|
|
|
|
qputenv("KWIN_XKB_DEFAULT_KEYMAP", "1");
|
|
|
|
qputenv("XKB_DEFAULT_RULES", "evdev");
|
|
|
|
|
|
|
|
kwinApp()->start();
|
2020-07-07 09:32:29 +00:00
|
|
|
QVERIFY(applicationStartedSpy.wait());
|
2018-02-25 16:07:25 +00:00
|
|
|
|
|
|
|
if (kwinApp()->x11Connection()) {
|
|
|
|
// verify the current desktop x11 property on startup, see BUG: 391034
|
|
|
|
Xcb::Atom currentDesktopAtom("_NET_CURRENT_DESKTOP");
|
|
|
|
QVERIFY(currentDesktopAtom.isValid());
|
|
|
|
Xcb::Property currentDesktop(0, kwinApp()->x11RootWindow(), currentDesktopAtom, XCB_ATOM_CARDINAL, 0, 1);
|
|
|
|
bool ok = true;
|
|
|
|
QCOMPARE(currentDesktop.value(0, &ok), 0);
|
|
|
|
QVERIFY(ok);
|
|
|
|
}
|
2017-10-01 09:01:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void VirtualDesktopTest::init()
|
|
|
|
{
|
|
|
|
QVERIFY(Test::setupWaylandConnection());
|
2021-08-28 18:58:29 +00:00
|
|
|
workspace()->setActiveOutput(QPoint(640, 512));
|
2017-10-01 09:01:55 +00:00
|
|
|
VirtualDesktopManager::self()->setCount(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void VirtualDesktopTest::cleanup()
|
|
|
|
{
|
|
|
|
Test::destroyWaylandConnection();
|
|
|
|
}
|
|
|
|
|
2018-02-25 16:07:25 +00:00
|
|
|
void VirtualDesktopTest::testNetCurrentDesktop()
|
|
|
|
{
|
|
|
|
if (!kwinApp()->x11Connection()) {
|
|
|
|
QSKIP("Skipped on Wayland only");
|
|
|
|
}
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->count(), 1u);
|
|
|
|
VirtualDesktopManager::self()->setCount(4);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->count(), 4u);
|
|
|
|
|
|
|
|
Xcb::Atom currentDesktopAtom("_NET_CURRENT_DESKTOP");
|
|
|
|
QVERIFY(currentDesktopAtom.isValid());
|
|
|
|
Xcb::Property currentDesktop(0, kwinApp()->x11RootWindow(), currentDesktopAtom, XCB_ATOM_CARDINAL, 0, 1);
|
|
|
|
bool ok = true;
|
|
|
|
QCOMPARE(currentDesktop.value(0, &ok), 0);
|
|
|
|
QVERIFY(ok);
|
|
|
|
|
|
|
|
// go to desktop 2
|
|
|
|
VirtualDesktopManager::self()->setCurrent(2);
|
|
|
|
currentDesktop = Xcb::Property(0, kwinApp()->x11RootWindow(), currentDesktopAtom, XCB_ATOM_CARDINAL, 0, 1);
|
|
|
|
QCOMPARE(currentDesktop.value(0, &ok), 1);
|
|
|
|
QVERIFY(ok);
|
|
|
|
|
|
|
|
// go to desktop 3
|
|
|
|
VirtualDesktopManager::self()->setCurrent(3);
|
|
|
|
currentDesktop = Xcb::Property(0, kwinApp()->x11RootWindow(), currentDesktopAtom, XCB_ATOM_CARDINAL, 0, 1);
|
|
|
|
QCOMPARE(currentDesktop.value(0, &ok), 2);
|
|
|
|
QVERIFY(ok);
|
|
|
|
|
|
|
|
// go to desktop 4
|
|
|
|
VirtualDesktopManager::self()->setCurrent(4);
|
|
|
|
currentDesktop = Xcb::Property(0, kwinApp()->x11RootWindow(), currentDesktopAtom, XCB_ATOM_CARDINAL, 0, 1);
|
|
|
|
QCOMPARE(currentDesktop.value(0, &ok), 3);
|
|
|
|
QVERIFY(ok);
|
|
|
|
|
|
|
|
// and back to first
|
|
|
|
VirtualDesktopManager::self()->setCurrent(1);
|
|
|
|
currentDesktop = Xcb::Property(0, kwinApp()->x11RootWindow(), currentDesktopAtom, XCB_ATOM_CARDINAL, 0, 1);
|
|
|
|
QCOMPARE(currentDesktop.value(0, &ok), 0);
|
|
|
|
QVERIFY(ok);
|
|
|
|
}
|
|
|
|
|
2017-10-01 09:01:55 +00:00
|
|
|
void VirtualDesktopTest::testLastDesktopRemoved()
|
|
|
|
{
|
|
|
|
// first create a new desktop
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->count(), 1u);
|
|
|
|
VirtualDesktopManager::self()->setCount(2);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->count(), 2u);
|
|
|
|
|
|
|
|
// switch to last desktop
|
|
|
|
VirtualDesktopManager::self()->setCurrent(VirtualDesktopManager::self()->desktops().last());
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 2u);
|
|
|
|
|
|
|
|
// now create a window on this desktop
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
|
|
|
|
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
|
|
|
|
auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
2017-10-01 09:01:55 +00:00
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(window);
|
|
|
|
QCOMPARE(window->desktop(), 2);
|
|
|
|
QSignalSpy desktopPresenceChangedSpy(window, &Window::desktopPresenceChanged);
|
2017-10-01 09:01:55 +00:00
|
|
|
QVERIFY(desktopPresenceChangedSpy.isValid());
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
QCOMPARE(window->desktops().count(), 1u);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->currentDesktop(), window->desktops().first());
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
|
2017-10-01 09:01:55 +00:00
|
|
|
// and remove last desktop
|
|
|
|
VirtualDesktopManager::self()->setCount(1);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->count(), 1u);
|
2022-04-23 19:51:16 +00:00
|
|
|
// now the window should be moved as well
|
2017-10-01 09:01:55 +00:00
|
|
|
QTRY_COMPARE(desktopPresenceChangedSpy.count(), 1);
|
2022-04-23 19:51:16 +00:00
|
|
|
QCOMPARE(window->desktop(), 1);
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
QCOMPARE(window->desktops().count(), 1u);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->currentDesktop(), window->desktops().first());
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void VirtualDesktopTest::testWindowOnMultipleDesktops()
|
|
|
|
{
|
|
|
|
// first create two new desktops
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->count(), 1u);
|
|
|
|
VirtualDesktopManager::self()->setCount(3);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->count(), 3u);
|
|
|
|
|
|
|
|
// switch to last desktop
|
|
|
|
VirtualDesktopManager::self()->setCurrent(VirtualDesktopManager::self()->desktops().last());
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 3u);
|
|
|
|
|
|
|
|
// now create a window on this desktop
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
|
|
|
|
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
|
|
|
|
auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(window);
|
|
|
|
QCOMPARE(window->desktop(), 3u);
|
|
|
|
QSignalSpy desktopPresenceChangedSpy(window, &Window::desktopPresenceChanged);
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
QVERIFY(desktopPresenceChangedSpy.isValid());
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
QCOMPARE(window->desktops().count(), 1u);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->currentDesktop(), window->desktops().first());
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
// Set the window on desktop 2 as well
|
2022-04-23 19:51:16 +00:00
|
|
|
window->enterDesktop(VirtualDesktopManager::self()->desktopForX11Id(2));
|
|
|
|
QCOMPARE(window->desktops().count(), 2u);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->desktops()[2], window->desktops()[0]);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->desktops()[1], window->desktops()[1]);
|
|
|
|
QVERIFY(window->isOnDesktop(2));
|
|
|
|
QVERIFY(window->isOnDesktop(3));
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
// leave desktop 3
|
2022-04-23 19:51:16 +00:00
|
|
|
window->leaveDesktop(VirtualDesktopManager::self()->desktopForX11Id(3));
|
|
|
|
QCOMPARE(window->desktops().count(), 1u);
|
2022-03-23 10:13:38 +00:00
|
|
|
// leave desktop 2
|
2022-04-23 19:51:16 +00:00
|
|
|
window->leaveDesktop(VirtualDesktopManager::self()->desktopForX11Id(2));
|
|
|
|
QCOMPARE(window->desktops().count(), 0u);
|
2022-03-23 10:13:38 +00:00
|
|
|
// we should be on all desktops now
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(window->isOnAllDesktops());
|
2022-03-23 10:13:38 +00:00
|
|
|
// put on desktop 1
|
2022-04-23 19:51:16 +00:00
|
|
|
window->enterDesktop(VirtualDesktopManager::self()->desktopForX11Id(1));
|
|
|
|
QVERIFY(window->isOnDesktop(1));
|
|
|
|
QVERIFY(!window->isOnDesktop(2));
|
|
|
|
QVERIFY(!window->isOnDesktop(3));
|
|
|
|
QCOMPARE(window->desktops().count(), 1u);
|
2022-03-23 10:13:38 +00:00
|
|
|
// put on desktop 2
|
2022-04-23 19:51:16 +00:00
|
|
|
window->enterDesktop(VirtualDesktopManager::self()->desktopForX11Id(2));
|
|
|
|
QVERIFY(window->isOnDesktop(1));
|
|
|
|
QVERIFY(window->isOnDesktop(2));
|
|
|
|
QVERIFY(!window->isOnDesktop(3));
|
|
|
|
QCOMPARE(window->desktops().count(), 2u);
|
2022-03-23 10:13:38 +00:00
|
|
|
// put on desktop 3
|
2022-04-23 19:51:16 +00:00
|
|
|
window->enterDesktop(VirtualDesktopManager::self()->desktopForX11Id(3));
|
|
|
|
QVERIFY(window->isOnDesktop(1));
|
|
|
|
QVERIFY(window->isOnDesktop(2));
|
|
|
|
QVERIFY(window->isOnDesktop(3));
|
|
|
|
QCOMPARE(window->desktops().count(), 3u);
|
2018-11-13 16:18:46 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
// entering twice dooes nothing
|
2022-04-23 19:51:16 +00:00
|
|
|
window->enterDesktop(VirtualDesktopManager::self()->desktopForX11Id(3));
|
|
|
|
QCOMPARE(window->desktops().count(), 3u);
|
2018-11-13 16:18:46 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
// adding to "all desktops" results in just that one desktop
|
2022-04-23 19:51:16 +00:00
|
|
|
window->setOnAllDesktops(true);
|
|
|
|
QCOMPARE(window->desktops().count(), 0u);
|
|
|
|
window->enterDesktop(VirtualDesktopManager::self()->desktopForX11Id(3));
|
|
|
|
QVERIFY(window->isOnDesktop(3));
|
|
|
|
QCOMPARE(window->desktops().count(), 1u);
|
2018-11-13 16:18:46 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
// leaving a desktop on "all desktops" puts on everything else
|
2022-04-23 19:51:16 +00:00
|
|
|
window->setOnAllDesktops(true);
|
|
|
|
QCOMPARE(window->desktops().count(), 0u);
|
|
|
|
window->leaveDesktop(VirtualDesktopManager::self()->desktopForX11Id(3));
|
|
|
|
QVERIFY(window->isOnDesktop(1));
|
|
|
|
QVERIFY(window->isOnDesktop(2));
|
|
|
|
QCOMPARE(window->desktops().count(), 2u);
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void VirtualDesktopTest::testRemoveDesktopWithWindow()
|
|
|
|
{
|
|
|
|
// first create two new desktops
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->count(), 1u);
|
|
|
|
VirtualDesktopManager::self()->setCount(3);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->count(), 3u);
|
|
|
|
|
|
|
|
// switch to last desktop
|
|
|
|
VirtualDesktopManager::self()->setCurrent(VirtualDesktopManager::self()->desktops().last());
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->current(), 3u);
|
|
|
|
|
|
|
|
// now create a window on this desktop
|
2022-08-01 21:29:02 +00:00
|
|
|
std::unique_ptr<KWayland::Client::Surface> surface(Test::createSurface());
|
|
|
|
std::unique_ptr<Test::XdgToplevel> shellSurface(Test::createXdgToplevelSurface(surface.get()));
|
|
|
|
auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
QVERIFY(window);
|
|
|
|
QCOMPARE(window->desktop(), 3u);
|
|
|
|
QSignalSpy desktopPresenceChangedSpy(window, &Window::desktopPresenceChanged);
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
QVERIFY(desktopPresenceChangedSpy.isValid());
|
|
|
|
|
2022-04-23 19:51:16 +00:00
|
|
|
QCOMPARE(window->desktops().count(), 1u);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->currentDesktop(), window->desktops().first());
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
// Set the window on desktop 2 as well
|
2022-04-23 19:51:16 +00:00
|
|
|
window->enterDesktop(VirtualDesktopManager::self()->desktops()[1]);
|
|
|
|
QCOMPARE(window->desktops().count(), 2u);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->desktops()[2], window->desktops()[0]);
|
|
|
|
QCOMPARE(VirtualDesktopManager::self()->desktops()[1], window->desktops()[1]);
|
|
|
|
QVERIFY(window->isOnDesktop(2));
|
|
|
|
QVERIFY(window->isOnDesktop(3));
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
// remove desktop 3
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
VirtualDesktopManager::self()->setCount(2);
|
2022-04-23 19:51:16 +00:00
|
|
|
QCOMPARE(window->desktops().count(), 1u);
|
2022-03-23 10:13:38 +00:00
|
|
|
// window is only on desktop 2
|
2022-04-23 19:51:16 +00:00
|
|
|
QCOMPARE(VirtualDesktopManager::self()->desktops()[1], window->desktops()[0]);
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
// Again 3 desktops
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
VirtualDesktopManager::self()->setCount(3);
|
2022-03-23 10:13:38 +00:00
|
|
|
// move window to be only on desktop 3
|
2022-04-23 19:51:16 +00:00
|
|
|
window->enterDesktop(VirtualDesktopManager::self()->desktops()[2]);
|
|
|
|
window->leaveDesktop(VirtualDesktopManager::self()->desktops()[1]);
|
|
|
|
QCOMPARE(window->desktops().count(), 1u);
|
2022-03-23 10:13:38 +00:00
|
|
|
// window is only on desktop 3
|
2022-04-23 19:51:16 +00:00
|
|
|
QCOMPARE(VirtualDesktopManager::self()->desktops()[2], window->desktops()[0]);
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
|
2022-03-23 10:13:38 +00:00
|
|
|
// remove desktop 3
|
[wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)
Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)
Test Plan: used a bit a plasma session together with D12820, D13748 and D13746
Reviewers: #plasma, #kwin, graesslin, davidedmundson
Reviewed By: #plasma, #kwin, davidedmundson
Subscribers: hein, zzag, davidedmundson, kwin
Tags: #kwin
Maniphest Tasks: T4457
Differential Revision: https://phabricator.kde.org/D13887
2018-10-29 22:29:15 +00:00
|
|
|
VirtualDesktopManager::self()->setCount(2);
|
2022-04-23 19:51:16 +00:00
|
|
|
QCOMPARE(window->desktops().count(), 1u);
|
2022-03-23 10:13:38 +00:00
|
|
|
// window is only on desktop 2
|
2022-04-23 19:51:16 +00:00
|
|
|
QCOMPARE(VirtualDesktopManager::self()->desktops()[1], window->desktops()[0]);
|
2017-10-01 09:01:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
WAYLANDTEST_MAIN(VirtualDesktopTest)
|
|
|
|
#include "virtual_desktop_test.moc"
|