diff options
-rw-r--r-- | indra/llwindow/llwindow.cpp | 25 | ||||
-rw-r--r-- | indra/llwindow/llwindow.h | 8 | ||||
-rw-r--r-- | indra/llwindow/llwindowheadless.h | 2 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx.cpp | 2 | ||||
-rw-r--r-- | indra/llwindow/llwindowmacosx.h | 2 | ||||
-rw-r--r-- | indra/llwindow/llwindowmesaheadless.h | 2 | ||||
-rw-r--r-- | indra/llwindow/llwindowsdl.cpp | 2 | ||||
-rw-r--r-- | indra/llwindow/llwindowsdl.h | 2 | ||||
-rw-r--r-- | indra/llwindow/llwindowwin32.cpp | 2 | ||||
-rw-r--r-- | indra/llwindow/llwindowwin32.h | 2 | ||||
-rwxr-xr-x | indra/newview/llappviewer.cpp | 30 | ||||
-rw-r--r-- | indra/newview/llfloaterwindowsize.cpp | 35 | ||||
-rw-r--r-- | indra/newview/llfloaterwindowsize.h | 22 | ||||
-rw-r--r-- | indra/newview/llviewerfloaterreg.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llviewerprecompiledheaders.h | 3 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 70 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.h | 19 |
17 files changed, 125 insertions, 105 deletions
diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp index a313885ca3..4919605afd 100644 --- a/indra/llwindow/llwindow.cpp +++ b/indra/llwindow/llwindow.cpp @@ -111,8 +111,8 @@ LLWindow::LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags) mCursorHidden(FALSE), mBusyCount(0), mIsMouseClipping(FALSE), - mMinWindowWidth(1024), // just a sanity check - actual minimum size is stored in settings.xml - mMinWindowHeight(768), + mMinWindowWidth(S32_MAX), // just a sanity check - actual minimum size is stored in settings.xml + mMinWindowHeight(S32_MAX), mSwapMethod(SWAP_METHOD_UNDEFINED), mHideCursorPermanent(FALSE), mFlags(flags), @@ -181,11 +181,32 @@ void *LLWindow::getMediaWindow() return getPlatformWindow(); } +BOOL LLWindow::setSize(LLCoordScreen size) +{ + if (!getMaximized()) + { + size.mX = llmin(size.mX, mMinWindowWidth); + size.mY = llmin(size.mY, mMinWindowHeight); + } + return setSizeImpl(size); +} + + // virtual void LLWindow::setMinSize(U32 min_width, U32 min_height) { mMinWindowWidth = min_width; mMinWindowHeight = min_height; + + LLCoordScreen cur_size; + if (!getMaximized() && getSize(&cur_size)) + { + if (cur_size.mX < mMinWindowWidth || cur_size.mY < mMinWindowHeight) + { + setSizeImpl(LLCoordScreen(llmin(cur_size.mX, mMinWindowWidth), llmin(cur_size.mY, mMinWindowHeight))); + } + } + } //virtual diff --git a/indra/llwindow/llwindow.h b/indra/llwindow/llwindow.h index b2c2628ec4..77a9e88287 100644 --- a/indra/llwindow/llwindow.h +++ b/indra/llwindow/llwindow.h @@ -72,7 +72,7 @@ public: virtual BOOL getSize(LLCoordScreen *size) = 0; virtual BOOL getSize(LLCoordWindow *size) = 0; virtual BOOL setPosition(LLCoordScreen position) = 0; - virtual BOOL setSize(LLCoordScreen size) = 0; + BOOL setSize(LLCoordScreen size); virtual void setMinSize(U32 min_width, U32 min_height); virtual BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) = 0; virtual BOOL setCursorPosition(LLCoordWindow position) = 0; @@ -170,6 +170,8 @@ protected: // Defaults to true virtual BOOL canDelete(); + virtual BOOL setSizeImpl(LLCoordScreen size) = 0; + protected: LLWindowCallbacks* mCallbacks; @@ -189,8 +191,8 @@ protected: BOOL mHideCursorPermanent; U32 mFlags; U16 mHighSurrogate; - U32 mMinWindowWidth; - U32 mMinWindowHeight; + S32 mMinWindowWidth; + S32 mMinWindowHeight; // 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/llwindowheadless.h b/indra/llwindow/llwindowheadless.h index ac53e6a86e..01f1d4fcd3 100644 --- a/indra/llwindow/llwindowheadless.h +++ b/indra/llwindow/llwindowheadless.h @@ -46,7 +46,7 @@ public: /*virtual*/ BOOL getSize(LLCoordScreen *size) {return FALSE;}; /*virtual*/ BOOL getSize(LLCoordWindow *size) {return FALSE;}; /*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;}; - /*virtual*/ BOOL setSize(LLCoordScreen size) {return FALSE;}; + /*virtual*/ BOOL setSizeImpl(LLCoordScreen size) {return FALSE;}; /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) {return FALSE;}; /*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;}; /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;}; diff --git a/indra/llwindow/llwindowmacosx.cpp b/indra/llwindow/llwindowmacosx.cpp index c48c3564b2..505e20278d 100644 --- a/indra/llwindow/llwindowmacosx.cpp +++ b/indra/llwindow/llwindowmacosx.cpp @@ -1254,7 +1254,7 @@ BOOL LLWindowMacOSX::setPosition(const LLCoordScreen position) return TRUE; } -BOOL LLWindowMacOSX::setSize(const LLCoordScreen size) +BOOL LLWindowMacOSX::setSizeImpl(const LLCoordScreen size) { if(mWindow) { diff --git a/indra/llwindow/llwindowmacosx.h b/indra/llwindow/llwindowmacosx.h index 6c9e075a21..b3010cee24 100644 --- a/indra/llwindow/llwindowmacosx.h +++ b/indra/llwindow/llwindowmacosx.h @@ -58,7 +58,7 @@ public: /*virtual*/ BOOL getSize(LLCoordScreen *size); /*virtual*/ BOOL getSize(LLCoordWindow *size); /*virtual*/ BOOL setPosition(LLCoordScreen position); - /*virtual*/ BOOL setSize(LLCoordScreen size); + /*virtual*/ BOOL setSizeImpl(LLCoordScreen size); /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL); /*virtual*/ BOOL setCursorPosition(LLCoordWindow position); /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position); diff --git a/indra/llwindow/llwindowmesaheadless.h b/indra/llwindow/llwindowmesaheadless.h index fd4bd635e2..45f96d2a0c 100644 --- a/indra/llwindow/llwindowmesaheadless.h +++ b/indra/llwindow/llwindowmesaheadless.h @@ -50,7 +50,7 @@ public: /*virtual*/ BOOL getSize(LLCoordScreen *size) {return FALSE;}; /*virtual*/ BOOL getSize(LLCoordWindow *size) {return FALSE;}; /*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;}; - /*virtual*/ BOOL setSize(LLCoordScreen size) {return FALSE;}; + /*virtual*/ BOOL setSizeImpl(LLCoordScreen size) {return FALSE;}; /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) {return FALSE;}; /*virtual*/ BOOL setCursorPosition(LLCoordWindow position) {return FALSE;}; /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position) {return FALSE;}; diff --git a/indra/llwindow/llwindowsdl.cpp b/indra/llwindow/llwindowsdl.cpp index da2222ad51..c75b6c2dce 100644 --- a/indra/llwindow/llwindowsdl.cpp +++ b/indra/llwindow/llwindowsdl.cpp @@ -966,7 +966,7 @@ BOOL LLWindowSDL::setPosition(const LLCoordScreen position) return TRUE; } -BOOL LLWindowSDL::setSize(const LLCoordScreen size) +BOOL LLWindowSDL::setSizeImpl(const LLCoordScreen size) { if(mWindow) { diff --git a/indra/llwindow/llwindowsdl.h b/indra/llwindow/llwindowsdl.h index fa544b16ce..03dbfc22e0 100644 --- a/indra/llwindow/llwindowsdl.h +++ b/indra/llwindow/llwindowsdl.h @@ -63,7 +63,7 @@ public: /*virtual*/ BOOL getSize(LLCoordScreen *size); /*virtual*/ BOOL getSize(LLCoordWindow *size); /*virtual*/ BOOL setPosition(LLCoordScreen position); - /*virtual*/ BOOL setSize(LLCoordScreen size); + /*virtual*/ BOOL setSizeImpl(LLCoordScreen size); /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL); /*virtual*/ BOOL setCursorPosition(LLCoordWindow position); /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position); diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index 06360d261f..34b1184cee 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -861,7 +861,7 @@ BOOL LLWindowWin32::setPosition(const LLCoordScreen position) return TRUE; } -BOOL LLWindowWin32::setSize(const LLCoordScreen size) +BOOL LLWindowWin32::setSizeImpl(const LLCoordScreen size) { LLCoordScreen position; diff --git a/indra/llwindow/llwindowwin32.h b/indra/llwindow/llwindowwin32.h index 387e4cbdb6..fa4a0ec1d3 100644 --- a/indra/llwindow/llwindowwin32.h +++ b/indra/llwindow/llwindowwin32.h @@ -57,7 +57,7 @@ public: /*virtual*/ BOOL getSize(LLCoordScreen *size); /*virtual*/ BOOL getSize(LLCoordWindow *size); /*virtual*/ BOOL setPosition(LLCoordScreen position); - /*virtual*/ BOOL setSize(LLCoordScreen size); + /*virtual*/ BOOL setSizeImpl(LLCoordScreen size); /*virtual*/ BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL); /*virtual*/ BOOL setCursorPosition(LLCoordWindow position); /*virtual*/ BOOL getCursorPosition(LLCoordWindow *position); diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 9b8f5c5961..106b272767 100755 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -2861,22 +2861,20 @@ bool LLAppViewer::initWindow() // always start windowed BOOL ignorePixelDepth = gSavedSettings.getBOOL("IgnorePixelDepth"); - // clamp to minimum window size - U32 min_window_width=gSavedSettings.getU32("MinWindowWidth"); - U32 window_width=gSavedSettings.getU32("WindowWidth"); - if ( window_width < min_window_width ) - window_width=min_window_width; - - U32 min_window_height=gSavedSettings.getU32("MinWindowHeight"); - U32 window_height=gSavedSettings.getU32("WindowHeight"); - if ( window_height < min_window_height ) - window_height=min_window_height; - - gViewerWindow = new LLViewerWindow(gWindowTitle, - VIEWER_WINDOW_CLASSNAME, - gSavedSettings.getS32("WindowX"), gSavedSettings.getS32("WindowY"), - window_width, window_height, - gSavedSettings.getBOOL("WindowFullScreen"), ignorePixelDepth); + LLViewerWindow::Params window_params; + window_params + .title(gWindowTitle) + .name(VIEWER_WINDOW_CLASSNAME) + .x(gSavedSettings.getS32("WindowX")) + .y(gSavedSettings.getS32("WindowY")) + .width(gSavedSettings.getU32("WindowWidth")) + .height(gSavedSettings.getU32("WindowHeight")) + .min_width(gSavedSettings.getU32("MinWindowWidth")) + .min_height(gSavedSettings.getU32("MinWindowHeight")) + .fullscreen(gSavedSettings.getBOOL("WindowFullScreen")) + .ignore_pixel_depth(ignorePixelDepth); + + gViewerWindow = new LLViewerWindow(window_params); LL_INFOS("AppInit") << "gViewerwindow created." << LL_ENDL; diff --git a/indra/newview/llfloaterwindowsize.cpp b/indra/newview/llfloaterwindowsize.cpp index a70f2af11a..ec161018b8 100644 --- a/indra/newview/llfloaterwindowsize.cpp +++ b/indra/newview/llfloaterwindowsize.cpp @@ -58,33 +58,12 @@ bool extractWindowSizeFromString(const std::string& instr, U32 *width, U32 *heig } -///---------------------------------------------------------------------------- -/// Class LLFloaterWindowSize -///---------------------------------------------------------------------------- -class LLFloaterWindowSize -: public LLFloater -{ - friend class LLFloaterReg; -private: - LLFloaterWindowSize(const LLSD& key); - virtual ~LLFloaterWindowSize(); - -public: - /*virtual*/ BOOL postBuild(); - void initWindowSizeControls(); - void onClickSet(); - void onClickCancel(); -}; - - LLFloaterWindowSize::LLFloaterWindowSize(const LLSD& key) : LLFloater(key) -{ -} +{} LLFloaterWindowSize::~LLFloaterWindowSize() -{ -} +{} BOOL LLFloaterWindowSize::postBuild() { @@ -145,13 +124,3 @@ void LLFloaterWindowSize::onClickCancel() { closeFloater(); } - -///---------------------------------------------------------------------------- -/// LLFloaterWindowSizeUtil -///---------------------------------------------------------------------------- -void LLFloaterWindowSizeUtil::registerFloater() -{ - LLFloaterReg::add("window_size", "floater_window_size.xml", - &LLFloaterReg::build<LLFloaterWindowSize>); - -} diff --git a/indra/newview/llfloaterwindowsize.h b/indra/newview/llfloaterwindowsize.h index 40f1a25bb3..a71e5e273c 100644 --- a/indra/newview/llfloaterwindowsize.h +++ b/indra/newview/llfloaterwindowsize.h @@ -26,10 +26,24 @@ #ifndef LLFLOATERWINDOWSIZE_H #define LLFLOATERWINDOWSIZE_H -// Allow user to set the window size for filming tutorials, machinima, etc -namespace LLFloaterWindowSizeUtil +#include "llfloater.h" + +///---------------------------------------------------------------------------- +/// Class LLFloaterWindowSize +///---------------------------------------------------------------------------- +class LLFloaterWindowSize + : public LLFloater { - void registerFloater(); -} + friend class LLFloaterReg; +private: + LLFloaterWindowSize(const LLSD& key); + virtual ~LLFloaterWindowSize(); + +public: + /*virtual*/ BOOL postBuild(); + void initWindowSizeControls(); + void onClickSet(); + void onClickCancel(); +}; #endif diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 0ec8cc1d4e..acbc5f8fb6 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -302,7 +302,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("web_content", "floater_web_content.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create); LLFloaterReg::add("whitelist_entry", "floater_whitelist_entry.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWhiteListEntry>); - LLFloaterWindowSizeUtil::registerFloater(); + LLFloaterReg::add("window_size", "floater_window_size.xml", &LLFloaterReg::build<LLFloaterWindowSize>); LLFloaterReg::add("world_map", "floater_world_map.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterWorldMap>); // *NOTE: Please keep these alphabetized for easier merges diff --git a/indra/newview/llviewerprecompiledheaders.h b/indra/newview/llviewerprecompiledheaders.h index 12f6a0dd1c..f738b84bb9 100644 --- a/indra/newview/llviewerprecompiledheaders.h +++ b/indra/newview/llviewerprecompiledheaders.h @@ -124,4 +124,7 @@ // Library includes from llmessage project #include "llcachename.h" +// Library includes from llxuixml +#include "llinitparam.h" + #endif diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 140cbb4e04..f24bab29a6 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -838,6 +838,20 @@ void LLViewerWindow::updateDebugText() // LLViewerWindow // +LLViewerWindow::Params::Params() +: title("title"), + name("name"), + x("x"), + y("y"), + width("width"), + height("height"), + min_width("min_width"), + min_height("min_height"), + fullscreen("fullscreen", false), + ignore_pixel_depth("ignore_pixel_depth", false) +{} + + BOOL LLViewerWindow::handleAnyMouseClick(LLWindow *window, LLCoordGL pos, MASK mask, LLMouseHandler::EClickType clicktype, BOOL down) { const char* buttonname = ""; @@ -1531,18 +1545,13 @@ std::string LLViewerWindow::translateString(const char* tag, // // Classes // -LLViewerWindow::LLViewerWindow( - const std::string& title, const std::string& name, - S32 x, S32 y, - S32 width, S32 height, - BOOL fullscreen, BOOL ignore_pixel_depth) // fullscreen is no longer used - : - mWindow(NULL), +LLViewerWindow::LLViewerWindow(const Params& p) +: mWindow(NULL), mActive(true), mUIVisible(true), - mWindowRectRaw(0, height, width, 0), - mWindowRectScaled(0, height, width, 0), - mWorldViewRectRaw(0, height, width, 0), + mWindowRectRaw(0, p.height, p.width, 0), + mWindowRectScaled(0, p.height, p.width, 0), + mWorldViewRectRaw(0, p.height, p.width, 0), mLeftMouseDown(FALSE), mMiddleMouseDown(FALSE), mRightMouseDown(FALSE), @@ -1578,12 +1587,12 @@ LLViewerWindow::LLViewerWindow( // create window mWindow = LLWindowManager::createWindow(this, - title, name, x, y, width, height, 0, - fullscreen, + p.title, p.name, p.x, p.y, p.width, p.height, 0, + p.fullscreen, gHeadlessClient, gSavedSettings.getBOOL("DisableVerticalSync"), !gHeadlessClient, - ignore_pixel_depth, + p.ignore_pixel_depth, gSavedSettings.getBOOL("RenderDeferred") ? 0 : gSavedSettings.getU32("RenderFSAASamples")); //don't use window level anti-aliasing if FBOs are enabled if (NULL == mWindow) @@ -1610,10 +1619,11 @@ LLViewerWindow::LLViewerWindow( LL_WARNS("Window") << " Someone took over my signal/exception handler (post createWindow)!" << LL_ENDL; } + mWindow->setMinSize(p.min_width, p.min_height); LLCoordScreen scr; mWindow->getSize(&scr); - if(fullscreen && ( scr.mX!=width || scr.mY!=height)) + if(p.fullscreen && ( scr.mX!=p.width || scr.mY!=p.height)) { llwarns << "Fullscreen has forced us in to a different resolution now using "<<scr.mX<<" x "<<scr.mY<<llendl; gSavedSettings.setS32("FullScreenWidth",scr.mX); @@ -2157,21 +2167,11 @@ void LLViewerWindow::reshape(S32 width, S32 height) BOOL maximized = mWindow->getMaximized(); gSavedSettings.setBOOL("WindowMaximized", maximized); - LLCoordScreen window_size; - if (!maximized - && mWindow->getSize(&window_size)) + if (!maximized) { U32 min_window_width=gSavedSettings.getU32("MinWindowWidth"); - if ( window_size.mX < min_window_width ) - window_size.mX=min_window_width; - gSavedSettings.setU32("WindowWidth", window_size.mX); - U32 min_window_height=gSavedSettings.getU32("MinWindowHeight"); - if ( window_size.mY < min_window_height ) - window_size.mY=min_window_height; - gSavedSettings.setU32("WindowHeight", window_size.mY); - - // tell the OS specific window code about min windoow size + // tell the OS specific window code about min window size mWindow->setMinSize(min_window_width, min_window_height); } @@ -4099,25 +4099,21 @@ void LLViewerWindow::resetSnapshotLoc() sSnapshotDir.clear(); } -static S32 BORDERHEIGHT = 0; -static S32 BORDERWIDTH = 0; - // static void LLViewerWindow::movieSize(S32 new_width, S32 new_height) { - LLCoordScreen size; + LLCoordWindow size; gViewerWindow->getWindow()->getSize(&size); - if ( (size.mX != new_width + BORDERWIDTH) - ||(size.mY != new_height + BORDERHEIGHT)) + if ( size.mX != new_width + || size.mY != new_height) { // use actual display dimensions, not virtual UI dimensions S32 x = gViewerWindow->getWindowWidthRaw(); S32 y = gViewerWindow->getWindowHeightRaw(); - BORDERWIDTH = size.mX - x; - BORDERHEIGHT = size.mY- y; - LLCoordScreen new_size(new_width + BORDERWIDTH, - new_height + BORDERHEIGHT); - gViewerWindow->getWindow()->setSize(new_size); + LLCoordWindow new_size(new_width, new_height); + LLCoordScreen screen_size; + gViewerWindow->getWindow()->convertCoords(new_size, &screen_size); + gViewerWindow->getWindow()->setSize(screen_size); } } diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 0cb7f82b58..6efcaeaf18 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -44,6 +44,7 @@ #include "llstat.h" #include "llmousehandler.h" #include "llhandle.h" +#include "llinitparam.h" #include <boost/function.hpp> #include <boost/signals2.hpp> @@ -133,7 +134,23 @@ public: // // CREATORS // - LLViewerWindow(const std::string& title, const std::string& name, S32 x, S32 y, S32 width, S32 height, BOOL fullscreen, BOOL ignore_pixel_depth); + struct Params : public LLInitParam::Block<Params> + { + Mandatory<std::string> title, + name; + Mandatory<S32> x, + y, + width, + height, + min_width, + min_height; + Optional<bool> fullscreen, + ignore_pixel_depth; + + Params(); + }; + + LLViewerWindow(const Params& p); virtual ~LLViewerWindow(); void shutdownViews(); |