Run in fullscreen?
Have last mouse position saved and keep checking if mouse left the window and if it did then get it to last valid position?
But I really recommend fullscreen since the purpose of the window is that you can click somewhere to get it to unfocus, hide, ect.