Changeset View
Changeset View
Standalone View
Standalone View
scripting/scripting_model.cpp
Show All 16 Lines | |||||
17 | You should have received a copy of the GNU General Public License | 17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #include "scripting_model.h" | 20 | #include "scripting_model.h" | ||
21 | #include <config-kwin.h> | 21 | #include <config-kwin.h> | ||
22 | #ifdef KWIN_BUILD_ACTIVITIES | 22 | #ifdef KWIN_BUILD_ACTIVITIES | ||
23 | #include "activities.h" | 23 | #include "activities.h" | ||
24 | #endif | 24 | #endif | ||
25 | #include "client.h" | 25 | #include "x11client.h" | ||
26 | #include "screens.h" | 26 | #include "screens.h" | ||
27 | #include "workspace.h" | 27 | #include "workspace.h" | ||
28 | #include "xdgshellclient.h" | 28 | #include "xdgshellclient.h" | ||
29 | #include "wayland_server.h" | 29 | #include "wayland_server.h" | ||
30 | 30 | | |||
31 | namespace KWin { | 31 | namespace KWin { | ||
32 | namespace ScriptingClientModel { | 32 | namespace ScriptingClientModel { | ||
33 | 33 | | |||
▲ Show 20 Lines • Show All 165 Lines • ▼ Show 20 Line(s) | 187 | { | |||
199 | m_clients.erase(it); | 199 | m_clients.erase(it); | ||
200 | emit endRemove(); | 200 | emit endRemove(); | ||
201 | } | 201 | } | ||
202 | 202 | | |||
203 | void ClientLevel::init() | 203 | void ClientLevel::init() | ||
204 | { | 204 | { | ||
205 | const ClientList &clients = Workspace::self()->clientList(); | 205 | const ClientList &clients = Workspace::self()->clientList(); | ||
206 | for (ClientList::const_iterator it = clients.begin(); it != clients.end(); ++it) { | 206 | for (ClientList::const_iterator it = clients.begin(); it != clients.end(); ++it) { | ||
207 | Client *client = *it; | 207 | X11Client *client = *it; | ||
208 | setupClientConnections(client); | 208 | setupClientConnections(client); | ||
209 | if (!exclude(client) && shouldAdd(client)) { | 209 | if (!exclude(client) && shouldAdd(client)) { | ||
210 | m_clients.insert(nextId(), client); | 210 | m_clients.insert(nextId(), client); | ||
211 | } | 211 | } | ||
212 | } | 212 | } | ||
213 | } | 213 | } | ||
214 | 214 | | |||
215 | void ClientLevel::reInit() | 215 | void ClientLevel::reInit() | ||
▲ Show 20 Lines • Show All 675 Lines • ▼ Show 20 Line(s) | 890 | if (!data.isValid()) { | |||
891 | // an invalid QVariant is valid data | 891 | // an invalid QVariant is valid data | ||
892 | return true; | 892 | return true; | ||
893 | } | 893 | } | ||
894 | // TODO: introduce a type as a data role and properly check, this seems dangerous | 894 | // TODO: introduce a type as a data role and properly check, this seems dangerous | ||
895 | if (data.type() == QVariant::Int || data.type() == QVariant::UInt || data.type() == QVariant::String) { | 895 | if (data.type() == QVariant::Int || data.type() == QVariant::UInt || data.type() == QVariant::String) { | ||
896 | // we do not filter out screen, desktop and activity | 896 | // we do not filter out screen, desktop and activity | ||
897 | return true; | 897 | return true; | ||
898 | } | 898 | } | ||
899 | Client *client = qvariant_cast<KWin::Client *>(data); | 899 | X11Client *client = qvariant_cast<KWin::X11Client *>(data); | ||
900 | if (!client) { | 900 | if (!client) { | ||
901 | return false; | 901 | return false; | ||
902 | } | 902 | } | ||
903 | if (client->caption().contains(m_filter, Qt::CaseInsensitive)) { | 903 | if (client->caption().contains(m_filter, Qt::CaseInsensitive)) { | ||
904 | return true; | 904 | return true; | ||
905 | } | 905 | } | ||
906 | const QString windowRole(QString::fromUtf8(client->windowRole())); | 906 | const QString windowRole(QString::fromUtf8(client->windowRole())); | ||
907 | if (windowRole.contains(m_filter, Qt::CaseInsensitive)) { | 907 | if (windowRole.contains(m_filter, Qt::CaseInsensitive)) { | ||
Show All 15 Lines |