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
1 changed files with 11 additions and 0 deletions

View File

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