cocoa_common: fix crash with dead key input and simplify related code

Fixes #29. When a user used dead input keys (like the accent key), `mpv`
crashed because the code tried to access the 0 element of a characters array
(which was empty).

While I was closing this bug, I refactored some related conditionals to
make the code more readable.