Add proper handling of left/right CTRL/ALT/SHIFT keys, and emit better diagnostics.