changeset 3296:bde32b5becf1

Merge
author lana
date Thu, 06 Jan 2011 18:01:33 -0800
parents 9320dcfb5398 (current diff) aa03f76d0e80 (diff)
children fff6fd437f4a
files test/java/awt/Insets/WindowWithWarningTest/WindowWithWarningTest.html test/java/awt/Insets/WindowWithWarningTest/WindowWithWarningTest.java test/javax/swing/SwingWorker/6480289/bug6480289.java
diffstat 18 files changed, 163 insertions(+), 557 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/awt/SplashScreen.java	Wed Jan 05 11:21:00 2011 -0800
+++ b/src/share/classes/java/awt/SplashScreen.java	Thu Jan 06 18:01:33 2011 -0800
@@ -33,27 +33,17 @@
 import sun.awt.image.SunWritableRaster;
 
 /**
- * The splash screen can be created at application startup, before the
+ * The splash screen can be displayed at application startup, before the
  * Java Virtual Machine (JVM) starts. The splash screen is displayed as an
- * undecorated window containing an image. You can use GIF, JPEG, and PNG files
- * for the image. Animation (for GIF) and transparency (for GIF, PNG) are
- * supported. The window is positioned at the center of the screen (the
- * position on multi-monitor systems is not specified - it is platform and
- * implementation dependent).
- * The window is closed automatically as soon as the first window is displayed by
- * Swing/AWT (may be also closed manually using the Java API, see below).
+ * undecorated window containing an image. You can use GIF, JPEG, or PNG files
+ * for the image. Animation is supported for the GIF format, while transparency
+ * is supported both for GIF and PNG.  The window is positioned at the center
+ * of the screen. The position on multi-monitor systems is not specified. It is
+ * platform and implementation dependent.  The splash screen window is closed
+ * automatically as soon as the first window is displayed by Swing/AWT (may be
+ * also closed manually using the Java API, see below).
  * <P>
- * There are two ways to show the native splash screen:
- * <P>
- * <UL>
- * <LI>If your application is run from the command line or from a shortcut,
- * use the "-splash:" Java application  launcher option to show a splash screen.
- * <BR>
- * For example:
- * <PRE>
- * java -splash:filename.gif Test
- * </PRE>
- * <LI>If your application is packaged in a jar file, you can use the
+ * If your application is packaged in a jar file, you can use the
  * "SplashScreen-Image" option in a manifest file to show a splash screen.
  * Place the image in the jar archive and specify the path in the option.
  * The path should not have a leading slash.
@@ -64,18 +54,39 @@
  * Main-Class: Test
  * SplashScreen-Image: filename.gif
  * </PRE>
+ * <P>
+ * If the Java implementation provides the command-line interface and you run
+ * your application by using the command line or a shortcut, use the Java
+ * application launcher option to show a splash screen. The Oracle reference
+ * implementation allows you to specify the splash screen image location with
+ * the {@code -splash:} option.
+ * <BR>
+ * For example:
+ * <PRE>
+ * java -splash:filename.gif Test
+ * </PRE>
  * The command line interface has higher precedence over the manifest
  * setting.
- * </UL>
+ * <p>
+ * The splash screen will be displayed as faithfully as possible to present the
+ * whole splash screen image given the limitations of the target platform and
+ * display.
+ * <p>
+ * It is implied that the specified image is presented on the screen "as is",
+ * i.e. preserving the exact color values as specified in the image file. Under
+ * certain circumstances, though, the presented image may differ, e.g. when
+ * applying color dithering to present a 32 bits per pixel (bpp) image on a 16
+ * or 8 bpp screen. The native platform display configuration may also affect
+ * the colors of the displayed image (e.g.  color profiles, etc.)
  * <p>
  * The {@code SplashScreen} class provides the API for controlling the splash
  * screen. This class may be used to close the splash screen, change the splash
- * screen image, get the image position/size and paint in the splash screen. It
- * cannot be used to create the splash screen; you should use the command line or manifest
- * file option for that.
+ * screen image, get the splash screen native window position/size, and paint
+ * in the splash screen. It cannot be used to create the splash screen. You
+ * should use the options provided by the Java implementation for that.
  * <p>
  * This class cannot be instantiated. Only a single instance of this class
- * can exist, and it may be obtained using the {@link #getSplashScreen()}
+ * can exist, and it may be obtained by using the {@link #getSplashScreen()}
  * static method. In case the splash screen has not been created at
  * application startup via the command line or manifest file option,
  * the <code>getSplashScreen</code> method returns <code>null</code>.
@@ -91,7 +102,7 @@
 
     /**
      * Returns the {@code SplashScreen} object used for
-     * Java startup splash screen control.
+     * Java startup splash screen control on systems that support display.
      *
      * @throws UnsupportedOperationException if the splash screen feature is not
      *         supported by the current toolkit
@@ -219,6 +230,9 @@
      * <p>
      * You cannot control the size or position of the splash screen.
      * The splash screen size is adjusted automatically when the image changes.
+     * <p>
+     * The image may contain transparent areas, and thus the reported bounds may
+     * be larger than the visible splash screen image on the screen.
      *
      * @return a {@code Rectangle} containing the splash screen bounds
      * @throws IllegalStateException if the splash screen has already been closed
@@ -237,6 +251,9 @@
      * <p>
      * You cannot control the size or position of the splash screen.
      * The splash screen size is adjusted automatically when the image changes.
+     * <p>
+     * The image may contain transparent areas, and thus the reported size may
+     * be larger than the visible splash screen image on the screen.
      *
      * @return a {@link Dimension} object indicating the splash screen size
      * @throws IllegalStateException if the splash screen has already been closed
@@ -254,6 +271,10 @@
      * screen window. You should call {@code update()} on the
      * <code>SplashScreen</code> when you want the splash screen to be
      * updated immediately.
+     * <p>
+     * The pixel (0, 0) in the coordinate space of the graphics context
+     * corresponds to the origin of the splash screen native window bounds (see
+     * {@link #getBounds()}).
      *
      * @return graphics context for the splash screen overlay surface
      * @throws IllegalStateException if the splash screen has already been closed
@@ -334,6 +355,11 @@
      * Determines whether the splash screen is visible. The splash screen may
      * be hidden using {@link #close()}, it is also hidden automatically when
      * the first AWT/Swing window is made visible.
+     * <p>
+     * Note that the native platform may delay presenting the splash screen
+     * native window on the screen. The return value of {@code true} for this
+     * method only guarantees that the conditions to hide the splash screen
+     * window have not occurred yet.
      *
      * @return true if the splash screen is visible (has not been closed yet),
      *         false otherwise
--- a/src/share/classes/sun/awt/SunToolkit.java	Wed Jan 05 11:21:00 2011 -0800
+++ b/src/share/classes/sun/awt/SunToolkit.java	Thu Jan 06 18:01:33 2011 -0800
@@ -102,26 +102,6 @@
     public final static int MAX_BUTTONS_SUPPORTED = 20;
 
     public SunToolkit() {
-        /* If awt.threadgroup is set to class name the instance of
-         * this class is created (should be subclass of ThreadGroup)
-         * and EventDispatchThread is created inside of it
-         *
-         * If loaded class overrides uncaughtException instance
-         * handles all uncaught exception on EventDispatchThread
-         */
-        ThreadGroup threadGroup = null;
-        String tgName = System.getProperty("awt.threadgroup", "");
-
-        if (tgName.length() != 0) {
-            try {
-                Constructor ctor = Class.forName(tgName).
-                    getConstructor(new Class[] {String.class});
-                threadGroup = (ThreadGroup)ctor.newInstance(new Object[] {"AWT-ThreadGroup"});
-            } catch (Exception e) {
-                System.err.println("Failed loading " + tgName + ": " + e);
-            }
-        }
-
         Runnable initEQ = new Runnable() {
             public void run () {
                 EventQueue eventQueue;
@@ -144,17 +124,7 @@
             }
         };
 
