summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorAndrew A. de Laix <alain@lindenlab.com>2011-09-07 14:43:47 -0500
committerAndrew A. de Laix <alain@lindenlab.com>2011-09-07 14:43:47 -0500
commit9fd8fb15d9ef4de3c22605ec4a0745eb67ae9550 (patch)
treeee31911bc1948ec0d6532a1b3b9371031a759108 /indra/newview
parentde2b7cd28c8e8669291b7ca21ecc9602f2044eeb (diff)
parent8739688d4d5fc044d1327a1109c0367c927e4b88 (diff)
Automated merge with ssh://hg.lindenlab.com/nat/viewer-ui-injection
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llwindowlistener.cpp30
-rw-r--r--indra/newview/llwindowlistener.h1
2 files changed, 31 insertions, 0 deletions
diff --git a/indra/newview/llwindowlistener.cpp b/indra/newview/llwindowlistener.cpp
index 3e3287032c..d497964f6c 100644
--- a/indra/newview/llwindowlistener.cpp
+++ b/indra/newview/llwindowlistener.cpp
@@ -82,6 +82,7 @@ LLWindowListener::LLWindowListener(LLViewerWindow *window, const KeyboardGetter&
"Optional [\"reply\"] requests a reply event on the named LLEventPump.\n"
"reply[\"error\"] isUndefined (None) on success, else an explanatory message.\n";
+ add("getInfo", "Get information about the ui element specified by [\"path\"]", &LLWindowListener::getInfo);
add("keyDown",
keySomething + "keypress event.\n" + keyExplain + mask,
&LLWindowListener::keyDown);
@@ -207,6 +208,35 @@ KEY getKEY(const LLSD& event)
} // namespace
+void LLWindowListener::getInfo(LLSD const & evt)
+{
+ Response response(LLSD(), evt);
+
+ if (evt.has("path"))
+ {
+ std::string path(evt["path"]);
+ LLView * target_view =
+ LLUI::resolvePath(gViewerWindow->getRootView(), path);
+ if (target_view != 0)
+ {
+ insertViewInformation(response, target_view);
+ LLRect rect(target_view->calcScreenRect());
+ response["rect"] = LLSDMap("left", rect.mLeft)("top", rect.mTop)
+ ("right", rect.mRight)("bottom", rect.mBottom);
+ }
+ else
+ {
+ response.error(STRINGIZE(evt["op"].asString() << " request "
+ "specified invalid \"path\": '" << path << "'"));
+ }
+ }
+ else
+ {
+ response.error(
+ STRINGIZE(evt["op"].asString() << "request did not provide a path" ));
+ }
+}
+
void LLWindowListener::keyDown(LLSD const & evt)
{
Response response(LLSD(), evt);
diff --git a/indra/newview/llwindowlistener.h b/indra/newview/llwindowlistener.h
index 26adff35ff..29c3575258 100644
--- a/indra/newview/llwindowlistener.h
+++ b/indra/newview/llwindowlistener.h
@@ -39,6 +39,7 @@ public:
typedef boost::function<LLKeyboard*()> KeyboardGetter;
LLWindowListener(LLViewerWindow * window, const KeyboardGetter& kbgetter);
+ void getInfo(LLSD const & evt);
void keyDown(LLSD const & evt);
void keyUp(LLSD const & evt);
void mouseDown(LLSD const & evt);