shims: Implement signal forwarding.

This make the rules, among other things, work.
This commit is contained in:
Emmanuel Lepage Vallee 2019-03-08 13:55:55 -05:00
parent be72b4033a
commit 6aabb73fa3
4 changed files with 15 additions and 0 deletions

View File

@ -42,8 +42,18 @@ local function _shim_fake_class()
return obj, meta
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()
awesome._shim_fake_class = _shim_fake_class
awesome._forward_class = forward_class
-- Avoid c.screen = acreen.focused() to be called, all tests will fail
awesome.startup = true

View File

@ -25,6 +25,8 @@ end
-- Create fake clients to move around
function client.gen_fake(args)
local ret = gears_obj()
awesome._forward_class(ret, client)
ret.data = {}
ret.type = "normal"
ret.valid = true

View File

@ -5,6 +5,8 @@ screen._count = 0
local function create_screen(args)
local s = gears_obj()
awesome._forward_class(s, screen)
s.data = {}
s.valid = true

View File

@ -13,6 +13,7 @@ end
local function new_tag(_, args)
local ret = gears_obj()
awesome._forward_class(ret, tag)
ret.data = {}
ret.name = args.name or "test"