matcher: Match all sources when none is provided.
Nobody wants to set this parameter. It is necessary because the old API allowed `awful.rules` to be used with random for random matching. This stopped "really" working between the 3.4 and 3.5 release because the code started to accumulate "corner case" fixes aligned with the client properties. v4.0 added more ordering and v4.3 added external sources. After this, it is unusable with external objects, but `gears.matcher` handle this use case very well.
This commit is contained in:
parent
91ca922671
commit
67e5dd3091
|
@ -215,12 +215,21 @@ end
|
||||||
--
|
--
|
||||||
-- @param o The object.
|
-- @param o The object.
|
||||||
-- @tparam[opt=nil] table rules The rules to check. List with "rule", "rule_any",
|
-- @tparam[opt=nil] table rules The rules to check. List with "rule", "rule_any",
|
||||||
-- "except" and "except_any" keys. If no rules are provided, one is selected at
|
-- "except" and "except_any" keys. If no rules are provided, all rules
|
||||||
-- random. Unless more rule sources are added, there is only one to begin with.
|
-- registered with a source will be matched.
|
||||||
-- @treturn table The list of matched rules.
|
|
||||||
-- @method matching_rules
|
-- @method matching_rules
|
||||||
function matcher:matching_rules(o, rules)
|
function matcher:matching_rules(o, rules)
|
||||||
rules = rules or select(2, next(self._matching_rules))
|
|
||||||
|
-- Match all sources.
|
||||||
|
if not rules then
|
||||||
|
local ret = {}
|
||||||
|
|
||||||
|
for _, r in pairs(self._matching_rules) do
|
||||||
|
gtable.merge(ret, self:matching_rules(o, r))
|
||||||
|
end
|
||||||
|
|
||||||
|
return ret
|
||||||
|
end
|
||||||
|
|
||||||
local result = {}
|
local result = {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue