summaryrefslogtreecommitdiff
path: root/indra/llwindow/llwindowwin32.cpp
diff options
context:
space:
mode:
authorRunitai Linden <davep@lindenlab.com>2021-12-09 16:44:44 -0600
committerRunitai Linden <davep@lindenlab.com>2021-12-09 16:44:44 -0600
commit7683477547131c8cb371e1357b3d25ca07b2feb4 (patch)
treeff1a39c889c7cd307016d4e4d8eecf99142e70fe /indra/llwindow/llwindowwin32.cpp
parentf475644bb1b49f0706bb34c59f4931f83bc11e81 (diff)
SL-16480 Followup -- fix for unintialized mRect/mClientRect and bad getClientRectInScreenSpace
Diffstat (limited to 'indra/llwindow/llwindowwin32.cpp')
-rw-r--r--indra/llwindow/llwindowwin32.cpp37
1 files changed, 28 insertions, 9 deletions
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 4deebea7e8..86eca6872e 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -1654,7 +1654,8 @@ void LLWindowWin32::recreateWindow(RECT window_rect, DWORD dw_ex_style, DWORD dw
std::promise<std::pair<HWND, HDC>> promise;
// What follows must be done on the window thread.
auto window_work =
- [self=mWindowThread,
+ [this,
+ self=mWindowThread,
oldHandle,
// bind CreateWindowEx() parameters by value instead of
// back-referencing LLWindowWin32 members
@@ -1704,7 +1705,9 @@ void LLWindowWin32::recreateWindow(RECT window_rect, DWORD dw_ex_style, DWORD dw
self->mWindowHandle = handle;
self->mhDC = GetDC(handle);
}
-
+
+ updateWindowRect();
+
// It's important to wake up the future either way.
promise.set_value(std::make_pair(self->mWindowHandle, self->mhDC));
LL_DEBUGS("Window") << "recreateWindow(): window_work done" << LL_ENDL;
@@ -3280,15 +3283,31 @@ void LLWindowWin32::setMouseClipping( BOOL b )
BOOL LLWindowWin32::getClientRectInScreenSpace( RECT* rectp )
{
- S32 offsetx = mRect.left - mClientRect.left;
- S32 offsety = mRect.top - mClientRect.top;
+ BOOL success = FALSE;
- rectp->left += offsetx;
- rectp->right += offsetx;
- rectp->bottom += offsety;
- rectp->bottom += offsety;
+ RECT client_rect;
+ if (mWindowHandle && GetClientRect(mWindowHandle, &client_rect))
+ {
+ POINT top_left;
+ top_left.x = client_rect.left;
+ top_left.y = client_rect.top;
+ ClientToScreen(mWindowHandle, &top_left);
+
+ POINT bottom_right;
+ bottom_right.x = client_rect.right;
+ bottom_right.y = client_rect.bottom;
+ ClientToScreen(mWindowHandle, &bottom_right);
+
+ SetRect(rectp,
+ top_left.x,
+ top_left.y,
+ bottom_right.x,
+ bottom_right.y);
+
+ success = TRUE;
+ }
- return TRUE;
+ return success;
}
void LLWindowWin32::flashIcon(F32 seconds)