Fix magnifier layout when focus is on another screen

The magnifier layout wants to ignore floating clients. Before 82342f0 this was
done by calling awful.client.floating.get(focus). If "focus" was nil, this might
have checked the floating status of a wrong client (if some other client was
focused, and the code in magnifier set focus=nil before). This issue can easily
be missed and might exist since forever. After 82342f, floating status is
checked via "focus.floating" and this now causes an "attempt to index nil value"
error instead. Much easier to notice.

Fix this by adding the missing nil check and while touching the code, merge this
with the previous "if" and correct another error (the wrong thing happened if we
had #cls=0).

Fixes: https://github.com/awesomeWM/awesome/issues/1103
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-09-23 09:52:46 +02:00
parent 750a1df1c7
commit 803264a488
1 changed files with 2 additions and 7 deletions

View File

@ -62,13 +62,8 @@ function magnifier.arrange(p)
-- Check that the focused window is on the right screen
if focus and focus.screen ~= p.screen then focus = nil end
if not focus and #cls > 0 then
focus = cls[1]
fidx = 1
end
-- If focused window is not tiled, take the first one which is tiled.
if focus.floating then
-- If no window is focused or focused window is not tiled, take the first tiled one.
if (not focus or focus.floating) and #cls > 0 then
focus = cls[1]
fidx = 1
end