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.
This commit is contained in:
SammysHP 2014-06-08 20:18:09 +02:00
parent 9a0ba0ff57
commit b6cdccda96
1 changed files with 2 additions and 0 deletions

View File

@ -138,6 +138,8 @@ function wallpaper.maximized(surf, s, ignore_aspect, offset)
if offset then if offset then
cr:translate(offset.x, offset.y) 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 end
cr:set_source_surface(surf, 0, 0) cr:set_source_surface(surf, 0, 0)