This fixes an issue where restoring from traditional fullscreen to a
maximized state was resulting in an incorrectly sized frame buffer. Now
all framebuffer and window size calculation happens in the same way in
all the various glfw codepaths that do it.
Let the input system do it for us. That wy we can hopefully use calls to
unmarkText as a signal to commit the pre-edit text.
Hopefully not clearing the marked text on key down doesnt break anything
else.
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
The constants `NSControlStateValueOn`, `NSControlStateValueOff` and `NSControlStateValueMixed` are only available for macOS 10.13 or above according to https://developer.apple.com/documentation/appkit/nscontrolstatevalueon?language=objc.
Without this commit, compilation fails with this message:
```
glfw/cocoa_window.m:1537:28: error: use of undeclared identifier 'NSControlStateValueOn'
item.state = NSControlStateValueOn;
^
glfw/cocoa_window.m:1539:28: error: use of undeclared identifier 'NSControlStateValueMixed'
item.state = NSControlStateValueMixed;
^
glfw/cocoa_window.m:1542:47: error: use of undeclared identifier 'NSControlStateValueOn'
item.state = controller.isDesired ? NSControlStateValueOn : NSControlStateValueOff;
^
glfw/cocoa_window.m:1542:71: error: use of undeclared identifier 'NSControlStateValueOff'
item.state = controller.isDesired ? NSControlStateValueOn : NSControlStateValueOff;
^
```
To fix this, simply redefine the constants to use the old and now deprecated constants on older macOS versions.
The code that causes this was introduced in 98519bf326.