From 9c21ce89076783c8ac282b036887a02272198344 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 18 Sep 2009 11:31:49 +0200 Subject: [PATCH] awful.layout: listen to geometry signal and lock arrange (FS#625) Signed-off-by: Julien Danjou --- lib/awful/layout/init.lua.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/awful/layout/init.lua.in b/lib/awful/layout/init.lua.in index d30d7fee..a50cf916 100644 --- a/lib/awful/layout/init.lua.in +++ b/lib/awful/layout/init.lua.in @@ -22,6 +22,10 @@ local client = require("awful.client") --- Layout module for awful module("awful.layout") +-- This is a special lock used by the arrange function. +-- This avoids recurring call by emitted signals. +local arrange_lock = false + --- Get the current layout. -- @param screen The screen number. -- @return The layout function. @@ -62,6 +66,8 @@ end --- Arrange a screen using its current layout. -- @param screen The screen to arrange. function arrange(screen) + if arrange_lock then return end + arrange_lock = true local p = {} p.workarea = capi.screen[screen].workarea -- Handle padding @@ -76,6 +82,7 @@ function arrange(screen) p.clients = client.tiled(screen) p.screen = screen get(screen).arrange(p) + arrange_lock = false end --- Get the current layout name. @@ -100,6 +107,7 @@ capi.client.add_signal("new", function(c) c:add_signal("property::hidden", arrange_prop) c:add_signal("property::titlebar", arrange_prop) c:add_signal("property::floating", arrange_prop) + c:add_signal("property::geometry", arrange_prop) -- If prop is screen, we do not know what was the previous screen, so -- let's arrange all screens :-( c:add_signal("property::screen", function(c)