Building on macOS 13.3.1 (22E261) clang 14.0.3 (clang-1403.0.22.14.1)
running to errors like #5477 where functions without argument lists at
least need void.
Looking for possible suspect functions via:
git grep -E "^([A-Za-z_]+ )?[A-Za-z_]+\()" \*.c \*.m
Apple go on making it harder and harder to support multiple
versions of their pathetic operating system in one code base.
kIOMainPortDefault is the "non-deprecated" replacement for
kIOMasterPortDefault. However, it is now marked as being available only
on macOS 12 and later so it refuses to build in a codebase designed to
run on earlier versions of macOS. Le bubbling sigh.
According to https://developer.apple.com/documentation/iokit/kiomasterportdefault?language=objc
passing NULL has the same effect and avoids the stupid warning.
Hopefully this will work till Apple decides to spend their trillion
dollars doing more stupid shit.
Try to ensure we have a functioning displaylink always.
GLFW skips over sleeping monitors during a poll and also
had a bug where the display link was not re-created for a monitor
that already had a glfw monitor entry.
Also add a bunch more debug reporting
This is caused, as far as I can tell, by CVDisplayLink getting stuck.
Apple apparently are incapable of writing a simple timer robustly.
So if it remains stuck after a second delete and recreate it to force it
to restart.
Fixes#2016
I had added an optimization to not pass messages to
main thread every time the CVDisplayLink timer fired, unless
a render frame for that monitor was actually requested.
However, this optimization is impossible to implement wihtout a deadlock
since CVDisplayLink has its own internal lock that it does not expose.
So I guess macOS users with multiple monitors will simply have to take
the performance hit of useless wakeups sixty times a second for every
extra monitor.
Fixes#1779