diff options
-rw-r--r-- | .hgtags | 1 | ||||
-rw-r--r-- | doc/contributions.txt | 1 | ||||
-rw-r--r-- | indra/cmake/GoogleMock.cmake | 5 | ||||
-rw-r--r-- | indra/cmake/LLAddBuildTest.cmake | 5 | ||||
-rw-r--r-- | indra/llcommon/llversionviewer.h | 2 | ||||
-rw-r--r-- | indra/llwindow/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/llwindow/llwindow.cpp | 10 | ||||
-rw-r--r-- | indra/llwindow/llwindow.h | 2 | ||||
-rw-r--r-- | indra/llwindow/llwindowlistener.cpp | 174 | ||||
-rw-r--r-- | indra/llwindow/llwindowlistener.h | 53 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_region_debug_console.xml | 3 |
11 files changed, 247 insertions, 11 deletions
@@ -70,3 +70,4 @@ b723921b5c711bd24dbe77dc76ef488b544dac78 2.5.0-beta3 b723921b5c711bd24dbe77dc76ef488b544dac78 DRTVWR-34_2.5.0-beta3 b723921b5c711bd24dbe77dc76ef488b544dac78 2.5.0-release b723921b5c711bd24dbe77dc76ef488b544dac78 DRTVWR-31_2.5.0-release +92e58e51776a4f8c29069b1a62ff21454d2085f0 2.6.0-start diff --git a/doc/contributions.txt b/doc/contributions.txt index e1fb234f05..5d59627a92 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -86,6 +86,7 @@ Aleric Inglewood VWR-24320 VWR-24321 VWR-24354 + VWR-24366 VWR-24519 SNOW-84 SNOW-477 diff --git a/indra/cmake/GoogleMock.cmake b/indra/cmake/GoogleMock.cmake index ca5a8034ba..06d6d847a0 100644 --- a/indra/cmake/GoogleMock.cmake +++ b/indra/cmake/GoogleMock.cmake @@ -8,9 +8,10 @@ set(GOOGLEMOCK_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/include) if (LINUX) + # VWR-24366: gmock is underlinked, it needs gtest. set(GOOGLEMOCK_LIBRARIES - gmock - gtest) + gmock -Wl,--no-as-needed + gtest -Wl,--as-needed) elseif(WINDOWS) set(GOOGLEMOCK_LIBRARIES gmock) diff --git a/indra/cmake/LLAddBuildTest.cmake b/indra/cmake/LLAddBuildTest.cmake index 05f0492234..cd0eada2d0 100644 --- a/indra/cmake/LLAddBuildTest.cmake +++ b/indra/cmake/LLAddBuildTest.cmake @@ -57,11 +57,6 @@ INCLUDE(GoogleMock) ${CMAKE_SOURCE_DIR}/test/test.h ) - # Use the default flags - if (LINUX) - SET(CMAKE_EXE_LINKER_FLAGS "") - endif (LINUX) - # start the source test executable definitions SET(${project}_TEST_OUTPUT "") FOREACH (source ${sources}) diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index 7d5afe92dc..7703132d90 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -28,7 +28,7 @@ #define LL_LLVERSIONVIEWER_H const S32 LL_VERSION_MAJOR = 2; -const S32 LL_VERSION_MINOR = 6; +const S32 LL_VERSION_MINOR = 7; const S32 LL_VERSION_PATCH = 0; const S32 LL_VERSION_BUILD = 0; diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index 4d2677fd91..00aaba2052 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -36,6 +36,7 @@ set(llwindow_SOURCE_FILES llkeyboard.cpp llwindowheadless.cpp llwindowcallbacks.cpp + llwindowlistener.cpp ) set(llwindow_HEADER_FILES @@ -44,6 +45,7 @@ set(llwindow_HEADER_FILES llkeyboard.h llwindowheadless.h llwindowcallbacks.h + llwindowlistener.h ) set(viewer_SOURCE_FILES diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index 072f694c24..2d00c37719 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -41,6 +41,7 @@ #include "llkeyboard.h" #include "linked_lists.h" #include "llwindowcallbacks.h" +#include "llwindowlistener.h" // @@ -115,10 +116,15 @@ LLWindow::LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags) mHideCursorPermanent(FALSE), mFlags(flags), mHighSurrogate(0) -{ } +{ + mListener = new LLWindowListener(callbacks, gKeyboard); +} LLWindow::~LLWindow() -{ } +{ + delete mListener; + mListener = NULL; +} //virtual BOOL LLWindow::isValid() diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index e8a86a1880..6bdc01ae88 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -36,6 +36,7 @@ class LLSplashScreen; class LLPreeditor; class LLWindowCallbacks; +class LLWindowListener; // Refer to llwindow_test in test/common/llwindow for usage example @@ -188,6 +189,7 @@ 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/llwindow/llwindowlistener.cpp b/indra/llwindow/llwindowlistener.cpp new file mode 100644 index 0000000000..22cc12acee --- /dev/null +++ b/indra/llwindow/llwindowlistener.cpp @@ -0,0 +1,174 @@ +/** + * @file llwindowlistener.cpp + * @brief EventAPI interface for injecting input into LLWindow + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "llwindowlistener.h" + +#include "llcoord.h" +#include "llkeyboard.h" +#include "llwindowcallbacks.h" + +LLWindowListener::LLWindowListener(LLWindowCallbacks *window, LLKeyboard * keyboard) + : LLEventAPI("LLWindow", "Inject input events into the LLWindow instance"), + mWindow(window), + mKeyboard(keyboard) +{ + add("keyDown", + "Given [\"keycode\"] or [\"char\"], will inject the given keypress event.", + &LLWindowListener::keyDown); + add("keyUp", + "Given [\"keycode\"] or [\"char\"], will inject the given key release event.", + &LLWindowListener::keyUp); + add("mouseDown", + "Given [\"button\"], [\"x\"] and [\"y\"], will inject the given mouse click event.", + &LLWindowListener::mouseDown); + add("mouseUp", + "Given [\"button\"], [\"x\"] and [\"y\"], will inject the given mouse release event.", + &LLWindowListener::mouseUp); + add("mouseMove", + "Given [\"x\"] and [\"y\"], will inject the given mouse movement event.", + &LLWindowListener::mouseMove); + add("mouseScroll", + "Given a number of [\"clicks\"], will inject the given mouse scroll event.", + &LLWindowListener::mouseScroll); +} + +void LLWindowListener::keyDown(LLSD const & evt) +{ + if(NULL == mKeyboard) + { + // *HACK to handle the fact that LLWindow subclasses have to initialize + // things in an inconvenient order + mKeyboard = gKeyboard; + } + + KEY keycode = 0; + if(evt.has("keycode")) + { + keycode = KEY(evt["keycode"].asInteger()); + } + else + { + keycode = KEY(evt["char"].asString()[0]); + } + + // *TODO - figure out how to handle the mask + mKeyboard->handleTranslatedKeyDown(keycode, 0); +} + +void LLWindowListener::keyUp(LLSD const & evt) +{ + if(NULL == mKeyboard) + { + // *HACK to handle the fact that LLWindow subclasses have to initialize + // things in an inconvenient order + mKeyboard = gKeyboard; + } + + KEY keycode = 0; + if(evt.has("keycode")) + { + keycode = KEY(evt["keycode"].asInteger()); + } + else + { + keycode = KEY(evt["char"].asString()[0]); + } + + // *TODO - figure out how to handle the mask + mKeyboard->handleTranslatedKeyDown(keycode, 0); +} + +void LLWindowListener::mouseDown(LLSD const & evt) +{ + LLCoordGL pos(evt["x"].asInteger(), evt["y"].asInteger()); + + std::string const & button = evt["button"].asString(); + + if(button == "LEFT") + { + // *TODO - figure out how to handle the mask + mWindow->handleMouseDown(NULL, pos, 0); + } + else if (button == "RIGHT") + { + // *TODO - figure out how to handle the mask + mWindow->handleRightMouseDown(NULL, pos, 0); + } + else if (button == "MIDDLE") + { + // *TODO - figure out how to handle the mask + mWindow->handleMiddleMouseDown(NULL, pos, 0); + } + else + { + llwarns << "ignoring unknown mous button \"" << button << '\"' << llendl; + } +} + +void LLWindowListener::mouseUp(LLSD const & evt) +{ + LLCoordGL pos(evt["x"].asInteger(), evt["y"].asInteger()); + + std::string const & button = evt["button"].asString(); + + if(button == "LEFT") + { + // *TODO - figure out how to handle the mask + mWindow->handleMouseUp(NULL, pos, 0); + } + else if (button == "RIGHT") + { + // *TODO - figure out how to handle the mask + mWindow->handleRightMouseUp(NULL, pos, 0); + } + else if (button == "MIDDLE") + { + // *TODO - figure out how to handle the mask + mWindow->handleMiddleMouseUp(NULL, pos, 0); + } + else + { + llwarns << "ignoring unknown mous button \"" << button << '\"' << llendl; + } +} + +void LLWindowListener::mouseMove(LLSD const & evt) +{ + LLCoordGL pos(evt["x"].asInteger(), evt["y"].asInteger()); + + // *TODO - figure out how to handle the mask + mWindow->handleMouseMove(NULL, pos, 0); +} + +void LLWindowListener::mouseScroll(LLSD const & evt) +{ + S32 clicks = evt["clicks"].asInteger(); + + mWindow->handleScrollWheel(NULL, clicks); +} + diff --git a/indra/llwindow/llwindowlistener.h b/indra/llwindow/llwindowlistener.h new file mode 100644 index 0000000000..5b234c5d1d --- /dev/null +++ b/indra/llwindow/llwindowlistener.h @@ -0,0 +1,53 @@ +/** + * @file llwindowlistener.h + * @brief EventAPI interface for injecting input into LLWindow + * + * $LicenseInfo:firstyear=2001&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLWINDOWLISTENER_H +#define LL_LLWINDOWLISTENER_H + +#include "lleventapi.h" + +class LLKeyboard; +class LLWindowCallbacks; + +class LLWindowListener : public LLEventAPI +{ +public: + LLWindowListener(LLWindowCallbacks * window, LLKeyboard * keyboard); + + void keyDown(LLSD const & evt); + void keyUp(LLSD const & evt); + void mouseDown(LLSD const & evt); + void mouseUp(LLSD const & evt); + void mouseMove(LLSD const & evt); + void mouseScroll(LLSD const & evt); + +private: + LLWindowCallbacks * mWindow; + LLKeyboard * mKeyboard; +}; + + +#endif // LL_LLWINDOWLISTENER_H diff --git a/indra/newview/skins/default/xui/en/floater_region_debug_console.xml b/indra/newview/skins/default/xui/en/floater_region_debug_console.xml index cf95257b0a..7c7ee2df4c 100644 --- a/indra/newview/skins/default/xui/en/floater_region_debug_console.xml +++ b/indra/newview/skins/default/xui/en/floater_region_debug_console.xml @@ -2,6 +2,7 @@ <floater name="region_debug_console" title="Region Debug" + can_resize="true" layout="topleft" min_height="300" min_width="300" @@ -12,7 +13,7 @@ left="10" type="string" length="1" - follows="left|top|right|bottom" + follows="left|right|bottom" font="Monospace" height="366" width="576" |