From 5449ae73b337c026afa93e99a47b670c28c8eb80 Mon Sep 17 00:00:00 2001 From: rider Date: Sat, 7 Nov 2015 12:09:08 -0800 Subject: MAINT-5754: Finish key modifier experiment. Still not working. --- indra/media_plugins/cef/media_plugin_cef.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'indra/media_plugins') diff --git a/indra/media_plugins/cef/media_plugin_cef.cpp b/indra/media_plugins/cef/media_plugin_cef.cpp index d653aaace9..7d60c1a5ed 100644 --- a/indra/media_plugins/cef/media_plugin_cef.cpp +++ b/indra/media_plugins/cef/media_plugin_cef.cpp @@ -720,7 +720,7 @@ void MediaPluginCEF::deserializeKeyboardData(LLSD native_key_data, uint32_t& nat //////////////////////////////////////////////////////////////////////////////// // -void MediaPluginCEF::keyEvent(LLCEFLib::EKeyEvent key_event, int key, LLCEFLib::EKeyboardModifier modifiers, LLSD native_key_data = LLSD::emptyMap()) +void MediaPluginCEF::keyEvent(LLCEFLib::EKeyEvent key_event, int key, LLCEFLib::EKeyboardModifier modifiers_x, LLSD native_key_data = LLSD::emptyMap()) { #if LL_DARWIN std::string utf8_text; @@ -729,14 +729,23 @@ void MediaPluginCEF::keyEvent(LLCEFLib::EKeyEvent key_event, int key, LLCEFLib:: uint32_t native_scan_code = native_key_data["scan_code"].asInteger(); uint32_t native_virtual_key = native_key_data["key_code"].asInteger(); uint32_t native_modifiers = native_key_data["modifiers"].asInteger(); - - if (key < 128) { utf8_text = (char)native_virtual_key; } + unsigned int modifers = LLCEFLib::KM_MODIFIER_NONE; + + if (native_modifiers & (MASK_CONTROL | MASK_MAC_CONTROL)) + modifers |= LLCEFLib::KM_MODIFIER_CONTROL; + if (native_modifiers & MASK_SHIFT) + modifers |= LLCEFLib::KM_MODIFIER_SHIFT; + if (native_modifiers & MASK_ALT) + modifers |= LLCEFLib::KM_MODIFIER_ALT; + + //modifers |= LLCEFLib::KM_MODIFIER_META; + switch ((KEY)key) { @@ -750,7 +759,10 @@ void MediaPluginCEF::keyEvent(LLCEFLib::EKeyEvent key_event, int key, LLCEFLib:: break; } - mLLCEFLib->keyboardEvent(key_event, native_char_code, utf8_text.c_str(), native_modifiers, native_scan_code, native_virtual_key, native_modifiers); + mLLCEFLib->keyboardEvent(key_event, native_char_code, utf8_text.c_str(), + static_cast(modifers), + native_scan_code, native_virtual_key, native_modifiers); + #elif LL_WINDOWS U32 msg = ll_U32_from_sd(native_key_data["msg"]); U32 wparam = ll_U32_from_sd(native_key_data["w_param"]); -- cgit v1.2.3