Capture mode may actually be what you want, but to warp the mouse back to it’s previous position. This thread has a good solution, though on windows you may need to use warp_mouse.call_deferred or waiting a frame
warp_mouse.call_deferred