From 17b0623cf8428fa547e2c81d088bac1e0ceb96d1 Mon Sep 17 00:00:00 2001 From: Katayama Hirofumi MZ Date: Fri, 22 Mar 2024 21:15:22 +0900 Subject: [PATCH] [EXPLORER] Start menu: Fix Small Icons flag (#6651) Follow-up to #6646. Fix wrong flag use: #6646 (comment) JIRA issue: CORE-19494 - Delete SmallStartMenu flag (wrong) from _TW_STUCKRECTS2. - Rename _TW_STUCKRECTS2.SmallIcons as SmSmallIcons. - Use SmSmallIcons flag. --- base/shell/explorer/precomp.h | 15 ++++++++++----- base/shell/explorer/settings.cpp | 3 +-- base/shell/explorer/startmnu.cpp | 10 ++++++++-- base/shell/explorer/startmnucust.cpp | 4 ++-- base/shell/explorer/traywnd.cpp | 18 ++++++++++++------ 5 files changed, 33 insertions(+), 17 deletions(-) diff --git a/base/shell/explorer/precomp.h b/base/shell/explorer/precomp.h index 16087fd6e21..5981b8f2329 100644 --- a/base/shell/explorer/precomp.h +++ b/base/shell/explorer/precomp.h @@ -203,9 +203,8 @@ typedef struct _TW_STUCKRECTS2 { DWORD AutoHide : 1; DWORD AlwaysOnTop : 1; - DWORD SmallIcons : 1; + DWORD SmSmallIcons : 1; // Start menu Small Icons DWORD HideClock : 1; - DWORD SmallStartMenu : 1; }; }; DWORD Position; @@ -327,16 +326,23 @@ DECLARE_INTERFACE_(ITrayBandSite, IUnknown) HRESULT CTrayBandSite_CreateInstance(IN ITrayWindow *tray, IN IDeskBand* pTaskBand, OUT ITrayBandSite** pBandSite); /* - * startmnu.cpp + * startctxmnu.cpp */ - HRESULT CStartMenuBtnCtxMenu_CreateInstance(ITrayWindow * TrayWnd, IN HWND hWndOwner, IContextMenu ** ppCtxMenu); +/* + * startmnu.cpp + */ IMenuPopup* CreateStartMenu(IN ITrayWindow *Tray, OUT IMenuBand **ppMenuBand, IN HBITMAP hbmBanner OPTIONAL, IN BOOL bSmallIcons); +HRESULT +UpdateStartMenu(IN OUT IMenuPopup *pMenuPopup, + IN HBITMAP hbmBanner OPTIONAL, + IN BOOL bSmallIcons, + IN BOOL bRefresh); /* * startmnucust.cpp @@ -347,7 +353,6 @@ ShowCustomizeClassic(HINSTANCE, HWND); /* * startmnusite.cpp */ - HRESULT CStartMenuSite_CreateInstance(IN OUT ITrayWindow *Tray, const IID & riid, PVOID * ppv); diff --git a/base/shell/explorer/settings.cpp b/base/shell/explorer/settings.cpp index 35ee8ba29d5..29e1c2b88b8 100644 --- a/base/shell/explorer/settings.cpp +++ b/base/shell/explorer/settings.cpp @@ -80,9 +80,8 @@ BOOL TaskbarSettings::Load() sr.Position = ABE_BOTTOM; sr.AutoHide = FALSE; sr.AlwaysOnTop = TRUE; - sr.SmallIcons = TRUE; + sr.SmSmallIcons = FALSE; sr.HideClock = FALSE; - sr.SmallStartMenu = FALSE; sr.Rect.left = sr.Rect.top = 0; sr.Rect.bottom = sr.Rect.right = 1; sr.Size.cx = sr.Size.cy = 0; diff --git a/base/shell/explorer/startmnu.cpp b/base/shell/explorer/startmnu.cpp index 450d6e63bbb..5a706a94069 100644 --- a/base/shell/explorer/startmnu.cpp +++ b/base/shell/explorer/startmnu.cpp @@ -23,7 +23,8 @@ HRESULT UpdateStartMenu(IN OUT IMenuPopup *pMenuPopup, IN HBITMAP hbmBanner OPTIONAL, - IN BOOL bSmallIcons) + IN BOOL bSmallIcons, + IN BOOL bRefresh) { CComPtr pbb; HRESULT hRet; @@ -37,6 +38,11 @@ UpdateStartMenu(IN OUT IMenuPopup *pMenuPopup, hRet = pbb->SetIconSize(bSmallIcons ? BMICON_SMALL : BMICON_LARGE); } + if (bRefresh) + { + FIXME("Refresh the Start menu with communicating with SHELL32\n"); + } + return hRet; } @@ -97,7 +103,7 @@ CreateStartMenu(IN ITrayWindow *Tray, if (FAILED_UNEXPECTEDLY(hr)) return NULL; - UpdateStartMenu(pMp, hbmBanner, bSmallIcons); + UpdateStartMenu(pMp, hbmBanner, bSmallIcons, FALSE); *ppMenuBand = pMb.Detach(); diff --git a/base/shell/explorer/startmnucust.cpp b/base/shell/explorer/startmnucust.cpp index 0d456fc8ee0..44f5b02e7c5 100644 --- a/base/shell/explorer/startmnucust.cpp +++ b/base/shell/explorer/startmnucust.cpp @@ -91,12 +91,12 @@ static VOID CALLBACK CustomSetAdvanced(const CUSTOM_ENTRY *entry, BOOL bValue) static BOOL CALLBACK CustomGetSmallStartMenu(const CUSTOM_ENTRY *entry) { - return g_TaskbarSettings.sr.SmallStartMenu; + return g_TaskbarSettings.sr.SmSmallIcons; } static VOID CALLBACK CustomSetSmallStartMenu(const CUSTOM_ENTRY *entry, BOOL bValue) { - g_TaskbarSettings.sr.SmallStartMenu = bValue; + g_TaskbarSettings.sr.SmSmallIcons = bValue; } static const CUSTOM_ENTRY s_CustomEntries[] = diff --git a/base/shell/explorer/traywnd.cpp b/base/shell/explorer/traywnd.cpp index 1bc0a9a8999..883fb643191 100644 --- a/base/shell/explorer/traywnd.cpp +++ b/base/shell/explorer/traywnd.cpp @@ -2554,9 +2554,9 @@ ChangePos: RegLoadSettings(); /* Create and initialize the start menu */ - BOOL bSmallStartMenu = g_TaskbarSettings.sr.SmallStartMenu; HBITMAP hbmBanner = LoadBitmapW(hExplorerInstance, MAKEINTRESOURCEW(IDB_STARTMENU)); - m_StartMenuPopup = CreateStartMenu(this, &m_StartMenuBand, hbmBanner, bSmallStartMenu); + m_StartMenuPopup = CreateStartMenu(this, &m_StartMenuBand, hbmBanner, + g_TaskbarSettings.sr.SmSmallIcons); /* Create the task band */ hRet = CTaskBand_CreateInstance(this, m_StartButton.m_hWnd, IID_PPV_ARG(IDeskBand, &m_TaskBand)); @@ -2661,13 +2661,19 @@ ChangePos: if (m_StartMenuPopup && lstrcmpiW((LPCWSTR)lParam, L"TraySettings") == 0) { - /* Re-create the start menu */ HideStartMenu(); - m_StartMenuBand.Release(); - BOOL bSmallStartMenu = g_TaskbarSettings.sr.SmallStartMenu; HBITMAP hbmBanner = LoadBitmapW(hExplorerInstance, MAKEINTRESOURCEW(IDB_STARTMENU)); - m_StartMenuPopup = CreateStartMenu(this, &m_StartMenuBand, hbmBanner, bSmallStartMenu); +#if 1 // FIXME: Please re-use the start menu + /* Re-create the start menu */ + m_StartMenuBand.Release(); + m_StartMenuPopup = CreateStartMenu(this, &m_StartMenuBand, hbmBanner, + g_TaskbarSettings.sr.SmSmallIcons); + FIXME("Use UpdateStartMenu\n"); +#else + // Update the start menu + UpdateStartMenu(m_StartMenuPopup, hbmBanner, g_TaskbarSettings.sr.SmSmallIcons, TRUE); +#endif } return 0;