From bf97cb6bfedaf64ae99bf8c7a824d6c2983433b2 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Wed, 5 Oct 2016 21:03:34 +0200 Subject: [PATCH] awful.tag: Save dynamic_cache as a tag property Instead of using magic with a weak table, the code now saves this cache as a property under the tag object. Signed-off-by: Uli Schlachter --- lib/awful/tag.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/awful/tag.lua b/lib/awful/tag.lua index 20b9c8e5e..466172023 100644 --- a/lib/awful/tag.lua +++ b/lib/awful/tag.lua @@ -35,7 +35,6 @@ local tag = {object = {}, mt = {} } -- Private data local data = {} data.history = {} -data.dynamic_cache = setmetatable({}, { __mode = 'k' }) data.tags = setmetatable({}, { __mode = 'k' }) -- History functions @@ -710,11 +709,11 @@ function tag.object.set_layout(t, layout) and getmetatable(layout) and getmetatable(layout).__call ) then - if not data.dynamic_cache[t] then - data.dynamic_cache[t] = {} + if not t.dynamic_layout_cache then + t.dynamic_layout_cache = {} end - local instance = data.dynamic_cache[t][layout] or layout(t) + local instance = t.dynamic_layout_cache[layout] or layout(t) -- Always make sure the layout is notified it is enabled if tag.getproperty(t, "screen").selected_tag == t and instance.wake_up then @@ -723,7 +722,7 @@ function tag.object.set_layout(t, layout) -- Avoid creating the same layout twice, use layout:reset() to reset if instance.is_dynamic then - data.dynamic_cache[t][layout] = instance + t.dynamic_layout_cache[layout] = instance end layout = instance