-        if (threadGroup != null) {
-            Thread eqInitThread = new Thread(threadGroup, initEQ, "EventQueue-Init");
-            eqInitThread.start();
-            try {
-                eqInitThread.join();
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-            }
-        } else {
-            initEQ.run();
-        }
+        initEQ.run();
     }
 
     public boolean useBufferPerWindow() {
--- a/src/share/native/sun/awt/splashscreen/splashscreen_gfx_impl.h	Wed Jan 05 11:21:00 2011 -0800
+++ b/src/share/native/sun/awt/splashscreen/splashscreen_gfx_impl.h	Thu Jan 06 18:01:33 2011 -0800
@@ -88,27 +88,18 @@
 /*      blend (lerp between) two rgb quads
         src and dst alpha is ignored
         the algorithm: src*alpha+dst*(1-alpha)=(src-dst)*alpha+dst, rb and g are done separately
-        it's possible to verify that it's almost accurate indeed */
-
+*/
 INLINE rgbquad_t
 blendRGB(rgbquad_t dst, rgbquad_t src, rgbquad_t alpha)
 {
-    const rgbquad_t dstrb = dst & 0xFF00FF;
-    const rgbquad_t dstg = dst & 0xFF00;
-    const rgbquad_t srcrb = src & 0xFF00FF;
-    const rgbquad_t srcg = src & 0xFF00;
-
-    rgbquad_t drb = srcrb - dstrb;
-    rgbquad_t dg = srcg - dstg;
+    const rgbquad_t a = alpha;
+    const rgbquad_t a1 = 0xFF - alpha;
 
-    alpha += 1;
-
-    drb *= alpha;
-    dg *= alpha;
-    drb >>= 8;
-    dg >>= 8;
-
-    return ((drb + dstrb) & 0xFF00FF) | ((dg + dstg) & 0xFF00);
+    return MAKE_QUAD(
+        (rgbquad_t)((QUAD_RED(src) * a + QUAD_RED(dst) * a1) / 0xFF),
+        (rgbquad_t)((QUAD_GREEN(src) * a + QUAD_GREEN(dst) * a1) / 0xFF),
+        (rgbquad_t)((QUAD_BLUE(src) * a + QUAD_BLUE(dst) * a1) / 0xFF),
+        0);
 }
 
 /*      scales rgb quad by alpha. basically similar to what's above. src alpha is retained.
--- a/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c	Wed Jan 05 11:21:00 2011 -0800
+++ b/src/solaris/native/sun/awt/sun_awt_X11_GtkFileDialogPeer.c	Thu Jan 06 18:01:33 2011 -0800
@@ -191,7 +191,7 @@
 
     fp_gdk_threads_enter();
 
-    const char *title = (*env)->GetStringUTFChars(env, jtitle, 0);
+    const char *title = jtitle == NULL? "": (*env)->GetStringUTFChars(env, jtitle, 0);
 
     if (mode == 1) {
         /* Save action */
@@ -212,7 +212,9 @@
         }
     }
 
