I started teeworlds with my xbox controller plugged in and the mouse cursor was moving on its own. SDL_JoystickGetAxis seems to always return a value even when not touching the controller (I guess controller sticks are not perfect).
So there are several issues here:
Joystick code should surely not modify mouse code.
Either the joystick or the mouse should be active at any time, not both at the same time.
A tolerance should be added so that the cursor starts moving only when we act...