summaryrefslogtreecommitdiff
path: root/indra/llwindow
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llwindow')
-rw-r--r--indra/llwindow/llwindow.cpp25
-rw-r--r--indra/llwindow/llwindow.h8
-rw-r--r--indra/llwindow/llwindowheadless.h2
-rw-r--r--indra/llwindow/llwindowmacosx.cpp2
-rw-r--r--indra/llwindow/llwindowmacosx.h2
-rw-r--r--indra/llwindow/llwindowmesaheadless.h2
-rw-r--r--indra/llwindow/llwindowsdl.cpp2
-rw-r--r--indra/llwindow/llwindowsdl.h2
-rw-r--r--indra/llwindow/llwindowwin32.cpp2
-rw-r--r--indra/llwindow/llwindowwin32.h2
10 files changed, 36 insertions, 13 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);