-    (*env)->ReleaseStringUTFChars(env, jtitle, title);
+    if (jtitle != NULL) {
+      (*env)->ReleaseStringUTFChars(env, jtitle, title);
+    }
 
     /* Set the directory */
     if (jdir != NULL) {
--- a/src/solaris/native/sun/xawt/XToolkit.c	Wed Jan 05 11:21:00 2011 -0800
+++ b/src/solaris/native/sun/xawt/XToolkit.c	Thu Jan 06 18:01:33 2011 -0800
@@ -187,7 +187,9 @@
                          "()Ljava/awt/Point;");
 
     keyclass = (*env)->FindClass(env, "java/awt/event/KeyEvent");
-    DASSERT (keyclass != NULL);
+    if (JNU_IsNull(env, keyclass)) {
+        return;
+    }
 
     componentIDs.isProxyActive =
         (*env)->GetFieldID(env, keyclass, "isProxyActive",
@@ -715,8 +717,10 @@
   if (xawt_root_shell == None){
       if (classXRootWindow == NULL){
           jclass cls_tmp = (*env)->FindClass(env, "sun/awt/X11/XRootWindow");
-          classXRootWindow = (jclass)(*env)->NewGlobalRef(env, cls_tmp);
-          (*env)->DeleteLocalRef(env, cls_tmp);
+          if (!JNU_IsNull(env, cls_tmp)) {
+              classXRootWindow = (jclass)(*env)->NewGlobalRef(env, cls_tmp);
+              (*env)->DeleteLocalRef(env, cls_tmp);
+          }
       }
       if( classXRootWindow != NULL) {
           methodGetXRootWindow = (*env)->GetStaticMethodID(env, classXRootWindow, "getXRootWindow", "()J");
--- a/src/windows/native/sun/windows/Devices.h	Wed Jan 05 11:21:00 2011 -0800
+++ b/src/windows/native/sun/windows/Devices.h	Thu Jan 06 18:01:33 2011 -0800
@@ -54,7 +54,7 @@
            InstanceAccess& operator=(const InstanceAccess&);
            InstanceAccess* operator&();
        };
-friend                          InstanceAccess;
+friend class InstanceAccess;
 
 private:
                                 Devices(int numElements);
--- a/src/windows/native/sun/windows/awt.h	Wed Jan 05 11:21:00 2011 -0800
+++ b/src/windows/native/sun/windows/awt.h	Thu Jan 06 18:01:33 2011 -0800
@@ -173,7 +173,7 @@
 
 // Platform encoding is Unicode (UTF-16), re-define JNU_ functions
 // to proper JNI functions.
-#define JNU_NewStringPlatform(env, x) env->NewString(reinterpret_cast<jchar*>(x), static_cast<jsize>(_tcslen(x)))
+#define JNU_NewStringPlatform(env, x) env->NewString(reinterpret_cast<const jchar*>(x), static_cast<jsize>(_tcslen(x)))
 #define JNU_GetStringPlatformChars(env, x, y) reinterpret_cast<LPCWSTR>(env->GetStringChars(x, y))
 #define JNU_ReleaseStringPlatformChars(env, x, y) env->ReleaseStringChars(x, reinterpret_cast<const jchar*>(y))
 
--- a/src/windows/native/sun/windows/awt_Debug.cpp	Wed Jan 05 11:21:00 2011 -0800
+++ b/src/windows/native/sun/windows/awt_Debug.cpp	Thu Jan 06 18:01:33 2011 -0800
@@ -47,12 +47,21 @@
     return ptr;
 }
 
+void * operator new[](size_t size, const char * filename, int linenumber) {
+    void * ptr = DMem_AllocateBlock(size, filename, linenumber);
+    if (ptr == NULL) {
+        throw std::bad_alloc();
+    }
+
+    return ptr;
+}
+
 #if _MSC_VER >= 1200
 void operator delete(void *ptr, const char*, int) {
     DASSERTMSG(FALSE, "This version of 'delete' should never get called!!!");
 }
 #endif
-void operator delete(void *ptr) {
+void operator delete(void *ptr) throw() {
     DMem_FreeBlock(ptr);
 }
 
--- a/src/windows/native/sun/windows/awt_Debug.h	Wed Jan 05 11:21:00 2011 -0800
+++ b/src/windows/native/sun/windows/awt_Debug.h	Thu Jan 06 18:01:33 2011 -0800
@@ -48,11 +48,14 @@
     };
 
     extern void * operator new(size_t size, const char * filename, int linenumber);
+    extern void * operator new[](size_t size, const char * filename, int linenumber);
+
 #if _MSC_VER >= 1200
     /* VC 6.0 is more strict about enforcing matching placement new & delete */
     extern void operator delete(void *ptr, const char*, int);
 #endif
-    extern void operator delete(void *ptr);
+
+    extern void operator delete(void *ptr) throw();
     extern void DumpClipRectangle(const char * file, int line, int argc, const char * fmt, va_list arglist);
     extern void DumpUpdateRectangle(const char * file, int line, int argc, const char * fmt, va_list arglist);
 
--- a/src/windows/native/sun/windows/awt_DesktopProperties.cpp	Wed Jan 05 11:21:00 2011 -0800
+++ b/src/windows/native/sun/windows/awt_DesktopProperties.cpp	Thu Jan 06 18:01:33 2011 -0800
@@ -650,7 +650,7 @@
 }
 
 void AwtDesktopProperties::SetStringProperty(LPCTSTR propName, LPTSTR value) {
-    jstring key = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(propName));
+    jstring key = JNU_NewStringPlatform(GetEnv(), propName);
     GetEnv()->CallVoidMethod(self,
                              AwtDesktopProperties::setStringPropertyID,
                              key, JNU_NewStringPlatform(GetEnv(), value));
