tests: Test client focus stealing filters.
This commit is contained in:
parent
d52c1e7f7a
commit
a2748a1fa3
|
@ -77,6 +77,54 @@ end
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local original_count, c1, c2 = 0
|
||||||
|
|
||||||
|
-- Check request::activate
|
||||||
|
table.insert(steps, function()
|
||||||
|
c1, c2 = client.get()[1], client.get()[2]
|
||||||
|
|
||||||
|
-- This should still be the case
|
||||||
|
assert(client.focus == c1)
|
||||||
|
|
||||||
|
c2:emit_signal("request::activate", "i_said_so")
|
||||||
|
|
||||||
|
return true
|
||||||
|
end)
|
||||||
|
|
||||||
|
-- Check if writing a focus stealing filter works.
|
||||||
|
table.insert(steps, function()
|
||||||
|
-- This should still be the case
|
||||||
|
assert(client.focus == c2)
|
||||||
|
|
||||||
|
original_count = #awful.ewmh.generic_activate_filters
|
||||||
|
|
||||||
|
awful.ewmh.add_activate_filter(function(c)
|
||||||
|
if c == c1 then return false end
|
||||||
|
end)
|
||||||
|
|
||||||
|
c1:emit_signal("request::activate", "i_said_so")
|
||||||
|
|
||||||
|
return true
|
||||||
|
end)
|
||||||
|
|
||||||
|
table.insert(steps, function()
|
||||||
|
-- The request should have been denied
|
||||||
|
assert(client.focus == c2)
|
||||||
|
|
||||||
|
-- Test the remove function
|
||||||
|
awful.ewmh.remove_activate_filter(function() end)
|
||||||
|
|
||||||
|
awful.ewmh.add_activate_filter(awful.ewmh.generic_activate_filters[1])
|
||||||
|
|
||||||
|
awful.ewmh.remove_activate_filter(awful.ewmh.generic_activate_filters[1])
|
||||||
|
|
||||||
|
assert(original_count == #awful.ewmh.generic_activate_filters)
|
||||||
|
|
||||||
|
c1:emit_signal("request::activate", "i_said_so")
|
||||||
|
|
||||||
|
return client.focus == c1
|
||||||
|
end)
|
||||||
|
|
||||||
local has_error
|
local has_error
|
||||||
|
|
||||||
-- Disable awful.screen.preferred(c)
|
-- Disable awful.screen.preferred(c)
|
||||||
|
|
Loading…
Reference in New Issue