From 89ddab9d5749c057951656ddf456ae570d886df4 Mon Sep 17 00:00:00 2001 From: Quantum Date: Sat, 6 Jun 2026 01:44:09 -0400 Subject: [PATCH] [idd] helper: use Resources.h for icon IDs --- idd/LGIddHelper/CConfigWindow.cpp | 1 - idd/LGIddHelper/CNotifyWindow.cpp | 3 ++- idd/LGIddHelper/CWindow.cpp | 5 +++-- idd/LGIddHelper/LGIddHelper.vcxproj | 1 + idd/LGIddHelper/LGIddHelper.vcxproj.filters | 8 ++++++- idd/LGIddHelper/Resources.h | 25 +++++++++++++++++++++ idd/LGIddHelper/resource.rc | 3 ++- 7 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 idd/LGIddHelper/Resources.h diff --git a/idd/LGIddHelper/CConfigWindow.cpp b/idd/LGIddHelper/CConfigWindow.cpp index 23f1e238..4baa4b95 100644 --- a/idd/LGIddHelper/CConfigWindow.cpp +++ b/idd/LGIddHelper/CConfigWindow.cpp @@ -35,7 +35,6 @@ bool CConfigWindow::registerClass() { WNDCLASSEX wx = {}; populateWindowClass(wx); - wx.hIconSm = wx.hIcon = LoadIcon(hInstance, IDI_APPLICATION); wx.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); wx.lpszClassName = L"LookingGlassIddConfig"; diff --git a/idd/LGIddHelper/CNotifyWindow.cpp b/idd/LGIddHelper/CNotifyWindow.cpp index be1977c8..356cc058 100644 --- a/idd/LGIddHelper/CNotifyWindow.cpp +++ b/idd/LGIddHelper/CNotifyWindow.cpp @@ -20,6 +20,7 @@ #include "CNotifyWindow.h" #include "CConfigWindow.h" +#include "Resources.h" #include #include #include @@ -156,7 +157,7 @@ void CNotifyWindow::registerIcon() m_iconData.hWnd = m_hwnd; m_iconData.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP | NIF_SHOWTIP; m_iconData.uCallbackMessage = WM_NOTIFY_ICON; - m_iconData.hIcon = LoadIcon(hInstance, IDI_APPLICATION); + m_iconData.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(ID_MAIN_ICON)); m_iconData.uVersion = NOTIFYICON_VERSION_4; StringCbCopy(m_iconData.szTip, sizeof m_iconData.szTip, L"Looking Glass (IDD)"); diff --git a/idd/LGIddHelper/CWindow.cpp b/idd/LGIddHelper/CWindow.cpp index 612c280b..a1c9019c 100644 --- a/idd/LGIddHelper/CWindow.cpp +++ b/idd/LGIddHelper/CWindow.cpp @@ -22,6 +22,7 @@ #include #include #include +#include "Resources.h" HINSTANCE CWindow::hInstance = (HINSTANCE)GetModuleHandle(NULL); @@ -30,8 +31,8 @@ void CWindow::populateWindowClass(WNDCLASSEX &wx) wx.cbSize = sizeof(WNDCLASSEX); wx.lpfnWndProc = wndProc; wx.hInstance = hInstance; - wx.hIcon = LoadIcon(NULL, IDI_APPLICATION); - wx.hIconSm = LoadIcon(NULL, IDI_APPLICATION); + wx.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(ID_MAIN_ICON)); + wx.hIconSm = wx.hIcon; wx.hCursor = LoadCursor(NULL, IDC_ARROW); wx.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); } diff --git a/idd/LGIddHelper/LGIddHelper.vcxproj b/idd/LGIddHelper/LGIddHelper.vcxproj index 388d2469..9336bc9a 100644 --- a/idd/LGIddHelper/LGIddHelper.vcxproj +++ b/idd/LGIddHelper/LGIddHelper.vcxproj @@ -211,6 +211,7 @@ copy /Y "$(ProjectDir)VERSION" "$(SolutionDir)$(Platform)\$(Configuration)\LGIdd + diff --git a/idd/LGIddHelper/LGIddHelper.vcxproj.filters b/idd/LGIddHelper/LGIddHelper.vcxproj.filters index 595c73ed..55d6c061 100644 --- a/idd/LGIddHelper/LGIddHelper.vcxproj.filters +++ b/idd/LGIddHelper/LGIddHelper.vcxproj.filters @@ -100,6 +100,9 @@ Header Files + + Header Files + @@ -109,4 +112,7 @@ Resource Files - + + + + \ No newline at end of file diff --git a/idd/LGIddHelper/Resources.h b/idd/LGIddHelper/Resources.h new file mode 100644 index 00000000..995d3f0f --- /dev/null +++ b/idd/LGIddHelper/Resources.h @@ -0,0 +1,25 @@ +/** + * Looking Glass + * Copyright © 2017-2026 The Looking Glass Authors + * https://looking-glass.io + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., 59 + * Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#pragma once + +#define ID_MAIN_ICON 1 +#define ID_GPU_ICON 2 +#define ID_NO_GPU_ICON 3 diff --git a/idd/LGIddHelper/resource.rc b/idd/LGIddHelper/resource.rc index abba60c9..0935120c 100644 --- a/idd/LGIddHelper/resource.rc +++ b/idd/LGIddHelper/resource.rc @@ -22,8 +22,9 @@ #include "winuser.h" #include "winver.h" #include "VersionInfo.h" +#include "Resources.h" -IDI_APPLICATION ICON "../../resources/icon.ico" +ID_MAIN_ICON ICON "../../resources/icon.ico" #define STRINGIFY2(s) L#s #define STRINGIFY(s) STRINGIFY2(s)