Mouse cursor not locking at the center of the screen

Hello everyone, I’m trying to make a light switch on my scene and the switch is working well but my mouse don’t get locked at the center of the screen as it should.

It’s a FPS scene and the mouse is locking at the corners of the screen when I move it, insted of lock on the center, and when I click something, I can’t rotate the camera until I click somewhere else on the screen, but then, when I do that the rotation cames back but it does not work properly anymore.