Repository navigation
Conversation
| } | ||
|
|
||
| // Delete platform.smallIcon and platform.largeIcon | ||
| static void DeleteIcons(void) |
There was a problem hiding this comment.
I'd prefer to avoid some of those extra functions, I think this one and probably UpdateIcons() can be removed and directly implement code, despite a bit of code duplication, they are only used on 2 places.
In general, I prefer to minimize additional functions when possible.
There was a problem hiding this comment.
Well, actually UpdateIcons() is used in 3 different places:
ResetToDefaultWindowsIconsSetWindowIconsSetWindowIcon
DeleteIcons() is used in 4:
The three above + CloseWindow()
The main reason I made DeleteIcons() a function was because you have to check that the large and small icon handles are not pointing to the same underlying resource (otherwise, you'll corrupt the heap with a double-free). This felt like an easy thing to forget.
UpdateIcons() could definitely be inlined without any risk though. I think the two SendMessage calls are pretty self-explanatory.
SetWindowIcons(). This function takes an array of icons. Windows can only store two different icon sizes, so the Win32 implementation ofSetWindowIcons()selects the best two images based on the resolution that they'll be rendered at.R8G8B8A8. This is true for theGLFWbackend as well. BothSetWindowIcon()andSetWindowIcons()verify the image's format before setting it as the icon.GLFW.DeleteIcons,UpdateIcons,ResetToDefaultWindowsIcons, andConvertImageToWindowsIconhave been added to make updating the icons less error-prone.