x11_common: refactor of fstype code

This is completely pointless, but it still somehow bugged me.
mplayer: handle subtitle renderer cleanup via uninit_player

This might actually fix an issue with DVB channel switching, because
that uses some sort of hack to reinitialize the demuxer, which causes
the subtitle renderer to initialize twice. As consequence, the assert in
add_subtitle_fonts_from_sources() would trigger.

I didn't actually test the DVB case, because I don't have the hardware.
getch2: move global state to file scope variables

Using static variables for mutable state inside functions is a bad idea,
because it's not immediately obvious that it is what it is.
getch2: assume EOF when input file descriptor is invalid

When starting mpv with nohup, file descriptor 0 seems to be invalid for
some reason. (I'm not quite sure why it should be... /proc/pid/fd/0
seems to indicate it's just /dev/null, and using /dev/null explicitly
shows that it works just fine.)

select() will always immediately return, and this causes mpv to burn CPU
without reason. Fix this by treating it as EOF when read() returns
EBADF.

Also add EINVAL to this condition, because it seems like a good idea.