diff options
author | Anton Tarasov <anton.tarasov@jetbrains.com> | 2019-03-22 19:05:27 +0300 |
---|---|---|
committer | Anton Tarasov <anton.tarasov@jetbrains.com> | 2019-03-22 19:05:27 +0300 |
commit | a4930bb1ae4c95d752a4ba729eda06871e573c09 (patch) | |
tree | 6488a4cc68a67a244a08d2e75093a12f688ee583 | |
parent | a1ef722a7241c97c8cdf5a86cbc5ca8af4b618d2 (diff) | |
download | jdk8u_jdk-jb8u202-b1535.tar.gz |
[followup] JBR-1293 do not modify client bounds when custom-decorated frame is set undecoratedjb8u202-b1535
Do not count insets in "undecorated" mode (in hit-test as well).
-rw-r--r-- | src/windows/native/sun/windows/awt_Frame.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/windows/native/sun/windows/awt_Frame.cpp b/src/windows/native/sun/windows/awt_Frame.cpp index 21dda32c17..8553cdf6ad 100644 --- a/src/windows/native/sun/windows/awt_Frame.cpp +++ b/src/windows/native/sun/windows/awt_Frame.cpp @@ -1711,9 +1711,13 @@ BOOL AwtFrame::HasCustomDecoration() 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); @@ -1728,7 +1732,7 @@ LRESULT HitTestNCA(AwtFrame* frame, int x, int y) { RECT rcWindow; RECT insets; - GetSysInsets(&insets); + GetSysInsets(&insets, frame); GetWindowRect(frame->GetHWnd(), &rcWindow); // Get the frame rectangle, adjusted for the style without a caption. @@ -1782,24 +1786,22 @@ MsgRouting AwtFrame::WmNcCalcSize(BOOL wParam, LPNCCALCSIZE_PARAMS lpncsp, LRESU 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; } |