shims: Use cairo PNG support instead of GDK
It is inferior, but at least doesn't print warnings on Travis due to the lack of X server.
This commit is contained in:
parent
fb0ccc3220
commit
45135b28b1
|
@ -51,7 +51,13 @@ function surface.load_uncached_silently(_surface, default)
|
||||||
if not pixbuf then
|
if not pixbuf then
|
||||||
return get_default(default), tostring(err)
|
return get_default(default), tostring(err)
|
||||||
end
|
end
|
||||||
_surface = capi.awesome.pixbuf_to_surface(pixbuf._native)
|
_surface = capi.awesome.pixbuf_to_surface(pixbuf._native, _surface)
|
||||||
|
|
||||||
|
-- The shims implement load_image() to return a surface directly,
|
||||||
|
-- instead of a lightuserdatum.
|
||||||
|
if cairo.Surface:is_type_of(_surface) then
|
||||||
|
return _surface
|
||||||
|
end
|
||||||
end
|
end
|
||||||
-- Everything else gets forced into a surface
|
-- Everything else gets forced into a surface
|
||||||
return cairo.Surface(_surface, true)
|
return cairo.Surface(_surface, true)
|
||||||
|
|
1
luaa.c
1
luaa.c
|
@ -284,6 +284,7 @@ luaA_sync(lua_State *L)
|
||||||
/** Translate a GdkPixbuf to a cairo image surface..
|
/** Translate a GdkPixbuf to a cairo image surface..
|
||||||
*
|
*
|
||||||
* @param pixbuf The pixbuf as a light user datum.
|
* @param pixbuf The pixbuf as a light user datum.
|
||||||
|
* @param path The pixbuf origin path
|
||||||
* @return A cairo surface as light user datum.
|
* @return A cairo surface as light user datum.
|
||||||
* @function pixbuf_to_surface
|
* @function pixbuf_to_surface
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
local lgi = require("lgi")
|
local lgi = require("lgi")
|
||||||
local GdkPixbuf = lgi.GdkPixbuf
|
|
||||||
local Gdk = lgi.Gdk
|
|
||||||
local gears_obj = require("gears.object")
|
local gears_obj = require("gears.object")
|
||||||
|
|
||||||
-- Emulate the C API classes. They differ from C API objects as connect_signal
|
-- Emulate the C API classes. They differ from C API objects as connect_signal
|
||||||
|
@ -48,27 +46,10 @@ awesome.startup = true
|
||||||
function awesome.register_xproperty()
|
function awesome.register_xproperty()
|
||||||
end
|
end
|
||||||
|
|
||||||
local init, surfaces = false, {}
|
awesome.load_image = lgi.cairo.ImageSurface.create_from_png
|
||||||
|
|
||||||
function awesome.load_image(file)
|
function awesome.pixbuf_to_surface(_, path)
|
||||||
if not init then
|
return awesome.load_image(path)
|
||||||
Gdk.init{}
|
|
||||||
init = true
|
|
||||||
end
|
|
||||||
|
|
||||||
local _, width, height = GdkPixbuf.Pixbuf.get_file_info(file)
|
|
||||||
|
|
||||||
local pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(file, width, height)
|
|
||||||
|
|
||||||
if not pixbuf then
|
|
||||||
return nil, "Could not load "..file
|
|
||||||
end
|
|
||||||
|
|
||||||
local s = Gdk.cairo_surface_create_from_pixbuf( pixbuf, 1, nil )
|
|
||||||
|
|
||||||
table.insert(surfaces, s)
|
|
||||||
|
|
||||||
return s._native, not s and "Could not load surface from "..file or nil, s
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Always show deprecated messages
|
-- Always show deprecated messages
|
||||||
|
|
Loading…
Reference in New Issue