From 96710a595ed5c910476d9f853e1ef9a8acd5b6ae Mon Sep 17 00:00:00 2001 From: Aire-One Date: Tue, 12 Oct 2021 20:56:10 +0200 Subject: [PATCH 1/4] fix(root) copy_to_image_surface parameters --- tests/test-screenshot.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test-screenshot.lua b/tests/test-screenshot.lua index e87446c3..8d7c2f1d 100644 --- a/tests/test-screenshot.lua +++ b/tests/test-screenshot.lua @@ -105,8 +105,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 From cf9d4d382e46ed094cd586f4377e52bd11d810e7 Mon Sep 17 00:00:00 2001 From: Aire-One Date: Tue, 12 Oct 2021 20:58:23 +0200 Subject: [PATCH 2/4] fix(screen.content) use capi.root --- lib/awful/screen.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/awful/screen.lua b/lib/awful/screen.lua index 08970644..5c2802f8 100644 --- a/lib/awful/screen.lua +++ b/lib/awful/screen.lua @@ -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) From 6d569f9e3b251e2e7134f8e060cb178a16245a6b Mon Sep 17 00:00:00 2001 From: Aire-One Date: Tue, 12 Oct 2021 21:48:56 +0200 Subject: [PATCH 3/4] fixup! fix(root) copy_to_image_surface parameters --- tests/test-screenshot.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test-screenshot.lua b/tests/test-screenshot.lua index 8d7c2f1d..65af2775 100644 --- a/tests/test-screenshot.lua +++ b/tests/test-screenshot.lua @@ -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 From 1f4ce1f4cba0ddfd3ca904b213c40640fed0313f Mon Sep 17 00:00:00 2001 From: Aire-One Date: Fri, 15 Oct 2021 18:25:04 +0200 Subject: [PATCH 4/4] fix: flush instead of finish Co-authored-by: Uli Schlachter Co-authored-by: ezz666 --- tests/test-screenshot.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test-screenshot.lua b/tests/test-screenshot.lua index 65af2775..954a37d9 100644 --- a/tests/test-screenshot.lua +++ b/tests/test-screenshot.lua @@ -94,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