From 3233eb6cce076e49a501f5db9e411a9dc2a4a6a9 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 26 Mar 2016 18:37:55 +0100 Subject: [PATCH] gears.wallpaper: Use connect_for_each_screen() Signed-off-by: Uli Schlachter --- lib/gears/wallpaper.lua | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/lib/gears/wallpaper.lua b/lib/gears/wallpaper.lua index 873324bd..491d8124 100644 --- a/lib/gears/wallpaper.lua +++ b/lib/gears/wallpaper.lua @@ -13,20 +13,12 @@ local timer = require("gears.timer") local wallpaper = { mt = {} } -- The size of the root window -local root_geom -do - local geom = screen[1].geometry - root_geom = { - x = 0, y = 0, - width = geom.x + geom.width, - height = geom.y + geom.height - } - for s in screen do - local g = screen[s].geometry - root_geom.width = math.max(root_geom.width, g.x + g.width) - root_geom.height = math.max(root_geom.height, g.y + g.height) - end -end +local root_geom = { x = 0, y = 0, width = 0, height = 0 } +require("gears.screen").connect_for_each_screen(function(s) + local g = s.geometry + root_geom.width = math.max(root_geom.width, g.x + g.width) + root_geom.height = math.max(root_geom.height, g.y + g.height) +end) -- A cairo surface that we still want to set as the wallpaper local pending_wallpaper = nil