[followup] JBR-1293 do not modify client bounds when custom-decorated frame is set undecorated
Do not count insets in "undecorated" mode (in hit-test as well).
(cherry picked from commit a4930bb1ae4c95d752a4ba729eda06871e573c09)
diff --git a/src/windows/native/sun/windows/awt_Frame.cpp b/src/windows/native/sun/windows/awt_Frame.cpp
index bbc7362..de0e8b5 100644
--- a/src/windows/native/sun/windows/awt_Frame.cpp
+++ b/src/windows/native/sun/windows/awt_Frame.cpp
@@ -1711,9 +1711,13 @@
return *m_pHasCustomDecoration;
}
-void GetSysInsets(RECT* insets) {
+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);
@@ -1727,7 +1731,7 @@
RECT rcWindow;
RECT insets;
- GetSysInsets(&insets);
+ GetSysInsets(&insets, frame);
GetWindowRect(frame->GetHWnd(), &rcWindow);
// Get the frame rectangle, adjusted for the style without a caption.
@@ -1780,24 +1784,22 @@
if (!wParam || !HasCustomDecoration()) {
return AwtWindow::WmNcCalcSize(wParam, lpncsp, retVal);
}
- // When undecorated, the client area should occupy the whole frame
- if (!m_isUndecorated) {
- RECT insets;
- GetSysInsets(&insets);
- RECT* rect = &lpncsp->rgrc[0];
+ RECT insets;
+ GetSysInsets(&insets, this);
+ RECT* rect = &lpncsp->rgrc[0];
- rect->left = rect->left + insets.left;
- if (::IsZoomed(GetHWnd())) {
- lpncsp->rgrc[0].top = lpncsp->rgrc[0].top + insets.bottom;
- }
- else {
- // this makes the native caption go uncovered
- // int yBorder = ::GetSystemMetrics(SM_CYBORDER);
- // lpncsp->rgrc[0].top = lpncsp->rgrc[0].top + yBorder;
- }
- rect->right = rect->right - insets.right;
- rect->bottom = rect->bottom - insets.bottom;
+ rect->left = rect->left + insets.left;
+ if (::IsZoomed(GetHWnd())) {
+ lpncsp->rgrc[0].top = lpncsp->rgrc[0].top + insets.bottom;
}
+ else {
+ // this makes the native caption go uncovered
+ // int yBorder = ::GetSystemMetrics(SM_CYBORDER);
+ // lpncsp->rgrc[0].top = lpncsp->rgrc[0].top + yBorder;
+ }
+ rect->right = rect->right - insets.right;
+ rect->bottom = rect->bottom - insets.bottom;
+
retVal = 0L;
return mrConsume;
}