-
Notifications
You must be signed in to change notification settings - Fork 459
Restore Main_no_icons2 behavior for inline subitems #1172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
a thank you button.. 🤔 or an 🤗 button would nice at the reacting 😊 |
Could you, please, verify that |
Yes, I believe it is working normally now! |
I was rather thinking about change like this (applicable on master): diff --git a/Src/StartMenu/StartMenuDLL/MenuContainer.cpp b/Src/StartMenu/StartMenuDLL/MenuContainer.cpp
index b6d6967..a859ab2 100644
--- a/Src/StartMenu/StartMenuDLL/MenuContainer.cpp
+++ b/Src/StartMenu/StartMenuDLL/MenuContainer.cpp
@@ -1071,7 +1071,7 @@ void CMenuContainer::AddStandardItems( void )
const StdMenuItem *pInlineParent=NULL;
int searchProviderIndex=-1;
m_SearchProvidersCount=0;
- MenuSkin::TIconSize mainIconSize=s_Skin.Main_icon_size;
+ bool bSecondColumn = false;
for (const StdMenuItem *pStdItem=m_pStdItem;;pStdItem++)
{
if (pStdItem->id==MENU_LAST)
@@ -1089,9 +1089,8 @@ void CMenuContainer::AddStandardItems( void )
if (m_bSubMenu && pStdItem->id==s_ShutdownCommand)
continue;
- const bool bTwoColumns = (!m_bSubMenu && s_Skin.TwoColumns);
- if (pStdItem->id==MENU_COLUMN_BREAK && bTwoColumns)
- mainIconSize=s_Skin.Main2_icon_size;
+ if (pStdItem->id==MENU_COLUMN_BREAK && !m_bSubMenu && s_Skin.TwoColumns)
+ bSecondColumn = true;
int stdOptions=GetStdOptions(pStdItem->id);
if (!(stdOptions&MENU_ENABLED)) continue;
@@ -1272,6 +1271,10 @@ void CMenuContainer::AddStandardItems( void )
item.bSplit=item.bFolder && (item.pStdItem->settings&StdMenuItem::MENU_SPLIT_BUTTON)!=0;
// get icon
+ MenuSkin::TIconSize mainIconSize = s_Skin.Main_icon_size;
+ if (bSecondColumn && !item.bInline)
+ mainIconSize = s_Skin.Main2_icon_size;
+
CItemManager::TIconSizeType iconSizeType;
int refreshFlags;
if (bSearchProvider7 || m_bSubMenu) It should be simpler (no need for weird old value storing/restoring) and hopefully clear too. |
That's clearer, yeah. |
Oki. Could you modify the PR then? And test whether it works as expected? |
@ge0rdi Tested it, works. |
@among-us-official @bonzibudd |
@bonzibudd |
Also, it's quite weird that first line looks good and only subsequent are corrupted. |
@bonzibudd Thanks so much for testing!! Can't believe that in less than a day I've forgotten what that MenuSkin::ICON_SIZE_NONE check was doing. I've put it back in, it should now work correctly. |
@among-us-official Yes, it seems to be working again. Thank you for your help with this! |
You could have explained why it is needed like that :) It is clear from sking manager's code that Now the code in menu container matches the one in skin manager. So hopefully it will be final fix :) |
I have tested the change as well and it looks that everything works as expected. |
Fix regression caused by b89aaed.
#1088 (comment)
The original commit fixed a bug where the icons would not be generated for the second column's icon size. However, the bugged behavior had masked a discrepancy between the icons generated for the inlined submenus (inserted as buttons) in CMenuContainer::AddStandardItems and the drawing settings for them in MenuSkin::LoadSkin. Here are the snippets in order:
Open-Shell-Menu/Src/StartMenu/StartMenuDLL/MenuContainer.cpp
Lines 1275 to 1305 in e6b33a7
Open-Shell-Menu/Src/StartMenu/StartMenuDLL/SkinManager.cpp
Lines 2932 to 2933 in e6b33a7
Since previously mainIconSize was always equal to Main_icon_size (first column's icons), the correct icons were created for the subitems. This workaround restores the old, more correct behavior by saving mainIconSize and restoring it after the related code is over.
Maybe a more permanent solution is to refactor the icon code to run after AddStandardItems, when we know about the icon sizes for each item?