From a4000c3744e42fcbb638e742f3b63fa31a0dee15 Mon Sep 17 00:00:00 2001 From: Steven Bennetts Date: Fri, 8 May 2009 07:43:08 +0000 Subject: merge trunk@116587 skinning-7@119389 -> viewer-2.0.0-skinning-7 --- indra/llwindow/CMakeLists.txt | 6 +- indra/llwindow/lldxhardware.cpp | 1 + indra/llwindow/llkeyboard.cpp | 2 +- indra/llwindow/llkeyboardmacosx.cpp | 2 +- indra/llwindow/llkeyboardsdl.cpp | 2 +- indra/llwindow/llkeyboardwin32.cpp | 10 +- indra/llwindow/llpreeditor.h | 2 +- indra/llwindow/llwindow.cpp | 233 +++++++---------------------------- indra/llwindow/llwindow.h | 83 +++---------- indra/llwindow/llwindowcallbacks.cpp | 201 ++++++++++++++++++++++++++++++ indra/llwindow/llwindowcallbacks.h | 85 +++++++++++++ indra/llwindow/llwindowheadless.cpp | 6 +- indra/llwindow/llwindowheadless.h | 9 +- indra/llwindow/llwindowmacosx.cpp | 27 ++-- indra/llwindow/llwindowmacosx.h | 6 +- indra/llwindow/llwindowsdl.cpp | 16 ++- indra/llwindow/llwindowsdl.h | 5 +- indra/llwindow/llwindowwin32.cpp | 121 ++++++++---------- indra/llwindow/llwindowwin32.h | 4 +- 19 files changed, 459 insertions(+), 362 deletions(-) create mode 100644 indra/llwindow/llwindowcallbacks.cpp create mode 100644 indra/llwindow/llwindowcallbacks.h (limited to 'indra/llwindow') diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index e1f7406287..f5d06b7258 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -37,7 +37,7 @@ set(llwindow_SOURCE_FILES llwindowheadless.cpp ) -set(llwindows_HEADER_FILES +set(llwindow_HEADER_FILES CMakeLists.txt llkeyboard.h @@ -47,10 +47,12 @@ set(llwindows_HEADER_FILES set(viewer_SOURCE_FILES llwindow.cpp llmousehandler.cpp + llwindowcallbacks.cpp ) set(viewer_HEADER_FILES llwindow.h + llwindowcallbacks.h llpreeditor.h llmousehandler.h ) @@ -143,7 +145,7 @@ if (SERVER AND NOT WINDOWS AND NOT DARWIN) ${llwindow_SOURCE_FILES} ${server_SOURCE_FILES} ) - # *TODO: This should probably have target_link_libraries + target_link_libraries (llwindowheadless ${llwindow_LINK_LIBRARIES}) endif (SERVER AND NOT WINDOWS AND NOT DARWIN) if (llwindow_HEADER_FILES) diff --git a/indra/llwindow/lldxhardware.cpp b/indra/llwindow/lldxhardware.cpp index beab131856..d33a0a6eea 100644 --- a/indra/llwindow/lldxhardware.cpp +++ b/indra/llwindow/lldxhardware.cpp @@ -47,6 +47,7 @@ #include "llstring.h" #include "llstl.h" +#include "lltimer.h" void (*gWriteDebug)(const char* msg) = NULL; LLDXHardware gDXHardware; diff --git a/indra/llwindow/llkeyboard.cpp b/indra/llwindow/llkeyboard.cpp index 02b4ed17c2..f0f618aef1 100644 --- a/indra/llwindow/llkeyboard.cpp +++ b/indra/llwindow/llkeyboard.cpp @@ -34,7 +34,7 @@ #include "indra_constants.h" #include "llkeyboard.h" -#include "llwindow.h" +#include "llwindowcallbacks.h" // diff --git a/indra/llwindow/llkeyboardmacosx.cpp b/indra/llwindow/llkeyboardmacosx.cpp index ec82032161..f53773c393 100644 --- a/indra/llwindow/llkeyboardmacosx.cpp +++ b/indra/llwindow/llkeyboardmacosx.cpp @@ -34,7 +34,7 @@ #include "linden_common.h" #include "llkeyboardmacosx.h" -#include "llwindow.h" +#include "llwindowcallbacks.h" #include diff --git a/indra/llwindow/llkeyboardsdl.cpp b/indra/llwindow/llkeyboardsdl.cpp index 8a6b6d6298..8a0b1de98c 100644 --- a/indra/llwindow/llkeyboardsdl.cpp +++ b/indra/llwindow/llkeyboardsdl.cpp @@ -34,7 +34,7 @@ #include "linden_common.h" #include "llkeyboardsdl.h" -#include "llwindow.h" +#include "llwindowcallbacks.h" #include "SDL/SDL.h" LLKeyboardSDL::LLKeyboardSDL() diff --git a/indra/llwindow/llkeyboardwin32.cpp b/indra/llwindow/llkeyboardwin32.cpp index a06f19149c..ea11e0537e 100644 --- a/indra/llwindow/llkeyboardwin32.cpp +++ b/indra/llwindow/llkeyboardwin32.cpp @@ -34,14 +34,16 @@ #include "linden_common.h" -#include "llkeyboardwin32.h" - -#include "llwindow.h" - #define WIN32_LEAN_AND_MEAN #include #include +#include "llkeyboardwin32.h" + +#include "llwindowcallbacks.h" + + + LLKeyboardWin32::LLKeyboardWin32() { // Set up key mapping for windows - eventually can read this from a file? diff --git a/indra/llwindow/llpreeditor.h b/indra/llwindow/llpreeditor.h index 370f76cb85..dd63a98606 100644 --- a/indra/llwindow/llpreeditor.h +++ b/indra/llwindow/llpreeditor.h @@ -94,7 +94,7 @@ public: // Get the contents of this preeditor as a LLWString. If there is an active preedit, // the returned LLWString contains it. - virtual const LLWString & getWText() const = 0; + virtual LLWString getWText() const = 0; // Handle a UTF-32 char on this preeditor, i.e., add the character // to the contents. diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index 7e412a14de..1c6c9e6e9d 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -46,14 +46,12 @@ #include "llerror.h" #include "llkeyboard.h" #include "linked_lists.h" +#include "llwindowcallbacks.h" -//static instance for default callbacks -LLWindowCallbacks LLWindow::sDefaultCallbacks; // -// LLWindowCallbacks +// Globals // - LLSplashScreen *gSplashScreenp = NULL; BOOL gDebugClicks = FALSE; BOOL gDebugWindowProc = FALSE; @@ -67,158 +65,6 @@ const std::string gURLProtocolWhitelist[] = { "file:", "http:", "https:" }; // Important - these lists should match - protocol to handler const std::string gURLProtocolWhitelistHandler[] = { "http", "http", "https" }; -BOOL LLWindowCallbacks::handleTranslatedKeyDown(const KEY key, const MASK mask, BOOL repeated) -{ - return FALSE; -} - - -BOOL LLWindowCallbacks::handleTranslatedKeyUp(const KEY key, const MASK mask) -{ - return FALSE; -} - -void LLWindowCallbacks::handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level) -{ -} - -BOOL LLWindowCallbacks::handleUnicodeChar(llwchar uni_char, MASK mask) -{ - return FALSE; -} - - -BOOL LLWindowCallbacks::handleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask) -{ - return FALSE; -} - -BOOL LLWindowCallbacks::handleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask) -{ - return FALSE; -} - -void LLWindowCallbacks::handleMouseLeave(LLWindow *window) -{ - return; -} - -BOOL LLWindowCallbacks::handleCloseRequest(LLWindow *window) -{ - //allow the window to close - return TRUE; -} - -void LLWindowCallbacks::handleQuit(LLWindow *window) -{ - if(LLWindowManager::destroyWindow(window) == FALSE) - { - llerrs << "LLWindowCallbacks::handleQuit() : Couldn't destroy window" << llendl; - } -} - -BOOL LLWindowCallbacks::handleRightMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask) -{ - return FALSE; -} - -BOOL LLWindowCallbacks::handleRightMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask) -{ - return FALSE; -} - -BOOL LLWindowCallbacks::handleMiddleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask) -{ - return FALSE; -} - -BOOL LLWindowCallbacks::handleMiddleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask) -{ - return FALSE; -} - -BOOL LLWindowCallbacks::handleActivate(LLWindow *window, BOOL activated) -{ - return FALSE; -} - -BOOL LLWindowCallbacks::handleActivateApp(LLWindow *window, BOOL activating) -{ - return FALSE; -} - -void LLWindowCallbacks::handleMouseMove(LLWindow *window, const LLCoordGL pos, MASK mask) -{ -} - -void LLWindowCallbacks::handleScrollWheel(LLWindow *window, S32 clicks) -{ -} - -void LLWindowCallbacks::handleResize(LLWindow *window, const S32 width, const S32 height) -{ -} - -void LLWindowCallbacks::handleFocus(LLWindow *window) -{ -} - -void LLWindowCallbacks::handleFocusLost(LLWindow *window) -{ -} - -void LLWindowCallbacks::handleMenuSelect(LLWindow *window, const S32 menu_item) -{ -} - -BOOL LLWindowCallbacks::handlePaint(LLWindow *window, const S32 x, const S32 y, - const S32 width, const S32 height) -{ - return FALSE; -} - -BOOL LLWindowCallbacks::handleDoubleClick(LLWindow *window, const LLCoordGL pos, MASK mask) -{ - return FALSE; -} - -void LLWindowCallbacks::handleWindowBlock(LLWindow *window) -{ -} - -void LLWindowCallbacks::handleWindowUnblock(LLWindow *window) -{ -} - -void LLWindowCallbacks::handleDataCopy(LLWindow *window, S32 data_type, void *data) -{ -} - -BOOL LLWindowCallbacks::handleTimerEvent(LLWindow *window) -{ - return FALSE; -} - -BOOL LLWindowCallbacks::handleDeviceChange(LLWindow *window) -{ - return FALSE; -} - -void LLWindowCallbacks::handlePingWatchdog(LLWindow *window, const char * msg) -{ - -} - -void LLWindowCallbacks::handlePauseWatchdog(LLWindow *window) -{ - -} - -void LLWindowCallbacks::handleResumeWatchdog(LLWindow *window) -{ - -} - S32 OSMessageBox(const std::string& text, const std::string& caption, U32 type) { @@ -257,8 +103,8 @@ S32 OSMessageBox(const std::string& text, const std::string& caption, U32 type) // LLWindow // -LLWindow::LLWindow(BOOL fullscreen, U32 flags) - : mCallbacks(&sDefaultCallbacks), +LLWindow::LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags) + : mCallbacks(callbacks), mPostQuit(TRUE), mFullscreen(fullscreen), mFullscreenWidth(0), @@ -275,9 +121,23 @@ LLWindow::LLWindow(BOOL fullscreen, U32 flags) mHideCursorPermanent(FALSE), mFlags(flags), mHighSurrogate(0) +{ } + +LLWindow::~LLWindow() +{ } + +//virtual +BOOL LLWindow::isValid() { + return TRUE; } - + +//virtual +BOOL LLWindow::canDelete() +{ + return TRUE; +} + // virtual void LLWindow::incBusyCount() { @@ -293,13 +153,28 @@ void LLWindow::decBusyCount() } } -void LLWindow::setCallbacks(LLWindowCallbacks *callbacks) +//virtual +void LLWindow::resetBusyCount() { - mCallbacks = callbacks; - if (gKeyboard) - { - gKeyboard->setCallbacks(callbacks); - } + mBusyCount = 0; +} + +//virtual +S32 LLWindow::getBusyCount() const +{ + return mBusyCount; +} + +//virtual +ECursorType LLWindow::getCursor() const +{ + return mCurrentCursor; +} + +//virtual +BOOL LLWindow::dialogColorPicker(F32 *r, F32 *g, F32 *b) +{ + return FALSE; } void *LLWindow::getMediaWindow() @@ -462,23 +337,7 @@ void LLSplashScreen::hide() static std::set sWindowList; LLWindow* LLWindowManager::createWindow( - const std::string& title, - const std::string& name, - LLCoordScreen upper_left, - LLCoordScreen size, - U32 flags, - BOOL fullscreen, - BOOL clearBg, - BOOL disable_vsync, - BOOL use_gl, - BOOL ignore_pixel_depth) -{ - return createWindow( - title, name, upper_left.mX, upper_left.mY, size.mX, size.mY, flags, - fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth); -} - -LLWindow* LLWindowManager::createWindow( + LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags, BOOL fullscreen, BOOL clearBg, @@ -492,26 +351,26 @@ LLWindow* LLWindowManager::createWindow( if (use_gl) { #if LL_MESA_HEADLESS - new_window = new LLWindowMesaHeadless( + new_window = new LLWindowMesaHeadless(callbacks, title, name, x, y, width, height, flags, fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth); #elif LL_SDL - new_window = new LLWindowSDL( + new_window = new LLWindowSDL(callbacks, title, x, y, width, height, flags, fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples); #elif LL_WINDOWS - new_window = new LLWindowWin32( + new_window = new LLWindowWin32(callbacks, title, name, x, y, width, height, flags, fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples); #elif LL_DARWIN - new_window = new LLWindowMacOSX( + new_window = new LLWindowMacOSX(callbacks, title, name, x, y, width, height, flags, fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth, fsaa_samples); #endif } else { - new_window = new LLWindowHeadless( + new_window = new LLWindowHeadless(callbacks, title, name, x, y, width, height, flags, fullscreen, clearBg, disable_vsync, use_gl, ignore_pixel_depth); } diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index 8361771b66..8602225108 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -39,52 +39,8 @@ #include "llcursortypes.h" class LLSplashScreen; - -class LLWindow; - class LLPreeditor; - -class LLWindowCallbacks -{ -public: - virtual ~LLWindowCallbacks() {} - virtual BOOL handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated); - virtual BOOL handleTranslatedKeyUp(KEY key, MASK mask); - virtual void handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level); - virtual BOOL handleUnicodeChar(llwchar uni_char, MASK mask); - - virtual BOOL handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); - virtual BOOL handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); - virtual void handleMouseLeave(LLWindow *window); - // return TRUE to allow window to close, which will then cause handleQuit to be called - virtual BOOL handleCloseRequest(LLWindow *window); - // window is about to be destroyed, clean up your business - virtual void handleQuit(LLWindow *window); - virtual BOOL handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); - virtual BOOL handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); - virtual BOOL handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); - virtual BOOL handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); - virtual BOOL handleActivate(LLWindow *window, BOOL activated); - virtual BOOL handleActivateApp(LLWindow *window, BOOL activating); - virtual void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask); - virtual void handleScrollWheel(LLWindow *window, S32 clicks); - virtual void handleResize(LLWindow *window, S32 width, S32 height); - virtual void handleFocus(LLWindow *window); - virtual void handleFocusLost(LLWindow *window); - virtual void handleMenuSelect(LLWindow *window, S32 menu_item); - virtual BOOL handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S32 height); - virtual BOOL handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask); // double-click of left mouse button - virtual void handleWindowBlock(LLWindow *window); // window is taking over CPU for a while - virtual void handleWindowUnblock(LLWindow *window); // window coming back after taking over CPU for a while - virtual void handleDataCopy(LLWindow *window, S32 data_type, void *data); - virtual BOOL handleTimerEvent(LLWindow *window); - virtual BOOL handleDeviceChange(LLWindow *window); - - virtual void handlePingWatchdog(LLWindow *window, const char * msg); - virtual void handlePauseWatchdog(LLWindow *window); - virtual void handleResumeWatchdog(LLWindow *window); - -}; +class LLWindowCallbacks; // Refer to llwindow_test in test/common/llwindow for usage example @@ -134,12 +90,12 @@ public: // arrow/hour if busycount > 0. virtual void incBusyCount(); virtual void decBusyCount(); - virtual void resetBusyCount() { mBusyCount = 0; } - virtual S32 getBusyCount() const { return mBusyCount; } + virtual void resetBusyCount(); + virtual S32 getBusyCount() const; // Sets cursor, may set to arrow+hourglass virtual void setCursor(ECursorType cursor) = 0; - virtual ECursorType getCursor() const { return mCurrentCursor; } + virtual ECursorType getCursor() const; virtual void captureMouse() = 0; virtual void releaseMouse() = 0; @@ -183,13 +139,12 @@ public: virtual F32 getPixelAspectRatio() = 0; virtual void setNativeAspectRatio(F32 aspect) = 0; - void setCallbacks(LLWindowCallbacks *callbacks); - virtual void beforeDialog() {}; // prepare to put up an OS dialog (if special measures are required, such as in fullscreen mode) virtual void afterDialog() {}; // undo whatever was done in beforeDialog() -// opens system default color picker - virtual BOOL dialog_color_picker (F32 *r, F32 *g, F32 *b) { return FALSE; }; + // opens system default color picker, modally + // Returns TRUE if valid color selected + virtual BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b); // return a platform-specific window reference (HWND on Windows, WindowRef on the Mac, Gtk window on Linux) virtual void *getPlatformWindow() = 0; @@ -207,12 +162,12 @@ public: static std::vector getDynamicFallbackFontList(); protected: - LLWindow(BOOL fullscreen, U32 flags); - virtual ~LLWindow() {} - virtual BOOL isValid() {return TRUE;} - virtual BOOL canDelete() {return TRUE;} -protected: - static LLWindowCallbacks sDefaultCallbacks; + LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags); + virtual ~LLWindow(); + // Defaults to true + virtual BOOL isValid(); + // Defaults to true + virtual BOOL canDelete(); protected: LLWindowCallbacks* mCallbacks; @@ -294,18 +249,8 @@ const S32 OSBTN_CANCEL = 3; class LLWindowManager { public: - static LLWindow* createWindow( - const std::string& title, - const std::string& name, - LLCoordScreen upper_left = LLCoordScreen(10, 10), - LLCoordScreen size = LLCoordScreen(320, 240), - U32 flags = 0, - BOOL fullscreen = FALSE, - BOOL clearBg = FALSE, - BOOL disable_vsync = TRUE, - BOOL use_gl = TRUE, - BOOL ignore_pixel_depth = FALSE); static LLWindow *createWindow( + LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags = 0, BOOL fullscreen = FALSE, diff --git a/indra/llwindow/llwindowcallbacks.cpp b/indra/llwindow/llwindowcallbacks.cpp new file mode 100644 index 0000000000..72f9997149 --- /dev/null +++ b/indra/llwindow/llwindowcallbacks.cpp @@ -0,0 +1,201 @@ +/** + * @file llwindowcallbacks.cpp + * @brief OS event callback class + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "llwindowcallbacks.h" + +#include "llcoord.h" + +// +// LLWindowCallbacks +// + +BOOL LLWindowCallbacks::handleTranslatedKeyDown(const KEY key, const MASK mask, BOOL repeated) +{ + return FALSE; +} + + +BOOL LLWindowCallbacks::handleTranslatedKeyUp(const KEY key, const MASK mask) +{ + return FALSE; +} + +void LLWindowCallbacks::handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level) +{ +} + +BOOL LLWindowCallbacks::handleUnicodeChar(llwchar uni_char, MASK mask) +{ + return FALSE; +} + + +BOOL LLWindowCallbacks::handleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask) +{ + return FALSE; +} + +BOOL LLWindowCallbacks::handleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask) +{ + return FALSE; +} + +void LLWindowCallbacks::handleMouseLeave(LLWindow *window) +{ + return; +} + +BOOL LLWindowCallbacks::handleCloseRequest(LLWindow *window) +{ + //allow the window to close + return TRUE; +} + +void LLWindowCallbacks::handleQuit(LLWindow *window) +{ +} + +BOOL LLWindowCallbacks::handleRightMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask) +{ + return FALSE; +} + +BOOL LLWindowCallbacks::handleRightMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask) +{ + return FALSE; +} + +BOOL LLWindowCallbacks::handleMiddleMouseDown(LLWindow *window, const LLCoordGL pos, MASK mask) +{ + return FALSE; +} + +BOOL LLWindowCallbacks::handleMiddleMouseUp(LLWindow *window, const LLCoordGL pos, MASK mask) +{ + return FALSE; +} + +BOOL LLWindowCallbacks::handleActivate(LLWindow *window, BOOL activated) +{ + return FALSE; +} + +BOOL LLWindowCallbacks::handleActivateApp(LLWindow *window, BOOL activating) +{ + return FALSE; +} + +void LLWindowCallbacks::handleMouseMove(LLWindow *window, const LLCoordGL pos, MASK mask) +{ +} + +void LLWindowCallbacks::handleScrollWheel(LLWindow *window, S32 clicks) +{ +} + +void LLWindowCallbacks::handleResize(LLWindow *window, const S32 width, const S32 height) +{ +} + +void LLWindowCallbacks::handleFocus(LLWindow *window) +{ +} + +void LLWindowCallbacks::handleFocusLost(LLWindow *window) +{ +} + +void LLWindowCallbacks::handleMenuSelect(LLWindow *window, const S32 menu_item) +{ +} + +BOOL LLWindowCallbacks::handlePaint(LLWindow *window, const S32 x, const S32 y, + const S32 width, const S32 height) +{ + return FALSE; +} + +BOOL LLWindowCallbacks::handleDoubleClick(LLWindow *window, const LLCoordGL pos, MASK mask) +{ + return FALSE; +} + +void LLWindowCallbacks::handleWindowBlock(LLWindow *window) +{ +} + +void LLWindowCallbacks::handleWindowUnblock(LLWindow *window) +{ +} + +void LLWindowCallbacks::handleDataCopy(LLWindow *window, S32 data_type, void *data) +{ +} + +BOOL LLWindowCallbacks::handleTimerEvent(LLWindow *window) +{ + return FALSE; +} + +BOOL LLWindowCallbacks::handleDeviceChange(LLWindow *window) +{ + return FALSE; +} + +void LLWindowCallbacks::handlePingWatchdog(LLWindow *window, const char * msg) +{ + +} + +void LLWindowCallbacks::handlePauseWatchdog(LLWindow *window) +{ + +} + +void LLWindowCallbacks::handleResumeWatchdog(LLWindow *window) +{ + +} + +std::string LLWindowCallbacks::translateString(const char* tag) +{ + return std::string(); +} + +//virtual +std::string LLWindowCallbacks::translateString(const char* tag, + const std::map& args) +{ + return std::string(); +} diff --git a/indra/llwindow/llwindowcallbacks.h b/indra/llwindow/llwindowcallbacks.h new file mode 100644 index 0000000000..abc66c42a2 --- /dev/null +++ b/indra/llwindow/llwindowcallbacks.h @@ -0,0 +1,85 @@ +/** + * @file llwindowcallbacks.h + * @brief OS event callback class + * + * $LicenseInfo:firstyear=2001&license=viewergpl$ + * + * Copyright (c) 2001-2009, Linden Research, Inc. + * + * Second Life Viewer Source Code + * The source code in this file ("Source Code") is provided by Linden Lab + * to you under the terms of the GNU General Public License, version 2.0 + * ("GPL"), unless you have obtained a separate licensing agreement + * ("Other License"), formally executed by you and Linden Lab. Terms of + * the GPL can be found in doc/GPL-license.txt in this distribution, or + * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * + * There are special exceptions to the terms and conditions of the GPL as + * it is applied to this Source Code. View the full text of the exception + * in the file doc/FLOSS-exception.txt in this software distribution, or + * online at + * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * + * By copying, modifying or distributing this software, you acknowledge + * that you have read and understood your obligations described above, + * and agree to abide by those obligations. + * + * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO + * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, + * COMPLETENESS OR PERFORMANCE. + * $/LicenseInfo$ + */ +#ifndef LLWINDOWCALLBACKS_H +#define LLWINDOWCALLBACKS_H + +class LLCoordGL; +class LLWindow; + +class LLWindowCallbacks +{ +public: + virtual ~LLWindowCallbacks() {} + virtual BOOL handleTranslatedKeyDown(KEY key, MASK mask, BOOL repeated); + virtual BOOL handleTranslatedKeyUp(KEY key, MASK mask); + virtual void handleScanKey(KEY key, BOOL key_down, BOOL key_up, BOOL key_level); + virtual BOOL handleUnicodeChar(llwchar uni_char, MASK mask); + + virtual BOOL handleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); + virtual BOOL handleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); + virtual void handleMouseLeave(LLWindow *window); + // return TRUE to allow window to close, which will then cause handleQuit to be called + virtual BOOL handleCloseRequest(LLWindow *window); + // window is about to be destroyed, clean up your business + virtual void handleQuit(LLWindow *window); + virtual BOOL handleRightMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); + virtual BOOL handleRightMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); + virtual BOOL handleMiddleMouseDown(LLWindow *window, LLCoordGL pos, MASK mask); + virtual BOOL handleMiddleMouseUp(LLWindow *window, LLCoordGL pos, MASK mask); + virtual BOOL handleActivate(LLWindow *window, BOOL activated); + virtual BOOL handleActivateApp(LLWindow *window, BOOL activating); + virtual void handleMouseMove(LLWindow *window, LLCoordGL pos, MASK mask); + virtual void handleScrollWheel(LLWindow *window, S32 clicks); + virtual void handleResize(LLWindow *window, S32 width, S32 height); + virtual void handleFocus(LLWindow *window); + virtual void handleFocusLost(LLWindow *window); + virtual void handleMenuSelect(LLWindow *window, S32 menu_item); + virtual BOOL handlePaint(LLWindow *window, S32 x, S32 y, S32 width, S32 height); + virtual BOOL handleDoubleClick(LLWindow *window, LLCoordGL pos, MASK mask); // double-click of left mouse button + virtual void handleWindowBlock(LLWindow *window); // window is taking over CPU for a while + virtual void handleWindowUnblock(LLWindow *window); // window coming back after taking over CPU for a while + virtual void handleDataCopy(LLWindow *window, S32 data_type, void *data); + virtual BOOL handleTimerEvent(LLWindow *window); + virtual BOOL handleDeviceChange(LLWindow *window); + + virtual void handlePingWatchdog(LLWindow *window, const char * msg); + virtual void handlePauseWatchdog(LLWindow *window); + virtual void handleResumeWatchdog(LLWindow *window); + + // Look up a localized string, usually for an error message + virtual std::string translateString(const char* tag); + virtual std::string translateString(const char* tag, + const std::map& args); +}; + + +#endif diff --git a/indra/llwindow/llwindowheadless.cpp b/indra/llwindow/llwindowheadless.cpp index 3742846440..b4e9009321 100644 --- a/indra/llwindow/llwindowheadless.cpp +++ b/indra/llwindow/llwindowheadless.cpp @@ -38,10 +38,10 @@ // // LLWindowHeadless // -LLWindowHeadless::LLWindowHeadless(const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, - U32 flags, BOOL fullscreen, BOOL clearBg, +LLWindowHeadless::LLWindowHeadless(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, + U32 flags, BOOL fullscreen, BOOL clear_background, BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth) - : LLWindow(fullscreen, flags) + : LLWindow(callbacks, fullscreen, flags) { } diff --git a/indra/llwindow/llwindowheadless.h b/indra/llwindow/llwindowheadless.h index 4353d157b5..3cffd2bbf6 100644 --- a/indra/llwindow/llwindowheadless.h +++ b/indra/llwindow/llwindowheadless.h @@ -94,9 +94,12 @@ public: /*virtual*/ void *getPlatformWindow() { return 0; }; /*virtual*/ void bringToFront() {}; - LLWindowHeadless(const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, - U32 flags, BOOL fullscreen, BOOL clearBg, - BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth); + LLWindowHeadless(LLWindowCallbacks* callbacks, + const std::string& title, const std::string& name, + S32 x, S32 y, + S32 width, S32 height, + U32 flags, BOOL fullscreen, BOOL clear_background, + BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth); virtual ~LLWindowHeadless(); private: diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index 65a40dcef4..82dc5e4a13 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -32,19 +32,21 @@ #include "linden_common.h" -#include -#include - #include "llwindowmacosx.h" + #include "llkeyboardmacosx.h" +#include "llwindowcallbacks.h" +#include "llwindowmacosx-objc.h" +#include "llpreeditor.h" + #include "llerror.h" #include "llgl.h" #include "llstring.h" #include "lldir.h" #include "indra_constants.h" -#include "llwindowmacosx-objc.h" -#include "llpreeditor.h" +#include +#include extern BOOL gDebugWindowProc; @@ -214,19 +216,27 @@ static LLWindowMacOSX *gWindowImplementation = NULL; -LLWindowMacOSX::LLWindowMacOSX(const std::string& title, const std::string& name, S32 x, S32 y, S32 width, +LLWindowMacOSX::LLWindowMacOSX(LLWindowCallbacks* callbacks, + const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags, BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth, U32 fsaa_samples) - : LLWindow(fullscreen, flags) + : LLWindow(NULL, fullscreen, flags) { + // *HACK: During window construction we get lots of OS events for window + // reshape, activate, etc. that the viewer isn't ready to handle. + // Route them to a dummy callback structure until the end of constructor. + LLWindowCallbacks null_callbacks; + mCallbacks = &null_callbacks; + // Voodoo for calling cocoa from carbon (see llwindowmacosx-objc.mm). setupCocoa(); // Initialize the keyboard gKeyboard = new LLKeyboardMacOSX(); + gKeyboard->setCallbacks(callbacks); // Ignore use_gl for now, only used for drones on PC mWindow = NULL; @@ -315,6 +325,7 @@ LLWindowMacOSX::LLWindowMacOSX(const std::string& title, const std::string& name setCursor( UI_CURSOR_ARROW ); } + mCallbacks = callbacks; stop_glerror(); } @@ -3202,7 +3213,7 @@ void LLWindowMacOSX::spawnWebBrowser(const std::string& escaped_url) } -BOOL LLWindowMacOSX::dialog_color_picker ( F32 *r, F32 *g, F32 *b) +BOOL LLWindowMacOSX::dialogColorPicker( F32 *r, F32 *g, F32 *b) { BOOL retval = FALSE; OSErr error = noErr; diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 3886782732..17074080eb 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -35,6 +35,8 @@ #include "llwindow.h" +#include "lltimer.h" + #include #include @@ -103,7 +105,7 @@ public: /*virtual*/ void beforeDialog(); /*virtual*/ void afterDialog(); - /*virtual*/ BOOL dialog_color_picker(F32 *r, F32 *g, F32 *b); + /*virtual*/ BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b); /*virtual*/ void *getPlatformWindow(); /*virtual*/ void *getMediaWindow(); @@ -116,7 +118,7 @@ public: static std::vector getDynamicFallbackFontList(); protected: - LLWindowMacOSX( + LLWindowMacOSX(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags, BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth, diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index 24bd70d57f..3c203d9f5c 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -36,15 +36,16 @@ #include "linden_common.h" #include "llwindowsdl.h" + +#include "llwindowcallbacks.h" #include "llkeyboardsdl.h" + #include "llerror.h" #include "llgl.h" #include "llstring.h" #include "lldir.h" #include "llfindlocale.h" -#include "indra_constants.h" - #if LL_GTK extern "C" { # include "gtk/gtk.h" @@ -187,16 +188,19 @@ Display* LLWindowSDL::get_SDL_Display(void) #endif // LL_X11 -LLWindowSDL::LLWindowSDL(const std::string& title, S32 x, S32 y, S32 width, +LLWindowSDL::LLWindowSDL(LLWindowCallbacks* callbacks, + const std::string& title, S32 x, S32 y, S32 width, S32 height, U32 flags, BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth, U32 fsaa_samples) - : LLWindow(fullscreen, flags), Lock_Display(NULL), + : LLWindow(callbacks, fullscreen, flags), + Lock_Display(NULL), Unlock_Display(NULL), mGamma(1.0f) { // Initialize the keyboard gKeyboard = new LLKeyboardSDL(); + gKeyboard->setCallbacks(callbacks); // Note that we can't set up key-repeat until after SDL has init'd video // Ignore use_gl for now, only used for drones on PC @@ -2229,7 +2233,7 @@ static void color_changed_callback(GtkWidget *widget, gtk_color_selection_get_current_color(colorsel, colorp); } -BOOL LLWindowSDL::dialog_color_picker ( F32 *r, F32 *g, F32 *b) +BOOL LLWindowSDL::dialogColorPicker( F32 *r, F32 *g, F32 *b) { BOOL rtn = FALSE; @@ -2306,7 +2310,7 @@ S32 OSMessageBoxSDL(const std::string& text, const std::string& caption, U32 typ return 0; } -BOOL LLWindowSDL::dialog_color_picker ( F32 *r, F32 *g, F32 *b) +BOOL LLWindowSDL::dialogColorPicker( F32 *r, F32 *g, F32 *b) { return (FALSE); } diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index 632d8fc1fa..1e4dffd7a6 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -36,6 +36,7 @@ // Simple Directmedia Layer (http://libsdl.org/) implementation of LLWindow class #include "llwindow.h" +#include "lltimer.h" #include "SDL/SDL.h" #include "SDL/SDL_endian.h" @@ -118,7 +119,7 @@ public: /*virtual*/ void beforeDialog(); /*virtual*/ void afterDialog(); - /*virtual*/ BOOL dialog_color_picker(F32 *r, F32 *g, F32 *b); + /*virtual*/ BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b); /*virtual*/ void *getPlatformWindow(); /*virtual*/ void bringToFront(); @@ -147,7 +148,7 @@ public: #endif // LL_X11 protected: - LLWindowSDL( + LLWindowSDL(LLWindowCallbacks* callbacks, const std::string& title, int x, int y, int width, int height, U32 flags, BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth, U32 fsaa_samples); diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 6280868dfb..b60740c7e4 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -36,6 +36,17 @@ #include "llwindowwin32.h" +// LLWindow library includes +#include "llkeyboardwin32.h" +#include "llpreeditor.h" +#include "llwindowcallbacks.h" + +// Linden library includes +#include "llerror.h" +#include "llgl.h" +#include "llstring.h" + +// System includes #include #include #include @@ -49,16 +60,6 @@ #include #include -#include "llkeyboardwin32.h" -#include "llerror.h" -#include "llgl.h" -#include "llstring.h" -#include "lldir.h" - -#include "indra_constants.h" - -#include "llpreeditor.h" - // culled from winuser.h #ifndef WM_MOUSEWHEEL /* Added to be compatible with later SDK's */ const S32 WM_MOUSEWHEEL = 0x020A; @@ -358,13 +359,14 @@ LLWinImm::~LLWinImm() } -LLWindowWin32::LLWindowWin32(const std::string& title, const std::string& name, S32 x, S32 y, S32 width, +LLWindowWin32::LLWindowWin32(LLWindowCallbacks* callbacks, + const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags, BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth, U32 fsaa_samples) - : LLWindow(fullscreen, flags) + : LLWindow(callbacks, fullscreen, flags) { mFSAASamples = fsaa_samples; mIconResource = gIconResource; @@ -378,6 +380,7 @@ LLWindowWin32::LLWindowWin32(const std::string& title, const std::string& name, // Initialize the keyboard gKeyboard = new LLKeyboardWin32(); + gKeyboard->setCallbacks(callbacks); // Initialize (boot strap) the Language text input management, // based on the system's (user's) default settings. @@ -481,7 +484,8 @@ LLWindowWin32::LLWindowWin32(const std::string& title, const std::string& name, if (!RegisterClass(&wc)) { - OSMessageBox("RegisterClass failed", "Error", OSMB_OK); + OSMessageBox(mCallbacks->translateString("MBRegClassFailed"), + mCallbacks->translateString("MBError"), OSMB_OK); return; } sIsClassRegistered = TRUE; @@ -572,8 +576,11 @@ LLWindowWin32::LLWindowWin32(const std::string& title, const std::string& name, mFullscreenBits = -1; mFullscreenRefresh = -1; - std::string error = llformat("Unable to run fullscreen at %d x %d.\nRunning in window.", width, height); - OSMessageBox(error, "Error", OSMB_OK); + std::map args; + args["[WIDTH]"] = llformat("%d", width); + args["[HEIGHT]"] = llformat ("%d", height); + OSMessageBox(mCallbacks->translateString("MBFullScreenErr", args), + mCallbacks->translateString("MBError"), OSMB_OK); } } @@ -712,7 +719,9 @@ void LLWindowWin32::close() // This causes WM_DESTROY to be sent *immediately* if (!DestroyWindow(mWindowHandle)) { - OSMessageBox("DestroyWindow(mWindowHandle) failed", "Shutdown Error", OSMB_OK); + OSMessageBox(mCallbacks->translateString("MBDestroyWinFailed"), + mCallbacks->translateString("MBShutdownErr"), + OSMB_OK); } mWindowHandle = NULL; @@ -1015,14 +1024,16 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO if (!(mhDC = GetDC(mWindowHandle))) { close(); - OSMessageBox("Can't make GL device context", "Error", OSMB_OK); + OSMessageBox(mCallbacks->translateString("MBDevContextErr"), + mCallbacks->translateString("MBError"), OSMB_OK); return FALSE; } if (!(pixel_format = ChoosePixelFormat(mhDC, &pfd))) { close(); - OSMessageBox("Can't find suitable pixel format", "Error", OSMB_OK); + OSMessageBox(mCallbacks->translateString("MBPixelFmtErr"), + mCallbacks->translateString("MBError"), OSMB_OK); return FALSE; } @@ -1031,57 +1042,48 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO &pfd)) { close(); - OSMessageBox("Can't get pixel format description", "Error", OSMB_OK); + OSMessageBox(mCallbacks->translateString("MBPixelFmtDescErr"), + mCallbacks->translateString("MBError"), OSMB_OK); return FALSE; } if (pfd.cColorBits < 32) { close(); - OSMessageBox( - "Second Life requires True Color (32-bit) to run in a window.\n" - "Please go to Control Panels -> Display -> Settings and\n" - "set the screen to 32-bit color.\n" - "Alternately, if you choose to run fullscreen, Second Life\n" - "will automatically adjust the screen each time it runs.", - "Error", - OSMB_OK); + OSMessageBox(mCallbacks->translateString("MBTrueColorWindow"), + mCallbacks->translateString("MBError"), OSMB_OK); return FALSE; } if (pfd.cAlphaBits < 8) { close(); - OSMessageBox( - "Second Life is unable to run because it can't get an 8 bit alpha\n" - "channel. Usually this is due to video card driver issues.\n" - "Please make sure you have the latest video card drivers installed.\n" - "Also be sure your monitor is set to True Color (32-bit) in\n" - "Control Panels -> Display -> Settings.\n" - "If you continue to receive this message, contact customer service.", - "Error", - OSMB_OK); + OSMessageBox(mCallbacks->translateString("MBAlpha"), + mCallbacks->translateString("MBError"), OSMB_OK); return FALSE; } if (!SetPixelFormat(mhDC, pixel_format, &pfd)) { close(); - OSMessageBox("Can't set pixel format", "Error", OSMB_OK); + OSMessageBox(mCallbacks->translateString("MBPixelFmtSetErr"), + mCallbacks->translateString("MBError"), OSMB_OK); return FALSE; } if (!(mhRC = wglCreateContext(mhDC))) { close(); - OSMessageBox("Can't create GL rendering context", "Error", OSMB_OK); + OSMessageBox(mCallbacks->translateString("MBGLContextErr"), + mCallbacks->translateString("MBError"), OSMB_OK); return FALSE; } if (!wglMakeCurrent(mhDC, mhRC)) { close(); - OSMessageBox("Can't activate GL rendering context", "Error", OSMB_OK); + OSMessageBox(mCallbacks->translateString("MBGLContextActErr"), + mCallbacks->translateString("MBError"), OSMB_OK); return FALSE; } @@ -1243,14 +1245,15 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO if (!(mhDC = GetDC(mWindowHandle))) { close(); - OSMessageBox("Can't make GL device context", "Error", OSMB_OK); + OSMessageBox(mCallbacks->translateString("MBDevContextErr"), mCallbacks->translateString("MBError"), OSMB_OK); return FALSE; } if (!SetPixelFormat(mhDC, pixel_format, &pfd)) { close(); - OSMessageBox("Can't set pixel format", "Error", OSMB_OK); + OSMessageBox(mCallbacks->translateString("MBPixelFmtSetErr"), + mCallbacks->translateString("MBError"), OSMB_OK); return FALSE; } @@ -1287,7 +1290,7 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO &pfd)) { close(); - OSMessageBox("Can't get pixel format description", "Error", OSMB_OK); + OSMessageBox(mCallbacks->translateString("MBPixelFmtDescErr"), mCallbacks->translateString("MBError"), OSMB_OK); return FALSE; } @@ -1300,57 +1303,35 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO if (pfd.cColorBits < 32 || GetDeviceCaps(mhDC, BITSPIXEL) < 32) { close(); - OSMessageBox( - "Second Life requires True Color (32-bit) to run in a window.\n" - "Please go to Control Panels -> Display -> Settings and\n" - "set the screen to 32-bit color.\n" - "Alternately, if you choose to run fullscreen, Second Life\n" - "will automatically adjust the screen each time it runs.", - "Error", - OSMB_OK); + OSMessageBox(mCallbacks->translateString("MBTrueColorWindow"), mCallbacks->translateString("MBError"), OSMB_OK); return FALSE; } if (pfd.cAlphaBits < 8) { close(); - OSMessageBox( - "Second Life is unable to run because it can't get an 8 bit alpha\n" - "channel. Usually this is due to video card driver issues.\n" - "Please make sure you have the latest video card drivers installed.\n" - "Also be sure your monitor is set to True Color (32-bit) in\n" - "Control Panels -> Display -> Settings.\n" - "If you continue to receive this message, contact customer service.", - "Error", - OSMB_OK); + OSMessageBox(mCallbacks->translateString("MBAlpha"), mCallbacks->translateString("MBError"), OSMB_OK); return FALSE; } if (!(mhRC = wglCreateContext(mhDC))) { close(); - OSMessageBox("Can't create GL rendering context", "Error", OSMB_OK); + OSMessageBox(mCallbacks->translateString("MBGLContextErr"), mCallbacks->translateString("MBError"), OSMB_OK); return FALSE; } if (!wglMakeCurrent(mhDC, mhRC)) { close(); - OSMessageBox("Can't activate GL rendering context", "Error", OSMB_OK); + OSMessageBox(mCallbacks->translateString("MBGLContextActErr"), mCallbacks->translateString("MBError"), OSMB_OK); return FALSE; } if (!gGLManager.initGL()) { close(); - OSMessageBox( - "Second Life is unable to run because your video card drivers\n" - "did not install properly, are out of date, or are for unsupported\n" - "hardware. Please make sure you have the latest video card drivers\n" - "and even if you do have the latest, try reinstalling them.\n\n" - "If you continue to receive this message, contact customer service.", - "Error", - OSMB_OK); + OSMessageBox(mCallbacks->translateString("MBVideoDrvErr"), mCallbacks->translateString("MBError"), OSMB_OK); return FALSE; } @@ -3030,7 +3011,7 @@ void LLWindowWin32::spawnWebBrowser(const std::string& escaped_url ) } -BOOL LLWindowWin32::dialog_color_picker ( F32 *r, F32 *g, F32 *b ) +BOOL LLWindowWin32::dialogColorPicker( F32 *r, F32 *g, F32 *b ) { BOOL retval = FALSE; diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 237f834318..e14324c9f1 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -100,7 +100,7 @@ public: /*virtual*/ F32 getPixelAspectRatio(); /*virtual*/ void setNativeAspectRatio(F32 ratio) { mOverrideAspectRatio = ratio; } - /*virtual*/ BOOL dialog_color_picker (F32 *r, F32 *g, F32 *b ); + /*virtual*/ BOOL dialogColorPicker(F32 *r, F32 *g, F32 *b ); /*virtual*/ void *getPlatformWindow(); /*virtual*/ void bringToFront(); @@ -115,7 +115,7 @@ public: static std::vector getDynamicFallbackFontList(); protected: - LLWindowWin32( + LLWindowWin32(LLWindowCallbacks* callbacks, const std::string& title, const std::string& name, int x, int y, int width, int height, U32 flags, BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth, U32 fsaa_samples); -- cgit v1.2.3 From 91667335ceca625a3bfeb1fdcf20cc2dc51c981d Mon Sep 17 00:00:00 2001 From: Nat Goodspeed Date: Tue, 23 Jun 2009 21:31:09 +0000 Subject: QAR-1619: For some reason the LLWindowMesaHeadless constructor omitted the LLWindowCallbacks* parameter passed by its consumer and required by the base-class LLWindow constructor. --- indra/llwindow/llwindowmesaheadless.cpp | 5 +++-- indra/llwindow/llwindowmesaheadless.h | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/llwindowmesaheadless.cpp b/indra/llwindow/llwindowmesaheadless.cpp index c1f9d2095e..48736d9207 100644 --- a/indra/llwindow/llwindowmesaheadless.cpp +++ b/indra/llwindow/llwindowmesaheadless.cpp @@ -44,10 +44,11 @@ U16 *gMesaBuffer = NULL; // // LLWindowMesaHeadless // -LLWindowMesaHeadless::LLWindowMesaHeadless(const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, +LLWindowMesaHeadless::LLWindowMesaHeadless(LLWindowCallbacks* callbacks, + const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags, BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth) - : LLWindow(fullscreen, flags) + : LLWindow(callbacks, fullscreen, flags) { if (use_gl) { diff --git a/indra/llwindow/llwindowmesaheadless.h b/indra/llwindow/llwindowmesaheadless.h index ab562d9ffe..46b62b914c 100644 --- a/indra/llwindow/llwindowmesaheadless.h +++ b/indra/llwindow/llwindowmesaheadless.h @@ -98,7 +98,8 @@ public: /*virtual*/ void *getPlatformWindow() { return 0; }; /*virtual*/ void bringToFront() {}; - LLWindowMesaHeadless(const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, + LLWindowMesaHeadless(LLWindowCallbacks* callbacks, + const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, U32 flags, BOOL fullscreen, BOOL clearBg, BOOL disable_vsync, BOOL use_gl, BOOL ignore_pixel_depth); ~LLWindowMesaHeadless(); -- cgit v1.2.3 From db7b4bb3f8905518b303e371d61fdc3aabd7b9be Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Mon, 29 Jun 2009 16:02:36 -0400 Subject: Fix for mismatched cmake if/endif pairs in llwindow/CMakeLists.txt --- indra/llwindow/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llwindow') diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt index b80080e458..beaf5c3488 100644 --- a/indra/llwindow/CMakeLists.txt +++ b/indra/llwindow/CMakeLists.txt @@ -64,7 +64,7 @@ if (NOT LINUX OR VIEWER) ${UI_LIBRARIES} # for GTK ${SDL_LIBRARY} ) -endif (VIEWER) +endif (NOT LINUX OR VIEWER) if (DARWIN) list(APPEND llwindow_SOURCE_FILES @@ -96,7 +96,7 @@ if (LINUX AND VIEWER) llkeyboardsdl.h llwindowsdl.h ) -endif (LINUX) +endif (LINUX AND VIEWER) if (WINDOWS) list(APPEND llwindow_SOURCE_FILES -- cgit v1.2.3