summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2011-08-25 14:54:38 -0400
committerNat Goodspeed <nat@lindenlab.com>2011-08-25 14:54:38 -0400
commit79f14b7febf512e96a7d63eff8e6db895a7e72cf (patch)
treebf0f0e62c30980fe755b9e3542a371911072eb50
parentf7a6ed85e40f53e5e28868bf34ac4dbc9bb204fb (diff)
CHOP-763: Move llwindowlistener.{h,cpp} from llwindow to newview.
Instantiate LLWindowListener on LLViewerWindow instead of on LLWindow. This permits LLWindowListener to use machinery from llui, e.g. LLUI::resolvePath(). Document planned new ["path"], ["reply"] params to "keyDown", "keyUp", "mouseDown", "mouseUp", "mouseMove" operations; document relationship between ["path"] and ["x"] and ["y"]. NEW PARAMS NOT YET IMPLEMENTED.
-rw-r--r--indra/llwindow/CMakeLists.txt2
-rw-r--r--indra/llwindow/llwindow.cpp9
-rw-r--r--indra/llwindow/llwindow.h2
-rw-r--r--indra/newview/CMakeLists.txt2
-rw-r--r--indra/newview/llviewerwindow.cpp9
-rw-r--r--indra/newview/llviewerwindow.h4
-rw-r--r--indra/newview/llwindowlistener.cpp (renamed from indra/llwindow/llwindowlistener.cpp)37
-rw-r--r--indra/newview/llwindowlistener.h (renamed from indra/llwindow/llwindowlistener.h)0
8 files changed, 38 insertions, 27 deletions
diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt
index 3d89867bc1..341bddfffd 100644
--- a/indra/llwindow/CMakeLists.txt
+++ b/indra/llwindow/CMakeLists.txt
@@ -38,7 +38,6 @@ set(llwindow_SOURCE_FILES
llkeyboardheadless.cpp
llwindowheadless.cpp
llwindowcallbacks.cpp
- llwindowlistener.cpp
)
set(llwindow_HEADER_FILES
@@ -48,7 +47,6 @@ set(llwindow_HEADER_FILES
llkeyboardheadless.h
llwindowheadless.h
llwindowcallbacks.h
- llwindowlistener.h
)
set(viewer_SOURCE_FILES
diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp
index 71a5df910d..dc3a1099b1 100644
--- a/indra/llwindow/llwindow.cpp
+++ b/indra/llwindow/llwindow.cpp
@@ -41,8 +41,6 @@
#include "llkeyboard.h"
#include "linked_lists.h"
#include "llwindowcallbacks.h"
-#include "llwindowlistener.h"
-#include <boost/lambda/core.hpp>
//
@@ -118,17 +116,10 @@ LLWindow::LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags)
mFlags(flags),
mHighSurrogate(0)
{
- // gKeyboard is still NULL, so it doesn't do LLWindowListener any good to
- // pass its value right now. Instead, pass it a nullary function that
- // will, when we later need it, return the value of gKeyboard.
- // boost::lambda::var() constructs such a functor on the fly.
- mListener = new LLWindowListener(callbacks, boost::lambda::var(gKeyboard));
}
LLWindow::~LLWindow()
{
- delete mListener;
- mListener = NULL;
}
//virtual
diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h
index 6bdc01ae88..e8a86a1880 100644
--- a/indra/llwindow/llwindow.h
+++ b/indra/llwindow/llwindow.h
@@ -36,7 +36,6 @@
class LLSplashScreen;
class LLPreeditor;
class LLWindowCallbacks;
-class LLWindowListener;
// Refer to llwindow_test in test/common/llwindow for usage example
@@ -189,7 +188,6 @@ protected:
BOOL mHideCursorPermanent;
U32 mFlags;
U16 mHighSurrogate;
- LLWindowListener* mListener;
// Handle a UTF-16 encoding unit received from keyboard.
// Converting the series of UTF-16 encoding units to UTF-32 data,
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 935dd2e887..bd080f2ac4 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -599,6 +599,7 @@ set(viewer_SOURCE_FILES
llweb.cpp
llwebsharing.cpp
llwind.cpp
+ llwindowlistener.cpp
llwlanimator.cpp
llwldaycycle.cpp
llwlhandlers.cpp
@@ -1153,6 +1154,7 @@ set(viewer_HEADER_FILES
llweb.h
llwebsharing.h
llwind.h
+ llwindowlistener.h
llwlanimator.h
llwldaycycle.h
llwlhandlers.h
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 988c4ed1a2..0501b61592 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -36,6 +36,7 @@
#include <iostream>
#include <fstream>
#include <algorithm>
+#include <boost/lambda/core.hpp>
#include "llagent.h"
#include "llagentcamera.h"
@@ -198,6 +199,7 @@
#include "llfloaternotificationsconsole.h"
#include "llnearbychat.h"
+#include "llwindowlistener.h"
#include "llviewerwindowlistener.h"
#include "llpaneltopinfobar.h"
@@ -1552,7 +1554,12 @@ LLViewerWindow::LLViewerWindow(
mResDirty(false),
mStatesDirty(false),
mCurrResolutionIndex(0),
- mViewerWindowListener(new LLViewerWindowListener(this)),
+ // gKeyboard is still NULL, so it doesn't do LLWindowListener any good to
+ // pass its value right now. Instead, pass it a nullary function that
+ // will, when we later need it, return the value of gKeyboard.
+ // boost::lambda::var() constructs such a functor on the fly.
+ mWindowListener(new LLWindowListener(this, boost::lambda::var(gKeyboard))),
+ mViewerWindowListener(new LLViewerWindowListener(this)),
mProgressView(NULL)
{
LLNotificationChannel::buildChannel("VW_alerts", "Visible", LLNotificationFilters::filterBy<std::string>(&LLNotification::getType, "alert"));
diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h
index ff49ed1f62..48599ebb00 100644
--- a/indra/newview/llviewerwindow.h
+++ b/indra/newview/llviewerwindow.h
@@ -62,6 +62,7 @@ class LLImageFormatted;
class LLHUDIcon;
class LLWindow;
class LLRootView;
+class LLWindowListener;
class LLViewerWindowListener;
class LLPopupView;
@@ -455,7 +456,8 @@ protected:
bool mStatesDirty;
U32 mCurrResolutionIndex;
- boost::scoped_ptr<LLViewerWindowListener> mViewerWindowListener;
+ boost::scoped_ptr<LLWindowListener> mWindowListener;
+ boost::scoped_ptr<LLViewerWindowListener> mViewerWindowListener;
protected:
static std::string sSnapshotBaseName;
diff --git a/indra/llwindow/llwindowlistener.cpp b/indra/newview/llwindowlistener.cpp
index 006aaa75e7..e5deaa42cf 100644
--- a/indra/llwindow/llwindowlistener.cpp
+++ b/indra/newview/llwindowlistener.cpp
@@ -31,6 +31,7 @@
#include "llcoord.h"
#include "llkeyboard.h"
#include "llwindowcallbacks.h"
+#include "llui.h"
#include <map>
LLWindowListener::LLWindowListener(LLWindowCallbacks *window, const KeyboardGetter& kbgetter)
@@ -42,35 +43,47 @@ LLWindowListener::LLWindowListener(LLWindowCallbacks *window, const KeyboardGett
"Given [\"keysym\"], [\"keycode\"] or [\"char\"], inject the specified ";
std::string keyExplain =
"(integer keycode values, or keysym string from any addKeyName() call in\n"
- "http://hg.secondlife.com/viewer-development/src/tip/indra/llwindow/llkeyboard.cpp )";
+ "http://hg.secondlife.com/viewer-development/src/tip/indra/llwindow/llkeyboard.cpp )\n";
std::string mask =
"Specify optional [\"mask\"] as an array containing any of \"CTL\", \"ALT\",\n"
"\"SHIFT\" or \"MAC_CONTROL\"; the corresponding modifier bits will be combined\n"
"to form the mask used with the event.";
- std::string mouseSomething =
- "Given [\"button\"], [\"x\"] and [\"y\"], inject the given mouse ";
- std::string mouseExplain =
- "(button values \"LEFT\", \"MIDDLE\", \"RIGHT\")";
+ std::string given = "Given ";
+ std::string mouseParams =
+ "optional [\"path\"], optional [\"x\"] and [\"y\"], inject the requested mouse ";
+ std::string buttonParams =
+ std::string("[\"button\"], ") + mouseParams;
+ std::string buttonExplain =
+ "(button values \"LEFT\", \"MIDDLE\", \"RIGHT\")\n";
+ std::string paramsExplain =
+ "[\"path\"] is as for LLUI::resolvePath(), described in\n"
+ "http://hg.secondlife.com/viewer-development/src/tip/indra/llui/llui.h\n"
+ "If you omit [\"path\"], you must specify both [\"x\"] and [\"y\"].\n"
+ "If you specify [\"path\"] without both [\"x\"] and [\"y\"], will synthesize (x, y)\n"
+ "in the center of the LLView selected by [\"path\"].\n"
+ "You may specify [\"path\"] with both [\"x\"] and [\"y\"], will use your (x, y).\n"
+ "This may cause the LLView selected by [\"path\"] to reject the event.\n"
+ "Optional [\"reply\"] requests a reply event on the named LLEventPump.\n"
+ "reply[\"error\"] isUndefined (None) on success, else an explanatory message.\n";
add("keyDown",
- keySomething + "keypress event.\n" + keyExplain + '\n' + mask,
+ keySomething + "keypress event.\n" + keyExplain + mask,
&LLWindowListener::keyDown);
add("keyUp",
- keySomething + "key release event.\n" + keyExplain + '\n' + mask,
+ keySomething + "key release event.\n" + keyExplain + mask,
&LLWindowListener::keyUp);
add("mouseDown",
- mouseSomething + "click event.\n" + mouseExplain + '\n' + mask,
+ given + buttonParams + "click event.\n" + buttonExplain + paramsExplain + mask,
&LLWindowListener::mouseDown);
add("mouseUp",
- mouseSomething + "release event.\n" + mouseExplain + '\n' + mask,
+ given + buttonParams + "release event.\n" + buttonExplain + paramsExplain + mask,
&LLWindowListener::mouseUp);
add("mouseMove",
- std::string("Given [\"x\"] and [\"y\"], inject the given mouse movement event.\n") +
- mask,
+ given + mouseParams + "movement event.\n" + paramsExplain + mask,
&LLWindowListener::mouseMove);
add("mouseScroll",
- "Given an integer number of [\"clicks\"], inject the given mouse scroll event.\n"
+ "Given an integer number of [\"clicks\"], inject the requested mouse scroll event.\n"
"(positive clicks moves downward through typical content)",
&LLWindowListener::mouseScroll);
}
diff --git a/indra/llwindow/llwindowlistener.h b/indra/newview/llwindowlistener.h
index 74e577ff93..74e577ff93 100644
--- a/indra/llwindow/llwindowlistener.h
+++ b/indra/newview/llwindowlistener.h