I've noticed runtimes keep focus on the mouse even if its not within the window, so I'd like to suggest a mouse/keyboard condition like mouse is outside layout.
I know you could probably add a detection object to follow mouse, but that seems like a wasted effort.
Or perhaps even a system property like keep focus.