KiTTY
KiTTY copied to clipboard
Support higher resolution icons?
When a custom icon is set (External icon file), it seems that the resolution is limited to 32x32. On HiDPI displays, this can result in a blurred icon.
Would it be possible to use the native system metric values for the resolution?
Untested, but I imagine the code could look something like:
HICON hIcon = NULL, hIconBig = NULL ;
if( (strlen(iconefile)>0) && existfile(iconefile) ) {
hIcon = LoadImage(NULL, iconefile, IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_LOADFROMFILE|LR_SHARED) ;
hIconBig = LoadImage(NULL, iconefile, IMAGE_ICON, 0, 0, LR_LOADFROMFILE|LR_SHARED|LR_DEFAULTSIZE) ;
}
if(hIcon || hIconBig) {
if(!hIcon) hIcon = hIconBig;
if(!hIconBig) hIconBig = hIcon;
SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)hIconBig) ;
SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)hIcon) ;
TrayIcone.hIcon = hIcon ;
//DeleteObject( hIcon ) ;
}
I've tested your code.
I did not really see a big difference, but you can check the result here.
Please report me, if it is better I'll upload a new release.
Thanks, that looks good!
I made a test icon which shows a different number, depending on the resolution chosen (also colours depending on colour depth). You can use this to test that it's selecting icons other than 32x32; set display scaling to something like 200% to see it use larger icons.
Old code:
New code:
Ok I'll produce a new release very soon