gears.wallpaper: Check for cairo errors

This makes things fail loudly which otherwise fail without giving a hint
on what went wrong.

Reference: https://github.com/awesomeWM/awesome/issues/1570
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2017-02-18 17:41:31 +01:00
parent 4fc396ec57
commit 4efee3c3d6
1 changed files with 4 additions and 0 deletions

View File

@ -130,6 +130,7 @@ function wallpaper.centered(surf, s, background)
if surf ~= original_surf then
surf:finish()
end
assert(cr.status == "SUCCESS", "Cairo context entered error state: " .. cr.status)
end
--- Set a tiled wallpaper.
@ -154,6 +155,7 @@ function wallpaper.tiled(surf, s, offset)
if surf ~= original_surf then
surf:finish()
end
assert(cr.status == "SUCCESS", "Cairo context entered error state: " .. cr.status)
end
--- Set a maximized wallpaper.
@ -191,6 +193,7 @@ function wallpaper.maximized(surf, s, ignore_aspect, offset)
if surf ~= original_surf then
surf:finish()
end
assert(cr.status == "SUCCESS", "Cairo context entered error state: " .. cr.status)
end
--- Set a fitting wallpaper.
@ -226,6 +229,7 @@ function wallpaper.fit(surf, s, background)
if surf ~= original_surf then
surf:finish()
end
assert(cr.status == "SUCCESS", "Cairo context entered error state: " .. cr.status)
end
return wallpaper