Yes it cannot be done by changing the mouse_x variable. I attached a screenshot from a compile error in GM 2 if you try to change the value of those variables. They're meant to only be read from to set as a value for other variables and functions.
It can however be done, I believe, using the window_mouse_set function.
Pro tip, seems that the resolution differences between windowed and full screen changes the positioning of the mouse position that you set, so some other thing needs to be done to fix that. I don't care personally because it's not an important part of my game, but I wanted to point it out so you know to watch out for it.