From 45c6e4b8110e6161fdc18fdd224e4edf5d8e9727 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tiago=20Corr=C3=AAa?= Date: Mon, 11 May 2020 14:26:39 +0300 Subject: [PATCH] scripting: Introduce ClientModelByScreenAndActivity Summary: Provide for KWin scripts the possibility to work with a activities aware ClientModel. In the same way that the ClientModelByScreenAndDesktop works with virtual desktops. Reviewers: #kwin, mart, zzag Reviewed By: #kwin, zzag Subscribers: zzag, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D29284 --- scripting/scripting.cpp | 1 + scripting/scripting_model.cpp | 1 + scripting/scripting_model.h | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/scripting/scripting.cpp b/scripting/scripting.cpp index 8ecddb3856..5ccde33f70 100644 --- a/scripting/scripting.cpp +++ b/scripting/scripting.cpp @@ -709,6 +709,7 @@ void KWin::Scripting::init() qmlRegisterType("org.kde.kwin", 2, 0, "ClientModel"); qmlRegisterType("org.kde.kwin", 2, 0, "ClientModelByScreen"); qmlRegisterType("org.kde.kwin", 2, 0, "ClientModelByScreenAndDesktop"); + qmlRegisterType("org.kde.kwin", 2, 1, "ClientModelByScreenAndActivity"); qmlRegisterType("org.kde.kwin", 2, 0, "ClientFilterModel"); qmlRegisterType(); qmlRegisterType(); diff --git a/scripting/scripting_model.cpp b/scripting/scripting_model.cpp index 235dc88f4b..199c2ebd01 100644 --- a/scripting/scripting_model.cpp +++ b/scripting/scripting_model.cpp @@ -847,6 +847,7 @@ name::~name() {} CLIENT_MODEL_WRAPPER(SimpleClientModel, QList()) CLIENT_MODEL_WRAPPER(ClientModelByScreen, QList() << ScreenRestriction) CLIENT_MODEL_WRAPPER(ClientModelByScreenAndDesktop, QList() << ScreenRestriction << VirtualDesktopRestriction) +CLIENT_MODEL_WRAPPER(ClientModelByScreenAndActivity, QList() << ScreenRestriction << ActivityRestriction) #undef CLIENT_MODEL_WRAPPER ClientFilterModel::ClientFilterModel(QObject *parent) diff --git a/scripting/scripting_model.h b/scripting/scripting_model.h index b98d6fbd93..c6e07aef30 100644 --- a/scripting/scripting_model.h +++ b/scripting/scripting_model.h @@ -268,6 +268,14 @@ public: ~ClientModelByScreenAndDesktop() override; }; +class ClientModelByScreenAndActivity : public ClientModel +{ + Q_OBJECT +public: + ClientModelByScreenAndActivity(QObject *parent = nullptr); + ~ClientModelByScreenAndActivity() override; +}; + /** * @brief Custom QSortFilterProxyModel to filter on Client caption, role and class. */