diff --git a/tests/examples/shims/mouse.lua b/tests/examples/shims/mouse.lua index f6fd4ff3a..128e49e67 100644 --- a/tests/examples/shims/mouse.lua +++ b/tests/examples/shims/mouse.lua @@ -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 diff --git a/tests/examples/shims/screen.lua b/tests/examples/shims/screen.lua index a1e2cf767..76e62ff78 100644 --- a/tests/examples/shims/screen.lua +++ b/tests/examples/shims/screen.lua @@ -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)