提交 be8232b5 编写于 作者: A anthony

6711717: PIT: Security Icon is hidden for FullScreen apps, WinXP

Summary: Force hiding the security warning in FS exclusive mode.
Reviewed-by: art, tdv
上级 5387110e
/* /*
* Copyright 1997-2005 Sun Microsystems, Inc. All Rights Reserved. * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -92,7 +92,15 @@ import java.security.BasicPermission; ...@@ -92,7 +92,15 @@ import java.security.BasicPermission;
* <td>Enter full-screen exclusive mode</td> * <td>Enter full-screen exclusive mode</td>
* <td>Entering full-screen exclusive mode allows direct access to * <td>Entering full-screen exclusive mode allows direct access to
* low-level graphics card memory. This could be used to spoof the * low-level graphics card memory. This could be used to spoof the
* system, since the program is in direct control of rendering.</td> * system, since the program is in direct control of rendering. Depending on
* the implementation, the security warning may not be shown for the windows
* used to enter the full-screen exclusive mode (assuming that the {@code
* fullScreenExclusive} permission has been granted to this application). Note
* that this behavior does not mean that the {@code
* showWindowWithoutWarningBanner} permission will be automatically granted to
* the application which has the {@code fullScreenExclusive} permission:
* non-full-screen windows will continue to be shown with the security
* warning.</td>
* </tr> * </tr>
* *
* <tr> * <tr>
......
...@@ -1510,4 +1510,24 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -1510,4 +1510,24 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
return new XAtomList(); return new XAtomList();
} }
/**
* Indicates if the window is currently in the FSEM.
* Synchronization: state lock.
*/
private boolean fullScreenExclusiveModeState = false;
// Implementation of the X11ComponentPeer
@Override
public void setFullScreenExclusiveModeState(boolean state) {
synchronized (getStateLock()) {
fullScreenExclusiveModeState = state;
}
}
public final boolean isFullScreenExclusiveMode() {
synchronized (getStateLock()) {
return fullScreenExclusiveModeState;
}
}
} }
...@@ -1080,31 +1080,39 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -1080,31 +1080,39 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
updateSecurityWarningVisibility(); updateSecurityWarningVisibility();
} }
@Override
public void setFullScreenExclusiveModeState(boolean state) {
super.setFullScreenExclusiveModeState(state);
updateSecurityWarningVisibility();
}
public void updateSecurityWarningVisibility() { public void updateSecurityWarningVisibility() {
if (warningWindow == null) { if (warningWindow == null) {
return; return;
} }
boolean show = false;
int state = getWMState();
if (!isVisible()) { if (!isVisible()) {
return; // The warning window should already be hidden. return; // The warning window should already be hidden.
} }
// getWMState() always returns 0 (Withdrawn) for simple windows. Hence boolean show = false;
// we ignore the state for such windows.
if (isVisible() && (state == XUtilConstants.NormalState || isSimpleWindow())) {
if (XKeyboardFocusManagerPeer.getCurrentNativeFocusedWindow() ==
getTarget())
{
show = true;
}
if (isMouseAbove() || warningWindow.isMouseAbove()) if (!isFullScreenExclusiveMode()) {
{ int state = getWMState();
show = true;
// getWMState() always returns 0 (Withdrawn) for simple windows. Hence
// we ignore the state for such windows.
if (isVisible() && (state == XUtilConstants.NormalState || isSimpleWindow())) {
if (XKeyboardFocusManagerPeer.getCurrentNativeFocusedWindow() ==
getTarget())
{
show = true;
}
if (isMouseAbove() || warningWindow.isMouseAbove())
{
show = true;
}
} }
} }
......
/* /*
* Copyright 2003-2005 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -39,4 +39,5 @@ public interface X11ComponentPeer { ...@@ -39,4 +39,5 @@ public interface X11ComponentPeer {
Rectangle getBounds(); Rectangle getBounds();
Graphics getGraphics(); Graphics getGraphics();
Object getTarget(); Object getTarget();
void setFullScreenExclusiveModeState(boolean state);
} }
/* /*
* Copyright 1997-2008 Sun Microsystems, Inc. All Rights Reserved. * Copyright 1997-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -306,12 +306,14 @@ public class X11GraphicsDevice ...@@ -306,12 +306,14 @@ public class X11GraphicsDevice
X11ComponentPeer peer = (X11ComponentPeer)w.getPeer(); X11ComponentPeer peer = (X11ComponentPeer)w.getPeer();
if (peer != null) { if (peer != null) {
enterFullScreenExclusive(peer.getContentWindow()); enterFullScreenExclusive(peer.getContentWindow());
peer.setFullScreenExclusiveModeState(true);
} }
} }
private static void exitFullScreenExclusive(Window w) { private static void exitFullScreenExclusive(Window w) {
X11ComponentPeer peer = (X11ComponentPeer)w.getPeer(); X11ComponentPeer peer = (X11ComponentPeer)w.getPeer();
if (peer != null) { if (peer != null) {
peer.setFullScreenExclusiveModeState(false);
exitFullScreenExclusive(peer.getContentWindow()); exitFullScreenExclusive(peer.getContentWindow());
} }
} }
......
...@@ -353,6 +353,7 @@ public class Win32GraphicsDevice extends GraphicsDevice implements ...@@ -353,6 +353,7 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
} }
WWindowPeer peer = (WWindowPeer)old.getPeer(); WWindowPeer peer = (WWindowPeer)old.getPeer();
if (peer != null) { if (peer != null) {
peer.setFullScreenExclusiveModeState(false);
// we used to destroy the buffers on exiting fs mode, this // we used to destroy the buffers on exiting fs mode, this
// is no longer needed since fs change will cause a surface // is no longer needed since fs change will cause a surface
// data replacement // data replacement
...@@ -370,12 +371,15 @@ public class Win32GraphicsDevice extends GraphicsDevice implements ...@@ -370,12 +371,15 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
addFSWindowListener(w); addFSWindowListener(w);
// Enter full screen exclusive mode. // Enter full screen exclusive mode.
WWindowPeer peer = (WWindowPeer)w.getPeer(); WWindowPeer peer = (WWindowPeer)w.getPeer();
synchronized(peer) { if (peer != null) {
enterFullScreenExclusive(screen, peer); synchronized(peer) {
// Note: removed replaceSurfaceData() call because enterFullScreenExclusive(screen, peer);
// changing the window size or making it visible // Note: removed replaceSurfaceData() call because
// will cause this anyway, and both of these events happen // changing the window size or making it visible
// as part of switching into fullscreen mode. // will cause this anyway, and both of these events happen
// as part of switching into fullscreen mode.
}
peer.setFullScreenExclusiveModeState(true);
} }
// fix for 4868278 // fix for 4868278
......
...@@ -510,6 +510,9 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer, ...@@ -510,6 +510,9 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
private native int getScreenImOn(); private native int getScreenImOn();
// Used in Win32GraphicsDevice.
public final native void setFullScreenExclusiveModeState(boolean state);
/* /*
* ----END DISPLAY CHANGE SUPPORT---- * ----END DISPLAY CHANGE SUPPORT----
*/ */
......
...@@ -143,6 +143,11 @@ struct RepositionSecurityWarningStruct { ...@@ -143,6 +143,11 @@ struct RepositionSecurityWarningStruct {
jobject window; jobject window;
}; };
struct SetFullScreenExclusiveModeStateStruct {
jobject window;
jboolean isFSEMState;
};
/************************************************************************ /************************************************************************
* AwtWindow fields * AwtWindow fields
...@@ -915,7 +920,9 @@ void AwtWindow::UpdateSecurityWarningVisibility() ...@@ -915,7 +920,9 @@ void AwtWindow::UpdateSecurityWarningVisibility()
bool show = false; bool show = false;
if (IsVisible() && currentWmSizeState != SIZE_MINIMIZED) { if (IsVisible() && currentWmSizeState != SIZE_MINIMIZED &&
!isFullScreenExclusiveMode())
{
if (AwtComponent::GetFocusedWindow() == GetHWnd()) { if (AwtComponent::GetFocusedWindow() == GetHWnd()) {
show = true; show = true;
} }
...@@ -2954,6 +2961,25 @@ void AwtWindow::_UpdateWindow(void* param) ...@@ -2954,6 +2961,25 @@ void AwtWindow::_UpdateWindow(void* param)
delete uws; delete uws;
} }
void AwtWindow::_SetFullScreenExclusiveModeState(void *param)
{
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
SetFullScreenExclusiveModeStateStruct * data =
(SetFullScreenExclusiveModeStateStruct*)param;
jobject self = data->window;
jboolean state = data->isFSEMState;
PDATA pData;
JNI_CHECK_PEER_GOTO(self, ret);
AwtWindow *window = (AwtWindow *)pData;
window->setFullScreenExclusiveModeState(state != 0);
ret:
env->DeleteGlobalRef(self);
delete data;
}
extern "C" { extern "C" {
...@@ -3333,6 +3359,29 @@ Java_sun_awt_windows_WWindowPeer_getScreenImOn(JNIEnv *env, jobject self) ...@@ -3333,6 +3359,29 @@ Java_sun_awt_windows_WWindowPeer_getScreenImOn(JNIEnv *env, jobject self)
CATCH_BAD_ALLOC_RET(-1); CATCH_BAD_ALLOC_RET(-1);
} }
/*
* Class: sun_awt_windows_WWindowPeer
* Method: setFullScreenExclusiveModeState
* Signature: (Z)V
*/
JNIEXPORT void JNICALL
Java_sun_awt_windows_WWindowPeer_setFullScreenExclusiveModeState(JNIEnv *env,
jobject self, jboolean state)
{
TRY;
SetFullScreenExclusiveModeStateStruct *data =
new SetFullScreenExclusiveModeStateStruct;
data->window = env->NewGlobalRef(self);
data->isFSEMState = state;
AwtToolkit::GetInstance().SyncCall(
AwtWindow::_SetFullScreenExclusiveModeState, data);
// global ref and data are deleted in the invoked method
CATCH_BAD_ALLOC;
}
/* /*
* Class: sun_awt_windows_WWindowPeer * Class: sun_awt_windows_WWindowPeer
* Method: modalDisable * Method: modalDisable
......
...@@ -229,6 +229,7 @@ public: ...@@ -229,6 +229,7 @@ public:
static void _SetOpaque(void* param); static void _SetOpaque(void* param);
static void _UpdateWindow(void* param); static void _UpdateWindow(void* param);
static void _RepositionSecurityWarning(void* param); static void _RepositionSecurityWarning(void* param);
static void _SetFullScreenExclusiveModeState(void* param);
inline static BOOL IsResizing() { inline static BOOL IsResizing() {
return sm_resizing; return sm_resizing;
...@@ -331,6 +332,16 @@ private: ...@@ -331,6 +332,16 @@ private:
static void SetLayered(HWND window, bool layered); static void SetLayered(HWND window, bool layered);
static bool IsLayered(HWND window); static bool IsLayered(HWND window);
BOOL fullScreenExclusiveModeState;
inline void setFullScreenExclusiveModeState(BOOL isEntered) {
fullScreenExclusiveModeState = isEntered;
UpdateSecurityWarningVisibility();
}
inline BOOL isFullScreenExclusiveMode() {
return fullScreenExclusiveModeState;
}
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.
先完成此消息的编辑!
想要评论请 注册