tests: Implement mouse.screen properly
This commit is contained in:
parent
e8c1463ce3
commit
f0b6e36ac1
|
@ -62,6 +62,13 @@ return setmetatable(mouse, {
|
||||||
forced_screen = nil
|
forced_screen = nil
|
||||||
end
|
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
|
-- Using capi.mouse.screen is *not* supported when there is zero
|
||||||
-- screen. Nearly all the code uses `mouse.screen` as its ultimate
|
-- screen. Nearly all the code uses `mouse.screen` as its ultimate
|
||||||
-- fallback. Having no screens is tolerated during early
|
-- fallback. Having no screens is tolerated during early
|
||||||
|
|
|
@ -35,12 +35,6 @@ local function create_screen(args)
|
||||||
|
|
||||||
local wa = args.workarea_sides or 10
|
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)
|
return setmetatable(s,{ __index = function(_, key)
|
||||||
assert(s.valid)
|
assert(s.valid)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue