Refactor: Move handle_special_keys() from win32 to common