From 6aabb73fa362bfd1ca2139885fce2f6bd586a478 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Fri, 8 Mar 2019 13:55:55 -0500 Subject: [PATCH] shims: Implement signal forwarding. This make the rules, among other things, work. --- tests/examples/shims/awesome.lua | 10 ++++++++++ tests/examples/shims/client.lua | 2 ++ tests/examples/shims/screen.lua | 2 ++ tests/examples/shims/tag.lua | 1 + 4 files changed, 15 insertions(+) diff --git a/tests/examples/shims/awesome.lua b/tests/examples/shims/awesome.lua index 8d1616d9..3e97847a 100644 --- a/tests/examples/shims/awesome.lua +++ b/tests/examples/shims/awesome.lua @@ -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 diff --git a/tests/examples/shims/client.lua b/tests/examples/shims/client.lua index d4bddd78..bf76a426 100644 --- a/tests/examples/shims/client.lua +++ b/tests/examples/shims/client.lua @@ -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 diff --git a/tests/examples/shims/screen.lua b/tests/examples/shims/screen.lua index 09df1108..10abbc9c 100644 --- a/tests/examples/shims/screen.lua +++ b/tests/examples/shims/screen.lua @@ -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 diff --git a/tests/examples/shims/tag.lua b/tests/examples/shims/tag.lua index b0bd4947..60ef6b4a 100644 --- a/tests/examples/shims/tag.lua +++ b/tests/examples/shims/tag.lua @@ -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"