Skip to content
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

Icon size does not scale immediately when changing your monitor scaling #125

Open
end2endzone opened this issue Jul 1, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@end2endzone
Copy link
Owner

Describe the bug
If you change your monitor scaling the icon size does not scale with the change. For example, changing from 100% to 300%, the icons are kept at 16x16 resolution which makes them much too small in the menu and very hard to see.
The same is also true if you move Windows Explorer window to another screen that has a different scaling factor.

To Reproduce
Steps to reproduce the behavior:

  1. Right-click a directory to show an icon from a ShellAnything menu.
  2. Go to Settings and Display.
  3. Increase your main monitor display scaling. For example, 100% -> 200% or 200% -> 300%.
  4. Right-click the same directory to show the icon from the same menu.
  5. The icon is displayed with the same resolution as before.

This problem seems to be affecting other application as well. Most (if not all) other application loads their icons "once" and do not refresh them until you sign-out/sign-in or reboot.

Expected behavior
The size of the icons should increase as the display scaling increases. Icons size should match other icons. The same way as the icons from the taskbar.

Screenshots
N/A

Environment

  • OS: Windows 10

Additional context
The workaround is to sign-off and sign-in again. Reboot is also an option. This way when explorer.exe is launched, its is updated to the latest monitor scaling.

@end2endzone end2endzone added the bug Something isn't working label Jul 1, 2023
@end2endzone
Copy link
Owner Author

In the logs we can observed the following:

I0701 11:57:58.265242  6896 shellext.cpp:300] System metrics:
I0701 11:57:58.265242  6896 shellext.cpp:301] SM_CXSCREEN    : 3840
I0701 11:57:58.265242  6896 shellext.cpp:302] SM_CYSCREEN    : 2160
I0701 11:57:58.265242  6896 shellext.cpp:303] SM_CXSMICON    : 32
I0701 11:57:58.265242  6896 shellext.cpp:304] SM_CYSMICON    : 32
I0701 11:57:58.265242  6896 shellext.cpp:305] SM_CXICON      : 64
I0701 11:57:58.265242  6896 shellext.cpp:306] SM_CYICON      : 64
I0701 11:57:58.265242  6896 shellext.cpp:309] Process is monitor DPI aware : true
I0701 11:57:58.265242  6896 shellext.cpp:310] System DPI     : 192
I0701 11:57:58.265242  6896 shellext.cpp:311] System Scaling : 200%
I0701 11:57:58.265242  6896 shellext.cpp:315] System monitor count : 1
I0701 11:57:58.265242  6896 shellext.cpp:320] Monitor 0 is scaled to 250% (dpi 240)

You can see that "System DPI" is detected as 200% which does not match the scaling of 250% of the single monitor in the system.

@end2endzone
Copy link
Owner Author

ShellAnything uses the ExtractIconEx() function to display the icon on menus. The same function is also used by the majority of other Shell Extensions.

More testing of function ExtractIconEx() should be done. The function resizes the extracted icon to match GetSystemMetrics(SM_CXSMICON) and GetSystemMetrics(SM_CYSMICON). These metric values may not be updated when you change the scaling of a monitor.

If function ExtractIconEx() does not detect changes of the main monitor scaling, another function should be use to extract icons from files. For example, function SHDefExtractIcon() might be a good alternative candidate.

ShellAnything should detect when a change in display setting occurred or if the window that will displays the menu has not the same scaling as before. When such a change is detected, it should flush all loaded icons to force refresh them.

@end2endzone end2endzone changed the title Icon size does not scale immediately when changing the monitor scaling Icon size does not scale immediately when changing your monitor scaling Jul 1, 2023
@end2endzone
Copy link
Owner Author

Follow up of #117.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant