EXP-1832 FIX Viewer Size not persistent across logins
made Set Window Size correctly set interior window rect, preserving measured dimensionsmaster
parent
3053712f44
commit
9da67fff0a
|
|
@ -192,6 +192,21 @@ BOOL LLWindow::setSize(LLCoordScreen size)
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ public:
|
|||
virtual BOOL getSize(LLCoordWindow *size) = 0;
|
||||
virtual BOOL setPosition(LLCoordScreen position) = 0;
|
||||
BOOL setSize(LLCoordScreen size);
|
||||
BOOL setSize(LLCoordWindow size);
|
||||
virtual void setMinSize(U32 min_width, U32 min_height, bool enforce_immediately = true);
|
||||
virtual BOOL switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp = NULL) = 0;
|
||||
virtual BOOL setCursorPosition(LLCoordWindow position) = 0;
|
||||
|
|
@ -172,6 +173,7 @@ protected:
|
|||
virtual BOOL canDelete();
|
||||
|
||||
virtual BOOL setSizeImpl(LLCoordScreen size) = 0;
|
||||
virtual BOOL setSizeImpl(LLCoordWindow size) = 0;
|
||||
|
||||
protected:
|
||||
LLWindowCallbacks* mCallbacks;
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ public:
|
|||
/*virtual*/ BOOL getSize(LLCoordWindow *size) {return FALSE;};
|
||||
/*virtual*/ BOOL setPosition(LLCoordScreen position) {return FALSE;};
|
||||
/*virtual*/ BOOL setSizeImpl(LLCoordScreen size) {return FALSE;};
|
||||
/*virtual*/ BOOL setSizeImpl(LLCoordWindow 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;};
|
||||
|
|
|
|||
|
|
@ -1266,6 +1266,19 @@ BOOL LLWindowMacOSX::setSizeImpl(const LLCoordScreen size)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL LLWindowMacOSX::setSizeImpl(const LLCoordWindow size)
|
||||
{
|
||||
Rect client_rect;
|
||||
if (mWindow && GetWindowBounds(mWindow, kWindowContentRgn, &client_rect) != noErr)
|
||||
{
|
||||
client_rect.right = client_rect.left + size.mX;
|
||||
client_rect.bottom = client_rect.top + size.mY;
|
||||
OSStatus err = SetWindowBounds(mWindow, kWindowContentRgn, &client_rect);
|
||||
return err == noErr;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void LLWindowMacOSX::swapBuffers()
|
||||
{
|
||||
aglSwapBuffers(mContext);
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ public:
|
|||
/*virtual*/ BOOL getSize(LLCoordWindow *size);
|
||||
/*virtual*/ BOOL setPosition(LLCoordScreen position);
|
||||
/*virtual*/ BOOL setSizeImpl(LLCoordScreen size);
|
||||
/*virtual*/ BOOL setSizeImpl(LLCoordWindow 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);
|
||||
|
|
|
|||
|
|
@ -981,6 +981,25 @@ BOOL LLWindowSDL::setSizeImpl(const LLCoordScreen size)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL LLWindowSDL::setSizeImpl(const LLCoordWindow size)
|
||||
{
|
||||
if(mWindow)
|
||||
{
|
||||
// Push a resize event onto SDL's queue - we'll handle it
|
||||
// when it comes out again.
|
||||
SDL_Event event;
|
||||
event.type = SDL_VIDEORESIZE;
|
||||
event.resize.w = size.mX;
|
||||
event.resize.h = size.mY;
|
||||
SDL_PushEvent(&event); // copied into queue
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
void LLWindowSDL::swapBuffers()
|
||||
{
|
||||
if (mWindow)
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ public:
|
|||
/*virtual*/ BOOL getSize(LLCoordWindow *size);
|
||||
/*virtual*/ BOOL setPosition(LLCoordScreen position);
|
||||
/*virtual*/ BOOL setSizeImpl(LLCoordScreen size);
|
||||
/*virtual*/ BOOL setSizeImpl(LLCoordWindow 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);
|
||||
|
|
|
|||
|
|
@ -876,6 +876,17 @@ BOOL LLWindowWin32::setSizeImpl(const LLCoordScreen size)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL LLWindowWin32::setSizeImpl(const LLCoordWindow size)
|
||||
{
|
||||
RECT window_rect = {0, 0, size.mX, size.mY };
|
||||
DWORD dw_ex_style = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
|
||||
DWORD dw_style = WS_OVERLAPPEDWINDOW;
|
||||
|
||||
AdjustWindowRectEx(&window_rect, dw_style, FALSE, dw_ex_style);
|
||||
|
||||
return setSizeImpl(LLCoordScreen(window_rect.right - window_rect.left, window_rect.bottom - window_rect.top));
|
||||
}
|
||||
|
||||
// changing fullscreen resolution
|
||||
BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BOOL disable_vsync, const LLCoordScreen * const posp)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@ public:
|
|||
/*virtual*/ BOOL getSize(LLCoordWindow *size);
|
||||
/*virtual*/ BOOL setPosition(LLCoordScreen position);
|
||||
/*virtual*/ BOOL setSizeImpl(LLCoordScreen size);
|
||||
/*virtual*/ BOOL setSizeImpl(LLCoordWindow 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);
|
||||
|
|
|
|||
|
|
@ -4102,7 +4102,7 @@ void LLViewerWindow::movieSize(S32 new_width, S32 new_height)
|
|||
gViewerWindow->getWindow()->getSize(&size);
|
||||
if ( size != new_size )
|
||||
{
|
||||
gViewerWindow->getWindow()->setSize(new_size.convert());
|
||||
gViewerWindow->getWindow()->setSize(new_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue