summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2015-10-27 15:17:12 -0700
committerRider Linden <rider@lindenlab.com>2015-10-27 15:17:12 -0700
commit9833a50260fb45d5f0033200ae756834c0cc9940 (patch)
tree7b1462d2c0802fb175746a8d05100bb8c102640f
parent8c74ed2a58f5443b931374489b04ba80fb11a590 (diff)
MAINT-5754: For MoaP and MediaCtrls forward all events including KEYUP and KEYDOWN to the CEF plugin.
-rwxr-xr-xindra/llui/llfocusmgr.cpp12
-rwxr-xr-xindra/llui/llfocusmgr.h8
-rwxr-xr-xindra/llwindow/llkeyboardwin32.cpp4
-rwxr-xr-xindra/llwindow/llwindowwin32.h2
-rw-r--r--indra/media_plugins/cef/media_plugin_cef.cpp2
-rwxr-xr-xindra/newview/llinventoryfunctions.cpp2
-rwxr-xr-xindra/newview/llmediactrl.cpp10
-rwxr-xr-xindra/newview/llmediactrl.h4
-rwxr-xr-xindra/newview/llviewermedia.cpp9
-rwxr-xr-xindra/newview/llviewermediafocus.cpp17
-rwxr-xr-xindra/newview/llviewermediafocus.h4
-rwxr-xr-xindra/newview/llviewerwindow.cpp34
12 files changed, 88 insertions, 20 deletions
diff --git a/indra/llui/llfocusmgr.cpp b/indra/llui/llfocusmgr.cpp
index fb811452be..1a51b96fdf 100755
--- a/indra/llui/llfocusmgr.cpp
+++ b/indra/llui/llfocusmgr.cpp
@@ -58,6 +58,18 @@ BOOL LLFocusableElement::handleUnicodeChar(llwchar uni_char, BOOL called_from_pa
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 950ac55325..0e3d7d8e59 100755
--- a/indra/llui/llfocusmgr.h
+++ b/indra/llui/llfocusmgr.h
@@ -60,6 +60,14 @@ public:
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/llwindow/llkeyboardwin32.cpp b/indra/llwindow/llkeyboardwin32.cpp
index dc40dcdde0..2123ed3939 100755
--- a/indra/llwindow/llkeyboardwin32.cpp
+++ b/indra/llwindow/llkeyboardwin32.cpp
@@ -258,7 +258,7 @@ void LLKeyboardWin32::scanKeyboard()
// *TODO: I KNOW there must be a better way of
// interrogating the key state than this, using async key
// state can cause ALL kinds of bugs - Doug
- if (key < KEY_BUTTON0)
+ if ((key < KEY_BUTTON0) && ((key < '0') || (key > '9')))
{
// ...under windows make sure the key actually still is down.
// ...translate back to windows key
@@ -267,7 +267,7 @@ void LLKeyboardWin32::scanKeyboard()
if (!pending_key_events && !(GetAsyncKeyState(virtual_key) & 0x8000))
{
//LL_INFOS() << "Key up event missed, resetting" << LL_ENDL;
- mKeyLevel[key] = FALSE;
+ mKeyLevel[key] = FALSE;
}
}
}
diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h
index 376bef3e50..1a775eadaf 100755
--- a/indra/llwindow/llwindowwin32.h
+++ b/indra/llwindow/llwindowwin32.h
@@ -126,7 +126,7 @@ protected:
HCURSOR loadColorCursor(LPCTSTR name);
BOOL isValid();
void moveWindow(const LLCoordScreen& position,const LLCoordScreen& size);
- LLSD getNativeKeyData();
+ virtual LLSD getNativeKeyData();
// Changes display resolution. Returns true if successful
BOOL setDisplayResolution(S32 width, S32 height, S32 bits, S32 refresh);
diff --git a/indra/media_plugins/cef/media_plugin_cef.cpp b/indra/media_plugins/cef/media_plugin_cef.cpp
index 5b08807619..2a1ef1484a 100644
--- a/indra/media_plugins/cef/media_plugin_cef.cpp
+++ b/indra/media_plugins/cef/media_plugin_cef.cpp
@@ -734,6 +734,8 @@ void MediaPluginCEF::keyEvent(LLCEFLib::EKeyEvent key_event, int key, LLCEFLib::
U32 msg = ll_U32_from_sd(native_key_data["msg"]);
U32 wparam = ll_U32_from_sd(native_key_data["w_param"]);
U64 lparam = ll_U32_from_sd(native_key_data["l_param"]);
+ //if ((msg == WM_CHAR) && (key_event == ))
+
mLLCEFLib->nativeKeyboardEvent(msg, wparam, lparam);
#endif
};
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 6aaf45c35d..984c650128 100755
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -1605,7 +1605,7 @@ bool sort_alpha(const LLViewerInventoryCategory* cat1, const LLViewerInventoryCa
void dump_trace(std::string& message, S32 depth, LLError::ELevel log_level)
{
- llinfos << "validate_marketplacelistings : error = "<< log_level << ", depth = " << depth << ", message = " << message << llendl;
+ LL_INFOS() << "validate_marketplacelistings : error = "<< log_level << ", depth = " << depth << ", message = " << message << LL_ENDL;
}
// Make all relevant business logic checks on the marketplace listings starting with the folder as argument.
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp
index d999c6f52b..9b8e24a8e8 100755
--- a/indra/newview/llmediactrl.cpp
+++ b/indra/newview/llmediactrl.cpp
@@ -1171,3 +1171,13 @@ void LLMediaCtrl::updateContextMenuParent(LLView* pNewParent)
{
mContextMenu->updateParent(pNewParent);
}
+
+bool LLMediaCtrl::wantsKeyUpKeyDown() const
+{
+ return true;
+}
+
+bool LLMediaCtrl::wantsReturnKey() const
+{
+ return true;
+}
diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h
index cb3a864d63..291d87073e 100755
--- a/indra/newview/llmediactrl.h
+++ b/indra/newview/llmediactrl.h
@@ -172,6 +172,10 @@ public:
void updateContextMenuParent(LLView* pNewParent);
+ // The Browser windows want keyup and keydown events. Overridden from LLFocusableElement to return true.
+ virtual bool wantsKeyUpKeyDown() const;
+ virtual bool wantsReturnKey() const;
+
protected:
void convertInputCoords(S32& x, S32& y);
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 49d6c1021e..8a16243ec1 100755
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -286,11 +286,11 @@ public:
const LLIOPipe::buffer_ptr_t& buffer)
{
const std::string url = getURL();
- llinfos << "@@@ URL to set cookie on" << url << llendl;
+ LL_INFOS() << "@@@ URL to set cookie on" << url << LL_ENDL;
// We don't care about the content of the response, only the Set-Cookie header.
- llinfos << dumpResponse()
- << " [headers:" << getResponseHeaders() << "]" << llendl;
+ LL_INFOS() << dumpResponse()
+ << " [headers:" << getResponseHeaders() << "]" << LL_ENDL;
const std::string& cookie = getResponseHeader(HTTP_IN_HEADER_SET_COOKIE);
// *TODO: What about bad status codes? Does this destroy previous cookies?
@@ -2759,8 +2759,7 @@ bool LLViewerMediaImpl::handleKeyHere(KEY key, MASK mask)
if (!result)
{
-
- LLSD native_key_data = gViewerWindow->getWindow()->getNativeKeyData();
+ LLSD native_key_data = gViewerWindow->getWindow()->getNativeKeyData();
result = mMediaSource->keyEvent(LLPluginClassMedia::KEY_EVENT_DOWN, key, mask, native_key_data);
}
}
diff --git a/indra/newview/llviewermediafocus.cpp b/indra/newview/llviewermediafocus.cpp
index 1265ca0a70..7b4df3d3da 100755
--- a/indra/newview/llviewermediafocus.cpp
+++ b/indra/newview/llviewermediafocus.cpp
@@ -354,7 +354,12 @@ BOOL LLViewerMediaFocus::handleKey(KEY key, MASK mask, BOOL called_from_parent)
BOOL LLViewerMediaFocus::handleKeyUp(KEY key, MASK mask, BOOL called_from_parent)
{
- return true;
+ LLViewerMediaImpl* media_impl = getFocusedMediaImpl();
+ if (media_impl)
+ {
+ media_impl->handleKeyUpHere(key, mask);
+ }
+ return true;
}
@@ -610,3 +615,13 @@ LLUUID LLViewerMediaFocus::getControlsMediaID()
return LLUUID::null;
}
+
+bool LLViewerMediaFocus::wantsKeyUpKeyDown() const
+{
+ return true;
+}
+
+bool LLViewerMediaFocus::wantsReturnKey() const
+{
+ return true;
+}
diff --git a/indra/newview/llviewermediafocus.h b/indra/newview/llviewermediafocus.h
index 42c841df15..0b2a64868e 100755
--- a/indra/newview/llviewermediafocus.h
+++ b/indra/newview/llviewermediafocus.h
@@ -88,6 +88,10 @@ public:
// Return the ID of the media instance the controls are currently attached to (either focus or hover).
LLUUID getControlsMediaID();
+ // The MoaP object wants keyup and keydown events. Overridden to return true.
+ virtual bool wantsKeyUpKeyDown() const;
+ virtual bool wantsReturnKey() const;
+
protected:
/*virtual*/ void onFocusReceived();
/*virtual*/ void onFocusLost();
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index b6212e0958..6be63ef889 100755
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1381,7 +1381,11 @@ BOOL LLViewerWindow::handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated)
// it's all entered/processed.
if (key == KEY_RETURN && mask == MASK_NONE)
{
- return FALSE;
+ // RIDER: although, at times some of the controlls (in particular the CEF viewer
+ // would like to know about the KEYDOWN for an enter key... so ask and pass it along.
+ LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus();
+ if (keyboard_focus && !keyboard_focus->wantsReturnKey())
+ return FALSE;
}
return gViewerKeyboard.handleKey(key, mask, repeated);
@@ -2543,22 +2547,27 @@ void LLViewerWindow::draw()
//#endif
}
-// Takes a single keydown event, usually when UI is visible
+// Takes a single keyup event, usually when UI is visible
BOOL LLViewerWindow::handleKeyUp(KEY key, MASK mask)
{
- if (gFocusMgr.getKeyboardFocus()
+ LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus();
+
+ if (keyboard_focus
&& !(mask & (MASK_CONTROL | MASK_ALT))
&& !gFocusMgr.getKeystrokesOnly())
{
// We have keyboard focus, and it's not an accelerator
- if (key < 0x80)
+ if (keyboard_focus && keyboard_focus->wantsKeyUpKeyDown())
+ {
+ return keyboard_focus->handleKey(key, mask, FALSE);
+ }
+ else if (key < 0x80)
{
// Not a special key, so likely (we hope) to generate a character. Let it fall through to character handler first.
return (gFocusMgr.getKeyboardFocus() != NULL);
}
}
- LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus();
if (keyboard_focus)
{
if (keyboard_focus->handleKeyUp(key, mask, FALSE))
@@ -2584,15 +2593,21 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
// hide tooltips on keypress
LLToolTipMgr::instance().blockToolTips();
- if (gFocusMgr.getKeyboardFocus()
+ LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus();
+
+ if (keyboard_focus
&& !(mask & (MASK_CONTROL | MASK_ALT))
&& !gFocusMgr.getKeystrokesOnly())
{
// We have keyboard focus, and it's not an accelerator
- if (key < 0x80)
+ if (keyboard_focus && keyboard_focus->wantsKeyUpKeyDown())
+ {
+ return keyboard_focus->handleKey(key, mask, FALSE );
+ }
+ else if (key < 0x80)
{
// Not a special key, so likely (we hope) to generate a character. Let it fall through to character handler first.
- return (gFocusMgr.getKeyboardFocus() != NULL);
+ return (keyboard_focus != NULL);
}
}
@@ -2606,7 +2621,6 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
return TRUE;
}
- LLFocusableElement* keyboard_focus = gFocusMgr.getKeyboardFocus();
// give menus a chance to handle modified (Ctrl, Alt) shortcut keys before current focus
// as long as focus isn't locked
@@ -2632,7 +2646,7 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask)
// give floaters first chance to handle TAB key
// so frontmost floater gets focus
// if nothing has focus, go to first or last UI element as appropriate
- if (key == KEY_TAB && (mask & MASK_CONTROL || gFocusMgr.getKeyboardFocus() == NULL))
+ if (key == KEY_TAB && (mask & MASK_CONTROL || keyboard_focus == NULL))
{
LL_WARNS() << "LLviewerWindow::handleKey give floaters first chance at tab key " << LL_ENDL;
if (gMenuHolder) gMenuHolder->hideMenus();