JDK-6900622 : Security warning icon is not getting displayed properly for tooltip
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6u18
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows
  • CPU: x86
  • Submitted: 2009-11-12
  • Updated: 2011-01-19
  • Resolved: 2009-12-16
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u19Fixed 7 b78Fixed
Related Reports
Relates :  
Description
Security warning icon is not getting displayed properly for tooltip.
Reproducible on windows XP from 6u18b03 build onwards

To Reproduce the problem:

1. Run Toplevel factory.jar 
2. click Display Security warning
3. Click button Show toplevel
4. Hover the mouse over the window to see the tooltip and then
   move the mouse over the tooltip
5. Observe the Security warning icon is not seen .
The tooltip's icon is seen with some artifacts once the mouse is moved away from the frame

Comments
SUGGESTED FIX --- old/src/windows/native/sun/windows/awt_Window.cpp 2009-12-04 14:33:35.000000000 +0300 +++ new/src/windows/native/sun/windows/awt_Window.cpp 2009-12-04 14:33:35.000000000 +0300 @@ -220,6 +220,7 @@ ::InitializeCriticalSection(&contentBitmapCS); m_windowType = Type::NORMAL; + m_alwaysOnTop = false; } AwtWindow::~AwtWindow() @@ -352,10 +353,10 @@ RECT rect; CalculateWarningWindowBounds(env, &rect); - ::SetWindowPos(warningWindow, HWND_NOTOPMOST, + ::SetWindowPos(warningWindow, IsAlwaysOnTop() ? HWND_TOPMOST : GetHWnd(), rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, - SWP_ASYNCWINDOWPOS | SWP_NOACTIVATE | SWP_NOZORDER | + SWP_ASYNCWINDOWPOS | SWP_NOACTIVATE | SWP_NOOWNERZORDER ); } @@ -831,7 +832,9 @@ securityAnimationTimerElapse, NULL); if (securityAnimationKind == akShow) { - ::SetWindowPos(warningWindow, HWND_NOTOPMOST, 0, 0, 0, 0, + ::SetWindowPos(warningWindow, + IsAlwaysOnTop() ? HWND_TOPMOST : GetHWnd(), + 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOMOVE | SWP_SHOWWINDOW | SWP_NOOWNERZORDER); @@ -2270,6 +2273,7 @@ if (::IsWindow(w->GetHWnd())) { w->SendMessage(WM_AWT_SETALWAYSONTOP, (WPARAM)value, (LPARAM)w); + w->m_alwaysOnTop = (bool)value; } ret: env->DeleteGlobalRef(self); --- old/src/windows/native/sun/windows/awt_Window.h 2009-12-04 14:33:37.000000000 +0300 +++ new/src/windows/native/sun/windows/awt_Window.h 2009-12-04 14:33:36.000000000 +0300 @@ -383,6 +383,10 @@ // Tweak the style according to the type of the window void TweakStyle(DWORD & style, DWORD & exStyle); + // Set in _SetAlwaysOnTop() + bool m_alwaysOnTop; +public: + inline bool IsAlwaysOnTop() { return m_alwaysOnTop; } }; #endif /* AWT_WINDOW_H */
04-12-2009

EVALUATION The SetWindowPos() takes the hWndInsertAfter argument. Currently we pass HWND_NOTOPMOST as the value when showing/positioning the security warning. In case when the security warning is being displayed for a topmost window (like the tooltip in the test), this obviously results in the warning being below the window in the z-order. Instead we must take into account whether the window is curretnly topmost or not (we can cache a boolean flag when a developer invokes setAlwaysOnTop()), and change the argument accordingly: 1. If the window is non-topmost, we can use the current value (HWND_NOTOPMOST), or, what seems a little more correct, pass the hwnd of the window the warning is displayed for. 2. If the window is topmost, we must pass the HWND_TOPMOST value there.
03-12-2009

EVALUATION This is a regression of the fix 6825342 in 6u17. Actually, the security warning gets displayed, however it is positioned below the tooltip window in the z-order. That is probably because with 6825342 we started using the SWP_NOOWNERZORDER flag when calling ::SetWindowPos() for positioning the security warning. That probably causes the function to not rearrange the security warning window and its owner in the z-order, and since the tooltip window is a top-most window, the security warning appears below in the z-order.
19-11-2009