Fix motion event behavior

Now I am writing an application which uses xterm's Button Event Tracking / Any Event Tracking, and I tested it on some different terminals.
Then I saw that some terminals fires motion events to application every time the OS dispatch it. but sometimes it causes performance issue. 
Xterm's document says that:

> Motion events are reported only if the mouse pointer has moved to a different character cell.

According to my own experience, it is reasonable behavior.
So I propose this patch which cuts down extra motion events.

ref: http://invisible-island.net/xterm/ctlseqs/ctlseqs.html#Mouse%20Tracking

Thanks.