summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llwindowlistener.cpp27
-rw-r--r--indra/newview/llwindowlistener.h6
2 files changed, 25 insertions, 8 deletions
diff --git a/indra/newview/llwindowlistener.cpp b/indra/newview/llwindowlistener.cpp
index 3d756ef9b9..4cadc8773d 100644
--- a/indra/newview/llwindowlistener.cpp
+++ b/indra/newview/llwindowlistener.cpp
@@ -35,10 +35,11 @@
#include "llui.h"
#include "llview.h"
#include "llviewerwindow.h"
+#include "llviewerkeyboard.h"
#include "llrootview.h"
#include <map>
-LLWindowListener::LLWindowListener(LLWindowCallbacks *window, const KeyboardGetter& kbgetter)
+LLWindowListener::LLWindowListener(LLViewerWindow *window, const KeyboardGetter& kbgetter)
: LLEventAPI("LLWindow", "Inject input events into the LLWindow instance"),
mWindow(window),
mKbGetter(kbgetter)
@@ -195,7 +196,8 @@ void LLWindowListener::keyDown(LLSD const & evt)
gFocusMgr.setKeyboardFocus(target_view);
KEY key = getKEY(evt);
MASK mask = getMask(evt);
- if (!target_view->handleKey(key, mask, true)) target_view->handleUnicodeChar(key, true);
+ gViewerKeyboard.handleKey(key, mask, false);
+ if(key < 0x80) mWindow->handleUnicodeChar(key, mask);
}
else
{
@@ -210,9 +212,24 @@ void LLWindowListener::keyDown(LLSD const & evt)
void LLWindowListener::keyUp(LLSD const & evt)
{
- if (evt.has("path")) return; // LLView only handles key down.
-
- mKbGetter()->handleTranslatedKeyUp(getKEY(evt), getMask(evt));
+ if (evt.has("path"))
+ {
+ LLView * target_view =
+ LLUI::resolvePath(gViewerWindow->getRootView(), evt["path"]);
+ if ((target_view != 0) && target_view->isAvailable())
+ {
+ gFocusMgr.setKeyboardFocus(target_view);
+ mKbGetter()->handleTranslatedKeyUp(getKEY(evt), getMask(evt));
+ }
+ else
+ {
+ ; // TODO: Don't silently fail if target not available.
+ }
+ }
+ else
+ {
+ mKbGetter()->handleTranslatedKeyUp(getKEY(evt), getMask(evt));
+ }
}
// for WhichButton
diff --git a/indra/newview/llwindowlistener.h b/indra/newview/llwindowlistener.h
index 74e577ff93..26adff35ff 100644
--- a/indra/newview/llwindowlistener.h
+++ b/indra/newview/llwindowlistener.h
@@ -31,13 +31,13 @@
#include <boost/function.hpp>
class LLKeyboard;
-class LLWindowCallbacks;
+class LLViewerWindow;
class LLWindowListener : public LLEventAPI
{
public:
typedef boost::function<LLKeyboard*()> KeyboardGetter;
- LLWindowListener(LLWindowCallbacks * window, const KeyboardGetter& kbgetter);
+ LLWindowListener(LLViewerWindow * window, const KeyboardGetter& kbgetter);
void keyDown(LLSD const & evt);
void keyUp(LLSD const & evt);
@@ -47,7 +47,7 @@ public:
void mouseScroll(LLSD const & evt);
private:
- LLWindowCallbacks * mWindow;
+ LLViewerWindow * mWindow;
KeyboardGetter mKbGetter;
};