Make same key pressed event recorded once

On windows, when pressed a key for a while, it will create many key
pressed events for the same key. This commit make it just create one
key pressed event.