How do I lock mouse in window?

thank you for your reply.
I set the viewport and tried using “Set input mode to game only”, but the mouse cursor went out of the window …
thank you.