Add a WinRT-based Window ColorSpace check, event tweaks #168
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.
Adds a C++/WinRT based event listener to the
WindowWin, which avoids having to check for ColorSpace changes manually when the window moves/is activated/etc.This only works on Windows 11, but since 10 is EOL I think that's fine. It comes with the cost of having to construct a WinRT
DispatcherQueuesince it won't work without one, so that's something to evaluate.I've made compilation optional in case it conflicts with older Windows SDKs that don't have the headers or access to the WindowsApp library. I've tested it with multiple monitors on Windows 11 and on a virtual machine in 10 (works the same as before).
Since I was also doing event stuff I snuck in a few extra tweaks:
nearlyEqual()before sending out the event.setScale()which should avoid aWM_SIZINGevent (and therefore yet another check) - I did not see this breaking anything with scaled displays but I'm not 100% sure if it could have unintended side effects.WM_SETTINGCHANGE