Issue #822

Get active screen with mouse

func activeScreen() -> NSScreen? {
    let mouseLocation = NSEvent.mouseLocation
    let screens = NSScreen.screens
    let screenWithMouse = (screens.first { NSMouseInRect(mouseLocation, $0.frame, false) })

    return screenWithMouse
}

Reposition our NSWIndow

if window.frame != screen.frame {
    window.setFrameOrigin(screen.frame.origin)
    window.setContentSize(screen.frame.size)
}

Flip y as AppKit has coordinate origin starting from bottom left of the screen, while our SwiftUI starts from top left

var point = window.convertPoint(fromScreen: event.locationInWindow)
point.y = window.frame.height - point.y
return point