tests: Implement mouse.screen properly

This commit is contained in:
Emmanuel Lepage Vallee 2019-07-18 00:25:16 -04:00
parent e8c1463ce3
commit f0b6e36ac1
2 changed files with 7 additions and 6 deletions

View File

@ -62,6 +62,13 @@ return setmetatable(mouse, {
forced_screen = nil
end
for s in screen do
if coords.x > s.geometry.x and coords.x < s.geometry.x +s.geometry.width
and coords.y > s.geometry.y and coords.y < s.geometry.y +s.geometry.height then
return s
end
end
-- Using capi.mouse.screen is *not* supported when there is zero
-- screen. Nearly all the code uses `mouse.screen` as its ultimate
-- fallback. Having no screens is tolerated during early

View File

@ -35,12 +35,6 @@ local function create_screen(args)
local wa = args.workarea_sides or 10
-- This will happen if `clear()` is called
if mouse and (screen.count() > 0 and not mouse.screen) then
screen[s] = s
mouse.screen = s
end
return setmetatable(s,{ __index = function(_, key)
assert(s.valid)