wallpaper: Turn asserts into warning

Regression in v4.1. It causes the `rc.lua` (and the fallback) to
exit when the wallpaper is missing or something went wrong.

In <= 4.0, the wallpaper wasn't loaded, but Awesome didn't "crash".

There should be no asserts in the code called during the first
event loop iteration.
This commit is contained in:
Emmanuel Lepage Vallee 2017-04-24 03:10:03 -04:00
parent 7481a6e6b8
commit 74bb34ff00
1 changed files with 13 additions and 4 deletions

View File

@ -8,6 +8,7 @@ local cairo = require("lgi").cairo
local color = require("gears.color") local color = require("gears.color")
local surface = require("gears.surface") local surface = require("gears.surface")
local timer = require("gears.timer") local timer = require("gears.timer")
local debug = require("gears.debug")
local root = root local root = root
local wallpaper = { mt = {} } local wallpaper = { mt = {} }
@ -139,7 +140,9 @@ function wallpaper.centered(surf, s, background, scale)
if surf ~= original_surf then if surf ~= original_surf then
surf:finish() surf:finish()
end end
assert(cr.status == "SUCCESS", "Cairo context entered error state: " .. cr.status) if cr.status ~= "SUCCESS" then
debug.print_warning("Cairo context entered error state: " .. cr.status)
end
end end
--- Set a tiled wallpaper. --- Set a tiled wallpaper.
@ -164,7 +167,9 @@ function wallpaper.tiled(surf, s, offset)
if surf ~= original_surf then if surf ~= original_surf then
surf:finish() surf:finish()
end end
assert(cr.status == "SUCCESS", "Cairo context entered error state: " .. cr.status) if cr.status ~= "SUCCESS" then
debug.print_warning("Cairo context entered error state: " .. cr.status)
end
end end
--- Set a maximized wallpaper. --- Set a maximized wallpaper.
@ -202,7 +207,9 @@ function wallpaper.maximized(surf, s, ignore_aspect, offset)
if surf ~= original_surf then if surf ~= original_surf then
surf:finish() surf:finish()
end end
assert(cr.status == "SUCCESS", "Cairo context entered error state: " .. cr.status) if cr.status ~= "SUCCESS" then
debug.print_warning("Cairo context entered error state: " .. cr.status)
end
end end
--- Set a fitting wallpaper. --- Set a fitting wallpaper.
@ -238,7 +245,9 @@ function wallpaper.fit(surf, s, background)
if surf ~= original_surf then if surf ~= original_surf then
surf:finish() surf:finish()
end end
assert(cr.status == "SUCCESS", "Cairo context entered error state: " .. cr.status) if cr.status ~= "SUCCESS" then
debug.print_warning("Cairo context entered error state: " .. cr.status)
end
end end
return wallpaper return wallpaper