diff --git a/src/windows/native/sun/windows/awt_Component.cpp b/src/windows/native/sun/windows/awt_Component.cpp index 9db8ec4b873dc7cd202e334561c00ae214e0f169..fb7ae4c40e21aff7240d37dfee643b2b8d4f83f2 100644 --- a/src/windows/native/sun/windows/awt_Component.cpp +++ b/src/windows/native/sun/windows/awt_Component.cpp @@ -1843,8 +1843,13 @@ LRESULT AwtComponent::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) case WM_AWT_SETALWAYSONTOP: { AwtWindow* w = (AwtWindow*)lParam; BOOL value = (BOOL)wParam; + UINT flags = SWP_NOMOVE | SWP_NOSIZE; + // transient windows shouldn't change the owner window's position in the z-order + if (w->IsRetainingHierarchyZOrder()) { + flags |= SWP_NOOWNERZORDER; + } ::SetWindowPos(w->GetHWnd(), (value != 0 ? HWND_TOPMOST : HWND_NOTOPMOST), - 0,0,0,0, SWP_NOMOVE|SWP_NOSIZE); + 0,0,0,0, flags); break; } diff --git a/src/windows/native/sun/windows/awt_Window.cpp b/src/windows/native/sun/windows/awt_Window.cpp index ad0400bc08b68a004e99bc237433f72ce7bb6bb5..3b0b1d3c2603b851662eb6f7174615328f097c9d 100644 --- a/src/windows/native/sun/windows/awt_Window.cpp +++ b/src/windows/native/sun/windows/awt_Window.cpp @@ -165,7 +165,6 @@ jmethodID AwtWindow::calculateSecurityWarningPositionMID; int AwtWindow::ms_instanceCounter = 0; HHOOK AwtWindow::ms_hCBTFilter; AwtWindow * AwtWindow::m_grabbedWindow = NULL; -HWND AwtWindow::sm_retainingHierarchyZOrderInShow = NULL; BOOL AwtWindow::sm_resizing = FALSE; UINT AwtWindow::untrustedWindowsCounter = 0; @@ -341,23 +340,6 @@ MsgRouting AwtWindow::WmNcMouseDown(WPARAM hitTest, int x, int y, int button) { } MsgRouting AwtWindow::WmWindowPosChanging(LPARAM windowPos) { - /* - * See 6178004. - * Some windows shouldn't trigger a change in z-order of - * any window from the hierarchy. - */ - if (IsRetainingHierarchyZOrder()) { - if (((WINDOWPOS *)windowPos)->flags & SWP_SHOWWINDOW) { - sm_retainingHierarchyZOrderInShow = GetHWnd(); - } - } else if (sm_retainingHierarchyZOrderInShow != NULL) { - HWND ancestor = ::GetAncestor(sm_retainingHierarchyZOrderInShow, GA_ROOTOWNER); - HWND windowAncestor = ::GetAncestor(GetHWnd(), GA_ROOTOWNER); - - if (windowAncestor == ancestor) { - ((WINDOWPOS *)windowPos)->flags |= SWP_NOZORDER; - } - } return mrDoDefault; } @@ -377,12 +359,6 @@ void AwtWindow::RepositionSecurityWarning(JNIEnv *env) MsgRouting AwtWindow::WmWindowPosChanged(LPARAM windowPos) { WINDOWPOS * wp = (WINDOWPOS *)windowPos; - if (IsRetainingHierarchyZOrder() && wp->flags & SWP_SHOWWINDOW) { - // By this time all the windows from the hierarchy are already notified about z-order change. - // Thus we may and we should reset the trigger in order not to affect other changes. - sm_retainingHierarchyZOrderInShow = NULL; - } - // Reposition the warning window if (IsUntrusted() && warningWindow != NULL) { if (wp->flags & SWP_HIDEWINDOW) { @@ -1251,7 +1227,16 @@ void AwtWindow::Show() } } if (!done) { - ::ShowWindow(GetHWnd(), nCmdShow); + // transient windows shouldn't change the owner window's position in the z-order + if (IsRetainingHierarchyZOrder()){ + UINT flags = SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW | SWP_NOOWNERZORDER; + if (nCmdShow == SW_SHOWNA) { + flags |= SWP_NOACTIVATE; + } + ::SetWindowPos(GetHWnd(), HWND_TOPMOST, 0, 0, 0, 0, flags); + } else { + ::ShowWindow(GetHWnd(), nCmdShow); + } } env->DeleteLocalRef(target); } diff --git a/src/windows/native/sun/windows/awt_Window.h b/src/windows/native/sun/windows/awt_Window.h index bf43150a7e8d6dd47255325706c38ec124dca9fe..05282f7232090061abe62b464e6ef2718e68f526 100644 --- a/src/windows/native/sun/windows/awt_Window.h +++ b/src/windows/native/sun/windows/awt_Window.h @@ -248,7 +248,6 @@ private: static int ms_instanceCounter; static HHOOK ms_hCBTFilter; static LRESULT CALLBACK CBTFilter(int nCode, WPARAM wParam, LPARAM lParam); - static HWND sm_retainingHierarchyZOrderInShow; // a referred window in the process of show static BOOL sm_resizing; /* in the middle of a resizing operation */ RECT m_insets; /* a cache of the insets being used */