提交 1f65791c 编写于 作者: A anthony

6805231: Security Warning Icon is missing in Windows 2000 Prof from Jdk build 6u12

Summary: The icon becomes layered only when the fading-out effect is being performed.
Reviewed-by: art, dcherepanov
上级 baba77a8
...@@ -524,7 +524,7 @@ void AwtWindow::CreateWarningWindow(JNIEnv *env) ...@@ -524,7 +524,7 @@ void AwtWindow::CreateWarningWindow(JNIEnv *env)
RegisterWarningWindowClass(); RegisterWarningWindowClass();
warningWindow = ::CreateWindowEx( warningWindow = ::CreateWindowEx(
WS_EX_NOACTIVATE | WS_EX_LAYERED, WS_EX_NOACTIVATE,
GetWarningWindowClassName(), GetWarningWindowClassName(),
warningString, warningString,
WS_POPUP, WS_POPUP,
...@@ -536,7 +536,7 @@ void AwtWindow::CreateWarningWindow(JNIEnv *env) ...@@ -536,7 +536,7 @@ void AwtWindow::CreateWarningWindow(JNIEnv *env)
NULL // lParam NULL // lParam
); );
if (warningWindow == NULL) { if (warningWindow == NULL) {
//XXX: actually this is bad... We didn't manage to create the widow. //XXX: actually this is bad... We didn't manage to create the window.
return; return;
} }
...@@ -836,6 +836,19 @@ void AwtWindow::RepaintWarningWindow() ...@@ -836,6 +836,19 @@ void AwtWindow::RepaintWarningWindow()
::ReleaseDC(warningWindow, hdc); ::ReleaseDC(warningWindow, hdc);
} }
void AwtWindow::SetLayered(HWND window, bool layered)
{
const LONG ex_style = ::GetWindowLong(window, GWL_EXSTYLE);
::SetWindowLong(window, GWL_EXSTYLE, layered ?
ex_style | WS_EX_LAYERED : ex_style & ~WS_EX_LAYERED);
}
bool AwtWindow::IsLayered(HWND window)
{
const LONG ex_style = ::GetWindowLong(window, GWL_EXSTYLE);
return ex_style & WS_EX_LAYERED;
}
void AwtWindow::StartSecurityAnimation(AnimationKind kind) void AwtWindow::StartSecurityAnimation(AnimationKind kind)
{ {
if (!IsUntrusted()) { if (!IsUntrusted()) {
...@@ -858,8 +871,14 @@ void AwtWindow::StartSecurityAnimation(AnimationKind kind) ...@@ -858,8 +871,14 @@ void AwtWindow::StartSecurityAnimation(AnimationKind kind)
::SetLayeredWindowAttributes(warningWindow, RGB(0, 0, 0), ::SetLayeredWindowAttributes(warningWindow, RGB(0, 0, 0),
0xFF, LWA_ALPHA); 0xFF, LWA_ALPHA);
AwtWindow::SetLayered(warningWindow, false);
::RedrawWindow(warningWindow, NULL, NULL, ::RedrawWindow(warningWindow, NULL, NULL,
RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN); RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN);
} else if (securityAnimationKind == akPreHide) {
// Pre-hiding means fading-out. We have to make the window layered.
// Note: Some VNC clients do not support layered windows, hence
// we dynamically turn it on and off. See 6805231.
AwtWindow::SetLayered(warningWindow, true);
} }
} }
...@@ -2528,8 +2547,6 @@ void AwtWindow::SetTranslucency(BYTE opacity, BOOL opaque) ...@@ -2528,8 +2547,6 @@ void AwtWindow::SetTranslucency(BYTE opacity, BOOL opaque)
HWND hwnd = GetHWnd(); HWND hwnd = GetHWnd();
LONG ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE);
if (opaque != old_opaque) { if (opaque != old_opaque) {
::EnterCriticalSection(&contentBitmapCS); ::EnterCriticalSection(&contentBitmapCS);
if (hContentBitmap != NULL) { if (hContentBitmap != NULL) {
...@@ -2541,21 +2558,22 @@ void AwtWindow::SetTranslucency(BYTE opacity, BOOL opaque) ...@@ -2541,21 +2558,22 @@ void AwtWindow::SetTranslucency(BYTE opacity, BOOL opaque)
if (opaque && opacity == 0xff) { if (opaque && opacity == 0xff) {
// Turn off all the effects // Turn off all the effects
::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style & ~WS_EX_LAYERED); AwtWindow::SetLayered(hwnd, false);
// Ask the window to repaint itself and all the children // Ask the window to repaint itself and all the children
RedrawWindow(); RedrawWindow();
} else { } else {
// We're going to enable some effects // We're going to enable some effects
if (!(ex_style & WS_EX_LAYERED)) { if (!AwtWindow::IsLayered(hwnd)) {
::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style | WS_EX_LAYERED); AwtWindow::SetLayered(hwnd, true);
} else { } else {
if ((opaque && opacity < 0xff) ^ (old_opaque && old_opacity < 0xff)) { if ((opaque && opacity < 0xff) ^ (old_opaque && old_opacity < 0xff)) {
// _One_ of the modes uses the SetLayeredWindowAttributes. // _One_ of the modes uses the SetLayeredWindowAttributes.
// Need to reset the style in this case. // Need to reset the style in this case.
// If both modes are simple (i.e. just changing the opacity level), // If both modes are simple (i.e. just changing the opacity level),
// no need to reset the style. // no need to reset the style.
::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style & ~WS_EX_LAYERED); AwtWindow::SetLayered(hwnd, false);
::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style | WS_EX_LAYERED); AwtWindow::SetLayered(hwnd, true);
} }
} }
......
...@@ -332,6 +332,9 @@ private: ...@@ -332,6 +332,9 @@ private:
void RepositionSecurityWarning(JNIEnv *env); void RepositionSecurityWarning(JNIEnv *env);
static void SetLayered(HWND window, bool layered);
static bool IsLayered(HWND window);
public: public:
void UpdateSecurityWarningVisibility(); void UpdateSecurityWarningVisibility();
static bool IsWarningWindow(HWND hWnd); static bool IsWarningWindow(HWND hWnd);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册