diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2020-06-24 00:08:35 +0300 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2020-06-24 00:08:35 +0300 |
commit | b8127f80c7e305b0c5af7a824b45c81432a8e6b8 (patch) | |
tree | ed34b16459488ce3e6293f84447f04c31ce4887a /indra/llwindow/llkeyboard.cpp | |
parent | aabb0bbc49aa15b100dc8c2cbf286202cb084646 (diff) | |
parent | 05f3287512557cd4cb41de7a8fe3f5171a48481d (diff) |
Merge branch 'DRTVWR-501-maint' into DRTVWR-503-maint
# Conflicts:
# indra/llcommon/llkeybind.cpp
# indra/llcommon/llkeybind.h
Diffstat (limited to 'indra/llwindow/llkeyboard.cpp')
-rw-r--r-- | indra/llwindow/llkeyboard.cpp | 88 |
1 files changed, 39 insertions, 49 deletions
diff --git a/indra/llwindow/llkeyboard.cpp b/indra/llwindow/llkeyboard.cpp index 5404ac50e5..f6f6c3931c 100644 --- a/indra/llwindow/llkeyboard.cpp +++ b/indra/llwindow/llkeyboard.cpp @@ -327,7 +327,7 @@ BOOL LLKeyboard::keyFromString(const std::string& str, KEY *key) // static -std::string LLKeyboard::stringFromKey(KEY key, bool translate) +std::string LLKeyboard::stringFromKey(KEY key) { std::string res = get_if_there(sKeysToNames, key, std::string()); if (res.empty()) @@ -338,60 +338,16 @@ std::string LLKeyboard::stringFromKey(KEY key, bool translate) res = std::string(buffer); } - if (translate) + LLKeyStringTranslatorFunc *trans = gKeyboard->mStringTranslator; + if (trans != NULL) { - LLKeyStringTranslatorFunc *trans = gKeyboard->mStringTranslator; - if (trans != NULL) - { - res = trans(res.c_str()); - } + res = trans(res.c_str()); } return res; } -//static -std::string LLKeyboard::stringFromAccelerator(MASK accel_mask) -{ - std::string res; - - LLKeyStringTranslatorFunc *trans = gKeyboard->mStringTranslator; - - if (trans == NULL) - { - LL_ERRS() << "No mKeyStringTranslator" << LL_ENDL; - return res; - } - // Append any masks -#ifdef LL_DARWIN - // Standard Mac names for modifier keys in menu equivalents - // We could use the symbol characters, but they only exist in certain fonts. - if (accel_mask & MASK_CONTROL) - { - if (accel_mask & MASK_MAC_CONTROL) - { - res.append(trans("accel-mac-control")); - } - else - { - res.append(trans("accel-mac-command")); // Symbol would be "\xE2\x8C\x98" - } - } - if (accel_mask & MASK_ALT) - res.append(trans("accel-mac-option")); // Symbol would be "\xE2\x8C\xA5" - if (accel_mask & MASK_SHIFT) - res.append(trans("accel-mac-shift")); // Symbol would be "\xE2\x8C\xA7" -#else - if (accel_mask & MASK_CONTROL) - res.append(trans("accel-win-control")); - if (accel_mask & MASK_ALT) - res.append(trans("accel-win-alt")); - if (accel_mask & MASK_SHIFT) - res.append(trans("accel-win-shift")); -#endif - return res; -} //static std::string LLKeyboard::stringFromAccelerator( MASK accel_mask, KEY key ) { @@ -403,7 +359,41 @@ std::string LLKeyboard::stringFromAccelerator( MASK accel_mask, KEY key ) return res; } - res.append(stringFromAccelerator(accel_mask)); + LLKeyStringTranslatorFunc *trans = gKeyboard->mStringTranslator; + + if( trans == NULL ) + { + LL_ERRS() << "No mKeyStringTranslator" << LL_ENDL; + return res; + } + + // Append any masks +#ifdef LL_DARWIN + // Standard Mac names for modifier keys in menu equivalents + // We could use the symbol characters, but they only exist in certain fonts. + if( accel_mask & MASK_CONTROL ) + { + if ( accel_mask & MASK_MAC_CONTROL ) + { + res.append( trans("accel-mac-control") ); + } + else + { + res.append( trans("accel-mac-command") ); // Symbol would be "\xE2\x8C\x98" + } + } + if( accel_mask & MASK_ALT ) + res.append( trans("accel-mac-option") ); // Symbol would be "\xE2\x8C\xA5" + if( accel_mask & MASK_SHIFT ) + res.append( trans("accel-mac-shift") ); // Symbol would be "\xE2\x8C\xA7" +#else + if( accel_mask & MASK_CONTROL ) + res.append( trans("accel-win-control") ); + if( accel_mask & MASK_ALT ) + res.append( trans("accel-win-alt") ); + if( accel_mask & MASK_SHIFT ) + res.append( trans("accel-win-shift") ); +#endif std::string key_string = LLKeyboard::stringFromKey(key); if ((accel_mask & MASK_NORMALKEYS) && (key_string[0] == '-' || key_string[0] == '=' || key_string[0] == '+')) |