kwin/scripting
Martin Gräßlin bc0a9cb53a [kwin] Use std::find_if and lambda functions for Workspace::findClient
Instead of passing the macro based Predicate to findClient it now
expects a function which can be passed to std::find_if.

Existing code like:
xcb_window_t window; // our test window
Client *c = findClient(WindowMatchPredicated(window));

becomes:
Client *c = findClient([window](const Client *c) {
    return c->window() == window;
});

The advantage is that it is way more flexible and has the logic what
to check for directly with the code and not hidden in the macro
definition.

In addition there is a simplified overload for the very common case of
matching a window id against one of Client's windows. This overloaded
method takes a Predicate and the window id.

Above example becomes:
Client *c = findClient(Predicate::WindowMatch, w);

Existing code is migrated to use the simplified method taking
MatchPredicate and window id. The very few cases where a more complex
condition is tested the lambda function is used. As these are very
local tests only used in one function it's not worthwhile to add further
overloads to the findClient method in Workspace.

With this change all the Predicate macro definitions are removed from
utils.h as they are now completely unused.

REVIEW: 116916
2014-03-25 15:17:11 +01:00
..
CMakeLists.txt [kwin/genericscriptedkcm] Generate dbus interface from XML description 2014-03-19 08:10:45 +01:00
dbuscall.cpp New QML Type DBusCall 2013-08-13 09:57:51 +02:00
dbuscall.h New QML Type DBusCall 2013-08-13 09:57:51 +02:00
documentation-effect-global.xml export AnimationEffect::set and ::cancel to script 2013-03-28 19:47:30 +01:00
documentation-global.xml
genericscriptedconfig.cpp [kwin/genericscriptedkcm] Generate dbus interface from XML description 2014-03-19 08:10:45 +01:00
genericscriptedconfig.h [kwin] Fix genericscripted config 2014-03-19 08:00:28 +01:00
genericscriptedconfig.json [kwin] Fix genericscripted config 2014-03-19 08:00:28 +01:00
kwinscript.desktop SVN_SILENT made messages (.desktop file) 2014-02-18 05:12:30 +00:00
Messages.sh Extract messages from scripts and scripting module 2013-03-04 10:29:25 +01:00
meta.cpp Fix no cast to/from ASCII intrduced issues 2013-07-24 09:58:33 +02:00
meta.h Export Toplevel to KWin::Scripts 2013-02-14 08:16:19 +01:00
screenedgeitem.cpp Add a ScreenEdgeItem to reserve a screen edge from QML 2013-08-13 09:57:51 +02:00
screenedgeitem.h Add a ScreenEdgeItem to reserve a screen edge from QML 2013-08-13 09:57:51 +02:00
scriptedeffect.cpp Remove KDE/ prefix in include directories 2014-03-17 16:24:10 +01:00
scriptedeffect.h Replace NULL with nullptr in scripting folder 2014-02-24 16:33:40 +01:00
scripting.cpp Remove KDE/ prefix in include directories 2014-03-17 16:24:10 +01:00
scripting.h [kwin] Share QQmlEngine between all declarative KWin Scripts 2014-03-10 09:08:38 +01:00
scripting_model.cpp Replace NULL with nullptr in scripting folder 2014-02-24 16:33:40 +01:00
scripting_model.h Replace NULL with nullptr in scripting folder 2014-02-24 16:33:40 +01:00
scriptingutils.cpp
scriptingutils.h Register KWin's global shortcuts with the new shortcut system 2014-03-19 14:14:56 +01:00
timer.cpp Strip module path from all Qt #include <> 2013-03-06 10:26:56 +01:00
workspace_wrapper.cpp [kwin] Use std::find_if and lambda functions for Workspace::findClient 2014-03-25 15:17:11 +01:00
workspace_wrapper.h [kwin] Introduce Screens::size and Screens::geometry 2014-03-05 13:03:33 +01:00