From 74106462ac1f0877d4dd3791c9a983283c034169 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Thu, 12 Feb 2015 23:09:27 +0100 Subject: [PATCH] Do layout.arrange only once per main loop This uses timer.delayed_call to arrange the layouts only once per main loop. --- lib/awful/layout/init.lua.in | 37 ++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/lib/awful/layout/init.lua.in b/lib/awful/layout/init.lua.in index 7735a949..b881b0b4 100755 --- a/lib/awful/layout/init.lua.in +++ b/lib/awful/layout/init.lua.in @@ -16,6 +16,7 @@ local capi = { client = client } local client = require("awful.client") +local timer = require("gears.timer") --- Layout module for awful -- awful.layout @@ -96,22 +97,26 @@ end function layout.arrange(screen) if arrange_lock then return end arrange_lock = true - local p = {} - p.workarea = capi.screen[screen].workarea - -- Handle padding - local padding = ascreen.padding(capi.screen[screen]) - if padding then - p.workarea.x = p.workarea.x + (padding.left or 0) - p.workarea.y = p.workarea.y + (padding.top or 0) - p.workarea.width = p.workarea.width - ((padding.left or 0 ) + (padding.right or 0)) - p.workarea.height = p.workarea.height - ((padding.top or 0) + (padding.bottom or 0)) - end - p.geometry = capi.screen[screen].geometry - p.clients = client.tiled(screen) - p.screen = screen - layout.get(screen).arrange(p) - capi.screen[screen]:emit_signal("arrange") - arrange_lock = false + + timer.delayed_call(function() + local p = {} + p.workarea = capi.screen[screen].workarea + -- Handle padding + local padding = ascreen.padding(capi.screen[screen]) + if padding then + p.workarea.x = p.workarea.x + (padding.left or 0) + p.workarea.y = p.workarea.y + (padding.top or 0) + p.workarea.width = p.workarea.width - ((padding.left or 0 ) + (padding.right or 0)) + p.workarea.height = p.workarea.height - ((padding.top or 0) + (padding.bottom or 0)) + end + p.geometry = capi.screen[screen].geometry + p.clients = client.tiled(screen) + p.screen = screen + layout.get(screen).arrange(p) + capi.screen[screen]:emit_signal("arrange") + + arrange_lock = false + end) end --- Get the current layout name.