JBR-1313 wrong insets for non-resizable custom-decorated frame
(cherry picked from commit 49ab04bb3085e1c309bbc9910772c6d10268e6d9)
diff --git a/src/windows/native/sun/windows/awt_Frame.cpp b/src/windows/native/sun/windows/awt_Frame.cpp
index de0e8b5..5a03ec1 100644
--- a/src/windows/native/sun/windows/awt_Frame.cpp
+++ b/src/windows/native/sun/windows/awt_Frame.cpp
@@ -1712,19 +1712,13 @@
}
void GetSysInsets(RECT* insets, AwtFrame* pFrame) {
- static RECT* sysInsets = NULL;
-
if (pFrame->IsUndecorated()) {
::SetRect(insets, 0, 0, 0, 0);
return;
}
- if (!sysInsets) {
- sysInsets = new RECT;
- sysInsets->left = sysInsets->right = ::GetSystemMetrics(SM_CXSIZEFRAME);
- sysInsets->top = sysInsets->bottom = ::GetSystemMetrics(SM_CYSIZEFRAME);
- sysInsets->top += ::GetSystemMetrics(SM_CYCAPTION);
- }
- ::CopyRect(insets, sysInsets);
+ insets->left = insets->right = ::GetSystemMetrics(pFrame->IsResizable() ? SM_CXSIZEFRAME : SM_CXFIXEDFRAME);
+ insets->top = insets->bottom = ::GetSystemMetrics(pFrame->IsResizable() ? SM_CYSIZEFRAME : SM_CYFIXEDFRAME);
+ insets->top += ::GetSystemMetrics(SM_CYCAPTION);
}
LRESULT HitTestNCA(AwtFrame* frame, int x, int y) {