-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved Windows icon rendering quality #14564
Conversation
I extracted these changes from #12107. We have postponed dark mode support in our product, so there is no need for any controversial API changes. But we still want to see these icon rendering improvements in time for our final release. |
You can test this PR using the following package version. |
In general, this PR looks good to me. Will test it on my machine on Monday. And will merge it if everything is good. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested, LGTM
Refresh icons when window DPI changes Provide ICON_SMALL icons Fixed Win32Icon.Size being incorrect when the exact size couldn't be found in the icon
d208ee7
to
08ec390
Compare
You can test this PR using the following package version. |
Refresh icons when window DPI changes Provide ICON_SMALL icons Fixed Win32Icon.Size being incorrect when the exact size couldn't be found in the icon
On MS Windows, a window has three icons:
Big
,Small
, andSmall2
.Small2
is requested by other applications, and appears to have been added to support the Taskbar displaying the window's small icon with the platform theme variant.Previously, Avalonia only set the
Big
icon, and did not refresh that icon when the window's DPI changed. With this PR it provides values for all three icons and updates them when appropriate. This provides higher quality icon rendering:This PR also adds handling of the
WM_GETICON
message. This message is sent by other applications when they request the local window's icon for their own use, and ought to have special handling because the message can request a DPI different from the window's own. This can happen when the window and taskbar are on different monitors with different DPIs, for example.Lastly, window icons are now set synchronously. Previously they were set with
PostMessage
, which only enqueues the change. By usingSendMessage
instead, we avoid a race condition which caused the window sometimes to be briefly drawn without an icon.Breaking changes
None
Obsoletions / Deprecations
None
Fixed issues
Fixes #11569