@@ -658,7 +658,7 @@
 }
 
 void AwtDesktopProperties::SetIntegerProperty(LPCTSTR propName, int value) {
-    jstring key = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(propName));
+    jstring key = JNU_NewStringPlatform(GetEnv(), propName);
     GetEnv()->CallVoidMethod(self,
                              AwtDesktopProperties::setIntegerPropertyID,
                              key, (jint)value);
@@ -666,7 +666,7 @@
 }
 
 void AwtDesktopProperties::SetBooleanProperty(LPCTSTR propName, BOOL value) {
-    jstring key = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(propName));
+    jstring key = JNU_NewStringPlatform(GetEnv(), propName);
     GetEnv()->CallVoidMethod(self,
                              AwtDesktopProperties::setBooleanPropertyID,
                              key, value ? JNI_TRUE : JNI_FALSE);
@@ -674,7 +674,7 @@
 }
 
 void AwtDesktopProperties::SetColorProperty(LPCTSTR propName, DWORD value) {
-    jstring key = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(propName));
+    jstring key = JNU_NewStringPlatform(GetEnv(), propName);
     GetEnv()->CallVoidMethod(self,
                              AwtDesktopProperties::setColorPropertyID,
                              key, GetRValue(value), GetGValue(value),
@@ -726,7 +726,7 @@
                         style |= java_awt_Font_ITALIC;
                     }
 
-                    jstring key = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(propName));
+                    jstring key = JNU_NewStringPlatform(GetEnv(), propName);
                     GetEnv()->CallVoidMethod(self,
                               AwtDesktopProperties::setFontPropertyID,
                               key, fontName, style, pointSize);
@@ -744,7 +744,7 @@
     jint pointSize;
     jint style;
 
-    fontName = JNU_NewStringPlatform(GetEnv(), const_cast<LPWSTR>(font.lfFaceName));
+    fontName = JNU_NewStringPlatform(GetEnv(), font.lfFaceName);
 
 #if 0
     HDC         hdc;
@@ -767,7 +767,7 @@
         style |= java_awt_Font_ITALIC;
     }
 
-    jstring key = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(propName));
+    jstring key = JNU_NewStringPlatform(GetEnv(), propName);
     GetEnv()->CallVoidMethod(self, AwtDesktopProperties::setFontPropertyID,
                              key, fontName, style, pointSize);
 
@@ -776,8 +776,8 @@
 }
 
 void AwtDesktopProperties::SetSoundProperty(LPCTSTR propName, LPCTSTR winEventName) {
-    jstring key = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(propName));
-    jstring event = JNU_NewStringPlatform(GetEnv(), const_cast<LPTSTR>(winEventName));
+    jstring key = JNU_NewStringPlatform(GetEnv(), propName);
+    jstring event = JNU_NewStringPlatform(GetEnv(), winEventName);
     GetEnv()->CallVoidMethod(self,
                              AwtDesktopProperties::setSoundPropertyID,
                              key, event);
--- a/src/windows/native/sun/windows/awt_Dialog.cpp	Wed Jan 05 11:21:00 2011 -0800
+++ b/src/windows/native/sun/windows/awt_Dialog.cpp	Thu Jan 06 18:01:33 2011 -0800
@@ -230,7 +230,7 @@
         if (::IsIconic(hWnd)) {
             ::ShowWindow(hWnd, SW_RESTORE);
         }
-        PopupAllDialogs(blocker, TRUE, ::GetForegroundWindow(), FALSE);
+        PopupBlockers(blocker, TRUE, ::GetForegroundWindow(), FALSE);
         // return 1 to prevent the system from allowing the operation
         return 1;
     }
@@ -256,7 +256,7 @@
             HWND blocker = AwtWindow::GetModalBlocker(AwtComponent::GetTopLevelParentForWindow(hWnd));
             if (::IsWindow(blocker)) {
                 BOOL onTaskbar = !(::WindowFromPoint(mhs->pt) == hWnd);
-                PopupAllDialogs(hWnd, FALSE, ::GetForegroundWindow(), onTaskbar);
+                PopupBlockers(blocker, FALSE, ::GetForegroundWindow(), onTaskbar);
                 // return a nonzero value to prevent the system from passing
                 // the message to the target window procedure
                 return 1;
@@ -268,60 +268,60 @@
 }
 
 /*
- * The function goes through the heirarchy of the blocker dialogs and
- * popups all the dialogs. Note that the function starts from the top
- * blocker dialog and goes down to the dialog which is the bottom dialog.
- * Using another traversal may cause to the flickering issue as a bottom
- * dialog will cover a top dialog for some period of time.
+ * The function goes through the hierarchy of the blockers and
+ * popups all the blockers. Note that the function starts from the top
+ * blocker and goes down to the blocker which is the bottom one.
+ * Using another traversal algorithm (bottom->top) may cause to flickering
+ * as the bottom blocker will cover the top blocker for a while.
  */
