Skip to content

Commit 5291fc2

Browse files
#4374 update icon for title bar
1 parent f80d62e commit 5291fc2

File tree

7 files changed

+27
-0
lines changed

7 files changed

+27
-0
lines changed

indra/llwindow/llwindowwin32.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ static std::thread::id sMainThreadId;
113113

114114

115115
LPWSTR gIconResource = IDI_APPLICATION;
116+
LPWSTR gIconSmallResource = IDI_APPLICATION;
116117
LPDIRECTINPUT8 gDirectInput8;
117118

118119
LLW32MsgCallback gAsyncMsgCallback = NULL;
@@ -527,6 +528,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
527528

528529
mFSAASamples = fsaa_samples;
529530
mIconResource = gIconResource;
531+
mIconSmallResource = gIconSmallResource;
530532
mOverrideAspectRatio = 0.f;
531533
mNativeAspectRatio = 0.f;
532534
mInputProcessingPaused = false;
@@ -860,6 +862,7 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks,
860862
// based on the system's (or user's) default settings.
861863
allowLanguageTextInput(NULL, false);
862864
updateWindowTheme();
865+
setCustomIcon();
863866
}
864867

865868

@@ -5043,3 +5046,20 @@ void LLWindowWin32::updateWindowTheme()
50435046

50445047
LL_INFOS("Window") << "Viewer window theme is set to " << (use_dark_mode ? "dark" : "light") << " mode" << LL_ENDL;
50455048
}
5049+
5050+
void LLWindowWin32::setCustomIcon()
5051+
{
5052+
if (mWindowHandle)
5053+
{
5054+
HICON hDefaultIcon = LoadIcon(mhInstance, mIconResource);
5055+
HICON hSmallIcon = LoadIcon(mhInstance, mIconSmallResource);
5056+
mWindowThread->post([=]()
5057+
{
5058+
SendMessage(mWindowHandle, WM_SETICON, ICON_BIG, (LPARAM)hDefaultIcon);
5059+
SendMessage(mWindowHandle, WM_SETICON, ICON_SMALL, (LPARAM)hSmallIcon);
5060+
5061+
SetClassLongPtr(mWindowHandle, GCLP_HICON, (LONG_PTR)hDefaultIcon);
5062+
SetClassLongPtr(mWindowHandle, GCLP_HICONSM, (LONG_PTR)hSmallIcon);
5063+
});
5064+
}
5065+
}

indra/llwindow/llwindowwin32.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ class LLWindowWin32 : public LLWindow
214214
bool mCustomGammaSet;
215215

216216
LPWSTR mIconResource;
217+
LPWSTR mIconSmallResource;
217218
bool mInputProcessingPaused;
218219

219220
// The following variables are for Language Text Input control.
@@ -248,6 +249,7 @@ class LLWindowWin32 : public LLWindow
248249

249250
void updateWindowTheme();
250251
bool isSystemAppDarkMode();
252+
void setCustomIcon();
251253
bool mCurrentDarkMode { false };
252254

253255
struct LLWindowWin32Thread;
@@ -285,6 +287,7 @@ class LLSplashScreenWin32 : public LLSplashScreen
285287

286288
extern LLW32MsgCallback gAsyncMsgCallback;
287289
extern LPWSTR gIconResource;
290+
extern LPWSTR gIconSmallResource;
288291

289292
S32 OSMessageBoxWin32(const std::string& text, const std::string& caption, U32 type);
290293

indra/newview/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,6 +1566,7 @@ if (WINDOWS)
15661566
res-sdl/ll_icon.BMP
15671567
res/ll_icon.BMP
15681568
res/ll_icon.ico
1569+
res/ll_icon_small.ico
15691570
res/resource.h
15701571
res/toolpickobject.cur
15711572
res/toolpickobject2.cur

indra/newview/llappviewerwin32.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ int APIENTRY WINMAIN(HINSTANCE hInstance,
448448

449449
// *FIX: global
450450
gIconResource = MAKEINTRESOURCE(IDI_LL_ICON);
451+
gIconSmallResource = MAKEINTRESOURCE(IDI_LL_ICON_SMALL);
451452

452453
LLAppViewerWin32* viewer_app_ptr = new LLAppViewerWin32(ll_convert_wide_to_string(pCmdLine).c_str());
453454

indra/newview/res/ll_icon_small.ico

88.9 KB
Binary file not shown.

indra/newview/res/resource.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#define IDREMOVE 3
3131
#define IDI_LL_ICON 103
3232
#define IDC_GRABHAND 104
33+
#define IDI_LL_ICON_SMALL 105
3334
#define IDC_CURSOR1 134
3435
#define IDC_CURSOR2 136
3536
#define IDC_CURSOR3 147

indra/newview/res/viewerRes.rc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ END
5656
// remains consistent on all systems.
5757
IDI_LL_ICON ICON "ll_icon.ico"
5858
IDI_LCD_LL_ICON ICON "icon1.ico"
59+
IDI_LL_ICON_SMALL ICON "ll_icon_small.ico"
5960

6061
/////////////////////////////////////////////////////////////////////////////
6162
//

0 commit comments

Comments
 (0)