fix logging of mouse event co-ordinates
Ensure default state at start of a command

This should help to reduce obscure bugs. For example if a click fails,
currently the state will be stuck as "mouse_event", and won't go back to
"default". In theory that's a programming error, but this change should
deal with that whole category of errors.