Commit e249d087 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

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.


(cherry picked from commit faf6b8e0)
parent ba2aab2f
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment