Skip to content

Commit 5ffa505

Browse files
authored
Merge pull request #165 from end2endzone/feature-issue6 #6 #31
Merge branch feature-issue6.
2 parents a4516fe + 94e1161 commit 5ffa505

4 files changed

Lines changed: 24 additions & 8 deletions

File tree

CHANGES

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Changes for 0.10.0
22

33
* Deprecated support for icons with negative resource id.
4+
* Fixed issue #6 : (twice) Right-click on a directory with Windows Explorer in the left panel shows the menus twice.
5+
* Fixed issue #31 : (twice) Error in logs for CContextMenu::GetCommandString()
46
* Fixed issue #109: Implement default and verbose logging.
57
* Fixed issue #150: ico icon (that do not specifically force index=0) are not working.
68
* Fixed issue #155: Drop support for loading icons from a resource id (icons with a negative index smaller than -1).

src/shellextension/CContextMenu.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
OBJECT_ENTRY_AUTO(CLSID_ShellAnything, CContextMenu)
5353

5454
static const GUID CLSID_UNDOCUMENTED_01 = { 0x924502a7, 0xcc8e, 0x4f60, { 0xae, 0x1f, 0xf7, 0x0c, 0x0a, 0x2b, 0x7a, 0x7c } };
55+
HMENU CContextMenu::m_previousMenu = 0;
5556

5657
void CContextMenu::BuildSubMenuTree(HMENU hMenu, shellanything::Menu* menu, UINT& insert_pos, bool& next_menu_is_column)
5758
{
@@ -333,7 +334,6 @@ CContextMenu::CContextMenu()
333334
m_FirstCommandId = 0;
334335
m_IsBackGround = false;
335336
m_BuildMenuTreeCount = 0;
336-
m_previousMenu = 0;
337337
}
338338

339339
CContextMenu::~CContextMenu()
@@ -382,7 +382,8 @@ HRESULT STDMETHODCALLTYPE CContextMenu::QueryContextMenu(HMENU hMenu, UINT menu_
382382
//Issue #6 - Right-click on a directory with Windows Explorer in the left panel shows the menus twice.
383383
//Issue #31 - Error in logs for CContextMenu::GetCommandString().
384384
//Using a static variable is a poor method for solving the issue but it is a "good enough" strategy.
385-
SA_LOG(INFO) << "Skipped, QueryContextMenu() called twice and menu is already populated once.";
385+
SA_LOG(INFO) << "Skipped, QueryContextMenu() called twice and menu is already populated once. "
386+
"A call to QueryContextMenu() from another instance has already run and populated the menu.";
386387
return MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_NULL, 0); //nothing inserted
387388
}
388389

src/shellextension/CContextMenu.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,6 @@ class ATL_NO_VTABLE CContextMenu :
8989
int m_BuildMenuTreeCount; //number of times that BuildMenuTree() was called
9090
shellanything::BitmapCache m_BitmapCache;
9191
IconMap m_FileExtensionCache;
92-
HMENU m_previousMenu;
92+
static HMENU m_previousMenu; // issue #6. Field must be static
9393
shellanything::SelectionContext m_Context;
9494
};

src/shellextension/utils.cpp

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,25 @@ template <class T> class FlagDescriptor
107107
const T& flag = flags[index].value;
108108
const char* name = flags[index].name;
109109

110-
//if flag is set
111-
if ((value & flag) == flag)
110+
// Test special case where a flag has no bit set (flag == 0x00)
111+
// The only time where it should be reported is when the value is also 0.
112+
if (flag == 0)
112113
{
113-
if (!desc.empty())
114-
desc.append("|");
115-
desc.append(name);
114+
if (flag == value)
115+
{
116+
desc = name;
117+
break;
118+
}
119+
}
120+
else
121+
{
122+
//if flag is set
123+
if ((value & flag) == flag)
124+
{
125+
if (!desc.empty())
126+
desc.append("|");
127+
desc.append(name);
128+
}
116129
}
117130

118131
//next flag

0 commit comments

Comments
 (0)