awful.layout: move arrange locks

This fixes a deadlock when some arrange signal handler itself changes
a property like `border_width`:

    function border1(c)
      c.border_width = 50
    end
    client.connect_signal("property::border_width", border1)

    awful.screen.connect_for_each_screen(function(s)
      local border_for_s = function(s_)
        local clients = awful.client.visible(s_)
        for _, c in pairs(clients) do
          c.border_width = 2
        end
      end
      screen[s]:connect_signal("arrange", border_for_s)
    end)

It might be better to have some counter there instead and emit a warning
if this happens (while allowing for e.g. 3 recursions).

This would allow handlers to break out of this themselves (by not insisting to
change the property).
This commit is contained in:
Daniel Hahler 2018-12-27 07:05:57 +01:00
parent 7d0976912e
commit 57e05cda1c
1 changed files with 3 additions and 2 deletions

View File

@ -232,10 +232,11 @@ function layout.arrange(screen)
c:geometry(g)
end
end)
screen:emit_signal("arrange")
-- Release locks after signal to avoid deadly lock.
arrange_lock = false
delayed_arrange[screen] = nil
screen:emit_signal("arrange")
end)
end