From 3d048dca04c115546fbde2cf74246bac74e93583 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Wed, 5 Oct 2016 20:55:28 +0200 Subject: [PATCH] awful.client: Save client properties under c.data Instead of using a weak table with some magic to save properties of a client, the code now uses the c.data table provided by the C code instead. Signed-off-by: Uli Schlachter --- lib/awful/client.lua | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/lib/awful/client.lua b/lib/awful/client.lua index 81c762cb7..6e6a28b2a 100644 --- a/lib/awful/client.lua +++ b/lib/awful/client.lua @@ -46,7 +46,6 @@ local client = {object={}} -- Private data client.data = {} client.data.marked = {} -client.data.properties = setmetatable({}, { __mode = 'k' }) client.data.persistent_properties_registered = {} -- keys are names of persistent properties, value always true -- Functions @@ -994,8 +993,8 @@ function client.property.get(c, prop) end end end - if client.data.properties[c] then - return client.data.properties[c][prop] + if c.data.awful_client_properties then + return c.data.awful_client_properties[prop] end end @@ -1009,14 +1008,14 @@ end -- @param value The value. -- @deprecated awful.client.property.set function client.property.set(c, prop, value) - if not client.data.properties[c] then - client.data.properties[c] = {} + if not c.data.awful_client_properties then + c.data.awful_client_properties = {} end - if client.data.properties[c][prop] ~= value then + if c.data.awful_client_properties[prop] ~= value then if client.data.persistent_properties_registered[prop] then c:set_xproperty("awful.client.property." .. prop, value) end - client.data.properties[c][prop] = value + c.data.awful_client_properties[prop] = value c:emit_signal("property::" .. prop) end end @@ -1033,9 +1032,9 @@ function client.property.persist(prop, kind) client.data.persistent_properties_registered[prop] = true -- Make already-set properties persistent - for c in pairs(client.data.properties) do - if client.data.properties[c] and client.data.properties[c][prop] ~= nil then - c:set_xproperty(xprop, client.data.properties[c][prop]) + for c in pairs(capi.client.get()) do + if c.data.awful_client_properties and c.data.awful_client_properties[prop] ~= nil then + c:set_xproperty(xprop, c.data.awful_client_properties[prop]) end end end