wayland: Fallback to any GL version if 3.0 is not supported

This fixes playback on Wayland with older GPUs.
demux_mkv: fix realaudio timestamps

This fixes the sample RA_missing_timestamps.mkv. Pretty funny how this
code got it almost right, but not quite, so it was broken all these
years. And then, after everyone stopped caring, someone comes and fixes
it. (By the way, I know absolutely nothing about realaudio.)
cache: fix time check for printing warning

This actually waited 2 seconds, because CACHE_WAIT_TIME happened to
be 0.5.
m_option: remove unused definitions
mp_msg: fixes windows code that assumes sizeof(DWORD) == sizeof(long)
direct3d: Fixes format string that assumed sizeof(LONG) == sizeof(long)
ao_wasapi0: Make it compile on cygwin64

Fixes format specifies that assume windows TYPEDEFS are as long as they look
like they are.

Remove calls to _beginthreadex and _endthreadex, these are only present on
microsoft's C runtimes. Replace by the otherwise identical CreateThread and
ExitThread calls.

This actually requires fixes to devicetopology.h, but the problem has been
(kinda) reported to mingw-w64:

<Kovensky> I see that those KSJACK* structs are supposedly declared in
  devicetopology.h itself, but for some reason (some of?) the decls that use
  them aren't seeing them?
<Kovensky> ok, it seems that it expects ks.h and ksmedia.h to declare those
  structs, but it doesn't
<Kovensky> the included files declare KDATAFORMAT, KSIDENTIFIER and LUID (and
  the associated pointer typedefs)
<Kovensky> but everything else is essentially inside #if 0
<Kovensky> changing the #ifndef _KS_ to only include KDATAFORMAT, KSIDENTIFIER
  and LUID (and putting the KSJACK stuff outside that #ifndef) makes the
  header compile
<Kovensky> it solves my immediate problem, but if that happened to begin with
  there's probably something more wrong with the ks headers :S
ao_wasapi0: Don't release WASAPI buffer twice

Would cause bogus AUDCLNT_E_OUT_OF_ORDER errors.
ao_wasapi0: Don't starve the WASAPI thread on seeks

Seeking calls thread_reset, but doesn't call thread_play. thread_reset
would disable WASAPI events, but they would never get re-enabled unless
the user paused and then unpaused.

Keep track of whether the stream is paused or not (there already was a
field for that, but it was apparently unused), and if it's not paused,
call thread_play after thread_reset. Fixes mpv freezing after seeks.
cocoa_common: implement conditional video dragging

This was more roundabout than expected, since it looks like the framework
caches isMovabileByWindowBackground so in mpv's case it's needed to set it
with setMovableByWindowBackground.
cocoa_common: implement MP_MOUSE_LEAVE notifications

This is needed for the OSC. At the moment I'm sending a notification for any
mouse movement outside of the video surface. This might be overkill.
cocoa_common: fix typo in comment

Surely it's copy pasta's fault.
cocoa_common: use a tracking area to handle mouse events

This change which also flipse the coordinate system of the view, greatly
simplifies the mouse event handling code.

There are still some uglities mostly related to the cursor visibility
code. For instance the core doesn't show the cursor when it receives a mouse
leave event.
sd_ass: remove unused variable warning

The `track` variable is used only if `LIBASS_VERSION >= 0x01020000`.
cocoa_common: make the fullscreen transition only when necessary

This makes the cocoa backend follow more closely the new fullscreen semantics
added in c4b08a9a.
Merge remote-tracking branch 'michaelforney/master'