The problem is when you simultaneously read keypresses and translated keys. If there's some untranslated keypresses left at the end of the buffer and you read them out, then they've vanished forever and will never form part of the next key translation.
As many translations will be the result of multiple keypresses anyway I'm not so sure that there's any use in knowing what keypresses caused what translated key to appear. Either you're interested in translated keys, or you're interested in raw scancode events, but not both simultaneously. (And if you do need raw keycodes simultaneously a poll() won't hurt). But it solves the problem if you just copy the raw keys into another buffer just for the use of the translator.
Cas
