diff options
Diffstat (limited to 'indra/media_plugins')
-rw-r--r-- | indra/media_plugins/cef/media_plugin_cef.cpp | 90 |
1 files changed, 9 insertions, 81 deletions
diff --git a/indra/media_plugins/cef/media_plugin_cef.cpp b/indra/media_plugins/cef/media_plugin_cef.cpp index f4ffd6d634..c1724fba3e 100644 --- a/indra/media_plugins/cef/media_plugin_cef.cpp +++ b/indra/media_plugins/cef/media_plugin_cef.cpp @@ -30,6 +30,7 @@ #include "indra_constants.h" // for indra keyboard codes #include "llgl.h" +#include "llsdutil.h" #include "llplugininstance.h" #include "llpluginmessage.h" #include "llpluginmessageclasses.h" @@ -502,93 +503,20 @@ void MediaPluginCEF::deserializeKeyboardData(LLSD native_key_data, uint32_t& nat // void MediaPluginCEF::keyEvent(EKeyEvent key_event, int key, EKeyboardModifier modifiers, LLSD native_key_data = LLSD::emptyMap()) { - // The incoming values for 'key' will be the ones from indra_constants.h - std::string utf8_text; + U32 msg = ll_U32_from_sd(native_key_data["msg"]); + U32 wparam = ll_U32_from_sd(native_key_data["w_param"]); + U64 lparam = ll_U32_from_sd(native_key_data["l_param"]); - if (key < 128) - { - // Low-ascii characters need to get passed through. - utf8_text = (char)key; - } - - // Any special-case handling we want to do for particular keys... - switch ((KEY)key) - { - // ASCII codes for some standard keys - case KEY_BACKSPACE: utf8_text = (char)8; break; - case KEY_TAB: utf8_text = (char)9; break; - case KEY_RETURN: utf8_text = (char)13; break; - case KEY_PAD_RETURN: utf8_text = (char)13; break; - case KEY_ESCAPE: utf8_text = (char)27; break; - - default: - break; - } - - uint32_t native_scan_code = 0; - uint32_t native_virtual_key = 0; - uint32_t native_modifiers = 0; - deserializeKeyboardData(native_key_data, native_scan_code, native_virtual_key, native_modifiers); - - //std::stringstream str; - //str << "@@@@@ KEYBOARD EVENT native_modifiers = " << native_modifiers; - //postDebugMessage(str.str()); - - mLLCEFLib->keyboardEvent(key_event, (uint32_t)key, utf8_text.c_str(), modifiers, native_scan_code, native_virtual_key, native_modifiers); - - - std::stringstream str; - str << "@@@@@@@@@@@@@@@@ MediaPluginCEF::keyEvent"; - postDebugMessage(str.str()); - - //uint32_t msg = native_key_data["msg"].asInteger(); - //uint32_t wparam = native_key_data["w_param"].asInteger(); - //uint64_t lparam = native_key_data["l_param"].asInteger(); - - //std::stringstream str; - //str << "@@@@@@@@@@@@@@@@ keyEvent Native message" << msg << ", " << wparam << ", " << lparam; - //postDebugMessage(str.str()); - - //mLLCEFLib->nativeKeyboardEvent(msg, wparam, lparam); - - - //checkEditState(); + mLLCEFLib->nativeKeyboardEvent(msg, wparam, lparam); }; void MediaPluginCEF::unicodeInput(const std::string &utf8str, EKeyboardModifier modifiers, LLSD native_key_data = LLSD::emptyMap()) { - uint32_t key = KEY_NONE; - - if (utf8str.size() == 1) - { - // The only way a utf8 string can be one byte long is if it's actually a single 7-bit ascii character. - // In this case, use it as the key value. - key = utf8str[0]; - } - - uint32_t native_scan_code = 0; - uint32_t native_virtual_key = 0; - uint32_t native_modifiers = 0; - deserializeKeyboardData(native_key_data, native_scan_code, native_virtual_key, native_modifiers); - - std::stringstream str; - str << "@@@@@@@@@@@@@@@@ MediaPluginCEF::unicodeInput"; - postDebugMessage(str.str()); - - //uint32_t msg = native_key_data["msg"].asInteger(); - //uint32_t wparam = native_key_data["w_param"].asInteger(); - //uint64_t lparam = native_key_data["l_param"].asInteger(); - - //std::stringstream str; - //str << "@@@@@@@@@@@@@@@@ unicodeInput Native message" << msg << ", " << wparam << ", " << lparam; - //postDebugMessage(str.str()); - - //mLLCEFLib->nativeKeyboardEvent(msg, wparam, lparam); - - mLLCEFLib->keyboardEvent(KE_KEY_DOWN, (uint32_t)key, utf8str.c_str(), modifiers, native_scan_code, native_virtual_key, native_modifiers); - mLLCEFLib->keyboardEvent(KE_KEY_UP, (uint32_t)key, utf8str.c_str(), modifiers, native_scan_code, native_virtual_key, native_modifiers); + U32 msg = ll_U32_from_sd(native_key_data["msg"]); + U32 wparam = ll_U32_from_sd(native_key_data["w_param"]); + U64 lparam = ll_U32_from_sd(native_key_data["l_param"]); - // checkEditState(); + mLLCEFLib->nativeKeyboardEvent(msg, wparam, lparam); }; //////////////////////////////////////////////////////////////////////////////// |