From b20bff17bea9e728de1aa64d35090f07b9b85fba Mon Sep 17 00:00:00 2001 From: Rye Mutt <rye@alchemyviewer.org> Date: Fri, 2 Jul 2021 02:05:27 -0400 Subject: [PATCH] Remove pointless string temporary in keyboard code --- indra/llwindow/llkeyboard.cpp | 3 +-- indra/llwindow/llkeyboard.h | 2 +- indra/newview/llkeyconflict.cpp | 2 +- indra/newview/llviewerinput.cpp | 4 ++-- indra/newview/llviewermenu.cpp | 20 -------------------- 5 files changed, 5 insertions(+), 26 deletions(-) diff --git a/indra/llwindow/llkeyboard.cpp b/indra/llwindow/llkeyboard.cpp index 6260c33d325..555d378773f 100644 --- a/indra/llwindow/llkeyboard.cpp +++ b/indra/llwindow/llkeyboard.cpp @@ -418,9 +418,8 @@ std::string LLKeyboard::stringFromAccelerator( MASK accel_mask, KEY key ) //static -BOOL LLKeyboard::maskFromString(const std::string& str, MASK *mask) +BOOL LLKeyboard::maskFromString(std::string_view instring, MASK* mask) { - std::string instring(str); if (instring == "NONE") { *mask = MASK_NONE; diff --git a/indra/llwindow/llkeyboard.h b/indra/llwindow/llkeyboard.h index 5bd7236191f..2371e11e6f4 100644 --- a/indra/llwindow/llkeyboard.h +++ b/indra/llwindow/llkeyboard.h @@ -92,7 +92,7 @@ class LLKeyboard EKeyboardInsertMode getInsertMode() { return mInsertMode; } void toggleInsertMode(); - static BOOL maskFromString(const std::string& str, MASK *mask); // False on failure + static BOOL maskFromString(std::string_view str, MASK *mask); // False on failure static BOOL keyFromString(const std::string& str, KEY *key); // False on failure static std::string stringFromKey(KEY key, bool translate = true); static std::string stringFromAccelerator( MASK accel_mask ); // separated for convinience, returns with "+": "Shift+" or "Shift+Alt+"... diff --git a/indra/newview/llkeyconflict.cpp b/indra/newview/llkeyconflict.cpp index b6107eeedf1..0485993a668 100644 --- a/indra/newview/llkeyconflict.cpp +++ b/indra/newview/llkeyconflict.cpp @@ -317,7 +317,7 @@ void LLKeyConflictHandler::loadFromSettings(const LLViewerInput::KeyMode& keymod { LLKeyboard::keyFromString(it->key, &key); } - LLKeyboard::maskFromString(it->mask, &mask); + LLKeyboard::maskFromString(it->mask.getValue(), &mask); // Note: it->command is also the name of UI element, howhever xml we are loading from // might not know all the commands, so UI will have to know what to fill by its own // Assumes U32_MAX conflict mask, and is assignable by default, diff --git a/indra/newview/llviewerinput.cpp b/indra/newview/llviewerinput.cpp index d74fc1dbbeb..34411604007 100644 --- a/indra/newview/llviewerinput.cpp +++ b/indra/newview/llviewerinput.cpp @@ -1268,7 +1268,7 @@ S32 LLViewerInput::loadBindingMode(const LLViewerInput::KeyMode& keymode, S32 mo if (key != KEY_NONE) { MASK mask; - LLKeyboard::maskFromString(it->mask, &mask); + LLKeyboard::maskFromString(it->mask.getValue(), &mask); bindKey(mode, key, mask, it->command); processed = true; } @@ -1284,7 +1284,7 @@ S32 LLViewerInput::loadBindingMode(const LLViewerInput::KeyMode& keymode, S32 mo if (mouse != CLICK_NONE) { MASK mask; - LLKeyboard::maskFromString(it->mask, &mask); + LLKeyboard::maskFromString(it->mask.getValue(), &mask); bindMouse(mode, mouse, mask, it->command); processed = true; } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index cd9bb04d2f8..7e13995c2b8 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -3742,15 +3742,6 @@ void handle_dump_focus() LL_INFOS() << "Keyboard focus " << (ctrl ? ctrl->getName() : "(none)") << LL_ENDL; } -class LLSelfStandUp : public view_listener_t -{ - bool handleEvent(const LLSD& userdata) - { - gAgent.standUp(); - return true; - } -}; - bool enable_standup_self() { // [RLVa:KB] - Checked: 2010-04-01 (RLVa-1.2.0c) | Modified: RLVa-1.0.0g @@ -3759,17 +3750,6 @@ bool enable_standup_self() // return isAgentAvatarValid() && gAgentAvatarp->isSitting(); } -class LLSelfSitDown : public view_listener_t - { - bool handleEvent(const LLSD& userdata) - { - gAgent.sitDown(); - return true; - } - }; - - - bool show_sitdown_self() { return isAgentAvatarValid() && !gAgentAvatarp->isSitting(); -- GitLab