assign a key code to the event

some applications only look at the key code and ignore the unicode value

fixes #1792
send key up events when typing text
don’t create/destroy an unused key event
check for NULL before releasing key events
Merge pull request #1827 from quicksilver/i1792

assign a key code to events when “typing” text