6711717: PIT: Security Icon is hidden for FullScreen apps, WinXP
Force hiding the security warning in FS exclusive mode. Reviewed-by: art, tdv
This commit is contained in:
parent
99d8a50297
commit
370b3a923b
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -92,7 +92,15 @@ import java.security.BasicPermission;
|
||||
* <td>Enter full-screen exclusive mode</td>
|
||||
* <td>Entering full-screen exclusive mode allows direct access to
|
||||
* 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>
|
||||
|
@ -1510,4 +1510,24 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
|
||||
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,
|
||||
updateSecurityWarningVisibility();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFullScreenExclusiveModeState(boolean state) {
|
||||
super.setFullScreenExclusiveModeState(state);
|
||||
updateSecurityWarningVisibility();
|
||||
}
|
||||
|
||||
public void updateSecurityWarningVisibility() {
|
||||
if (warningWindow == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean show = false;
|
||||
|
||||
int state = getWMState();
|
||||
|
||||
if (!isVisible()) {
|
||||
return; // The warning window should already be hidden.
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
boolean show = false;
|
||||
|
||||
if (isMouseAbove() || warningWindow.isMouseAbove())
|
||||
{
|
||||
show = true;
|
||||
if (!isFullScreenExclusiveMode()) {
|
||||
int state = getWMState();
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -39,4 +39,5 @@ public interface X11ComponentPeer {
|
||||
Rectangle getBounds();
|
||||
Graphics getGraphics();
|
||||
Object getTarget();
|
||||
void setFullScreenExclusiveModeState(boolean state);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* 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.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -306,12 +306,14 @@ public class X11GraphicsDevice
|
||||
X11ComponentPeer peer = (X11ComponentPeer)w.getPeer();
|
||||
if (peer != null) {
|
||||
enterFullScreenExclusive(peer.getContentWindow());
|
||||
peer.setFullScreenExclusiveModeState(true);
|
||||
}
|
||||
}
|
||||
|
||||
private static void exitFullScreenExclusive(Window w) {
|
||||
X11ComponentPeer peer = (X11ComponentPeer)w.getPeer();
|
||||
if (peer != null) {
|
||||
peer.setFullScreenExclusiveModeState(false);
|
||||
exitFullScreenExclusive(peer.getContentWindow());
|
||||
}
|
||||
}
|
||||
|
@ -353,6 +353,7 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
|
||||
}
|
||||
WWindowPeer peer = (WWindowPeer)old.getPeer();
|
||||
if (peer != null) {
|
||||
peer.setFullScreenExclusiveModeState(false);
|
||||
// we used to destroy the buffers on exiting fs mode, this
|
||||
// is no longer needed since fs change will cause a surface
|
||||
// data replacement
|
||||
@ -370,12 +371,15 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
|
||||
addFSWindowListener(w);
|
||||
// Enter full screen exclusive mode.
|
||||
WWindowPeer peer = (WWindowPeer)w.getPeer();
|
||||
synchronized(peer) {
|
||||
enterFullScreenExclusive(screen, peer);
|
||||
// Note: removed replaceSurfaceData() call because
|
||||
// changing the window size or making it visible
|
||||
// will cause this anyway, and both of these events happen
|
||||
// as part of switching into fullscreen mode.
|
||||
if (peer != null) {
|
||||
synchronized(peer) {
|
||||
enterFullScreenExclusive(screen, peer);
|
||||
// Note: removed replaceSurfaceData() call because
|
||||
// changing the window size or making it visible
|
||||
// will cause this anyway, and both of these events happen
|
||||
// as part of switching into fullscreen mode.
|
||||
}
|
||||
peer.setFullScreenExclusiveModeState(true);
|
||||
}
|
||||
|
||||
// fix for 4868278
|
||||
|
@ -510,6 +510,9 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
|
||||
|
||||
private native int getScreenImOn();
|
||||
|
||||
// Used in Win32GraphicsDevice.
|
||||
public final native void setFullScreenExclusiveModeState(boolean state);
|
||||
|
||||
/*
|
||||
* ----END DISPLAY CHANGE SUPPORT----
|
||||
*/
|
||||
|
@ -143,6 +143,11 @@ struct RepositionSecurityWarningStruct {
|
||||
jobject window;
|
||||
};
|
||||
|
||||
struct SetFullScreenExclusiveModeStateStruct {
|
||||
jobject window;
|
||||
jboolean isFSEMState;
|
||||
};
|
||||
|
||||
|
||||
/************************************************************************
|
||||
* AwtWindow fields
|
||||
@ -915,7 +920,9 @@ void AwtWindow::UpdateSecurityWarningVisibility()
|
||||
|
||||
bool show = false;
|
||||
|
||||
if (IsVisible() && currentWmSizeState != SIZE_MINIMIZED) {
|
||||
if (IsVisible() && currentWmSizeState != SIZE_MINIMIZED &&
|
||||
!isFullScreenExclusiveMode())
|
||||
{
|
||||
if (AwtComponent::GetFocusedWindow() == GetHWnd()) {
|
||||
show = true;
|
||||
}
|
||||
@ -2954,6 +2961,25 @@ void AwtWindow::_UpdateWindow(void* param)
|
||||
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" {
|
||||
|
||||
@ -3333,6 +3359,29 @@ Java_sun_awt_windows_WWindowPeer_getScreenImOn(JNIEnv *env, jobject self)
|
||||
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
|
||||
* Method: modalDisable
|
||||
|
@ -229,6 +229,7 @@ public:
|
||||
static void _SetOpaque(void* param);
|
||||
static void _UpdateWindow(void* param);
|
||||
static void _RepositionSecurityWarning(void* param);
|
||||
static void _SetFullScreenExclusiveModeState(void* param);
|
||||
|
||||
inline static BOOL IsResizing() {
|
||||
return sm_resizing;
|
||||
@ -331,6 +332,16 @@ private:
|
||||
static void SetLayered(HWND window, bool layered);
|
||||
static bool IsLayered(HWND window);
|
||||
|
||||
BOOL fullScreenExclusiveModeState;
|
||||
inline void setFullScreenExclusiveModeState(BOOL isEntered) {
|
||||
fullScreenExclusiveModeState = isEntered;
|
||||
UpdateSecurityWarningVisibility();
|
||||
}
|
||||
inline BOOL isFullScreenExclusiveMode() {
|
||||
return fullScreenExclusiveModeState;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
void UpdateSecurityWarningVisibility();
|
||||
static bool IsWarningWindow(HWND hWnd);
|
||||
|
Loading…
x
Reference in New Issue
Block a user