FIRE-19933: Wire up context menu key in inventory (and other folder views)

meow-7.2.2
Ansariel 2020-02-16 01:46:08 +01:00
parent 0ce85ef3b8
commit f7b56e6f7c
1 changed files with 40 additions and 0 deletions

View File

@ -1338,7 +1338,47 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask )
handled = TRUE;
}
break;
// <FS:Ansariel> FIRE-19933: Open context menu on context menu key press
case KEY_CONTEXT_MENU:
S32 count = mSelectedItems.size();
LLMenuGL* menu = (LLMenuGL*)mPopupMenuHandle.get();
if (( count > 0 && (hasVisibleChildren()) ) // show menu only if selected items are visible
&& menu )
{
if (mCallbackRegistrar)
{
mCallbackRegistrar->pushScope();
}
updateMenuOptions(menu);
menu->updateParent(LLMenuGL::sMenuContainer);
LLView* spawning_view = getParentByType<LLFolderViewScrollContainer>();
if (!spawning_view)
{
spawning_view = this;
}
LLMenuGL::showPopup(spawning_view, menu, spawning_view->getRect().getCenterX(), spawning_view->getRect().getCenterY());
if (mCallbackRegistrar)
{
mCallbackRegistrar->popScope();
}
}
else
{
if (menu && menu->getVisible())
{
menu->setVisible(FALSE);
}
setSelection(NULL, FALSE, TRUE);
}
handled = TRUE;
break;
}
// </FS:Ansariel>
return handled;
}