summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/llwindow/llwindowwin32.cpp37
-rw-r--r--indra/llwindow/llwindowwin32.h6
-rw-r--r--indra/media_plugins/webkit/media_plugin_webkit.cpp37
3 files changed, 65 insertions, 15 deletions
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);