https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9cc9a26392ea4cc246284…
commit 9cc9a26392ea4cc246284af61185db01f8212ca9
Author: Thamatip Chitpong <tangaming123456(a)outlook.com>
AuthorDate: Thu Oct 13 21:52:14 2022 +0700
Commit: GitHub <noreply(a)github.com>
CommitDate: Thu Oct 13 17:52:14 2022 +0300
[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
---
dll/cpl/sysdm/licence.c | 30 ++++++++++++++++++++----------
dll/cpl/sysdm/resource.h | 1 +
dll/cpl/sysdm/resources/license.ico | Bin 0 -> 25214 bytes
dll/cpl/sysdm/sysdm.rc | 1 +
4 files changed, 22 insertions(+), 10 deletions(-)
diff --git a/dll/cpl/sysdm/licence.c b/dll/cpl/sysdm/licence.c
index 6894fd6598d..fb895143f60 100644
--- a/dll/cpl/sysdm/licence.c
+++ b/dll/cpl/sysdm/licence.c
@@ -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);
-
- SendMessage(hDlg,
- WM_SETICON,
- ICON_SMALL,
- (LPARAM)pLicInfo->hIcon);
+ 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_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;
diff --git a/dll/cpl/sysdm/resource.h b/dll/cpl/sysdm/resource.h
index 4490a7d4eb2..ec4eaf07a39 100644
--- a/dll/cpl/sysdm/resource.h
+++ b/dll/cpl/sysdm/resource.h
@@ -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
diff --git a/dll/cpl/sysdm/resources/license.ico b/dll/cpl/sysdm/resources/license.ico
new file mode 100644
index 00000000000..4cbfe98ccd9
Binary files /dev/null and b/dll/cpl/sysdm/resources/license.ico differ
diff --git a/dll/cpl/sysdm/sysdm.rc b/dll/cpl/sysdm/sysdm.rc
index 6ba6b87ba37..cb0e6914d06 100644
--- a/dll/cpl/sysdm/sysdm.rc
+++ b/dll/cpl/sysdm/sysdm.rc
@@ -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"