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 <psychon@znc.in>
This commit is contained in:
parent
22d1375e5f
commit
3d048dca04
|
@ -46,7 +46,6 @@ local client = {object={}}
|
||||||
-- Private data
|
-- Private data
|
||||||
client.data = {}
|
client.data = {}
|
||||||
client.data.marked = {}
|
client.data.marked = {}
|
||||||
client.data.properties = setmetatable({}, { __mode = 'k' })
|
|
||||||
client.data.persistent_properties_registered = {} -- keys are names of persistent properties, value always true
|
client.data.persistent_properties_registered = {} -- keys are names of persistent properties, value always true
|
||||||
|
|
||||||
-- Functions
|
-- Functions
|
||||||
|
@ -994,8 +993,8 @@ function client.property.get(c, prop)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if client.data.properties[c] then
|
if c.data.awful_client_properties then
|
||||||
return client.data.properties[c][prop]
|
return c.data.awful_client_properties[prop]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1009,14 +1008,14 @@ end
|
||||||
-- @param value The value.
|
-- @param value The value.
|
||||||
-- @deprecated awful.client.property.set
|
-- @deprecated awful.client.property.set
|
||||||
function client.property.set(c, prop, value)
|
function client.property.set(c, prop, value)
|
||||||
if not client.data.properties[c] then
|
if not c.data.awful_client_properties then
|
||||||
client.data.properties[c] = {}
|
c.data.awful_client_properties = {}
|
||||||
end
|
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
|
if client.data.persistent_properties_registered[prop] then
|
||||||
c:set_xproperty("awful.client.property." .. prop, value)
|
c:set_xproperty("awful.client.property." .. prop, value)
|
||||||
end
|
end
|
||||||
client.data.properties[c][prop] = value
|
c.data.awful_client_properties[prop] = value
|
||||||
c:emit_signal("property::" .. prop)
|
c:emit_signal("property::" .. prop)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1033,9 +1032,9 @@ function client.property.persist(prop, kind)
|
||||||
client.data.persistent_properties_registered[prop] = true
|
client.data.persistent_properties_registered[prop] = true
|
||||||
|
|
||||||
-- Make already-set properties persistent
|
-- Make already-set properties persistent
|
||||||
for c in pairs(client.data.properties) do
|
for c in pairs(capi.client.get()) do
|
||||||
if client.data.properties[c] and client.data.properties[c][prop] ~= nil then
|
if c.data.awful_client_properties and c.data.awful_client_properties[prop] ~= nil then
|
||||||
c:set_xproperty(xprop, client.data.properties[c][prop])
|
c:set_xproperty(xprop, c.data.awful_client_properties[prop])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue