summaryrefslogtreecommitdiff
path: root/indra/llwindow/llwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llwindow/llwindow.cpp')
-rw-r--r--indra/llwindow/llwindow.cpp96
1 files changed, 87 insertions, 9 deletions
diff --git a/indra/llwindow/llwindow.cpp b/indra/llwindow/llwindow.cpp
index 71a5df910d..5b7424acbb 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>
//
@@ -110,25 +108,21 @@ LLWindow::LLWindow(LLWindowCallbacks* callbacks, BOOL fullscreen, U32 flags)
mSupportedResolutions(NULL),
mNumSupportedResolutions(0),
mCurrentCursor(UI_CURSOR_ARROW),
+ mNextCursor(UI_CURSOR_ARROW),
mCursorHidden(FALSE),
mBusyCount(0),
mIsMouseClipping(FALSE),
+ mMinWindowWidth(0),
+ mMinWindowHeight(0),
mSwapMethod(SWAP_METHOD_UNDEFINED),
mHideCursorPermanent(FALSE),
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
@@ -188,6 +182,51 @@ void *LLWindow::getMediaWindow()
return getPlatformWindow();
}
+BOOL LLWindow::setSize(LLCoordScreen size)
+{
+ if (!getMaximized())
+ {
+ size.mX = llmax(size.mX, mMinWindowWidth);
+ size.mY = llmax(size.mY, mMinWindowHeight);
+ }
+ return setSizeImpl(size);
+}
+
+BOOL LLWindow::setSize(LLCoordWindow size)
+{
+ //HACK: we are inconsistently using minimum window dimensions
+ // in this case, we are constraining the inner "client" rect and other times
+ // we constrain the outer "window" rect
+ // There doesn't seem to be a good way to do this consistently without a bunch of platform
+ // specific code
+ if (!getMaximized())
+ {
+ size.mX = llmax(size.mX, mMinWindowWidth);
+ size.mY = llmax(size.mY, mMinWindowHeight);
+ }
+ return setSizeImpl(size);
+}
+
+
+// virtual
+void LLWindow::setMinSize(U32 min_width, U32 min_height, bool enforce_immediately)
+{
+ mMinWindowWidth = min_width;
+ mMinWindowHeight = min_height;
+
+ if (enforce_immediately)
+ {
+ 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
void LLWindow::processMiscNativeEvents()
{
@@ -412,3 +451,42 @@ BOOL LLWindowManager::isWindowValid(LLWindow *window)
{
return sWindowList.find(window) != sWindowList.end();
}
+
+//coordinate conversion utility funcs that forward to llwindow
+LLCoordCommon LL_COORD_TYPE_WINDOW::convertToCommon() const
+{
+ const LLCoordWindow& self = LLCoordWindow::getTypedCoords(*this);
+
+ LLWindow* windowp = &(*LLWindow::beginInstances());
+ LLCoordGL out;
+ windowp->convertCoords(self, &out);
+ return out.convert();
+}
+
+void LL_COORD_TYPE_WINDOW::convertFromCommon(const LLCoordCommon& from)
+{
+ LLCoordWindow& self = LLCoordWindow::getTypedCoords(*this);
+
+ LLWindow* windowp = &(*LLWindow::beginInstances());
+ LLCoordGL from_gl(from);
+ windowp->convertCoords(from_gl, &self);
+}
+
+LLCoordCommon LL_COORD_TYPE_SCREEN::convertToCommon() const
+{
+ const LLCoordScreen& self = LLCoordScreen::getTypedCoords(*this);
+
+ LLWindow* windowp = &(*LLWindow::beginInstances());
+ LLCoordGL out;
+ windowp->convertCoords(self, &out);
+ return out.convert();
+}
+
+void LL_COORD_TYPE_SCREEN::convertFromCommon(const LLCoordCommon& from)
+{
+ LLCoordScreen& self = LLCoordScreen::getTypedCoords(*this);
+
+ LLWindow* windowp = &(*LLWindow::beginInstances());
+ LLCoordGL from_gl(from);
+ windowp->convertCoords(from_gl, &self);
+}