Fixed disabling key repeat on Linux

This is a fix for issue #564.
Key repeat was broken because the ReparentNotify xevent get stuck when the window is recreated (recreating the window does fire a reparenting xevent).
With this patch, remaining events are discarded upon window recreation. Holding a key down properly fires a KeyRelease xevent followed by a KeyPress xevent, which fixes the mechanism for disabling key repeat.