Set MacOS Dock icon and query optimal icon size
Resolves #2041 Replaces #2244
The changes in this PR update glfwSetWindowIcon to allow a NULL window handle. When NULL is passed, GLFW sets the application's icon rather than a window's icon. An implementation for this is provided on MacOS.
This PR also updates glfwSetWindowIcon to allow querying for an optimal icon size. This requires an internal const-cast for the images parameter. This is unfortunate, but is required for backwards-compatibility. This preserves the signature of the function. This is currently only supported on MacOS.
Some platforms consume icons of more than one size at once. If GLFW is updated to return the optimal size for these platforms, the largest size should be returned. This is a limitation that is better revisited in GLFW 4.0.
This PR is more in line with #2286 and #2312, and should be the preferred choice over #2244.
Tested on MacOS with the icon and a new animate-icon test programs.
@elmindreda Considering that you have assigned yourself to this, is this something that could get included in 3.4?
I waited on this for a long time now. Can this please be merged?
Looking back at this, I might have put a little too much of my feelings in the commit messages. :P Hopefully a squash will rid it of the feelings.
Strikes me that a future enhancement to this new feature could include also caching the application icon for all platforms and then automatically set that as the window icon when new windows are created, on Win32, X11 and WL.