Windows: Fix ICC profile detection not working per-monitor #724
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When I implemented the color space stuff, it was intended to have at least basic support for per-monitor ICC profiles. Specifically, even if it doesn't update in realtime as one drags the window to a different monitor, it should at least use the current monitor's ICC profile when loading a new image or reloading the current image. I remember testing this, but probably only on macOS, since just I discovered it wasn't working as intended on Windows.
GetDC(hWnd)
is apparently too simplistic of an approach and the result was always the same ICC profile regardless of which monitor the window was on (maybe it just returned the ICC profile for the default monitor). Even though all my monitors are the same model, I was able to test it by assigning a fake profile to one of them (this is handy for testing: SwappedRedAndGreen.zip).Recommended to review the diff with "Hide whitespace" enabled.