shims: Implement signal forwarding.
This make the rules, among other things, work.
This commit is contained in:
parent
be72b4033a
commit
6aabb73fa3
|
@ -42,8 +42,18 @@ local function _shim_fake_class()
|
||||||
return obj, meta
|
return obj, meta
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function forward_class(obj, class)
|
||||||
|
assert(obj.emit_signal)
|
||||||
|
local es = obj.emit_signal
|
||||||
|
function obj:emit_signal(name, ...)
|
||||||
|
es(obj, name, ...)
|
||||||
|
class.emit_signal(name, obj, ...)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local awesome = _shim_fake_class()
|
local awesome = _shim_fake_class()
|
||||||
awesome._shim_fake_class = _shim_fake_class
|
awesome._shim_fake_class = _shim_fake_class
|
||||||
|
awesome._forward_class = forward_class
|
||||||
|
|
||||||
-- Avoid c.screen = acreen.focused() to be called, all tests will fail
|
-- Avoid c.screen = acreen.focused() to be called, all tests will fail
|
||||||
awesome.startup = true
|
awesome.startup = true
|
||||||
|
|
|
@ -25,6 +25,8 @@ end
|
||||||
-- Create fake clients to move around
|
-- Create fake clients to move around
|
||||||
function client.gen_fake(args)
|
function client.gen_fake(args)
|
||||||
local ret = gears_obj()
|
local ret = gears_obj()
|
||||||
|
awesome._forward_class(ret, client)
|
||||||
|
|
||||||
ret.data = {}
|
ret.data = {}
|
||||||
ret.type = "normal"
|
ret.type = "normal"
|
||||||
ret.valid = true
|
ret.valid = true
|
||||||
|
|
|
@ -5,6 +5,8 @@ screen._count = 0
|
||||||
|
|
||||||
local function create_screen(args)
|
local function create_screen(args)
|
||||||
local s = gears_obj()
|
local s = gears_obj()
|
||||||
|
awesome._forward_class(s, screen)
|
||||||
|
|
||||||
s.data = {}
|
s.data = {}
|
||||||
s.valid = true
|
s.valid = true
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ end
|
||||||
|
|
||||||
local function new_tag(_, args)
|
local function new_tag(_, args)
|
||||||
local ret = gears_obj()
|
local ret = gears_obj()
|
||||||
|
awesome._forward_class(ret, tag)
|
||||||
|
|
||||||
ret.data = {}
|
ret.data = {}
|
||||||
ret.name = args.name or "test"
|
ret.name = args.name or "test"
|
||||||
|
|
Loading…
Reference in New Issue