diff options
author | Anton Tarasov <anton.tarasov@jetbrains.com> | 2018-05-11 17:55:29 +0300 |
---|---|---|
committer | Anton Tarasov <anton.tarasov@jetbrains.com> | 2018-05-11 18:00:06 +0300 |
commit | 37263603eaafcf4e1432b1ed1908ef0ac948aa89 (patch) | |
tree | 42d7289a4d13dda0b6328094d729ed3019084ec6 | |
parent | e6c6cdfc41f6087d626285f270f6fd93dad12414 (diff) | |
download | jdk8u_jdk-37263603eaafcf4e1432b1ed1908ef0ac948aa89.tar.gz |
JRE-765 [win] window dragged to another display is not resizedjb8u152-b1248.4jb8u152-b1248.3
(cherry picked from commit 07b27f7)
-rw-r--r-- | src/windows/native/sun/windows/awt_Component.cpp | 7 | ||||
-rw-r--r-- | src/windows/native/sun/windows/awt_Component.h | 4 | ||||
-rw-r--r-- | src/windows/native/sun/windows/awt_Window.cpp | 13 |
3 files changed, 22 insertions, 2 deletions
diff --git a/src/windows/native/sun/windows/awt_Component.cpp b/src/windows/native/sun/windows/awt_Component.cpp index cad362138d..0c0592b06e 100644 --- a/src/windows/native/sun/windows/awt_Component.cpp +++ b/src/windows/native/sun/windows/awt_Component.cpp @@ -1559,6 +1559,12 @@ LRESULT AwtComponent::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) SetCompositionWindow(r); break; } + case WM_ENTERSIZEMOVE: + { + m_inMoveResizeLoop = TRUE; + mr = mrDoDefault; + break; + } case WM_SIZING: mr = WmSizing(); break; @@ -1570,6 +1576,7 @@ LRESULT AwtComponent::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); break; case WM_EXITSIZEMOVE: + m_inMoveResizeLoop = FALSE; mr = WmExitSizeMove(); break; // Bug #4039858 (Selecting menu item causes bogus mouse click event) diff --git a/src/windows/native/sun/windows/awt_Component.h b/src/windows/native/sun/windows/awt_Component.h index 039b3d8d17..e4718523d9 100644 --- a/src/windows/native/sun/windows/awt_Component.h +++ b/src/windows/native/sun/windows/awt_Component.h @@ -744,6 +744,8 @@ protected: static BOOL sm_suppressFocusAndActivation; static BOOL sm_restoreFocusAndActivation; + INLINE BOOL IsInMoveResizeLoop() { return m_inMoveResizeLoop; } + /* * The function sets the focus-restore flag ON/OFF. * When the flag is ON, focus is restored immidiately after the proxy loses it. @@ -836,6 +838,8 @@ private: int m_wheelRotationAmountX; int m_wheelRotationAmountY; + BOOL m_inMoveResizeLoop; + BOOL deadKeyActive; /* diff --git a/src/windows/native/sun/windows/awt_Window.cpp b/src/windows/native/sun/windows/awt_Window.cpp index 49b87d46d0..ffbedb70d7 100644 --- a/src/windows/native/sun/windows/awt_Window.cpp +++ b/src/windows/native/sun/windows/awt_Window.cpp @@ -955,8 +955,17 @@ MsgRouting AwtWindow::WmDPIChanged(UINT xDPI, UINT yDPI, RECT* bounds) { // may diverge with Component::Reshape in this state return mrDoDefault; } - // set the new bounds for async update - ::CopyRect(&m_boundsOnDPIChange, bounds); + if (IsInMoveResizeLoop()) { + // Dragged with mouse to new screen. In this case the new bounds must be set immediately + // or otherwise OS will reset it back to the previous values. + ::SetWindowPos(GetHWnd(), NULL, + bounds->left, bounds->top, + bounds->right - bounds->left, bounds->bottom - bounds->top, + SWP_NOZORDER | SWP_NOACTIVATE); + } else { + // DPI of this screen changed. Store the new bounds for async update. + ::CopyRect(&m_boundsOnDPIChange, bounds); + } return mrConsume; } |