Skip to content

Commit 43f8da3

Browse files
lidaixingchenstd-microblock
authored andcommitted
fix: pass correct menu item index in WM_INITMENUPOPUP lParam for submenus
Previously, WM_INITMENUPOPUP was sent with lParam=0xFFFFFFFF for all submenus, which tells the context menu handler that the menu position is unknown. This caused the SendTo shell extension to fail to properly identify the submenu, resulting in it enumerating the wrong directory (user home directory instead of the SendTo folder). Now we pass the actual menu item index as the low-order word of lParam, allowing context menu handlers to correctly identify which submenu is being initialized.
1 parent 033ee34 commit 43f8da3

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/shell/contextmenu/contextmenu.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,12 @@ menu menu::construct_with_hmenu(
177177

178178
if (info.hSubMenu) {
179179
auto main_thread_id = GetCurrentThreadId();
180+
int submenu_pos = i;
180181
item.submenu = [=](std::shared_ptr<menu_widget> mw) {
181182
auto task = [&]() {
182183
HandleMenuMsg(WM_INITMENUPOPUP,
183184
reinterpret_cast<WPARAM>(info.hSubMenu),
184-
0xFFFFFFFF);
185+
static_cast<LPARAM>(submenu_pos));
185186
mw->init_from_data(menu::construct_with_hmenu(
186187
info.hSubMenu, hWnd, false, HandleMenuMsg));
187188
};

0 commit comments

Comments
 (0)