diff --git a/build-utils/lgi-check.c b/build-utils/lgi-check.c index 9d7a2261..c0e3bfcd 100644 --- a/build-utils/lgi-check.c +++ b/build-utils/lgi-check.c @@ -35,7 +35,7 @@ const char commands[] = " '0.8.0', require('lgi.version')))\n" "end\n" "lgi = require('lgi')\n" -"assert(lgi.cairo, lgi.Pango, lgi.PangoCairo, lgi.GLib, lgi.Gio)\n" +"assert(lgi.cairo, lgi.Pango, lgi.PangoCairo, lgi.GLib, lgi.Gio, lgi.GdkPixbuf)\n" ; int main() diff --git a/lib/gears/surface.lua b/lib/gears/surface.lua index 3e506b9b..24d3a000 100644 --- a/lib/gears/surface.lua +++ b/lib/gears/surface.lua @@ -8,6 +8,7 @@ local setmetatable = setmetatable local type = type local capi = { awesome = awesome } local cairo = require("lgi").cairo +local GdkPixbuf = require("lgi").GdkPixbuf local color = nil local gdebug = require("gears.debug") local hierarchy = require("wibox.hierarchy") @@ -36,7 +37,6 @@ end -- @return The loaded surface, or the replacement default -- @return An error message, or nil on success function surface.load_uncached_silently(_surface, default) - local file -- On nil, return some sane default if not _surface then return get_default(default) @@ -47,12 +47,11 @@ function surface.load_uncached_silently(_surface, default) end -- Strings are assumed to be file names and get loaded if type(_surface) == "string" then - local err - file = _surface - _surface, err = capi.awesome.load_image(file) - if not _surface then - return get_default(default), err + local pixbuf, err = GdkPixbuf.Pixbuf.new_from_file(_surface) + if not pixbuf then + return get_default(default), tostring(err) end + _surface = capi.awesome.pixbuf_to_surface(pixbuf._native) end -- Everything else gets forced into a surface return cairo.Surface(_surface, true)