summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/llwindowsdl.cpp73
-rw-r--r--indra/llwindow/llwindowsdl.h13
2 files changed, 68 insertions, 18 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;
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;
};