From f7b56e6f7cce8d221f439950badccb807ab73a51 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sun, 16 Feb 2020 01:46:08 +0100 Subject: [PATCH] FIRE-19933: Wire up context menu key in inventory (and other folder views) --- indra/llui/llfolderview.cpp | 40 +++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/indra/llui/llfolderview.cpp b/indra/llui/llfolderview.cpp index d7d4249d93..4fa0ba0117 100644 --- a/indra/llui/llfolderview.cpp +++ b/indra/llui/llfolderview.cpp @@ -1338,7 +1338,47 @@ BOOL LLFolderView::handleKeyHere( KEY key, MASK mask ) handled = TRUE; } break; + + // 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(); + 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; } + // return handled; }