From dd6163ffe6e676743bede9f3f5e4e9d04e89e598 Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Tue, 6 Jul 2021 00:52:21 -0700 Subject: [PATCH] shims: Fix the screen workarea value. It didn't work with multiple screens. --- tests/examples/shims/screen.lua | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/tests/examples/shims/screen.lua b/tests/examples/shims/screen.lua index b969fa3b..47a01d94 100644 --- a/tests/examples/shims/screen.lua +++ b/tests/examples/shims/screen.lua @@ -1,21 +1,35 @@ local gears_obj = require("gears.object") local gears_tab = require("gears.table") +local grect = require("gears.geometry").rectangle local screen, meta = awesome._shim_fake_class() screen._count, screen._deleted = 0, {} +local function get_drawin_screen(s, d) + return grect.area_intersect_area (s.geometry, { + x = d:geometry().x, + y = d:geometry().y, + width = 1, + height = 1 + }) +end + local function compute_workarea(s) local struts = {top=0,bottom=0,left=0,right=0} for _, c in ipairs(drawin.get()) do - for k,v in pairs(struts) do - struts[k] = v + (c:struts()[k] or 0) + if get_drawin_screen(s, c) then + for k,v in pairs(struts) do + struts[k] = v + (c:struts()[k] or 0) + end end end for _, c in ipairs(client.get()) do - for k,v in pairs(struts) do - struts[k] = v + (c:struts()[k] or 0) + if c.screen == s then + for k,v in pairs(struts) do + struts[k] = v + (c:struts()[k] or 0) + end end end