[SYSDM] Improve license dialog icon (#4773)

- Use `mimetypes/application-certificate` icon
  from Tango Icon Theme 0.8.90 instead of `IDI_CPLSYSTEM`
- Set large icon correctly
- Add NULL check for DestroyIcon
- Minor code formatting
This commit is contained in:
Thamatip Chitpong 2022-10-13 21:52:14 +07:00 committed by GitHub
parent bbef618032
commit 9cc9a26392
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 9 deletions

View File

@ -12,6 +12,7 @@
typedef struct _LIC_CONTEXT
{
HICON hIcon;
HICON hIconSm;
} LIC_CONTEXT, *PLIC_CONTEXT;
@ -23,16 +24,20 @@ OnInitDialog(HWND hDlg, PLIC_CONTEXT pLicInfo)
PCSTR LicenseText;
pLicInfo->hIcon = LoadImage(hApplet,
MAKEINTRESOURCE(IDI_CPLSYSTEM),
MAKEINTRESOURCE(IDI_LICENSE),
IMAGE_ICON,
16,
16,
0);
GetSystemMetrics(SM_CXICON),
GetSystemMetrics(SM_CYICON),
LR_DEFAULTCOLOR);
pLicInfo->hIconSm = LoadImage(hApplet,
MAKEINTRESOURCE(IDI_LICENSE),
IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON),
LR_DEFAULTCOLOR);
SendMessage(hDlg,
WM_SETICON,
ICON_SMALL,
(LPARAM)pLicInfo->hIcon);
SendMessage(hDlg, WM_SETICON, ICON_BIG, (LPARAM)pLicInfo->hIcon);
SendMessage(hDlg, WM_SETICON, ICON_SMALL, (LPARAM)pLicInfo->hIconSm);
/* Load license from resource */
if (!(hResInfo = FindResource(hApplet,
@ -86,7 +91,12 @@ LicenceDlgProc(HWND hDlg,
case WM_DESTROY:
if (pLicInfo)
{
DestroyIcon(pLicInfo->hIcon);
if (pLicInfo->hIconSm)
DestroyIcon(pLicInfo->hIconSm);
if (pLicInfo->hIcon)
DestroyIcon(pLicInfo->hIcon);
HeapFree(GetProcessHeap(), 0, pLicInfo);
}
break;

View File

@ -6,6 +6,7 @@
#define IDI_DEVMGR 51
#define IDI_HARDPROF 52
#define IDI_USERPROF 53
#define IDI_LICENSE 54
#define IDI_UP 2500
#define IDI_DOWN 2501
#define IDI_ADDHW 2502

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -16,6 +16,7 @@ IDI_CPLSYSTEM ICON "resources/applet.ico"
IDI_USERPROF ICON "resources/devmgr.ico"
IDI_HARDPROF ICON "resources/hwprofile.ico"
IDI_DEVMGR ICON "resources/dev.ico"
IDI_LICENSE ICON "resources/license.ico"
IDI_UP ICON "resources/up.ico"
IDI_DOWN ICON "resources/down.ico"
IDI_ADDHW ICON "resources/addhw.ico"