commit
a1716a7edc
|
@ -213,8 +213,9 @@ end
|
|||
|
||||
function screen.object.get_content(s)
|
||||
local geo = s.geometry
|
||||
local source = gsurf(root.content())
|
||||
local target = source:create_similar(cairo.Content.COLOR, geo.width, geo.height)
|
||||
local source = gsurf(capi.root.content())
|
||||
local target = source:create_similar(cairo.Content.COLOR, geo.width,
|
||||
geo.height)
|
||||
local cr = cairo.Context(target)
|
||||
cr:set_source_surface(source, -geo.x, -geo.y)
|
||||
cr:rectangle(0, 0, geo.width, geo.height)
|
||||
|
|
|
@ -7,6 +7,9 @@ local gsurface = require("gears.surface")
|
|||
local lgi = require('lgi')
|
||||
local cairo = lgi.cairo
|
||||
local gdk = lgi.require('Gdk', '3.0')
|
||||
local capi = {
|
||||
root = _G.root
|
||||
}
|
||||
|
||||
-- Dummy blue client for the client.content test
|
||||
-- the lua_executable portion may need to get ironed out. I need to specify 5.3
|
||||
|
@ -91,7 +94,7 @@ local function copy_to_image_surface(content, w, h)
|
|||
|
||||
cr:set_source_surface(sur)
|
||||
cr:paint()
|
||||
img:finish()
|
||||
img:flush()
|
||||
|
||||
return img
|
||||
end
|
||||
|
@ -105,8 +108,9 @@ local steps = {}
|
|||
|
||||
-- Check the whole root window.
|
||||
table.insert(steps, function()
|
||||
local img = copy_to_image_surface(root.content(), root.size())
|
||||
local root_width, root_height = root.size()
|
||||
local img = copy_to_image_surface(capi.root.content(), root_width,
|
||||
root_height)
|
||||
|
||||
if get_pixel(img, 100, 100) ~= "#00ff00" then return end
|
||||
if get_pixel(img, 2, 2) ~= "#ff0000" then return end
|
||||
|
|
Loading…
Reference in New Issue