summaryrefslogtreecommitdiff
path: root/indra/newview/llkeyconflict.cpp
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2019-10-03 19:46:12 +0300
committerandreykproductengine <andreykproductengine@lindenlab.com>2019-10-03 19:46:12 +0300
commitb8c5ae8d8fcf9219112c4ab48233615732737e44 (patch)
treedb0661d9084100f1e700d868ffe78609ccc0f3f0 /indra/newview/llkeyconflict.cpp
parentb6890180eae59529a5825a47f80c9833c0959352 (diff)
SL-6109 Better menu accelerator support and slight reorganization
Diffstat (limited to 'indra/newview/llkeyconflict.cpp')
-rw-r--r--indra/newview/llkeyconflict.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/indra/newview/llkeyconflict.cpp b/indra/newview/llkeyconflict.cpp
index 01230ea26a..bad4e4a2d8 100644
--- a/indra/newview/llkeyconflict.cpp
+++ b/indra/newview/llkeyconflict.cpp
@@ -38,6 +38,7 @@
#include "llkeyboard.h"
#include "llviewercontrol.h"
#include "llviewerinput.h"
+#include "llviewermenu.h"
#include "llxuiparser.h"
//#include "llstring.h"
@@ -170,6 +171,22 @@ bool LLKeyConflictHandler::canAssignControl(const std::string &control_name)
return true;
}
+// static
+bool LLKeyConflictHandler::isReservedByMenu(const KEY &key, const MASK &mask)
+{
+ return gMenuBarView->hasAccelerator(key, mask) || gLoginMenuBarView->hasAccelerator(key, mask);
+}
+
+// static
+bool LLKeyConflictHandler::isReservedByMenu(const LLKeyData &data)
+{
+ if (data.mMouse != CLICK_NONE)
+ {
+ return false;
+ }
+ return gMenuBarView->hasAccelerator(data.mKey, data.mMask) || gLoginMenuBarView->hasAccelerator(data.mKey, data.mMask);
+}
+
bool LLKeyConflictHandler::registerControl(const std::string &control_name, U32 index, EMouseClickType mouse, KEY key, MASK mask, bool ignore_mask)
{
if (control_name.empty())
@@ -186,6 +203,10 @@ bool LLKeyConflictHandler::registerControl(const std::string &control_name, U32
{
return true;
}
+ if (isReservedByMenu(data))
+ {
+ return false;
+ }
if (removeConflicts(data, type_data.mConflictMask))
{
type_data.mKeyBind.replaceKeyData(data, index);