Correctly position wiboxes (FS#892)
Let's just quote the bug report:
A regression was introduced in commit f5a5af4001
which causes wiboxes to position themselves incorrectly on Xinerama screens
besides the first one. In lib/awful/wibox.lua.in line 49, function
set_position(), the screen number used to use wibox.screen but now just defaults
to 1. Since the screen parameter is never actually passed to set_position(),
that means that wiboxes will always use screen 1's geometry when determining the
proper position. So, if a different screen is larger or smaller or isn't aligned
with the primary screen, the wibox will either be offscreen or not on the edge.
This should be fixed by explicitly passing the right screen argument to all
functions which need it.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
d3ba8aa072
commit
82921ef57b
|
@ -46,7 +46,6 @@ end
|
|||
-- @param screen If the wibox it not attached to a screen, specified on which
|
||||
-- screen the position should be set.
|
||||
function set_position(wibox, position, screen)
|
||||
local screen = screen or 1
|
||||
local area = capi.screen[screen].geometry
|
||||
|
||||
-- The "length" of a wibox is always chosen to be the optimal size
|
||||
|
@ -73,7 +72,7 @@ end
|
|||
-- Reset all wiboxes positions.
|
||||
local function update_all_wiboxes_position()
|
||||
for _, wprop in ipairs(wiboxes) do
|
||||
set_position(wprop.wibox, wprop.position)
|
||||
set_position(wprop.wibox, wprop.position, wprop.screen)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -105,7 +104,7 @@ end
|
|||
-- will be attached.
|
||||
-- @param wibox The wibox to attach.
|
||||
-- @param position The position of the wibox: top, bottom, left or right.
|
||||
function attach(wibox, position)
|
||||
function attach(wibox, position, screen)
|
||||
-- Store wibox as attached in a weak-valued table
|
||||
local wibox_prop_table
|
||||
-- Start from end since we sometimes remove items
|
||||
|
@ -122,7 +121,7 @@ function attach(wibox, position)
|
|||
end
|
||||
|
||||
if not wibox_prop_table then
|
||||
table.insert(wiboxes, setmetatable({ wibox = wibox, position = position }, { __mode = 'v' }))
|
||||
table.insert(wiboxes, setmetatable({ wibox = wibox, position = position, screen = screen }, { __mode = 'v' }))
|
||||
else
|
||||
wibox_prop_table.position = position
|
||||
end
|
||||
|
@ -144,7 +143,6 @@ end
|
|||
-- screen where to align. Otherwise 1 is assumed.
|
||||
function align(wibox, align, screen)
|
||||
local position = get_position(wibox)
|
||||
local screen = screen or 1
|
||||
local area = capi.screen[screen].workarea
|
||||
|
||||
if position == "right" then
|
||||
|
@ -214,6 +212,7 @@ function new(arg)
|
|||
local arg = arg or {}
|
||||
local position = arg.position or "top"
|
||||
local has_to_stretch = true
|
||||
local screen = arg.screen or 1
|
||||
|
||||
arg.type = arg.type or "dock"
|
||||
|
||||
|
@ -252,14 +251,14 @@ function new(arg)
|
|||
|
||||
w.visible = true
|
||||
|
||||
attach(w, position)
|
||||
attach(w, position, screen)
|
||||
if has_to_stretch then
|
||||
stretch(w, arg.screen or 1)
|
||||
stretch(w, screen)
|
||||
else
|
||||
align(w, arg.align)
|
||||
align(w, arg.align, screen)
|
||||
end
|
||||
|
||||
set_position(w, position)
|
||||
set_position(w, position, screen)
|
||||
|
||||
return w
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue