bc0a9cb53a
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 |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
dbuscall.cpp | ||
dbuscall.h | ||
documentation-effect-global.xml | ||
documentation-global.xml | ||
genericscriptedconfig.cpp | ||
genericscriptedconfig.h | ||
genericscriptedconfig.json | ||
kwinscript.desktop | ||
Messages.sh | ||
meta.cpp | ||
meta.h | ||
screenedgeitem.cpp | ||
screenedgeitem.h | ||
scriptedeffect.cpp | ||
scriptedeffect.h | ||
scripting.cpp | ||
scripting.h | ||
scripting_model.cpp | ||
scripting_model.h | ||
scriptingutils.cpp | ||
scriptingutils.h | ||
timer.cpp | ||
workspace_wrapper.cpp | ||
workspace_wrapper.h |