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,21 +1,35 @@
local gears_obj = require("gears.object") local gears_obj = require("gears.object")
local gears_tab = require("gears.table") local gears_tab = require("gears.table")
local grect = require("gears.geometry").rectangle
local screen, meta = awesome._shim_fake_class() local screen, meta = awesome._shim_fake_class()
screen._count, screen._deleted = 0, {} 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 function compute_workarea(s)
local struts = {top=0,bottom=0,left=0,right=0} local struts = {top=0,bottom=0,left=0,right=0}
for _, c in ipairs(drawin.get()) do for _, c in ipairs(drawin.get()) do
for k,v in pairs(struts) do if get_drawin_screen(s, c) then
struts[k] = v + (c:struts()[k] or 0) for k,v in pairs(struts) do
struts[k] = v + (c:struts()[k] or 0)
end
end end
end end
for _, c in ipairs(client.get()) do for _, c in ipairs(client.get()) do
for k,v in pairs(struts) do if c.screen == s then
struts[k] = v + (c:struts()[k] or 0) for k,v in pairs(struts) do
struts[k] = v + (c:struts()[k] or 0)
end
end end
end end