diff --git a/src/share/classes/java/awt/AWTPermission.java b/src/share/classes/java/awt/AWTPermission.java
index b6eb03f62c7225c3631ee33d41c97930c7acbcb6..84b400f53d9e80386394a0cdb309ad1845747cc7 100644
--- a/src/share/classes/java/awt/AWTPermission.java
+++ b/src/share/classes/java/awt/AWTPermission.java
@@ -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;
*
Enter full-screen exclusive mode |
* 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. |
+ * 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.
*
*
*
diff --git a/src/solaris/classes/sun/awt/X11/XWindow.java b/src/solaris/classes/sun/awt/X11/XWindow.java
index f1c3c675b6c4db50b4033c7fe02a69ca07d313d8..9081aa5e54556cf878b78fd52b69441e347db986 100644
--- a/src/solaris/classes/sun/awt/X11/XWindow.java
+++ b/src/solaris/classes/sun/awt/X11/XWindow.java
@@ -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;
+ }
+ }
+
}
diff --git a/src/solaris/classes/sun/awt/X11/XWindowPeer.java b/src/solaris/classes/sun/awt/X11/XWindowPeer.java
index 076526fd653d9e14bed7353c15d789d377a91809..51c55b96c2b073c4d3c862b6ca98c2f5f8e6a317 100644
--- a/src/solaris/classes/sun/awt/X11/XWindowPeer.java
+++ b/src/solaris/classes/sun/awt/X11/XWindowPeer.java
@@ -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;
+ }
}
}
diff --git a/src/solaris/classes/sun/awt/X11ComponentPeer.java b/src/solaris/classes/sun/awt/X11ComponentPeer.java
index a4a0750689473c0069b441cf79048b452a187e50..24b24809285af0e52b8131af2e511c0ac7f45bd9 100644
--- a/src/solaris/classes/sun/awt/X11ComponentPeer.java
+++ b/src/solaris/classes/sun/awt/X11ComponentPeer.java
@@ -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);
}
diff --git a/src/solaris/classes/sun/awt/X11GraphicsDevice.java b/src/solaris/classes/sun/awt/X11GraphicsDevice.java
index ed495b177ece3fe58b42b85b36d35756651388b5..a009a16e234bf0ab0790cf42d4a2ff269747c491 100644
--- a/src/solaris/classes/sun/awt/X11GraphicsDevice.java
+++ b/src/solaris/classes/sun/awt/X11GraphicsDevice.java
@@ -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());
}
}
diff --git a/src/windows/classes/sun/awt/Win32GraphicsDevice.java b/src/windows/classes/sun/awt/Win32GraphicsDevice.java
index 1da339ce9f17d69c659df8a560b3ce9e02b9fed6..7d8c17e69879cd16ee5e1c2276767bb470518ef9 100644
--- a/src/windows/classes/sun/awt/Win32GraphicsDevice.java
+++ b/src/windows/classes/sun/awt/Win32GraphicsDevice.java
@@ -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
diff --git a/src/windows/classes/sun/awt/windows/WWindowPeer.java b/src/windows/classes/sun/awt/windows/WWindowPeer.java
index fbb7442ba7d68152d12ee9d87f7ad892ef0462ac..3f11839e8cc1144f7eea5c1d7d893545472800e0 100644
--- a/src/windows/classes/sun/awt/windows/WWindowPeer.java
+++ b/src/windows/classes/sun/awt/windows/WWindowPeer.java
@@ -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----
*/
diff --git a/src/windows/native/sun/windows/awt_Window.cpp b/src/windows/native/sun/windows/awt_Window.cpp
index 4c902c3fb47b97973d0336c8ac3b739fbc4b3c19..8bb5c90021939c326d2d2a5966477fda3be60d37 100644
--- a/src/windows/native/sun/windows/awt_Window.cpp
+++ b/src/windows/native/sun/windows/awt_Window.cpp
@@ -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
diff --git a/src/windows/native/sun/windows/awt_Window.h b/src/windows/native/sun/windows/awt_Window.h
index 1d238b44dac1df0390039fd167f8f1479c1ac215..001062835e3a733ea369580f01eb2e503e7c017a 100644
--- a/src/windows/native/sun/windows/awt_Window.h
+++ b/src/windows/native/sun/windows/awt_Window.h
@@ -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);