summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2015-12-18 13:55:41 -0500
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2015-12-18 13:55:41 -0500
commit3f81bb15b32cfa9db2a1a3cbcf0eb976b7751368 (patch)
treed534594be435e7cc1a5ca5c14b8b146ed47bb2e2 /indra/llui
parent99f4b27020c101591de5c1cbe53185c610e48caa (diff)
parent7b993d15b70d419dc0a7c8d92286d34a2635537d (diff)
merge
Diffstat (limited to 'indra/llui')
-rwxr-xr-xindra/llui/llfocusmgr.cpp18
-rwxr-xr-xindra/llui/llfocusmgr.h9
-rwxr-xr-xindra/llui/llview.cpp46
-rwxr-xr-xindra/llui/llview.h3
4 files changed, 76 insertions, 0 deletions
diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp
index 547f0bd398..1a51b96fdf 100755
--- a/indra/llui/llfocusmgr.cpp
+++ b/indra/llui/llfocusmgr.cpp
@@ -47,11 +47,29 @@ BOOL LLFocusableElement::handleKey(KEY key, MASK mask, BOOL called_from_parent)
}
// virtual
+BOOL LLFocusableElement::handleKeyUp(KEY key, MASK mask, BOOL called_from_parent)
+{
+ return FALSE;
+}
+
+// virtual
BOOL LLFocusableElement::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent)
{
return FALSE;
}
+// virtual
+bool LLFocusableElement::wantsKeyUpKeyDown() const
+{
+ return false;
+}
+
+//virtual
+bool LLFocusableElement::wantsReturnKey() const
+{
+ return false;
+}
+
// virtual
LLFocusableElement::~LLFocusableElement()
{
diff --git a/indra/llui/llfocusmgr.h b/indra/llui/llfocusmgr.h
index afd2a8ce06..0e3d7d8e59 100755
--- a/indra/llui/llfocusmgr.h
+++ b/indra/llui/llfocusmgr.h
@@ -57,8 +57,17 @@ public:
// These were brought up the hierarchy from LLView so that we don't have to use dynamic_cast when dealing with keyboard focus.
virtual BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
+ virtual BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent);
virtual BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent);
+ /**
+ * If true this LLFocusableElement wants to receive KEYUP and KEYDOWN messages
+ * even for normal character strokes.
+ * Default implementation returns false.
+ */
+ virtual bool wantsKeyUpKeyDown() const;
+ virtual bool wantsReturnKey() const;
+
virtual void onTopLost(); // called when registered as top ctrl and user clicks elsewhere
protected:
virtual void onFocusReceived();
diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index a8beb9cfc9..8f7cac1f61 100755
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -866,6 +866,7 @@ BOOL LLView::handleToolTip(S32 x, S32 y, MASK mask)
return handled;
}
+
BOOL LLView::handleKey(KEY key, MASK mask, BOOL called_from_parent)
{
BOOL handled = FALSE;
@@ -898,6 +899,38 @@ BOOL LLView::handleKey(KEY key, MASK mask, BOOL called_from_parent)
return handled;
}
+BOOL LLView::handleKeyUp(KEY key, MASK mask, BOOL called_from_parent)
+{
+ BOOL handled = FALSE;
+
+ if (getVisible() && getEnabled())
+ {
+ if (called_from_parent)
+ {
+ // Downward traversal
+ handled = childrenHandleKeyUp(key, mask) != NULL;
+ }
+
+ if (!handled)
+ {
+ // For event logging we don't care which widget handles it
+ // So we capture the key at the end of this function once we know if it was handled
+ handled = handleKeyUpHere(key, mask);
+ if (handled)
+ {
+ LL_DEBUGS() << "Key handled by " << getName() << LL_ENDL;
+ }
+ }
+ }
+
+ if (!handled && !called_from_parent && mParentView)
+ {
+ // Upward traversal
+ handled = mParentView->handleKeyUp(key, mask, FALSE);
+ }
+ return handled;
+}
+
// Called from handleKey()
// Handles key in this object. Checking parents and children happens in handleKey()
BOOL LLView::handleKeyHere(KEY key, MASK mask)
@@ -905,6 +938,13 @@ BOOL LLView::handleKeyHere(KEY key, MASK mask)
return FALSE;
}
+// Called from handleKey()
+// Handles key in this object. Checking parents and children happens in handleKey()
+BOOL LLView::handleKeyUpHere(KEY key, MASK mask)
+{
+ return FALSE;
+}
+
BOOL LLView::handleUnicodeChar(llwchar uni_char, BOOL called_from_parent)
{
BOOL handled = FALSE;
@@ -1021,6 +1061,12 @@ LLView* LLView::childrenHandleKey(KEY key, MASK mask)
}
// Called during downward traversal
+LLView* LLView::childrenHandleKeyUp(KEY key, MASK mask)
+{
+ return childrenHandleCharEvent("Key Up", &LLView::handleKeyUp, key, mask);
+}
+
+// Called during downward traversal
LLView* LLView::childrenHandleUnicodeChar(llwchar uni_char)
{
return childrenHandleCharEvent("Unicode character", &LLView::handleUnicodeCharWithDummyMask,
diff --git a/indra/llui/llview.h b/indra/llui/llview.h
index 7861c8f729..8494bb338a 100755
--- a/indra/llui/llview.h
+++ b/indra/llui/llview.h
@@ -378,6 +378,7 @@ public:
// inherited from LLFocusableElement
/* virtual */ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
+ /* virtual */ BOOL handleKeyUp(KEY key, MASK mask, BOOL called_from_parent);
/* virtual */ BOOL handleUnicodeChar(llwchar uni_char, BOOL called_from_parent);
virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
@@ -509,6 +510,7 @@ public:
//virtual BOOL addChildFromParam(const LLInitParam::BaseBlock& params) { return TRUE; }
virtual BOOL handleKeyHere(KEY key, MASK mask);
+ virtual BOOL handleKeyUpHere(KEY key, MASK mask);
virtual BOOL handleUnicodeCharHere(llwchar uni_char);
virtual void handleReshape(const LLRect& rect, bool by_user);
@@ -538,6 +540,7 @@ protected:
void logMouseEvent();
LLView* childrenHandleKey(KEY key, MASK mask);
+ LLView* childrenHandleKeyUp(KEY key, MASK mask);
LLView* childrenHandleUnicodeChar(llwchar uni_char);
LLView* childrenHandleDragAndDrop(S32 x, S32 y, MASK mask,
BOOL drop,