Or simply upgrade to the top of tree version of Emacs that now has native mouse support in the terminal.