awful.wibox(): correctly handle position changes

This patch fixes a bug and changes the position handling for wiboxes:

The bug was that awful.wibox.set_position() didn't update the cached
wibox position, i.e. the wibox was moved, but the position value in the
wiboxes table stayed the same

The change in position handling was that unknown positions (i.e.
"fnord") default to "floating"

Signed-off-by: Gregor Best <farhaven@googlemail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Gregor Best 2009-06-05 19:49:03 +02:00 committed by Julien Danjou
parent be238512cc
commit 8f0c6c5979

View file

@ -115,6 +115,13 @@ function set_position(wibox, position, screen)
wingeom.y = area.y
end
for _, wprop in ipairs(wiboxes) do
if wprop.wibox == wibox then
wprop.position = position
break
end
end
wibox:geometry(wingeom)
end
@ -147,6 +154,10 @@ function attach(wibox, position)
end
end
if position ~= "top" and position ~= "bottom" and position ~= "right" and position ~= "left" then
position = "floating"
end
if not wibox_prop_table then
table.insert(wiboxes,
setmetatable({ wibox = wibox, position = position }, { __mode = 'v' }))