You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
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
11 years ago
..
CMakeLists.txt
Messages.sh
dbuscall.cpp
dbuscall.h
documentation-effect-global.xml
documentation-global.xml
genericscriptedconfig.cpp
genericscriptedconfig.h
genericscriptedconfig.json
kwinscript.desktop
meta.cpp
meta.h
screenedgeitem.cpp
screenedgeitem.h
scriptedeffect.cpp
scriptedeffect.h
scripting.cpp
scripting.h
scripting_model.cpp
scripting_model.h Replace NULL with nullptr in scripting folder 11 years ago
scriptingutils.cpp
scriptingutils.h
timer.cpp
workspace_wrapper.cpp
workspace_wrapper.h