Merge pull request #3462 from Aire-One/fix/3458

Fix 3458
This commit is contained in:
Emmanuel Lepage Vallée 2021-10-22 23:27:55 -07:00 committed by GitHub
commit a1716a7edc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View File

@ -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)

View File

@ -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