shims: Fix the screen workarea value.

It didn't work with multiple screens.
This commit is contained in:
Emmanuel Lepage Vallee 2021-07-06 00:52:21 -07:00
parent a94a4beb6f
commit dd6163ffe6
1 changed files with 18 additions and 4 deletions

View File

@ -1,23 +1,37 @@
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
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
if c.screen == s then
for k,v in pairs(struts) do
struts[k] = v + (c:struts()[k] or 0)
end
end
end
return {
x = s.geometry.x + struts.left,