From fae9c8fe864278b20dfdb7caae3fbc50c779947b Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Mon, 18 Jan 2010 17:58:12 -0800 Subject: Added getNativeKeyData() function to LLWindow and LLWindowMacOSX. Added an LLSD argument to LLPluginClassMedia::keyEvent() and LLPluginClassMedia::textInput() which contains the native key data. Made LLViewerMediaImpl retrieve the native key data and pass it to keyEvent and textInput. Added a native_key_data parameter to the text_event and key_event messages. Made the webkit plugin extract the native_key_data parameter and pass it to the internal keyEvent() and unicodeInput() functions. Fixed LLMediaPluginTest to match function signature change to LLPluginClassMedia::keyEvent(). --- indra/media_plugins/webkit/media_plugin_webkit.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'indra/media_plugins') diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index 084cdd9561..3248f1dab5 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -464,7 +464,7 @@ private: //////////////////////////////////////////////////////////////////////////////// // - void keyEvent(LLQtWebKit::EKeyEvent key_event, int key, LLQtWebKit::EKeyboardModifier modifiers) + void keyEvent(LLQtWebKit::EKeyEvent key_event, int key, LLQtWebKit::EKeyboardModifier modifiers, LLSD native_key_data = LLSD::emptyMap()) { int llqt_key; @@ -515,6 +515,8 @@ private: } // std::cerr << "keypress, original code = 0x" << std::hex << key << ", converted code = 0x" << std::hex << llqt_key << std::dec << std::endl; + + std::cerr << "key event " << (int)key_event << ", native_key_data = " << native_key_data << std::endl; if(llqt_key != 0) { @@ -526,10 +528,12 @@ private: //////////////////////////////////////////////////////////////////////////////// // - void unicodeInput( const std::string &utf8str, LLQtWebKit::EKeyboardModifier modifiers) + void unicodeInput( const std::string &utf8str, LLQtWebKit::EKeyboardModifier modifiers, LLSD native_key_data = LLSD::emptyMap()) { LLWString wstr = utf8str_to_wstring(utf8str); + std::cerr << "unicode input, native_key_data = " << native_key_data << std::endl; + unsigned int i; for(i=0; i < wstr.size(); i++) { @@ -843,6 +847,7 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) std::string event = message_in.getValue("event"); S32 key = message_in.getValueS32("key"); std::string modifiers = message_in.getValue("modifiers"); + LLSD native_key_data = message_in.getValueLLSD("native_key_data"); // Treat unknown events as key-up for safety. LLQtWebKit::EKeyEvent key_event = LLQtWebKit::KE_KEY_UP; @@ -855,14 +860,15 @@ void MediaPluginWebKit::receiveMessage(const char *message_string) key_event = LLQtWebKit::KE_KEY_REPEAT; } - keyEvent(key_event, key, decodeModifiers(modifiers)); + keyEvent(key_event, key, decodeModifiers(modifiers), native_key_data); } else if(message_name == "text_event") { std::string text = message_in.getValue("text"); std::string modifiers = message_in.getValue("modifiers"); + LLSD native_key_data = message_in.getValueLLSD("native_key_data"); - unicodeInput(text, decodeModifiers(modifiers)); + unicodeInput(text, decodeModifiers(modifiers), native_key_data); } if(message_name == "edit_cut") { -- cgit v1.3 From 572b8fc518ee45cdf5403f58b18e0000868696cb Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Tue, 19 Jan 2010 21:55:51 -0800 Subject: Changes to llqtwebkit keyboard event api. Reference to new mac build of llqtwebkit (from revision 5e61bf24915f in https://hg.lindenlab.com/monroe/llqtwebkit-4.6). --- indra/llplugin/llpluginclassmedia.cpp | 6 +- indra/media_plugins/webkit/media_plugin_webkit.cpp | 109 +++++++++------------ install.xml | 4 +- 3 files changed, 52 insertions(+), 67 deletions(-) (limited to 'indra/media_plugins') diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp index 609e198db2..adc0b3467d 100644 --- a/indra/llplugin/llpluginclassmedia.cpp +++ b/indra/llplugin/llpluginclassmedia.cpp @@ -682,13 +682,13 @@ LLPluginClassMedia::ETargetType getTargetTypeFromLLQtWebkit(int target_type) // so that we don't expose the llqtwebkit header in viewer code switch (target_type) { - case LinkTargetType::LTT_TARGET_NONE: + case LLQtWebKit::LTT_TARGET_NONE: return LLPluginClassMedia::TARGET_NONE; - case LinkTargetType::LTT_TARGET_BLANK: + case LLQtWebKit::LTT_TARGET_BLANK: return LLPluginClassMedia::TARGET_BLANK; - case LinkTargetType::LTT_TARGET_EXTERNAL: + case LLQtWebKit::LTT_TARGET_EXTERNAL: return LLPluginClassMedia::TARGET_EXTERNAL; default: diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index 3248f1dab5..e95e9e3b34 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -466,62 +466,43 @@ private: // void keyEvent(LLQtWebKit::EKeyEvent key_event, int key, LLQtWebKit::EKeyboardModifier modifiers, LLSD native_key_data = LLSD::emptyMap()) { - int llqt_key; - // The incoming values for 'key' will be the ones from indra_constants.h - // the outgoing values are the ones from llqtwebkit.h + std::string utf8_text; + + if(key < KEY_SPECIAL) + { + // 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) { - // This is the list that the llqtwebkit implementation actually maps into Qt keys. -// case KEY_XXX: llqt_key = LL_DOM_VK_CANCEL; break; -// case KEY_XXX: llqt_key = LL_DOM_VK_HELP; break; - case KEY_BACKSPACE: llqt_key = LL_DOM_VK_BACK_SPACE; break; - case KEY_TAB: llqt_key = LL_DOM_VK_TAB; break; -// case KEY_XXX: llqt_key = LL_DOM_VK_CLEAR; break; - case KEY_RETURN: llqt_key = LL_DOM_VK_RETURN; break; - case KEY_PAD_RETURN: llqt_key = LL_DOM_VK_ENTER; break; - case KEY_SHIFT: llqt_key = LL_DOM_VK_SHIFT; break; - case KEY_CONTROL: llqt_key = LL_DOM_VK_CONTROL; break; - case KEY_ALT: llqt_key = LL_DOM_VK_ALT; break; -// case KEY_XXX: llqt_key = LL_DOM_VK_PAUSE; break; - case KEY_CAPSLOCK: llqt_key = LL_DOM_VK_CAPS_LOCK; break; - case KEY_ESCAPE: llqt_key = LL_DOM_VK_ESCAPE; break; - case KEY_PAGE_UP: llqt_key = LL_DOM_VK_PAGE_UP; break; - case KEY_PAGE_DOWN: llqt_key = LL_DOM_VK_PAGE_DOWN; break; - case KEY_END: llqt_key = LL_DOM_VK_END; break; - case KEY_HOME: llqt_key = LL_DOM_VK_HOME; break; - case KEY_LEFT: llqt_key = LL_DOM_VK_LEFT; break; - case KEY_UP: llqt_key = LL_DOM_VK_UP; break; - case KEY_RIGHT: llqt_key = LL_DOM_VK_RIGHT; break; - case KEY_DOWN: llqt_key = LL_DOM_VK_DOWN; break; -// case KEY_XXX: llqt_key = LL_DOM_VK_PRINTSCREEN; break; - case KEY_INSERT: llqt_key = LL_DOM_VK_INSERT; break; - case KEY_DELETE: llqt_key = LL_DOM_VK_DELETE; break; -// case KEY_XXX: llqt_key = LL_DOM_VK_CONTEXT_MENU; break; + // ASCII codes for some standard keys + case LLQtWebKit::KEY_BACKSPACE: utf8_text = (char)8; break; + case LLQtWebKit::KEY_TAB: utf8_text = (char)9; break; + case LLQtWebKit::KEY_RETURN: utf8_text = (char)13; break; + case LLQtWebKit::KEY_PAD_RETURN: utf8_text = (char)13; break; + case LLQtWebKit::KEY_ESCAPE: utf8_text = (char)27; break; - default: - if(key < KEY_SPECIAL) - { - // Pass the incoming key through -- it should be regular ASCII, which should be correct for webkit. - llqt_key = key; - } - else - { - // Don't pass through untranslated special keys -- they'll be all wrong. - llqt_key = 0; - } + default: break; } -// std::cerr << "keypress, original code = 0x" << std::hex << key << ", converted code = 0x" << std::hex << llqt_key << std::dec << std::endl; - - std::cerr << "key event " << (int)key_event << ", native_key_data = " << native_key_data << std::endl; +// std::cerr << "key event " << (int)key_event << ", native_key_data = " << native_key_data << std::endl; + + uint32_t native_scan_code = 0; + uint32_t native_virtual_key = 0; + uint32_t native_modifiers = 0; - if(llqt_key != 0) + if(native_key_data.isMap()) { - LLQtWebKit::getInstance()->keyEvent( mBrowserWindowId, key_event, llqt_key, modifiers); + native_scan_code = (uint32_t)(native_key_data["key_code"].asInteger()); + native_virtual_key = (uint32_t)(native_key_data["char_code"].asInteger()); + native_modifiers = (uint32_t)(native_key_data["modifiers"].asInteger()); } + + LLQtWebKit::getInstance()->keyboardEvent( mBrowserWindowId, key_event, (uint32_t)key, utf8_text.c_str(), modifiers, native_scan_code, native_virtual_key, native_modifiers); checkEditState(); }; @@ -529,27 +510,31 @@ private: //////////////////////////////////////////////////////////////////////////////// // void unicodeInput( const std::string &utf8str, LLQtWebKit::EKeyboardModifier modifiers, LLSD native_key_data = LLSD::emptyMap()) - { - LLWString wstr = utf8str_to_wstring(utf8str); + { + uint32_t key = LLQtWebKit::KEY_NONE; - std::cerr << "unicode input, native_key_data = " << native_key_data << std::endl; +// std::cerr << "unicode input, native_key_data = " << native_key_data << std::endl; - unsigned int i; - for(i=0; i < wstr.size(); i++) + if(utf8str.size() == 1) { -// std::cerr << "unicode input, code = 0x" << std::hex << (unsigned long)(wstr[i]) << std::dec << std::endl; - - if(wstr[i] == 32) - { - // For some reason, the webkit plugin really wants the space bar to come in through the key-event path, not the unicode path. - LLQtWebKit::getInstance()->keyEvent( mBrowserWindowId, LLQtWebKit::KE_KEY_DOWN, 32, modifiers); - LLQtWebKit::getInstance()->keyEvent( mBrowserWindowId, LLQtWebKit::KE_KEY_UP, 32, modifiers); - } - else - { - LLQtWebKit::getInstance()->unicodeInput(mBrowserWindowId, wstr[i], modifiers); - } + // 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; + + if(native_key_data.isMap()) + { + native_scan_code = (uint32_t)(native_key_data["key_code"].asInteger()); + native_virtual_key = (uint32_t)(native_key_data["char_code"].asInteger()); + native_modifiers = (uint32_t)(native_key_data["modifiers"].asInteger()); } + + LLQtWebKit::getInstance()->keyboardEvent( mBrowserWindowId, LLQtWebKit::KE_KEY_DOWN, (uint32_t)key, utf8str.c_str(), modifiers, native_scan_code, native_virtual_key, native_modifiers); + LLQtWebKit::getInstance()->keyboardEvent( mBrowserWindowId, LLQtWebKit::KE_KEY_UP, (uint32_t)key, utf8str.c_str(), modifiers, native_scan_code, native_virtual_key, native_modifiers); checkEditState(); }; diff --git a/install.xml b/install.xml index ef24263972..81064c6306 100644 --- a/install.xml +++ b/install.xml @@ -948,9 +948,9 @@ anguage Infrstructure (CLI) international standard darwin md5sum - 2eb58f544c0d912aa382de2c947be7f1 + 02d3d8171fff0c673f900f1d1a53046a url - http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/llqtwebkit-4.6-darwin-20100104.tar.bz2 + http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/llqtwebkit-4.6-darwin-20100119.tar.bz2 linux -- cgit v1.3 From 80139d95adbcb2258c5541a4e0ace32f32b78ba5 Mon Sep 17 00:00:00 2001 From: Callum Prentice Date: Thu, 4 Feb 2010 16:30:21 -0800 Subject: added code to grab raw key codes from Win32 WPARAM and LPARAM and send to plugin factored out keyboard message deserialization for media_plugin_webkit new version of llqtwebkit with Girish's changes to keyboard and cursor handling code --- indra/llwindow/llwindowwin32.cpp | 37 ++++++++++++++++++++++ indra/llwindow/llwindowwin32.h | 6 +++- indra/media_plugins/webkit/media_plugin_webkit.cpp | 37 ++++++++++++++-------- install.xml | 4 +-- 4 files changed, 67 insertions(+), 17 deletions(-) (limited to 'indra/media_plugins') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index b591111b75..1b9331e784 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -376,6 +376,9 @@ LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, mMousePositionModified = FALSE; mInputProcessingPaused = FALSE; mPreeditor = NULL; + mKeyCharCode = 0; + mKeyScanCode = 0; + mKeyVirtualKey = 0; mhDC = NULL; mhRC = NULL; @@ -1858,6 +1861,10 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ // allow system keys, such as ALT-F4 to be processed by Windows eat_keystroke = FALSE; case WM_KEYDOWN: + window_imp->mKeyCharCode = 0; // don't know until wm_char comes in next + window_imp->mKeyScanCode = ( l_param >> 16 ) & 0xff; + window_imp->mKeyVirtualKey = w_param; + window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_KEYDOWN"); { if (gDebugWindowProc) @@ -1877,6 +1884,9 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ eat_keystroke = FALSE; case WM_KEYUP: { + window_imp->mKeyScanCode = ( l_param >> 16 ) & 0xff; + window_imp->mKeyVirtualKey = w_param; + window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_KEYUP"); LLFastTimer t2(FTM_KEYHANDLER); @@ -1962,6 +1972,8 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_ break; case WM_CHAR: + window_imp->mKeyCharCode = w_param; + // Should really use WM_UNICHAR eventually, but it requires a specific Windows version and I need // to figure out how that works. - Doug // @@ -3033,6 +3045,31 @@ void LLWindowWin32::spawnWebBrowser(const std::string& escaped_url ) */ } +/* + Make the raw keyboard data available - used to poke through to LLQtWebKit so + that Qt/Webkit has access to the virtual keycodes etc. that it needs +*/ +LLSD LLWindowWin32::getNativeKeyData() +{ + LLSD result = LLSD::emptyMap(); + + // would like to use LLQtWebKit::KM_MODIFIER_SHIFT but don't want + // make the client depend on llQtWebKit so pass over as an int + // (not bool so we can to modifier list later) + S32 modifiers = 0; + if ( GetKeyState( VK_SHIFT ) ) + { + modifiers = 1; + }; + + // these LLSD names are a little confusing here but they + // make more sense on the Mac specific version and that was done first + result["key_code"] = (S32)mKeyScanCode; + result["char_code"] = (S32)mKeyVirtualKey; + result["modifiers"] = modifiers; + + return result; +} BOOL LLWindowWin32::dialogColorPicker( F32 *r, F32 *g, F32 *b ) { diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index e4e9179db7..d53538cba1 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -128,7 +128,7 @@ protected: HCURSOR loadColorCursor(LPCTSTR name); BOOL isValid(); void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size); - + LLSD getNativeKeyData(); // Changes display resolution. Returns true if successful BOOL setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh); @@ -205,6 +205,10 @@ protected: LLPreeditor *mPreeditor; + U32 mKeyCharCode; + U32 mKeyScanCode; + U32 mKeyVirtualKey; + friend class LLWindowManager; }; diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index e95e9e3b34..89ea1b0537 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -461,6 +461,27 @@ private: return (LLQtWebKit::EKeyboardModifier)result; } + //////////////////////////////////////////////////////////////////////////////// + // + void deserializeKeyboardData( LLSD native_key_data, uint32_t& native_scan_code, uint32_t& native_virtual_key, uint32_t& native_modifiers ) + { + if( native_key_data.isMap() ) + { + // these LLSD names are a little confusing here but they + // make more sense on the Mac specific version and that was done first + native_scan_code = (uint32_t)(native_key_data["key_code"].asInteger()); + native_virtual_key = (uint32_t)(native_key_data["char_code"].asInteger()); + native_modifiers = (uint32_t)(native_key_data["modifiers"].asInteger()); + + // would like to use LLQtWebKit::KM_MODIFIER_SHIFT but don't want + // make the client depend on llQtWebKit so pass over as an int + // (not bool so we can to modifier list later) + if ( native_modifiers == 1 ) + native_modifiers = LLQtWebKit::KM_MODIFIER_SHIFT; + else + native_modifiers = LLQtWebKit::KM_MODIFIER_NONE; + }; + }; //////////////////////////////////////////////////////////////////////////////// // @@ -494,13 +515,7 @@ private: uint32_t native_scan_code = 0; uint32_t native_virtual_key = 0; uint32_t native_modifiers = 0; - - if(native_key_data.isMap()) - { - native_scan_code = (uint32_t)(native_key_data["key_code"].asInteger()); - native_virtual_key = (uint32_t)(native_key_data["char_code"].asInteger()); - native_modifiers = (uint32_t)(native_key_data["modifiers"].asInteger()); - } + deserializeKeyboardData( native_key_data, native_scan_code, native_virtual_key, native_modifiers ); LLQtWebKit::getInstance()->keyboardEvent( mBrowserWindowId, key_event, (uint32_t)key, utf8_text.c_str(), modifiers, native_scan_code, native_virtual_key, native_modifiers); @@ -525,13 +540,7 @@ private: uint32_t native_scan_code = 0; uint32_t native_virtual_key = 0; uint32_t native_modifiers = 0; - - if(native_key_data.isMap()) - { - native_scan_code = (uint32_t)(native_key_data["key_code"].asInteger()); - native_virtual_key = (uint32_t)(native_key_data["char_code"].asInteger()); - native_modifiers = (uint32_t)(native_key_data["modifiers"].asInteger()); - } + deserializeKeyboardData( native_key_data, native_scan_code, native_virtual_key, native_modifiers ); LLQtWebKit::getInstance()->keyboardEvent( mBrowserWindowId, LLQtWebKit::KE_KEY_DOWN, (uint32_t)key, utf8str.c_str(), modifiers, native_scan_code, native_virtual_key, native_modifiers); LLQtWebKit::getInstance()->keyboardEvent( mBrowserWindowId, LLQtWebKit::KE_KEY_UP, (uint32_t)key, utf8str.c_str(), modifiers, native_scan_code, native_virtual_key, native_modifiers); diff --git a/install.xml b/install.xml index 81064c6306..ee8f26378c 100644 --- a/install.xml +++ b/install.xml @@ -962,9 +962,9 @@ anguage Infrstructure (CLI) international standard windows md5sum - c41be1ba9728555ae5a2d2151c96dfe1 + 5c9c02e4f81fc6221225f426653f13b1 url - http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/llqtwebkit-windows-qt4.6-20100115.tar.bz2 + http://viewer-source-downloads.s3.amazonaws.com/install_pkgs/llqtwebkit-windows-qt4.6-20100204.tar.bz2 -- cgit v1.3 From f9f6f1958db0fcaabf78f61ab86f9e533bb9cc02 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Fri, 5 Feb 2010 09:01:58 +0000 Subject: EXT-4290 [Flash] On linux, youtube videos don't play unless its getting a mouse move event This should be a lot better now. But still not good overall. Performance is now just bad instead of intolerable. --- indra/llwindow/llwindowsdl.cpp | 2 +- indra/media_plugins/webkit/CMakeLists.txt | 11 +++++++++- indra/media_plugins/webkit/media_plugin_webkit.cpp | 24 ++++++++++++++++++---- 3 files changed, 31 insertions(+), 6 deletions(-) (limited to 'indra/media_plugins') diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index bfdf1147a1..f9c3694459 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -1617,7 +1617,7 @@ void LLWindowSDL::processMiscNativeEvents() pump_timer.setTimerExpirySec(1.0f / 15.0f); do { // Always do at least one non-blocking pump - gtk_main_iteration_do(0); + gtk_main_iteration_do(FALSE); } while (gtk_events_pending() && !pump_timer.hasExpired()); diff --git a/indra/media_plugins/webkit/CMakeLists.txt b/indra/media_plugins/webkit/CMakeLists.txt index 5bccd589d8..812760a116 100644 --- a/indra/media_plugins/webkit/CMakeLists.txt +++ b/indra/media_plugins/webkit/CMakeLists.txt @@ -9,6 +9,7 @@ include(LLPlugin) include(LLMath) include(LLRender) include(LLWindow) +include(UI) include(Linking) include(PluginAPI) include(MediaPluginBase) @@ -38,7 +39,7 @@ add_library(media_plugin_webkit ${media_plugin_webkit_SOURCE_FILES} ) -target_link_libraries(media_plugin_webkit +set(media_plugin_webkit_LINK_LIBRARIES ${LLPLUGIN_LIBRARIES} ${MEDIA_PLUGIN_BASE_LIBRARIES} ${LLCOMMON_LIBRARIES} @@ -46,6 +47,14 @@ target_link_libraries(media_plugin_webkit ${PLUGIN_API_WINDOWS_LIBRARIES} ) +if (LINUX) + list(APPEND media_plugin_webkit_LINK_LIBRARIES + ${UI_LIBRARIES} # for glib/GTK + ) +endif (LINUX) + +target_link_libraries(media_plugin_webkit ${media_plugin_webkit_LINK_LIBRARIES}) + add_dependencies(media_plugin_webkit ${LLPLUGIN_LIBRARIES} ${MEDIA_PLUGIN_BASE_LIBRARIES} diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index 3c24b4ed22..b607d2f66a 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -43,15 +43,21 @@ #include "llpluginmessageclasses.h" #include "media_plugin_base.h" +#if LL_LINUX +extern "C" { +# include +} +#endif // LL_LINUX + #if LL_WINDOWS -#include +# include #else -#include -#include +# include +# include #endif #if LL_WINDOWS - // *NOTE:Mani - This captures the module handle fo rthe dll. This is used below + // *NOTE:Mani - This captures the module handle for the dll. This is used below // to get the path to this dll for webkit initialization. // I don't know how/if this can be done with apr... namespace { HMODULE gModuleHandle;}; @@ -112,6 +118,16 @@ private: // void update(int milliseconds) { +#if LL_LINUX + // pump glib generously, as Linux browser plugins are on the + // glib main loop, even if the browser itself isn't - ugh + //*TODO: shouldn't this be transparent if Qt was compiled with + // glib mainloop integration? investigate. + GMainContext *mainc = g_main_context_default(); + while(g_main_context_iteration(mainc, FALSE)); +#endif // LL_LINUX + + // pump qt LLQtWebKit::getInstance()->pump( milliseconds ); checkEditState(); -- cgit v1.3 From 456bbdfa2f3471896f6981e70a9daa56dae51d18 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Fri, 5 Feb 2010 09:03:09 +0000 Subject: fix hook whine. --- indra/media_plugins/webkit/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/media_plugins') diff --git a/indra/media_plugins/webkit/CMakeLists.txt b/indra/media_plugins/webkit/CMakeLists.txt index 812760a116..4512c22b5d 100644 --- a/indra/media_plugins/webkit/CMakeLists.txt +++ b/indra/media_plugins/webkit/CMakeLists.txt @@ -88,4 +88,5 @@ if (DARWIN) DEPENDS media_plugin_webkit ${CMAKE_SOURCE_DIR}/../libraries/universal-darwin/lib_release/libllqtwebkit.dylib ) -endif (DARWIN) \ No newline at end of file +endif (DARWIN) + -- cgit v1.3 From 8b0ae67e73a82940d3e7004eb17081a8ca4b8594 Mon Sep 17 00:00:00 2001 From: Monroe Linden Date: Fri, 5 Feb 2010 18:23:16 -0800 Subject: Changed LLWindowWin32::getNativeKeyData() to use platform-specific names in the key data. Changed MediaPluginWebkit::deserializeKeyboardData() to use platform-specific names when extracting the key data. Also fixed a mac-specific issue where the arguments were reversed, which was causing flash apps to get bad keycode data. Just pass 0 for the "native modifiers" param on windows, since it doesn't seem to actually have a native notion of a "modifier keys mask". The Qt (non-native) modifiers should be good enough. --- indra/llwindow/llwindowwin32.cpp | 16 ++----------- indra/media_plugins/webkit/media_plugin_webkit.cpp | 26 ++++++++++++---------- 2 files changed, 16 insertions(+), 26 deletions(-) (limited to 'indra/media_plugins') diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 1b9331e784..4c63938415 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -3053,20 +3053,8 @@ LLSD LLWindowWin32::getNativeKeyData() { LLSD result = LLSD::emptyMap(); - // would like to use LLQtWebKit::KM_MODIFIER_SHIFT but don't want - // make the client depend on llQtWebKit so pass over as an int - // (not bool so we can to modifier list later) - S32 modifiers = 0; - if ( GetKeyState( VK_SHIFT ) ) - { - modifiers = 1; - }; - - // these LLSD names are a little confusing here but they - // make more sense on the Mac specific version and that was done first - result["key_code"] = (S32)mKeyScanCode; - result["char_code"] = (S32)mKeyVirtualKey; - result["modifiers"] = modifiers; + result["scan_code"] = (S32)mKeyScanCode; + result["virtual_key"] = (S32)mKeyVirtualKey; return result; } diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index 56b9250393..b147b1d96a 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -474,21 +474,23 @@ private: // void deserializeKeyboardData( LLSD native_key_data, uint32_t& native_scan_code, uint32_t& native_virtual_key, uint32_t& native_modifiers ) { + native_scan_code = 0; + native_virtual_key = 0; + native_modifiers = 0; + if( native_key_data.isMap() ) { - // these LLSD names are a little confusing here but they - // make more sense on the Mac specific version and that was done first - native_scan_code = (uint32_t)(native_key_data["key_code"].asInteger()); - native_virtual_key = (uint32_t)(native_key_data["char_code"].asInteger()); +#if LL_DARWIN + native_scan_code = (uint32_t)(native_key_data["char_code"].asInteger()); + native_virtual_key = (uint32_t)(native_key_data["key_code"].asInteger()); native_modifiers = (uint32_t)(native_key_data["modifiers"].asInteger()); - - // would like to use LLQtWebKit::KM_MODIFIER_SHIFT but don't want - // make the client depend on llQtWebKit so pass over as an int - // (not bool so we can to modifier list later) - if ( native_modifiers == 1 ) - native_modifiers = LLQtWebKit::KM_MODIFIER_SHIFT; - else - native_modifiers = LLQtWebKit::KM_MODIFIER_NONE; +#elif LL_WINDOWS + native_scan_code = (uint32_t)(native_key_data["scan_code"].asInteger()); + native_virtual_key = (uint32_t)(native_key_data["virtual_key"].asInteger()); + // TODO: I don't think we need to do anything with native modifiers here -- please verify +#else + // Add other platforms here as needed +#endif }; }; -- cgit v1.3 From 5abb6dece78d9c7639511830590e0f447790fa82 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Tue, 9 Feb 2010 14:00:33 +0000 Subject: HACK HACK HACK to unbreak linux build while I wait for access to the new llqtwebkit code. only affects linux. may harm webkit functionality temporarily. to be backed-out. --- indra/llplugin/llpluginclassmedia.cpp | 3 ++- indra/media_plugins/webkit/media_plugin_webkit.cpp | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'indra/media_plugins') diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp index 6a2449cf4b..b9bab491f3 100644 --- a/indra/llplugin/llpluginclassmedia.cpp +++ b/indra/llplugin/llpluginclassmedia.cpp @@ -684,6 +684,7 @@ LLPluginClassMedia::ETargetType getTargetTypeFromLLQtWebkit(int target_type) // so that we don't expose the llqtwebkit header in viewer code switch (target_type) { +#if !LL_LINUX case LLQtWebKit::LTT_TARGET_NONE: return LLPluginClassMedia::TARGET_NONE; @@ -692,7 +693,7 @@ LLPluginClassMedia::ETargetType getTargetTypeFromLLQtWebkit(int target_type) case LLQtWebKit::LTT_TARGET_EXTERNAL: return LLPluginClassMedia::TARGET_EXTERNAL; - +#endif default: return LLPluginClassMedia::TARGET_OTHER; } diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index 02dba41f2a..d1f06147d6 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -526,13 +526,14 @@ private: // Any special-case handling we want to do for particular keys... switch((KEY)key) { +#if !LL_LINUX // ASCII codes for some standard keys case LLQtWebKit::KEY_BACKSPACE: utf8_text = (char)8; break; case LLQtWebKit::KEY_TAB: utf8_text = (char)9; break; case LLQtWebKit::KEY_RETURN: utf8_text = (char)13; break; case LLQtWebKit::KEY_PAD_RETURN: utf8_text = (char)13; break; case LLQtWebKit::KEY_ESCAPE: utf8_text = (char)27; break; - +#endif default: break; } @@ -544,7 +545,9 @@ private: uint32_t native_modifiers = 0; deserializeKeyboardData( native_key_data, native_scan_code, native_virtual_key, native_modifiers ); +#if !LL_LINUX LLQtWebKit::getInstance()->keyboardEvent( mBrowserWindowId, key_event, (uint32_t)key, utf8_text.c_str(), modifiers, native_scan_code, native_virtual_key, native_modifiers); +#endif checkEditState(); }; @@ -553,8 +556,12 @@ private: // void unicodeInput( const std::string &utf8str, LLQtWebKit::EKeyboardModifier modifiers, LLSD native_key_data = LLSD::emptyMap()) { +#if !LL_LINUX uint32_t key = LLQtWebKit::KEY_NONE; - +#else + uint32_t key = 0; +#endif + // std::cerr << "unicode input, native_key_data = " << native_key_data << std::endl; if(utf8str.size() == 1) @@ -569,8 +576,10 @@ private: uint32_t native_modifiers = 0; deserializeKeyboardData( native_key_data, native_scan_code, native_virtual_key, native_modifiers ); +#if !LL_LINUX LLQtWebKit::getInstance()->keyboardEvent( mBrowserWindowId, LLQtWebKit::KE_KEY_DOWN, (uint32_t)key, utf8str.c_str(), modifiers, native_scan_code, native_virtual_key, native_modifiers); LLQtWebKit::getInstance()->keyboardEvent( mBrowserWindowId, LLQtWebKit::KE_KEY_UP, (uint32_t)key, utf8str.c_str(), modifiers, native_scan_code, native_virtual_key, native_modifiers); +#endif checkEditState(); }; -- cgit v1.3 From c66e9199a56f7fd43ddab423af9d37e71b51f158 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Tue, 9 Feb 2010 14:52:13 +0000 Subject: Backed out changeset b1c241040751 --- indra/llplugin/llpluginclassmedia.cpp | 3 +-- indra/media_plugins/webkit/media_plugin_webkit.cpp | 13 ++----------- 2 files changed, 3 insertions(+), 13 deletions(-) (limited to 'indra/media_plugins') diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp index b9bab491f3..6a2449cf4b 100644 --- a/indra/llplugin/llpluginclassmedia.cpp +++ b/indra/llplugin/llpluginclassmedia.cpp @@ -684,7 +684,6 @@ LLPluginClassMedia::ETargetType getTargetTypeFromLLQtWebkit(int target_type) // so that we don't expose the llqtwebkit header in viewer code switch (target_type) { -#if !LL_LINUX case LLQtWebKit::LTT_TARGET_NONE: return LLPluginClassMedia::TARGET_NONE; @@ -693,7 +692,7 @@ LLPluginClassMedia::ETargetType getTargetTypeFromLLQtWebkit(int target_type) case LLQtWebKit::LTT_TARGET_EXTERNAL: return LLPluginClassMedia::TARGET_EXTERNAL; -#endif + default: return LLPluginClassMedia::TARGET_OTHER; } diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index d1f06147d6..02dba41f2a 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -526,14 +526,13 @@ private: // Any special-case handling we want to do for particular keys... switch((KEY)key) { -#if !LL_LINUX // ASCII codes for some standard keys case LLQtWebKit::KEY_BACKSPACE: utf8_text = (char)8; break; case LLQtWebKit::KEY_TAB: utf8_text = (char)9; break; case LLQtWebKit::KEY_RETURN: utf8_text = (char)13; break; case LLQtWebKit::KEY_PAD_RETURN: utf8_text = (char)13; break; case LLQtWebKit::KEY_ESCAPE: utf8_text = (char)27; break; -#endif + default: break; } @@ -545,9 +544,7 @@ private: uint32_t native_modifiers = 0; deserializeKeyboardData( native_key_data, native_scan_code, native_virtual_key, native_modifiers ); -#if !LL_LINUX LLQtWebKit::getInstance()->keyboardEvent( mBrowserWindowId, key_event, (uint32_t)key, utf8_text.c_str(), modifiers, native_scan_code, native_virtual_key, native_modifiers); -#endif checkEditState(); }; @@ -556,12 +553,8 @@ private: // void unicodeInput( const std::string &utf8str, LLQtWebKit::EKeyboardModifier modifiers, LLSD native_key_data = LLSD::emptyMap()) { -#if !LL_LINUX uint32_t key = LLQtWebKit::KEY_NONE; -#else - uint32_t key = 0; -#endif - + // std::cerr << "unicode input, native_key_data = " << native_key_data << std::endl; if(utf8str.size() == 1) @@ -576,10 +569,8 @@ private: uint32_t native_modifiers = 0; deserializeKeyboardData( native_key_data, native_scan_code, native_virtual_key, native_modifiers ); -#if !LL_LINUX LLQtWebKit::getInstance()->keyboardEvent( mBrowserWindowId, LLQtWebKit::KE_KEY_DOWN, (uint32_t)key, utf8str.c_str(), modifiers, native_scan_code, native_virtual_key, native_modifiers); LLQtWebKit::getInstance()->keyboardEvent( mBrowserWindowId, LLQtWebKit::KE_KEY_UP, (uint32_t)key, utf8str.c_str(), modifiers, native_scan_code, native_virtual_key, native_modifiers); -#endif checkEditState(); }; -- cgit v1.3 From b0791c3001f669a32abc4d4b40f4dc4f6f2bc912 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Tue, 9 Feb 2010 15:07:45 +0000 Subject: Backed out changeset 0664cf2c9edf --- indra/llwindow/llwindowsdl.cpp | 2 +- indra/media_plugins/webkit/CMakeLists.txt | 11 +--------- indra/media_plugins/webkit/media_plugin_webkit.cpp | 24 ++++------------------ 3 files changed, 6 insertions(+), 31 deletions(-) (limited to 'indra/media_plugins') diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index f9c3694459..bfdf1147a1 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -1617,7 +1617,7 @@ void LLWindowSDL::processMiscNativeEvents() pump_timer.setTimerExpirySec(1.0f / 15.0f); do { // Always do at least one non-blocking pump - gtk_main_iteration_do(FALSE); + gtk_main_iteration_do(0); } while (gtk_events_pending() && !pump_timer.hasExpired()); diff --git a/indra/media_plugins/webkit/CMakeLists.txt b/indra/media_plugins/webkit/CMakeLists.txt index 812760a116..5bccd589d8 100644 --- a/indra/media_plugins/webkit/CMakeLists.txt +++ b/indra/media_plugins/webkit/CMakeLists.txt @@ -9,7 +9,6 @@ include(LLPlugin) include(LLMath) include(LLRender) include(LLWindow) -include(UI) include(Linking) include(PluginAPI) include(MediaPluginBase) @@ -39,7 +38,7 @@ add_library(media_plugin_webkit ${media_plugin_webkit_SOURCE_FILES} ) -set(media_plugin_webkit_LINK_LIBRARIES +target_link_libraries(media_plugin_webkit ${LLPLUGIN_LIBRARIES} ${MEDIA_PLUGIN_BASE_LIBRARIES} ${LLCOMMON_LIBRARIES} @@ -47,14 +46,6 @@ set(media_plugin_webkit_LINK_LIBRARIES ${PLUGIN_API_WINDOWS_LIBRARIES} ) -if (LINUX) - list(APPEND media_plugin_webkit_LINK_LIBRARIES - ${UI_LIBRARIES} # for glib/GTK - ) -endif (LINUX) - -target_link_libraries(media_plugin_webkit ${media_plugin_webkit_LINK_LIBRARIES}) - add_dependencies(media_plugin_webkit ${LLPLUGIN_LIBRARIES} ${MEDIA_PLUGIN_BASE_LIBRARIES} diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index b607d2f66a..3c24b4ed22 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -43,21 +43,15 @@ #include "llpluginmessageclasses.h" #include "media_plugin_base.h" -#if LL_LINUX -extern "C" { -# include -} -#endif // LL_LINUX - #if LL_WINDOWS -# include +#include #else -# include -# include +#include +#include #endif #if LL_WINDOWS - // *NOTE:Mani - This captures the module handle for the dll. This is used below + // *NOTE:Mani - This captures the module handle fo rthe dll. This is used below // to get the path to this dll for webkit initialization. // I don't know how/if this can be done with apr... namespace { HMODULE gModuleHandle;}; @@ -118,16 +112,6 @@ private: // void update(int milliseconds) { -#if LL_LINUX - // pump glib generously, as Linux browser plugins are on the - // glib main loop, even if the browser itself isn't - ugh - //*TODO: shouldn't this be transparent if Qt was compiled with - // glib mainloop integration? investigate. - GMainContext *mainc = g_main_context_default(); - while(g_main_context_iteration(mainc, FALSE)); -#endif // LL_LINUX - - // pump qt LLQtWebKit::getInstance()->pump( milliseconds ); checkEditState(); -- cgit v1.3 From b809b871369f5aeced50a81467f539cab9a9ed4e Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Tue, 9 Feb 2010 15:28:30 +0000 Subject: EXT-4290 [Flash] On linux, youtube videos don't play unless its getting a mouse move event restore part of this fix - glib-compatible Qt needs it, and flash needs a glib-compatible Qt. --- indra/media_plugins/webkit/CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'indra/media_plugins') diff --git a/indra/media_plugins/webkit/CMakeLists.txt b/indra/media_plugins/webkit/CMakeLists.txt index c4dd5fd79d..a46ffefdac 100644 --- a/indra/media_plugins/webkit/CMakeLists.txt +++ b/indra/media_plugins/webkit/CMakeLists.txt @@ -9,6 +9,7 @@ include(LLPlugin) include(LLMath) include(LLRender) include(LLWindow) +include(LLUI) include(Linking) include(PluginAPI) include(MediaPluginBase) @@ -38,7 +39,7 @@ add_library(media_plugin_webkit ${media_plugin_webkit_SOURCE_FILES} ) -target_link_libraries(media_plugin_webkit +set(media_plugin_webkit_LINK_LIBRARIES ${LLPLUGIN_LIBRARIES} ${MEDIA_PLUGIN_BASE_LIBRARIES} ${LLCOMMON_LIBRARIES} @@ -46,6 +47,14 @@ target_link_libraries(media_plugin_webkit ${PLUGIN_API_WINDOWS_LIBRARIES} ) +if (LINUX) + list(APPEND media_plugin_webkit_LINK_LIBRARIES + ${UI_LIBRARIES} # for glib/GTK + ) +endif (LINUX) + +target_link_libraries(media_plugin_webkit ${media_plugin_webkit_LINK_LIBRARIES}) + add_dependencies(media_plugin_webkit ${LLPLUGIN_LIBRARIES} ${MEDIA_PLUGIN_BASE_LIBRARIES} -- cgit v1.3 From c9b27bec33d601330afe854d0322d22fce9da76a Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Tue, 9 Feb 2010 15:56:34 +0000 Subject: EXT-4290 [Flash] On linux, youtube videos don't play unless its getting a mouse move event use the proper cmake include() so glib is really found! --- indra/media_plugins/webkit/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/media_plugins') diff --git a/indra/media_plugins/webkit/CMakeLists.txt b/indra/media_plugins/webkit/CMakeLists.txt index a46ffefdac..4512c22b5d 100644 --- a/indra/media_plugins/webkit/CMakeLists.txt +++ b/indra/media_plugins/webkit/CMakeLists.txt @@ -9,7 +9,7 @@ include(LLPlugin) include(LLMath) include(LLRender) include(LLWindow) -include(LLUI) +include(UI) include(Linking) include(PluginAPI) include(MediaPluginBase) -- cgit v1.3 From 6d08400145c3e3016ab3bccfe24474e52b435c72 Mon Sep 17 00:00:00 2001 From: Tofu Linden Date: Tue, 9 Feb 2010 18:19:35 +0000 Subject: EXT-3651 DEV-44500 Keyboard interaction does not work with Flash media This change lets Linux pass keys through to Flash. --- indra/llwindow/llwindowsdl.cpp | 73 +++++++++++++++++----- indra/llwindow/llwindowsdl.h | 13 ++-- indra/media_plugins/webkit/media_plugin_webkit.cpp | 4 ++ 3 files changed, 72 insertions(+), 18 deletions(-) (limited to 'indra/media_plugins') diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index f9c3694459..7cd06c9c37 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -251,6 +251,10 @@ LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks, #if LL_X11 mFlashing = FALSE; #endif // LL_X11 + + mKeyScanCode = 0; + mKeyVirtualKey = 0; + mKeyModifiers = KMOD_NONE; } static SDL_Surface *Load_BMP_Resource(const char *basename) @@ -1651,24 +1655,32 @@ void LLWindowSDL::gatherInput() } case SDL_KEYDOWN: - gKeyboard->handleKeyDown(event.key.keysym.sym, event.key.keysym.mod); - // part of the fix for SL-13243 - if (SDLCheckGrabbyKeys(event.key.keysym.sym, TRUE) != 0) - SDLReallyCaptureInput(TRUE); - - if (event.key.keysym.unicode) - { - handleUnicodeUTF16(event.key.keysym.unicode, - gKeyboard->currentMask(FALSE)); - } + mKeyScanCode = event.key.keysym.scancode; + mKeyVirtualKey = event.key.keysym.unicode; + mKeyModifiers = event.key.keysym.mod; + + gKeyboard->handleKeyDown(event.key.keysym.sym, event.key.keysym.mod); + // part of the fix for SL-13243 + if (SDLCheckGrabbyKeys(event.key.keysym.sym, TRUE) != 0) + SDLReallyCaptureInput(TRUE); + + if (event.key.keysym.unicode) + { + handleUnicodeUTF16(event.key.keysym.unicode, + gKeyboard->currentMask(FALSE)); + } break; case SDL_KEYUP: - if (SDLCheckGrabbyKeys(event.key.keysym.sym, FALSE) == 0) - SDLReallyCaptureInput(FALSE); // part of the fix for SL-13243 + mKeyScanCode = event.key.keysym.scancode; + mKeyVirtualKey = event.key.keysym.unicode; + mKeyModifiers = event.key.keysym.mod; - gKeyboard->handleKeyUp(event.key.keysym.sym, event.key.keysym.mod); - break; + if (SDLCheckGrabbyKeys(event.key.keysym.sym, FALSE) == 0) + SDLReallyCaptureInput(FALSE); // part of the fix for SL-13243 + + gKeyboard->handleKeyUp(event.key.keysym.sym, event.key.keysym.mod); + break; case SDL_MOUSEBUTTONDOWN: { @@ -2224,6 +2236,39 @@ static void color_changed_callback(GtkWidget *widget, gtk_color_selection_get_current_color(colorsel, colorp); } + +/* + Make the raw keyboard data available - used to poke through to LLQtWebKit so + that Qt/Webkit has access to the virtual keycodes etc. that it needs +*/ +LLSD LLWindowSDL::getNativeKeyData() +{ + LLSD result = LLSD::emptyMap(); + + U32 modifiers = 0; // pretend-native modifiers... oh what a tangled web we weave! + + // we go through so many levels of device abstraction that I can't really guess + // what a plugin under GDK under Qt under SL under SDL under X11 considers + // a 'native' modifier mask. this has been sort of reverse-engineered... they *appear* + // to match GDK consts, but that may be co-incidence. + modifiers |= (mKeyModifiers & KMOD_LSHIFT) ? 0x0001 : 0; + modifiers |= (mKeyModifiers & KMOD_RSHIFT) ? 0x0001 : 0;// munge these into the same shift + modifiers |= (mKeyModifiers & KMOD_CAPS) ? 0x0002 : 0; + modifiers |= (mKeyModifiers & KMOD_LCTRL) ? 0x0004 : 0; + modifiers |= (mKeyModifiers & KMOD_RCTRL) ? 0x0004 : 0;// munge these into the same ctrl + modifiers |= (mKeyModifiers & KMOD_LALT) ? 0x0008 : 0;// untested + modifiers |= (mKeyModifiers & KMOD_RALT) ? 0x0008 : 0;// untested + // *todo: test ALTs - I don't have a case for testing these. Do you? + // *todo: NUM? - I don't care enough right now (and it's not a GDK modifier). + + result["scan_code"] = (S32)mKeyScanCode; + result["virtual_key"] = (S32)mKeyVirtualKey; + result["modifiers"] = (S32)modifiers; + + return result; +} + + BOOL LLWindowSDL::dialogColorPicker( F32 *r, F32 *g, F32 *b) { BOOL rtn = FALSE; diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index 0ba1c861da..e6bdd46a77 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -102,7 +102,7 @@ public: /*virtual*/ void gatherInput(); /*virtual*/ void swapBuffers(); - /*virtual*/ void delayInputProcessing() { }; + /*virtual*/ void delayInputProcessing() { }; // handy coordinate space conversion routines /*virtual*/ BOOL convertCoords(LLCoordScreen from, LLCoordWindow *to); @@ -155,12 +155,13 @@ protected: BOOL ignore_pixel_depth, U32 fsaa_samples); ~LLWindowSDL(); + /*virtual*/ BOOL isValid(); + /*virtual*/ LLSD getNativeKeyData(); + void initCursors(); void quitCursors(); - BOOL isValid(); void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size); - // Changes display resolution. Returns true if successful BOOL setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh); @@ -204,12 +205,16 @@ protected: friend class LLWindowManager; -#if LL_X11 private: +#if LL_X11 void x11_set_urgent(BOOL urgent); BOOL mFlashing; LLTimer mFlashTimer; #endif //LL_X11 + + U32 mKeyScanCode; + U32 mKeyVirtualKey; + SDLMod mKeyModifiers; }; diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp index 22e285cdb8..688d3bcd3d 100644 --- a/indra/media_plugins/webkit/media_plugin_webkit.cpp +++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp @@ -488,6 +488,10 @@ private: native_scan_code = (uint32_t)(native_key_data["scan_code"].asInteger()); native_virtual_key = (uint32_t)(native_key_data["virtual_key"].asInteger()); // TODO: I don't think we need to do anything with native modifiers here -- please verify +#elif LL_LINUX + native_scan_code = (uint32_t)(native_key_data["scan_code"].asInteger()); + native_virtual_key = (uint32_t)(native_key_data["virtual_key"].asInteger()); + native_modifiers = (uint32_t)(native_key_data["modifiers"].asInteger()); #else // Add other platforms here as needed #endif -- cgit v1.3