Simplify keypress detection

Also get rid of the macros dealing with longs, because none of the code is actually using longs.