From faf6b8e04923b8c1b8368d6e41cd717506cbe491 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 1 Oct 2020 10:54:01 +0300 Subject: [PATCH] scripting: Properly initialize clients model for Wayland windows In some cases, a ClientLevel model may not contain all Wayland windows because of missing if (waylandServer()) {} code path in init() method. --- scripting/scripting_model.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/scripting/scripting_model.cpp b/scripting/scripting_model.cpp index ac8195526c..870b905b7e 100644 --- a/scripting/scripting_model.cpp +++ b/scripting/scripting_model.cpp @@ -13,8 +13,8 @@ #endif #include "x11client.h" #include "screens.h" +#include "virtualdesktops.h" #include "workspace.h" -#include "wayland_server.h" namespace KWin { namespace ScriptingClientModel { @@ -193,9 +193,9 @@ void ClientLevel::removeClient(AbstractClient *client) void ClientLevel::init() { - const QList &clients = Workspace::self()->clientList(); + const QList &clients = workspace()->allClientList(); for (auto it = clients.begin(); it != clients.end(); ++it) { - X11Client *client = *it; + AbstractClient *client = *it; setupClientConnections(client); if (!exclude(client) && shouldAdd(client)) { m_clients.insert(nextId(), client); @@ -205,16 +205,10 @@ void ClientLevel::init() void ClientLevel::reInit() { - const QList &clients = Workspace::self()->clientList(); + const QList &clients = workspace()->allClientList(); for (auto it = clients.begin(); it != clients.end(); ++it) { checkClient((*it)); } - if (waylandServer()) { - const auto &clients = waylandServer()->clients(); - for (auto *c : clients) { - checkClient(c); - } - } } quint32 ClientLevel::idForRow(int row) const