if (event.type == SDL_KEYDOWN || event.type == SDL_KEYUP)
if ((!(event.key.keysym.mod&KEY_MOD_NUM)) ^ (!!(event.key.keysym.mod&KEY_MOD_SHIFT)))
// If unicode is zero, this could be a numpad key with numlock off, or numlock on and shift on (unicode is set to 0 by SDL or the OS in these circumstances. If numlock is on, unicode is the relevant digit character).
// For some unknown reason, event.key.keysym.mod seems to be unreliable on some computers (keysum.mod&KEY_MOD_NUM is opposite to the actual value), so check keysym.unicode instead.
// Note: unicode is always zero for SDL_KEYUP events, so this translation won't always work properly for keyup events.