Fix handling of mouse events by adding an event filter.

The problem was that internal_GetEvents only processes one event per call,
so it needs reasonable certainty that the event it processes is an interesting
one. It achieves this with a loop that waits for a non-mousemotion event,
so the presence of large numbers of other events (which turned out to be
touch and gesture events new in SDL 2.0) broke this logic.

A better fix would probably be to change internal_GetEvents to keep processing
events until none are left.