KiTTY icon indicating copy to clipboard operation
KiTTY copied to clipboard

Support higher resolution icons?

Open zingaburga opened this issue 2 years ago • 3 comments

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 ) ; 
	}

zingaburga avatar Sep 09 '22 05:09 zingaburga

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.

cyd01 avatar Sep 12 '22 16:09 cyd01

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: old

New code: new

zingaburga avatar Sep 13 '22 00:09 zingaburga

Ok I'll produce a new release very soon

cyd01 avatar Sep 13 '22 07:09 cyd01