From a17a86999b8a20db1db30671b52a95b77f8b0d4f Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 22 Jul 2020 21:35:41 +0300 Subject: [PATCH] Emit clientAdded for wayland clients Emit the clientAdded() signal also for Wayland clients in order to unify the API of the Workspace class for different client types. --- autotests/integration/dbus_interface_test.cpp | 2 +- .../integration/idle_inhibition_test.cpp | 2 +- .../integration/input_stacking_order.cpp | 2 +- autotests/integration/lockscreen.cpp | 2 +- autotests/integration/plasmawindow_test.cpp | 2 +- autotests/integration/pointer_input.cpp | 34 ++++----- autotests/integration/test_helpers.cpp | 9 ++- autotests/integration/xdgshellclient_test.cpp | 12 +-- .../integration/xwayland_selections_test.cpp | 21 +----- debug_console.cpp | 74 +++++++++---------- debug_console.h | 9 ++- effects.cpp | 6 -- pointer_input.cpp | 2 - popup_input_filter.cpp | 4 +- scripting/scripting_model.cpp | 3 - scripting/workspace_wrapper.cpp | 5 -- workspace.cpp | 1 + 17 files changed, 83 insertions(+), 107 deletions(-) diff --git a/autotests/integration/dbus_interface_test.cpp b/autotests/integration/dbus_interface_test.cpp index 1170a3a998..650553639c 100644 --- a/autotests/integration/dbus_interface_test.cpp +++ b/autotests/integration/dbus_interface_test.cpp @@ -120,7 +120,7 @@ void TestDbusInterface::testGetWindowInfoXdgShellClient_data() void TestDbusInterface::testGetWindowInfoXdgShellClient() { - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); QScopedPointer surface(Test::createSurface()); diff --git a/autotests/integration/idle_inhibition_test.cpp b/autotests/integration/idle_inhibition_test.cpp index 05e1c72c3d..fda10d70a2 100644 --- a/autotests/integration/idle_inhibition_test.cpp +++ b/autotests/integration/idle_inhibition_test.cpp @@ -260,7 +260,7 @@ void TestIdleInhibition::testDontInhibitWhenUnmapped() QVERIFY(inhibitor->isValid()); // Map the client. - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); Test::render(surface.data(), QSize(100, 50), Qt::blue); QVERIFY(clientAddedSpy.isEmpty()); diff --git a/autotests/integration/input_stacking_order.cpp b/autotests/integration/input_stacking_order.cpp index b3359408db..38b7d356a6 100644 --- a/autotests/integration/input_stacking_order.cpp +++ b/autotests/integration/input_stacking_order.cpp @@ -122,7 +122,7 @@ void InputStackingOrderTest::testPointerFocusUpdatesOnStackingOrderChange() QVERIFY(leftSpy.isValid()); // now create the two windows and make them overlap - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); Surface *surface1 = Test::createSurface(Test::waylandCompositor()); QVERIFY(surface1); diff --git a/autotests/integration/lockscreen.cpp b/autotests/integration/lockscreen.cpp index ce9fe6b272..34685df4a3 100644 --- a/autotests/integration/lockscreen.cpp +++ b/autotests/integration/lockscreen.cpp @@ -226,7 +226,7 @@ void LockScreenTest::testStackingOrder() { // This test verifies that the lockscreen greeter is placed above other windows. - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); LOCK diff --git a/autotests/integration/plasmawindow_test.cpp b/autotests/integration/plasmawindow_test.cpp index 890f0c0676..8f9bd9fbf7 100644 --- a/autotests/integration/plasmawindow_test.cpp +++ b/autotests/integration/plasmawindow_test.cpp @@ -273,7 +273,7 @@ void PlasmaWindowTest::testLockScreenNoPlasmaWindow() QVERIFY(plasmaWindowCreatedSpy.isValid()); // this time we use a QSignalSpy on XdgShellClient as it'a a little bit more complex setup - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); // lock ScreenLocker::KSldApp::self()->lock(ScreenLocker::EstablishLock::Immediate); diff --git a/autotests/integration/pointer_input.cpp b/autotests/integration/pointer_input.cpp index 6e64205f7b..f01aeb54c6 100644 --- a/autotests/integration/pointer_input.cpp +++ b/autotests/integration/pointer_input.cpp @@ -209,7 +209,7 @@ void PointerInputTest::testWarpingUpdatesFocus() QVERIFY(leftSpy.isValid()); // create a window - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); @@ -257,7 +257,7 @@ void PointerInputTest::testWarpingGeneratesPointerMotion() QVERIFY(movedSpy.isValid()); // create a window - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); @@ -297,7 +297,7 @@ void PointerInputTest::testWarpingDuringFilter() Cursors::self()->mouse()->setPos(10, 10); // create a window - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); @@ -340,7 +340,7 @@ void PointerInputTest::testUpdateFocusAfterScreenChange() QVERIFY(enteredSpy.isValid()); // create a window - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); @@ -436,7 +436,7 @@ void PointerInputTest::testModifierClickUnrestrictedMove() QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove); // create a window - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); @@ -503,7 +503,7 @@ void PointerInputTest::testModifierClickUnrestrictedMoveGlobalShortcutsDisabled( QCOMPARE(options->commandAll3(), Options::MouseUnrestrictedMove); // create a window - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); @@ -576,7 +576,7 @@ void PointerInputTest::testModifierScrollOpacity() workspace()->slotReconfigure(); // create a window - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); @@ -635,7 +635,7 @@ void PointerInputTest::testModifierScrollOpacityGlobalShortcutsDisabled() workspace()->slotReconfigure(); // create a window - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); @@ -685,7 +685,7 @@ void PointerInputTest::testScrollAction() group.sync(); workspace()->slotReconfigure(); // create two windows - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); Surface *surface1 = Test::createSurface(m_compositor); QVERIFY(surface1); @@ -745,7 +745,7 @@ void PointerInputTest::testFocusFollowsMouse() QCOMPARE(options->delayFocusInterval(), 200); // create two windows - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); Surface *surface1 = Test::createSurface(m_compositor); QVERIFY(surface1); @@ -831,7 +831,7 @@ void PointerInputTest::testMouseActionInactiveWindow() workspace()->slotReconfigure(); // create two windows - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); Surface *surface1 = Test::createSurface(m_compositor); QVERIFY(surface1); @@ -921,7 +921,7 @@ void PointerInputTest::testMouseActionActiveWindow() QCOMPARE(options->isClickRaise(), clickRaise); // create two windows - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); Surface *surface1 = Test::createSurface(m_compositor); QVERIFY(surface1); @@ -1003,7 +1003,7 @@ void PointerInputTest::testCursorImage() QVERIFY(!fallbackCursor.isNull()); // create a window - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); @@ -1104,7 +1104,7 @@ void PointerInputTest::testEffectOverrideCursorImage() QVERIFY(!fallback.isNull()); // now let's create a window - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); @@ -1180,7 +1180,7 @@ void PointerInputTest::testPopup() Cursors::self()->mouse()->setPos(800, 800); - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); @@ -1261,7 +1261,7 @@ void PointerInputTest::testDecoCancelsPopup() QVERIFY(motionSpy.isValid()); Cursors::self()->mouse()->setPos(800, 800); - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); @@ -1338,7 +1338,7 @@ void PointerInputTest::testWindowUnderCursorWhileButtonPressed() QVERIFY(leftSpy.isValid()); Cursors::self()->mouse()->setPos(800, 800); - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); Surface *surface = Test::createSurface(m_compositor); QVERIFY(surface); diff --git a/autotests/integration/test_helpers.cpp b/autotests/integration/test_helpers.cpp index fb0d12087c..0f3fcb83c8 100644 --- a/autotests/integration/test_helpers.cpp +++ b/autotests/integration/test_helpers.cpp @@ -21,6 +21,7 @@ along with this program. If not, see . #include "abstract_client.h" #include "screenlockerwatcher.h" #include "wayland_server.h" +#include "workspace.h" #include #include @@ -64,7 +65,7 @@ namespace Test static struct { ConnectionThread *connection = nullptr; EventQueue *queue = nullptr; - Compositor *compositor = nullptr; + KWayland::Client::Compositor *compositor = nullptr; SubCompositor *subCompositor = nullptr; ServerSideDecorationManager *decoration = nullptr; ShadowManager *shadowManager = nullptr; @@ -283,7 +284,7 @@ ConnectionThread *waylandConnection() return s_waylandConnection.connection; } -Compositor *waylandCompositor() +KWayland::Client::Compositor *waylandCompositor() { return s_waylandConnection.compositor; } @@ -401,7 +402,7 @@ void render(Surface *surface, const QImage &img) AbstractClient *waitForWaylandWindowShown(int timeout) { - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); if (!clientAddedSpy.isValid()) { return nullptr; } @@ -413,7 +414,7 @@ AbstractClient *waitForWaylandWindowShown(int timeout) AbstractClient *renderAndWaitForShown(Surface *surface, const QSize &size, const QColor &color, const QImage::Format &format, int timeout) { - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); if (!clientAddedSpy.isValid()) { return nullptr; } diff --git a/autotests/integration/xdgshellclient_test.cpp b/autotests/integration/xdgshellclient_test.cpp index ed74211572..e0cc420fbe 100644 --- a/autotests/integration/xdgshellclient_test.cpp +++ b/autotests/integration/xdgshellclient_test.cpp @@ -171,7 +171,7 @@ void TestXdgShellClient::testMapUnmap() QScopedPointer shellSurface( Test::createXdgShellStableSurface(surface.data(), nullptr, Test::CreationSetup::CreateOnly)); - QSignalSpy clientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); QSignalSpy configureRequestedSpy(shellSurface.data(), &XdgShellSurface::configureRequested); @@ -878,8 +878,8 @@ void TestXdgShellClient::testUnresponsiveWindow() // for this an external binary is launched const QString kill = QFINDTESTDATA(QStringLiteral("kill")); QVERIFY(!kill.isEmpty()); - QSignalSpy shellClientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); - QVERIFY(shellClientAddedSpy.isValid()); + QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); + QVERIFY(clientAddedSpy.isValid()); QScopedPointer process(new QProcess); QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); @@ -907,12 +907,12 @@ void TestXdgShellClient::testUnresponsiveWindow() QVERIFY(processStartedSpy.wait()); AbstractClient *killClient = nullptr; - if (shellClientAddedSpy.isEmpty()) { - QVERIFY(shellClientAddedSpy.wait()); + if (clientAddedSpy.isEmpty()) { + QVERIFY(clientAddedSpy.wait()); } ::kill(process->processId(), SIGUSR1); // send a signal to freeze the process - killClient = shellClientAddedSpy.first().first().value(); + killClient = clientAddedSpy.first().first().value(); QVERIFY(killClient); QSignalSpy unresponsiveSpy(killClient, &AbstractClient::unresponsiveChanged); QSignalSpy killedSpy(process.data(), static_cast(&QProcess::finished)); diff --git a/autotests/integration/xwayland_selections_test.cpp b/autotests/integration/xwayland_selections_test.cpp index 8d7298dd4c..5c27944eb3 100644 --- a/autotests/integration/xwayland_selections_test.cpp +++ b/autotests/integration/xwayland_selections_test.cpp @@ -112,8 +112,6 @@ void XwaylandSelectionsTest::testSync() QSignalSpy clientAddedSpy(workspace(), &Workspace::clientAdded); QVERIFY(clientAddedSpy.isValid()); - QSignalSpy shellClientAddedSpy(waylandServer(), &WaylandServer::shellClientAdded); - QVERIFY(shellClientAddedSpy.isValid()); QSignalSpy clipboardChangedSpy(Xwl::DataBridge::self()->dataDeviceIface(), &KWaylandServer::DataDeviceInterface::selectionChanged); QVERIFY(clipboardChangedSpy.isValid()); @@ -131,13 +129,8 @@ void XwaylandSelectionsTest::testSync() QVERIFY(m_copyProcess->waitForStarted()); AbstractClient *copyClient = nullptr; - if (copyPlatform == QLatin1String("xcb")) { - QVERIFY(clientAddedSpy.wait()); - copyClient = clientAddedSpy.first().first().value(); - } else { - QVERIFY(shellClientAddedSpy.wait()); - copyClient = shellClientAddedSpy.first().first().value(); - } + QVERIFY(clientAddedSpy.wait()); + copyClient = clientAddedSpy.first().first().value(); QVERIFY(copyClient); if (workspace()->activeClient() != copyClient) { workspace()->activateClient(copyClient); @@ -166,15 +159,9 @@ void XwaylandSelectionsTest::testSync() QVERIFY(m_pasteProcess->waitForStarted()); AbstractClient *pasteClient = nullptr; - if (pastePlatform == QLatin1String("xcb")) { - QVERIFY(clientAddedSpy.wait()); - pasteClient = clientAddedSpy.last().first().value(); - } else { - QVERIFY(shellClientAddedSpy.wait()); - pasteClient = shellClientAddedSpy.last().first().value(); - } + QVERIFY(clientAddedSpy.wait()); + pasteClient = clientAddedSpy.last().first().value(); QCOMPARE(clientAddedSpy.count(), 1); - QCOMPARE(shellClientAddedSpy.count(), 1); QVERIFY(pasteClient); if (workspace()->activeClient() != pasteClient) { diff --git a/debug_console.cpp b/debug_console.cpp index e2985197bb..708522b149 100644 --- a/debug_console.cpp +++ b/debug_console.cpp @@ -25,6 +25,7 @@ along with this program. If not, see . #include "main.h" #include "scene.h" #include "unmanaged.h" +#include "waylandclient.h" #include "wayland_server.h" #include "workspace.h" #include "keyboard_input.h" @@ -876,40 +877,15 @@ DebugConsoleModel::DebugConsoleModel(QObject *parent) if (waylandServer()) { const auto clients = waylandServer()->clients(); for (auto c : clients) { - m_waylandClients.append(c); + handleClientAdded(c); } - // TODO: that only includes windows getting shown, not those which are only created - connect(waylandServer(), &WaylandServer::shellClientAdded, this, - [this] (AbstractClient *c) { - add(s_waylandClientId -1, m_waylandClients, c); - } - ); - connect(waylandServer(), &WaylandServer::shellClientRemoved, this, - [this] (AbstractClient *c) { - remove(s_waylandClientId -1, m_waylandClients, c); - } - ); } const auto x11Clients = workspace()->clientList(); for (auto c : x11Clients) { - m_x11Clients.append(c); + handleClientAdded(c); } - connect(workspace(), &Workspace::clientAdded, this, - [this] (AbstractClient *client) { - if (X11Client *x11Client = qobject_cast(client)) { - add(s_x11ClientId -1, m_x11Clients, x11Client); - } - } - ); - connect(workspace(), &Workspace::clientRemoved, this, - [this] (AbstractClient *ac) { - X11Client *c = qobject_cast(ac); - if (!c) { - return; - } - remove(s_x11ClientId -1, m_x11Clients, c); - } - ); + connect(workspace(), &Workspace::clientAdded, this, &DebugConsoleModel::handleClientAdded); + connect(workspace(), &Workspace::clientRemoved, this, &DebugConsoleModel::handleClientRemoved); const auto unmangeds = workspace()->unmanagedList(); for (auto u : unmangeds) { @@ -940,6 +916,36 @@ DebugConsoleModel::DebugConsoleModel(QObject *parent) ); } +void DebugConsoleModel::handleClientAdded(AbstractClient *client) +{ + X11Client *x11Client = qobject_cast(client); + if (x11Client) { + add(s_x11ClientId - 1, m_x11Clients, x11Client); + return; + } + + WaylandClient *waylandClient = qobject_cast(client); + if (waylandClient) { + add(s_waylandClientId - 1, m_waylandClients, waylandClient); + return; + } +} + +void DebugConsoleModel::handleClientRemoved(AbstractClient *client) +{ + X11Client *x11Client = qobject_cast(client); + if (x11Client) { + remove(s_x11ClientId - 1, m_x11Clients, x11Client); + return; + } + + WaylandClient *waylandClient = qobject_cast(client); + if (waylandClient) { + remove(s_waylandClientId - 1, m_waylandClients, waylandClient); + return; + } +} + DebugConsoleModel::~DebugConsoleModel() = default; int DebugConsoleModel::columnCount(const QModelIndex &parent) const @@ -1241,7 +1247,7 @@ static T *clientForIndex(const QModelIndex &index, const QVector &clients, i return clients.at(row); } -AbstractClient *DebugConsoleModel::waylandClient(const QModelIndex &index) const +WaylandClient *DebugConsoleModel::waylandClient(const QModelIndex &index) const { return clientForIndex(index, m_waylandClients, s_waylandClientId); } @@ -1285,14 +1291,6 @@ SurfaceTreeModel::SurfaceTreeModel(QObject *parent) } connect(c->surface(), &SurfaceInterface::subSurfaceTreeChanged, this, reset); } - if (waylandServer()) { - connect(waylandServer(), &WaylandServer::shellClientAdded, this, - [this, reset] (AbstractClient *c) { - connect(c->surface(), &SurfaceInterface::subSurfaceTreeChanged, this, reset); - reset(); - } - ); - } connect(workspace(), &Workspace::clientAdded, this, [this, reset] (AbstractClient *c) { if (c->surface()) { diff --git a/debug_console.h b/debug_console.h index ba758c83ec..cd05947966 100644 --- a/debug_console.h +++ b/debug_console.h @@ -44,6 +44,7 @@ class X11Client; class InternalClient; class Unmanaged; class DebugConsoleFilter; +class WaylandClient; class KWIN_EXPORT DebugConsoleModel : public QAbstractItemModel { @@ -59,6 +60,10 @@ public: int rowCount(const QModelIndex &parent) const override; QModelIndex parent(const QModelIndex &child) const override; +private Q_SLOTS: + void handleClientAdded(AbstractClient *client); + void handleClientRemoved(AbstractClient *client); + private: template QModelIndex indexForClient(int row, int column, const QVector &clients, int id) const; @@ -73,13 +78,13 @@ private: void add(int parentRow, QVector &clients, T *client); template void remove(int parentRow, QVector &clients, T *client); - AbstractClient *waylandClient(const QModelIndex &index) const; + WaylandClient *waylandClient(const QModelIndex &index) const; InternalClient *internalClient(const QModelIndex &index) const; X11Client *x11Client(const QModelIndex &index) const; Unmanaged *unmanaged(const QModelIndex &index) const; int topLevelRowCount() const; - QVector m_waylandClients; + QVector m_waylandClients; QVector m_internalClients; QVector m_x11Clients; QVector m_unmanageds; diff --git a/effects.cpp b/effects.cpp index 78adbc316d..79cb667a0b 100644 --- a/effects.cpp +++ b/effects.cpp @@ -258,12 +258,6 @@ EffectsHandlerImpl::EffectsHandlerImpl(Compositor *compositor, Scene *scene) setupClientConnections(client); } if (auto w = waylandServer()) { - connect(w, &WaylandServer::shellClientAdded, this, [this](AbstractClient *c) { - if (c->readyForPainting()) - slotClientShown(c); - else - connect(c, &Toplevel::windowShown, this, &EffectsHandlerImpl::slotClientShown); - }); const auto clients = waylandServer()->clients(); for (AbstractClient *c : clients) { if (c->readyForPainting()) { diff --git a/pointer_input.cpp b/pointer_input.cpp index c79aa0b59c..0098b68dad 100644 --- a/pointer_input.cpp +++ b/pointer_input.cpp @@ -163,7 +163,6 @@ void PointerInputRedirection::init() const auto clients = workspace()->allClientList(); std::for_each(clients.begin(), clients.end(), setupMoveResizeConnection); connect(workspace(), &Workspace::clientAdded, this, setupMoveResizeConnection); - connect(waylandServer(), &WaylandServer::shellClientAdded, this, setupMoveResizeConnection); // warp the cursor to center of screen warp(screens()->geometry().center()); @@ -964,7 +963,6 @@ CursorImage::CursorImage(PointerInputRedirection *parent) const auto clients = workspace()->allClientList(); std::for_each(clients.begin(), clients.end(), setupMoveResizeConnection); connect(workspace(), &Workspace::clientAdded, this, setupMoveResizeConnection); - connect(waylandServer(), &WaylandServer::shellClientAdded, this, setupMoveResizeConnection); loadThemeCursor(Qt::ArrowCursor, &m_fallbackCursor); m_surfaceRenderedTimer.start(); diff --git a/popup_input_filter.cpp b/popup_input_filter.cpp index 769519c8da..0e8a0a55f0 100644 --- a/popup_input_filter.cpp +++ b/popup_input_filter.cpp @@ -21,7 +21,7 @@ #include "popup_input_filter.h" #include "abstract_client.h" #include "deleted.h" -#include "wayland_server.h" +#include "workspace.h" #include @@ -31,7 +31,7 @@ namespace KWin PopupInputFilter::PopupInputFilter() : QObject() { - connect(waylandServer(), &WaylandServer::shellClientAdded, this, &PopupInputFilter::handleClientAdded); + connect(workspace(), &Workspace::clientAdded, this, &PopupInputFilter::handleClientAdded); } void PopupInputFilter::handleClientAdded(Toplevel *client) diff --git a/scripting/scripting_model.cpp b/scripting/scripting_model.cpp index 199c2ebd01..22cf61f418 100644 --- a/scripting/scripting_model.cpp +++ b/scripting/scripting_model.cpp @@ -47,9 +47,6 @@ ClientLevel::ClientLevel(ClientModel *model, AbstractLevel *parent) connect(Workspace::self(), &Workspace::clientAdded, this, &ClientLevel::clientAdded); connect(Workspace::self(), &Workspace::clientRemoved, this, &ClientLevel::clientRemoved); connect(model, SIGNAL(exclusionsChanged()), SLOT(reInit())); - if (waylandServer()) { - connect(waylandServer(), &WaylandServer::shellClientAdded, this, &ClientLevel::clientAdded); - } } ClientLevel::~ClientLevel() diff --git a/scripting/workspace_wrapper.cpp b/scripting/workspace_wrapper.cpp index 6530986d40..00360f97d2 100644 --- a/scripting/workspace_wrapper.cpp +++ b/scripting/workspace_wrapper.cpp @@ -23,7 +23,6 @@ along with this program. If not, see . #include "../x11client.h" #include "../outline.h" #include "../screens.h" -#include "../xdgshellclient.h" #include "../virtualdesktops.h" #include "../wayland_server.h" #include "../workspace.h" @@ -67,10 +66,6 @@ WorkspaceWrapper::WorkspaceWrapper(QObject* parent) : QObject(parent) } ); connect(QApplication::desktop(), SIGNAL(resized(int)), SIGNAL(screenResized(int))); - if (waylandServer()) { - connect(waylandServer(), &WaylandServer::shellClientAdded, this, &WorkspaceWrapper::clientAdded); - connect(waylandServer(), &WaylandServer::shellClientAdded, this, &WorkspaceWrapper::setupClientConnections); - } foreach (KWin::X11Client *client, ws->clientList()) { setupClientConnections(client); } diff --git a/workspace.cpp b/workspace.cpp index f901166709..ab6583ae41 100644 --- a/workspace.cpp +++ b/workspace.cpp @@ -752,6 +752,7 @@ void Workspace::addShellClient(AbstractClient *client) updateStackingOrder(true); updateClientArea(); }); + emit clientAdded(client); } void Workspace::removeShellClient(AbstractClient *client)