summaryrefslogtreecommitdiff
path: root/indra/media_plugins/cef/media_plugin_cef.cpp
diff options
context:
space:
mode:
authorcallum_linden <none@none>2015-07-15 02:27:33 +0100
committercallum_linden <none@none>2015-07-15 02:27:33 +0100
commit83a9ae7b3c66e87179362f0da9fa7a378b1527e2 (patch)
tree06f185396e03113d643d2c6d96431d3cf25a5493 /indra/media_plugins/cef/media_plugin_cef.cpp
parenta5f1226f248c4d32f7ea84967e3e2f3acc0e0698 (diff)
New keyboard code for windows that uses system messages directly and works ok. Points to new LLCEFLib
Diffstat (limited to 'indra/media_plugins/cef/media_plugin_cef.cpp')
-rw-r--r--indra/media_plugins/cef/media_plugin_cef.cpp90
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);
};
////////////////////////////////////////////////////////////////////////////////