# HG changeset patch
# User anthony
# Date 1255522786 -14400
# Node ID 24d614d4764a277f58695e84efe41e15f94ec443
# Parent 69e00373e85bd4b273489f50a3f5579abb61a5a4
6711717: PIT: Security Icon is hidden for FullScreen apps, WinXP
Summary: Force hiding the security warning in FS exclusive mode.
Reviewed-by: art, tdv
diff -r 69e00373e85b -r 24d614d4764a jdk/src/share/classes/java/awt/AWTPermission.java
--- a/jdk/src/share/classes/java/awt/AWTPermission.java Wed Oct 14 15:46:13 2009 +0400
+++ b/jdk/src/share/classes/java/awt/AWTPermission.java Wed Oct 14 16:19:46 2009 +0400
@@ -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 @@
*
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 -r 69e00373e85b -r 24d614d4764a jdk/src/solaris/classes/sun/awt/X11/XWindow.java
--- a/jdk/src/solaris/classes/sun/awt/X11/XWindow.java Wed Oct 14 15:46:13 2009 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWindow.java Wed Oct 14 16:19:46 2009 +0400
@@ -1510,4 +1510,24 @@
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 -r 69e00373e85b -r 24d614d4764a jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java
--- a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java Wed Oct 14 15:46:13 2009 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java Wed Oct 14 16:19:46 2009 +0400
@@ -1080,31 +1080,39 @@
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 (!isFullScreenExclusiveMode()) {
+ int state = getWMState();
- if (isMouseAbove() || warningWindow.isMouseAbove())
- {
- 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;
+ }
}
}
diff -r 69e00373e85b -r 24d614d4764a jdk/src/solaris/classes/sun/awt/X11ComponentPeer.java
--- a/jdk/src/solaris/classes/sun/awt/X11ComponentPeer.java Wed Oct 14 15:46:13 2009 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11ComponentPeer.java Wed Oct 14 16:19:46 2009 +0400
@@ -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 @@
Rectangle getBounds();
Graphics getGraphics();
Object getTarget();
+ void setFullScreenExclusiveModeState(boolean state);
}
diff -r 69e00373e85b -r 24d614d4764a jdk/src/solaris/classes/sun/awt/X11GraphicsDevice.java
--- a/jdk/src/solaris/classes/sun/awt/X11GraphicsDevice.java Wed Oct 14 15:46:13 2009 +0400
+++ b/jdk/src/solaris/classes/sun/awt/X11GraphicsDevice.java Wed Oct 14 16:19:46 2009 +0400
@@ -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 @@
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 -r 69e00373e85b -r 24d614d4764a jdk/src/windows/classes/sun/awt/Win32GraphicsDevice.java
--- a/jdk/src/windows/classes/sun/awt/Win32GraphicsDevice.java Wed Oct 14 15:46:13 2009 +0400
+++ b/jdk/src/windows/classes/sun/awt/Win32GraphicsDevice.java Wed Oct 14 16:19:46 2009 +0400
@@ -353,6 +353,7 @@
}
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 @@
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 -r 69e00373e85b -r 24d614d4764a jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java
--- a/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java Wed Oct 14 15:46:13 2009 +0400
+++ b/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java Wed Oct 14 16:19:46 2009 +0400
@@ -510,6 +510,9 @@
private native int getScreenImOn();
+ // Used in Win32GraphicsDevice.
+ public final native void setFullScreenExclusiveModeState(boolean state);
+
/*
* ----END DISPLAY CHANGE SUPPORT----
*/
diff -r 69e00373e85b -r 24d614d4764a jdk/src/windows/native/sun/windows/awt_Window.cpp
--- a/jdk/src/windows/native/sun/windows/awt_Window.cpp Wed Oct 14 15:46:13 2009 +0400
+++ b/jdk/src/windows/native/sun/windows/awt_Window.cpp Wed Oct 14 16:19:46 2009 +0400
@@ -143,6 +143,11 @@
jobject window;
};
+struct SetFullScreenExclusiveModeStateStruct {
+ jobject window;
+ jboolean isFSEMState;
+};
+
/************************************************************************
* AwtWindow fields
@@ -915,7 +920,9 @@
bool show = false;
- if (IsVisible() && currentWmSizeState != SIZE_MINIMIZED) {
+ if (IsVisible() && currentWmSizeState != SIZE_MINIMIZED &&
+ !isFullScreenExclusiveMode())
+ {
if (AwtComponent::GetFocusedWindow() == GetHWnd()) {
show = true;
}
@@ -2954,6 +2961,25 @@
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" {
@@ -3335,6 +3361,29 @@
/*
* 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
* Signature: (J)V
*/
diff -r 69e00373e85b -r 24d614d4764a jdk/src/windows/native/sun/windows/awt_Window.h
--- a/jdk/src/windows/native/sun/windows/awt_Window.h Wed Oct 14 15:46:13 2009 +0400
+++ b/jdk/src/windows/native/sun/windows/awt_Window.h Wed Oct 14 16:19:46 2009 +0400
@@ -229,6 +229,7 @@
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 @@
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);