From b6cdccda964aa826df65970e46ff06dcb16ef6ba Mon Sep 17 00:00:00 2001 From: SammysHP Date: Sun, 8 Jun 2014 20:18:09 +0200 Subject: [PATCH] gears.wallpaper: Center maximized if no offset set maximized() used to align the image with (0,0) so that it is shifted to the right or bottom. Most wallpapers are designed from the center, so this behavior is not desired usually. With this commit the wallpaper is centered when no offset is set. To get the old behavior use {x=0, y=0} for the offset parameter. --- lib/gears/wallpaper.lua.in | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/gears/wallpaper.lua.in b/lib/gears/wallpaper.lua.in index c19c39ad4..e3e41ac16 100644 --- a/lib/gears/wallpaper.lua.in +++ b/lib/gears/wallpaper.lua.in @@ -138,6 +138,8 @@ function wallpaper.maximized(surf, s, ignore_aspect, offset) if offset then cr:translate(offset.x, offset.y) + elseif not ignore_aspect then + cr:translate(((geom.width / aspect_w) - w) / 2, ((geom.height / aspect_h) - h) / 2) end cr:set_source_surface(surf, 0, 0)