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