-void AwtDialog::PopupAllDialogs(HWND dialog, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar)
+void AwtDialog::PopupBlockers(HWND blocker, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar)
 {
-    HWND blocker = AwtWindow::GetModalBlocker(dialog);
-    BOOL isBlocked = ::IsWindow(blocker);
-    if (isBlocked) {
-        PopupAllDialogs(blocker, isModalHook, prevFGWindow, onTaskbar);
+    HWND nextBlocker = AwtWindow::GetModalBlocker(blocker);
+    BOOL nextBlockerExists = ::IsWindow(nextBlocker);
+    if (nextBlockerExists) {
+        PopupBlockers(nextBlocker, isModalHook, prevFGWindow, onTaskbar);
     }
-    PopupOneDialog(dialog, blocker, isModalHook, prevFGWindow, onTaskbar);
+    PopupBlocker(blocker, nextBlocker, isModalHook, prevFGWindow, onTaskbar);
 }
 
 /*
- * The function popups the dialog, it distinguishes non-blocked dialogs
- * and activates the dialogs (sets as foreground window). If the dialog is
- * blocked, then it changes the Z-order of the dialog.
+ * The function popups the blocker, for a non-blocked blocker we need
+ * to activate the blocker but if a blocker is blocked, then we need
+ * to change z-order of the blocker placing the blocker under the next blocker.
  */
-void AwtDialog::PopupOneDialog(HWND dialog, HWND blocker, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar)
+void AwtDialog::PopupBlocker(HWND blocker, HWND nextBlocker, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar)
 {
-    if (dialog == AwtToolkit::GetInstance().GetHWnd()) {
+    if (blocker == AwtToolkit::GetInstance().GetHWnd()) {
         return;
     }
 
     // fix for 6494032
-    if (isModalHook && !::IsWindowVisible(dialog)) {
-        ::ShowWindow(dialog, SW_SHOWNA);
+    if (isModalHook && !::IsWindowVisible(blocker)) {
+        ::ShowWindow(blocker, SW_SHOWNA);
     }
 
-    BOOL isBlocked = ::IsWindow(blocker);
+    BOOL nextBlockerExists = ::IsWindow(nextBlocker);
     UINT flags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE;
 
-    if (isBlocked) {
+    if (nextBlockerExists) {
         // Fix for 6829546: if blocker is a top-most window, but window isn't, then
         // calling ::SetWindowPos(dialog, blocker, ...) makes window top-most as well
-        BOOL isBlockerTopmost = (::GetWindowLong(blocker, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0;
-        BOOL isDialogTopmost = (::GetWindowLong(dialog, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0;
-        if (!isBlockerTopmost || isDialogTopmost) {
-            ::SetWindowPos(dialog, blocker, 0, 0, 0, 0, flags);
+        BOOL topmostNextBlocker = (::GetWindowLong(nextBlocker, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0;
+        BOOL topmostBlocker = (::GetWindowLong(blocker, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0;
+        if (!topmostNextBlocker || topmostBlocker) {
+            ::SetWindowPos(blocker, nextBlocker, 0, 0, 0, 0, flags);
         } else {
-            ::SetWindowPos(dialog, HWND_TOP, 0, 0, 0, 0, flags);
+            ::SetWindowPos(blocker, HWND_TOP, 0, 0, 0, 0, flags);
         }
     } else {
-        ::SetWindowPos(dialog, HWND_TOP, 0, 0, 0, 0, flags);
+        ::SetWindowPos(blocker, HWND_TOP, 0, 0, 0, 0, flags);
         // no beep/flash if the mouse was clicked in the taskbar menu
         // or the dialog is currently inactive
-        if (!isModalHook && !onTaskbar && (dialog == prevFGWindow)) {
-            AnimateModalBlocker(dialog);
+        if (!isModalHook && !onTaskbar && (blocker == prevFGWindow)) {
+            AnimateModalBlocker(blocker);
         }
-        ::BringWindowToTop(dialog);
-        ::SetForegroundWindow(dialog);
+        ::BringWindowToTop(blocker);
+        ::SetForegroundWindow(blocker);
     }
 }
 
--- a/src/windows/native/sun/windows/awt_Dialog.h	Wed Jan 05 11:21:00 2011 -0800
+++ b/src/windows/native/sun/windows/awt_Dialog.h	Thu Jan 06 18:01:33 2011 -0800
@@ -113,8 +113,8 @@
      */
     static void ModalPerformActivation(HWND hWnd);
 
-    static void PopupAllDialogs(HWND dialog, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar);
-    static void PopupOneDialog(HWND dialog, HWND blocker, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar);
+    static void PopupBlockers(HWND blocker, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar);
+    static void PopupBlocker(HWND blocker, HWND nextBlocker, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar);
 
 public:
 
--- a/src/windows/native/sun/windows/awt_TextArea.h	Wed Jan 05 11:21:00 2011 -0800
+++ b/src/windows/native/sun/windows/awt_TextArea.h	Thu Jan 06 18:01:33 2011 -0800
@@ -41,9 +41,6 @@
 
 class AwtTextArea : public AwtTextComponent {
 
-    // inner classes
-    class OleCallback;
-
 public:
 
     /* java.awt.TextArea fields ids */
@@ -89,6 +86,37 @@
     static void _ReplaceText(void *param);
 
 protected:
+
+    /*****************************************************************
+     * Inner class OleCallback declaration.
+     */
+    class OleCallback : public IRichEditOleCallback {
+    public:
+        OleCallback();
+
+        STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
+        STDMETHODIMP_(ULONG) AddRef();
+        STDMETHODIMP_(ULONG) Release();
+        STDMETHODIMP GetNewStorage(LPSTORAGE FAR * ppstg);
+        STDMETHODIMP GetInPlaceContext(LPOLEINPLACEFRAME FAR * ppipframe,
+                                       LPOLEINPLACEUIWINDOW FAR* ppipuiDoc,
+                                       LPOLEINPLACEFRAMEINFO pipfinfo);
+        STDMETHODIMP ShowContainerUI(BOOL fShow);
+        STDMETHODIMP QueryInsertObject(LPCLSID pclsid, LPSTORAGE pstg, LONG cp);
+        STDMETHODIMP DeleteObject(LPOLEOBJECT poleobj);
+        STDMETHODIMP QueryAcceptData(LPDATAOBJECT pdataobj, CLIPFORMAT *pcfFormat,
+                                     DWORD reco, BOOL fReally, HGLOBAL hMetaPict);
+        STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode);
+        STDMETHODIMP GetClipboardData(CHARRANGE *pchrg, DWORD reco,
+                                      LPDATAOBJECT *ppdataobj);
+        STDMETHODIMP GetDragDropEffect(BOOL fDrag, DWORD grfKeyState,
+                                       LPDWORD pdwEffect);
+        STDMETHODIMP GetContextMenu(WORD seltype, LPOLEOBJECT poleobj,
+                                    CHARRANGE FAR * pchrg, HMENU FAR * phmenu);
+    private:
+        ULONG             m_refs; // Reference count
+    };//OleCallback class
+
     INLINE static OleCallback& GetOleCallback() { return sm_oleCallback; }
     void EditSetSel(CHARRANGE &cr);
     void EditGetSel(CHARRANGE &cr);
@@ -114,37 +142,6 @@
 
     static OleCallback sm_oleCallback;
 
-    /*****************************************************************
-     * Inner class OleCallback declaration.
-     */
-
-    class AwtTextArea::OleCallback : public IRichEditOleCallback {
-    public:
-        OleCallback();
-
-        STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
-        STDMETHODIMP_(ULONG) AddRef();
-        STDMETHODIMP_(ULONG) Release();
-        STDMETHODIMP GetNewStorage(LPSTORAGE FAR * ppstg);
-        STDMETHODIMP GetInPlaceContext(LPOLEINPLACEFRAME FAR * ppipframe,
-                                       LPOLEINPLACEUIWINDOW FAR* ppipuiDoc,
-                                       LPOLEINPLACEFRAMEINFO pipfinfo);
-        STDMETHODIMP ShowContainerUI(BOOL fShow);
-        STDMETHODIMP QueryInsertObject(LPCLSID pclsid, LPSTORAGE pstg, LONG cp);
-        STDMETHODIMP DeleteObject(LPOLEOBJECT poleobj);
-        STDMETHODIMP QueryAcceptData(LPDATAOBJECT pdataobj, CLIPFORMAT *pcfFormat,
-                                     DWORD reco, BOOL fReally, HGLOBAL hMetaPict);
-        STDMETHODIMP ContextSensitiveHelp(BOOL fEnterMode);
-        STDMETHODIMP GetClipboardData(CHARRANGE *pchrg, DWORD reco,
-                                      LPDATAOBJECT *ppdataobj);
-        STDMETHODIMP GetDragDropEffect(BOOL fDrag, DWORD grfKeyState,
-                                       LPDWORD pdwEffect);
-        STDMETHODIMP GetContextMenu(WORD seltype, LPOLEOBJECT poleobj,
-                                    CHARRANGE FAR * pchrg, HMENU FAR * phmenu);
-    private:
-        ULONG             m_refs; // Reference count
-    };
-
 };
 
 #endif /* AWT_TEXTAREA_H */
--- a/src/windows/native/sun/windows/awt_Toolkit.h	Wed Jan 05 11:21:00 2011 -0800
+++ b/src/windows/native/sun/windows/awt_Toolkit.h	Thu Jan 06 18:01:33 2011 -0800
@@ -110,7 +110,7 @@
       private:
         const CriticalSection& critSec;
     };
-    friend Lock;
+    friend class Lock;
 
   private:
     CRITICAL_SECTION rep;
--- a/test/com/sun/awt/Translucency/WindowOpacity.java	Wed Jan 05 11:21:00 2011 -0800
+++ b/test/com/sun/awt/Translucency/WindowOpacity.java	Thu Jan 06 18:01:33 2011 -0800
@@ -64,6 +64,7 @@
         boolean passed;
 
         Frame f = new Frame("Opacity test");
+        f.setUndecorated(true);
 
         passed = false;
         try {
--- a/test/java/awt/Insets/WindowWithWarningTest/WindowWithWarningTest.html	Wed Jan 05 11:21:00 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,20 +0,0 @@
-<html>
-<!--
-        @test
-        @bug 6391770
-        @summary Content of the Window should be laid out in the area left after WarningWindow was added.
-        @author Yuri Nesterenko
-        @run applet WindowWithWarningTest.html
--->
-
-  <head>
-    <title>WindowWithWarningTest</title>
-  </head>
-  <pre>
-  This test will run automatically.
-  </pre>
-  <body>
-    <applet code="WindowWithWarningTest.class" width=350 height=300></applet>
-  </body>
-</html>
-
--- a/test/java/awt/Insets/WindowWithWarningTest/WindowWithWarningTest.java	Wed Jan 05 11:21:00 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,315 +0,0 @@
-/*
- * Copyright (c) 2006, 2008, Oracle and/or its affiliates. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-/*
-  test
-  @bug 6391770
-  @summary Content of the Window should be laid out in the area left after WarningWindow was added.
-  @author yuri nesterenko: area=
-  @run applet WindowWithWarningTest.html
-*/
-
-// Note there is no @ in front of test above.  This is so that the
-//  harness will not mistake this file as a test file.  It should
-//  only see the html file as a test file. (the harness runs all
-//  valid test files, so it would run this test twice if this file
-//  were valid as well as the html file.)
-// Also, note the area= after Your Name in the author tag.  Here, you
-//  should put which functional area the test falls in.  See the
-//  AWT-core home page -> test areas and/or -> AWT team  for a list of
-//  areas.
-// Note also the 'AutomaticAppletTest.html' in the run tag.  This should
-//  be changed to the name of the test.
-
-
-/**
- * WindowWithWarningTest.java
- *
- * summary:
- */
-
-import java.applet.Applet;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-
-//Automated tests should run as applet tests if possible because they
-// get their environments cleaned up, including AWT threads, any
-// test created threads, and any system resources used by the test
-// such as file descriptors.  (This is normally not a problem as
-// main tests usually run in a separate VM, however on some platforms
-// such as the Mac, separate VMs are not possible and non-applet
-// tests will cause problems).  Also, you don't have to worry about
-// synchronisation stuff in Applet tests they way you do in main
-// tests...
-
-
-public class WindowWithWarningTest extends Applet
-{
-    //Declare things used in the test, like buttons and labels here
-    boolean buttonClicked = false;
-    public static final int MAX_COUNT = 100;
-
-    public void init()
-    {
-        //Create instructions for the user here, as well as set up
-        // the environment -- set the layout manager, add buttons,
-        // etc.
-
-        this.setLayout (new BorderLayout ());
-
-        String[] instructions =
-        {
-            "This is an AUTOMATIC test",
-            "simply wait until it is done"
-        };
-        //Sysout.createDialog( );
-        //Sysout.printInstructions( instructions );
-
-    }//End  init()
-    public void start ()
-    {
-        //Get things going.  Request focus, set size, et cetera
-        System.setSecurityManager( new SecurityManager() {
-        // deny AWTPermission("showWindowWithoutWarningBanner")
-            public boolean checkTopLevelWindow(Object window) {
-                return false;
-            }
-         });
-        JFrame frame = new JFrame("Window Test");
-        frame.setBounds(50, 50, 200, 200);
-        frame.show();
-
-        JWindow window = new JWindow( frame );
-        JButton jbutton1 = new JButton( "First" );
-        jbutton1.addMouseListener( new MouseAdapter() {
-            public void mousePressed( MouseEvent me ) {
-                buttonClicked = true;
-            }
-         });
-        JButton jbutton2 = new JButton( "Second" );
-        window.setLocation( 300, 300 );
-
-        window.add("North", jbutton1);
-        window.add("South", jbutton2);
-
-        window.pack();
-        window.show();
-        //wait for frame to show:
-        getLocation( frame );
-        window.toFront();
-
-        Dimension size0 = window.getSize();
-        Dimension size1 = null;
-        try {
-            Robot robot = new Robot();
-
-            robot.delay(500);
-            window.pack();
-            robot.delay(500);
-            window.pack();
-            // size1 must be the same as size0
-            size1 = window.getSize();
-            robot.delay(500);
-            Point pt = jbutton1.getLocationOnScreen();
-            robot.mouseMove((int) jbutton1.getLocationOnScreen().x + jbutton1.getWidth() / 2,
-                            (int) jbutton1.getLocationOnScreen().y + jbutton1.getHeight() / 2);
-            robot.delay(500);
-            robot.mousePress(MouseEvent.BUTTON1_MASK);
-            robot.delay(100);
-            robot.mouseRelease(MouseEvent.BUTTON1_MASK);
-            robot.delay(2000);
-         }catch(Exception e) {
-            throw new RuntimeException( "Exception "+e );
-         }
-         if( !size0.equals(size1) ) {
-            throw new RuntimeException( "Wrong Window size after multiple pack()s");
-         }
-         if( !buttonClicked ) {
-            throw new RuntimeException( "Button was not clicked");
-         }
-         window.dispose();
-         frame.dispose();
-
-         System.out.println("Test Passed.");
-    }// start()
-    public static Point getLocation( Component co ) throws RuntimeException {
-       Point pt = null;
-       boolean bFound = false;
-       int count = 0;
-       while( !bFound ) {
-          try {
-             pt = co.getLocationOnScreen();
-             bFound = true;
-          }catch( Exception ex ) {
-             bFound = false;
-             count++;
-          }
-          if( !bFound && count > MAX_COUNT ) {
-             throw new RuntimeException("don't see a component to get location");
-          }
-       }
-       return pt;
-    }
-
-
-}// class AutomaticAppletTest
-
-
-/****************************************************
- Standard Test Machinery
- DO NOT modify anything below -- it's a standard
-  chunk of code whose purpose is to make user
-  interaction uniform, and thereby make it simpler
-  to read and understand someone else's test.
- ****************************************************/
-
-/**
- This is part of the standard test machinery.
- It creates a dialog (with the instructions), and is the interface
-  for sending text messages to the user.
- To print the instructions, send an array of strings to Sysout.createDialog
-  WithInstructions method.  Put one line of instructions per array entry.
- To display a message for the tester to see, simply call Sysout.println
-  with the string to be displayed.
- This mimics System.out.println but works within the test harness as well
-  as standalone.
- */
-
-class Sysout
-{
-    private static TestDialog dialog;
-
-    public static void createDialogWithInstructions( String[] instructions )
-    {
-        dialog = new TestDialog( new Frame(), "Instructions" );
-        dialog.printInstructions( instructions );
-        dialog.setVisible(true);
-        println( "Any messages for the tester will display here." );
-    }
-
-    public static void createDialog( )
-    {
-        dialog = new TestDialog( new Frame(), "Instructions" );
-        String[] defInstr = { "Instructions will appear here. ", "" } ;
-        dialog.printInstructions( defInstr );
-        dialog.setVisible(true);
-        println( "Any messages for the tester will display here." );
-    }
-
-
-    public static void printInstructions( String[] instructions )
-    {
-        dialog.printInstructions( instructions );
-    }
-
-
-    public static void println( String messageIn )
-    {
-        dialog.displayMessage( messageIn );
-    }
-
-}// Sysout  class
-
-/**
-  This is part of the standard test machinery.  It provides a place for the
-   test instructions to be displayed, and a place for interactive messages
-   to the user to be displayed.
-  To have the test instructions displayed, see Sysout.
-  To have a message to the user be displayed, see Sysout.
-  Do not call anything in this dialog directly.
-  */
-class TestDialog extends Dialog
-{
-
-    TextArea instructionsText;
-    TextArea messageText;
-    int maxStringLength = 80;
-
-    //DO NOT call this directly, go through Sysout
-    public TestDialog( Frame frame, String name )
-    {
-        super( frame, name );
-        int scrollBoth = TextArea.SCROLLBARS_BOTH;
-        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
-        add( "North", instructionsText );
-
-        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
-        add("Center", messageText);
-
-        pack();
-
-        show();
-    }// TestDialog()
-
-    //DO NOT call this directly, go through Sysout
-    public void printInstructions( String[] instructions )
-    {
-        //Clear out any current instructions
-        instructionsText.setText( "" );
-
-        //Go down array of instruction strings
-
-        String printStr, remainingStr;
-        for( int i=0; i < instructions.length; i++ )
-        {
-            //chop up each into pieces maxSringLength long
-            remainingStr = instructions[ i ];
-            while( remainingStr.length() > 0 )
-            {
-                //if longer than max then chop off first max chars to print
-                if( remainingStr.length() >= maxStringLength )
-                {
-                    //Try to chop on a word boundary
-                    int posOfSpace = remainingStr.
-                        lastIndexOf( ' ', maxStringLength - 1 );
-
-                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
-
-                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
-                    remainingStr = remainingStr.substring( posOfSpace + 1 );
-                }
-                //else just print
-                else
-                {
-                    printStr = remainingStr;
-                    remainingStr = "";
-                }
-
-                instructionsText.append( printStr + "\n" );
-
-            }// while
-
-        }// for
-
-    }//printInstructions()
-
-    //DO NOT call this directly, go through Sysout
-    public void displayMessage( String messageIn )
-    {
-        messageText.append( messageIn + "\n" );
-        System.out.println(messageIn);
-    }
-
-}// TestDialog  class
--- a/test/javax/swing/SwingWorker/6480289/bug6480289.java	Wed Jan 05 11:21:00 2011 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2007, Oracle and/or its affiliates. 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/* @test
- *
- * @bug 6480289
- * @author Igor Kushnirskiy
- * @summary tests if consequent workers are executed on the same thread and that VM can exit.
- */
-
-import java.util.*;
-import javax.swing.SwingWorker;
-
-public class bug6480289 {
-    private static final int ITERATIONS = 5;
-    private static final Map<Thread, Integer> threadMap =
-        Collections.synchronizedMap(new HashMap<Thread, Integer>());
-    public static void main(String[] args) throws Exception {
-
-        for (int i = 0; i < ITERATIONS; i++) {
-            if (i != 0) {
-                Thread.sleep(1000 * 5);
-            }
-            SwingWorker<?,?> worker =
-                new SwingWorker<Void, Void>() {
-                    @Override
-                    protected Void doInBackground() {
-                        Integer value = threadMap.get(Thread.currentThread());
-                        value = Integer.valueOf(
-                            ((value == null) ? 0 : value.intValue())
-                            + 1);
-                        threadMap.put(Thread.currentThread(), value);
-                        return null;
-                    }
-                };
-            worker.execute();
-        }
-        if (threadMap.keySet().size() != 1) {
-            throw new RuntimeException("failed. More than one thread.");
-        }
-    }
-}