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.
master
Vlad Zahorodnii 2020-10-01 10:54:01 +03:00
parent a3caf7f6dd
commit faf6b8e049
1 changed files with 4 additions and 10 deletions

View File

@ -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<X11Client *> &clients = Workspace::self()->clientList();
const QList<AbstractClient *> &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<X11Client *> &clients = Workspace::self()->clientList();
const QList<AbstractClient *> &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