summaryrefslogtreecommitdiff
path: root/indra/llwindow/llwindowsdl.cpp
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-02-09 18:19:35 +0000
committerTofu Linden <tofu.linden@lindenlab.com>2010-02-09 18:19:35 +0000
commit6d08400145c3e3016ab3bccfe24474e52b435c72 (patch)
treece204654c60f34e9bb52932b242d7df4dc9b5804 /indra/llwindow/llwindowsdl.cpp
parentc9b27bec33d601330afe854d0322d22fce9da76a (diff)
EXT-3651 DEV-44500 Keyboard interaction does not work with Flash media
This change lets Linux pass keys through to Flash.
Diffstat (limited to 'indra/llwindow/llwindowsdl.cpp')
-rw-r--r--indra/llwindow/llwindowsdl.cpp73
1 files changed, 59 insertions, 14 deletions
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;