[scripting] Add support for ShellClients in ScriptingClientModel

This commit is contained in:
Martin Gräßlin 2015-06-06 19:05:14 +02:00
parent 1d9769af1f
commit b196ad7052

View file

@ -25,6 +25,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "client.h"
#include "screens.h"
#include "workspace.h"
#if HAVE_WAYLAND
#include "shell_client.h"
#include "wayland_server.h"
#endif
namespace KWin {
namespace ScriptingClientModel {
@ -40,6 +44,11 @@ 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 HAVE_WAYLAND
if (waylandServer()) {
connect(waylandServer(), &WaylandServer::shellClientAdded, this, &ClientLevel::clientAdded);
}
#endif
}
ClientLevel::~ClientLevel()
@ -105,7 +114,6 @@ bool ClientLevel::exclude(AbstractClient *client) const
return true;
}
}
#if 0
if (exclusions & ClientModel::SkipTaskbarExclusion) {
if (client->skipTaskbar()) {
return true;
@ -116,7 +124,6 @@ bool ClientLevel::exclude(AbstractClient *client) const
return true;
}
}
#endif
if (exclusions & ClientModel::SwitchSwitcherExclusion) {
if (client->skipSwitcher()) {
return true;
@ -218,6 +225,14 @@ void ClientLevel::reInit()
for (ClientList::const_iterator it = clients.begin(); it != clients.end(); ++it) {
checkClient((*it));
}
#if HAVE_WAYLAND
if (waylandServer()) {
const auto &clients = waylandServer()->clients();
for (auto *c : clients) {
checkClient(c);
}
}
#endif
}
quint32 ClientLevel::idForRow(int row) const