#4374 update icon for title bar

master
Maxim Nikolenko 2025-07-26 01:20:22 +03:00 committed by GitHub
parent f80d62e6b2
commit 5291fc252a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 27 additions and 0 deletions

View File

@ -113,6 +113,7 @@ static std::thread::id sMainThreadId;
LPWSTR gIconResource = IDI_APPLICATION;
LPWSTR gIconSmallResource = IDI_APPLICATION;
LPDIRECTINPUT8 gDirectInput8;
LLW32MsgCallback gAsyncMsgCallback = NULL;
@ -527,6 +528,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
mFSAASamples = fsaa_samples;
mIconResource = gIconResource;
mIconSmallResource = gIconSmallResource;
mOverrideAspectRatio = 0.f;
mNativeAspectRatio = 0.f;
mInputProcessingPaused = false;
@ -860,6 +862,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
// based on the system's (or user's) default settings.
allowLanguageTextInput(NULL, false);
updateWindowTheme();
setCustomIcon();
}
@ -5043,3 +5046,20 @@ void LLWindowWin32::updateWindowTheme()
LL_INFOS("Window") << "Viewer window theme is set to " << (use_dark_mode ? "dark" : "light") << " mode" << LL_ENDL;
}
void LLWindowWin32::setCustomIcon()
{
if (mWindowHandle)
{
HICON hDefaultIcon = LoadIcon(mhInstance, mIconResource);
HICON hSmallIcon = LoadIcon(mhInstance, mIconSmallResource);
mWindowThread->post([=]()
{
SendMessage(mWindowHandle, WM_SETICON, ICON_BIG, (LPARAM)hDefaultIcon);
SendMessage(mWindowHandle, WM_SETICON, ICON_SMALL, (LPARAM)hSmallIcon);
SetClassLongPtr(mWindowHandle, GCLP_HICON, (LONG_PTR)hDefaultIcon);
SetClassLongPtr(mWindowHandle, GCLP_HICONSM, (LONG_PTR)hSmallIcon);
});
}
}

View File

@ -214,6 +214,7 @@ protected:
bool mCustomGammaSet;
LPWSTR mIconResource;
LPWSTR mIconSmallResource;
bool mInputProcessingPaused;
// The following variables are for Language Text Input control.
@ -248,6 +249,7 @@ protected:
void updateWindowTheme();
bool isSystemAppDarkMode();
void setCustomIcon();
bool mCurrentDarkMode { false };
struct LLWindowWin32Thread;
@ -285,6 +287,7 @@ private:
extern LLW32MsgCallback gAsyncMsgCallback;
extern LPWSTR gIconResource;
extern LPWSTR gIconSmallResource;
S32 OSMessageBoxWin32(const std::string& text, const std::string& caption, U32 type);

View File

@ -1566,6 +1566,7 @@ if (WINDOWS)
res-sdl/ll_icon.BMP
res/ll_icon.BMP
res/ll_icon.ico
res/ll_icon_small.ico
res/resource.h
res/toolpickobject.cur
res/toolpickobject2.cur

View File

@ -448,6 +448,7 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
// *FIX: global
gIconResource = MAKEINTRESOURCE(IDI_LL_ICON);
gIconSmallResource = MAKEINTRESOURCE(IDI_LL_ICON_SMALL);
LLAppViewerWin32* viewer_app_ptr = new LLAppViewerWin32(ll_convert_wide_to_string(pCmdLine).c_str());

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

View File

@ -30,6 +30,7 @@
#define IDREMOVE 3
#define IDI_LL_ICON 103
#define IDC_GRABHAND 104
#define IDI_LL_ICON_SMALL 105
#define IDC_CURSOR1 134
#define IDC_CURSOR2 136
#define IDC_CURSOR3 147

View File

@ -56,6 +56,7 @@ END
// remains consistent on all systems.
IDI_LL_ICON ICON "ll_icon.ico"
IDI_LCD_LL_ICON ICON "icon1.ico"
IDI_LL_ICON_SMALL ICON "ll_icon_small.ico"
/////////////////////////////////////////////////////////////////////////////
//