summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
authorCallum Prentice <callum@lindenlab.com>2010-02-04 16:30:21 -0800
committerCallum Prentice <callum@lindenlab.com>2010-02-04 16:30:21 -0800
commit80139d95adbcb2258c5541a4e0ace32f32b78ba5 (patch)
tree09a08fdd55cd6d9de97f25896cab2c6d224bf91c /indra/llwindow
parent572b8fc518ee45cdf5403f58b18e0000868696cb (diff)
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
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/llwindowwin32.cpp37
-rw-r--r--indra/llwindow/llwindowwin32.h6
2 files changed, 42 insertions, 1 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;
};