From 06d5f1e07f8ba64f7fb29daf7b717e533c93dce1 Mon Sep 17 00:00:00 2001
From: Peter Zhelezniakov
Date: Wed, 4 Feb 2009 18:48:24 +0300
Subject: [PATCH 01/80] 6588003: LayoutQueue shares mutable implementation
across AppContexts
DefaultQueue property is made per-AppContext
Reviewed-by: alexp
---
.../classes/javax/swing/text/LayoutQueue.java | 31 +++++++---
.../swing/text/LayoutQueue/Test6588003.java | 59 +++++++++++++++++++
2 files changed, 81 insertions(+), 9 deletions(-)
create mode 100644 jdk/test/javax/swing/text/LayoutQueue/Test6588003.java
diff --git a/jdk/src/share/classes/javax/swing/text/LayoutQueue.java b/jdk/src/share/classes/javax/swing/text/LayoutQueue.java
index e02f9b0f9b6..dbb5d00ccce 100644
--- a/jdk/src/share/classes/javax/swing/text/LayoutQueue.java
+++ b/jdk/src/share/classes/javax/swing/text/LayoutQueue.java
@@ -25,6 +25,7 @@
package javax.swing.text;
import java.util.Vector;
+import sun.awt.AppContext;
/**
* A queue of text layout tasks.
@@ -35,10 +36,10 @@ import java.util.Vector;
*/
public class LayoutQueue {
- Vector tasks;
- Thread worker;
+ private static final Object DEFAULT_QUEUE = new Object();
- static LayoutQueue defaultQueue;
+ private Vector tasks;
+ private Thread worker;
/**
* Construct a layout queue.
@@ -51,19 +52,31 @@ public class LayoutQueue {
* Fetch the default layout queue.
*/
public static LayoutQueue getDefaultQueue() {
- if (defaultQueue == null) {
- defaultQueue = new LayoutQueue();
+ AppContext ac = AppContext.getAppContext();
+ synchronized (DEFAULT_QUEUE) {
+ LayoutQueue defaultQueue = (LayoutQueue) ac.get(DEFAULT_QUEUE);
+ if (defaultQueue == null) {
+ defaultQueue = new LayoutQueue();
+ ac.put(DEFAULT_QUEUE, defaultQueue);
+ }
+ return defaultQueue;
}
- return defaultQueue;
}
/**
* Set the default layout queue.
*
- * @param q the new queue.
+ * @param defaultQueue the new queue.
*/
- public static void setDefaultQueue(LayoutQueue q) {
- defaultQueue = q;
+ public static void setDefaultQueue(LayoutQueue defaultQueue) {
+ synchronized (DEFAULT_QUEUE) {
+ AppContext ac = AppContext.getAppContext();
+ if (defaultQueue == null) {
+ ac.remove(DEFAULT_QUEUE);
+ } else {
+ ac.put(DEFAULT_QUEUE, defaultQueue);
+ }
+ }
}
/**
diff --git a/jdk/test/javax/swing/text/LayoutQueue/Test6588003.java b/jdk/test/javax/swing/text/LayoutQueue/Test6588003.java
new file mode 100644
index 00000000000..d14d6a56a95
--- /dev/null
+++ b/jdk/test/javax/swing/text/LayoutQueue/Test6588003.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2007 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
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ @bug 6588003
+ @summary LayoutQueue should not share its DefaultQueue across AppContexts
+ @author Peter Zhelezniakov
+ @run main Test6588003
+*/
+
+import javax.swing.text.LayoutQueue;
+import sun.awt.SunToolkit;
+
+public class Test6588003 implements Runnable {
+ private static final LayoutQueue DEFAULT = new LayoutQueue();
+
+ public static void main(String[] args) throws InterruptedException {
+ LayoutQueue.setDefaultQueue(DEFAULT);
+
+ ThreadGroup group = new ThreadGroup("Test6588003");
+ Thread thread = new Thread(group, new Test6588003());
+ thread.start();
+ thread.join();
+
+ if (LayoutQueue.getDefaultQueue() != DEFAULT) {
+ throw new RuntimeException("Sharing detected");
+ }
+ }
+
+ public void run() {
+ SunToolkit.createNewAppContext();
+
+ if (LayoutQueue.getDefaultQueue() == DEFAULT) {
+ throw new RuntimeException("Sharing detected");
+ }
+
+ LayoutQueue.setDefaultQueue(new LayoutQueue());
+ }
+}
From 837ece487dd4c28c9d20b914695e5eae5277bb24 Mon Sep 17 00:00:00 2001
From: Sergey Malenkov
Date: Thu, 5 Feb 2009 14:48:10 +0300
Subject: [PATCH 02/80] 4769844: classes in java.beans that are serializable
but don't define serialVersionUID
Reviewed-by: peterz, rupashka
---
.../share/classes/java/beans/IndexedPropertyChangeEvent.java | 3 ++-
jdk/src/share/classes/java/beans/IntrospectionException.java | 3 ++-
jdk/src/share/classes/java/beans/PropertyChangeEvent.java | 3 ++-
jdk/src/share/classes/java/beans/PropertyVetoException.java | 4 ++--
.../classes/java/beans/beancontext/BeanContextEvent.java | 3 ++-
.../java/beans/beancontext/BeanContextMembershipEvent.java | 3 ++-
.../beans/beancontext/BeanContextServiceAvailableEvent.java | 3 ++-
.../beans/beancontext/BeanContextServiceRevokedEvent.java | 3 ++-
.../java/beans/beancontext/BeanContextServicesSupport.java | 4 +++-
jdk/src/share/classes/sun/beans/editors/ColorEditor.java | 4 +++-
jdk/src/share/classes/sun/beans/editors/FontEditor.java | 3 ++-
11 files changed, 24 insertions(+), 12 deletions(-)
diff --git a/jdk/src/share/classes/java/beans/IndexedPropertyChangeEvent.java b/jdk/src/share/classes/java/beans/IndexedPropertyChangeEvent.java
index ea78643e435..951cd871fe5 100644
--- a/jdk/src/share/classes/java/beans/IndexedPropertyChangeEvent.java
+++ b/jdk/src/share/classes/java/beans/IndexedPropertyChangeEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2003 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
@@ -41,6 +41,7 @@ package java.beans;
* @author Mark Davidson
*/
public class IndexedPropertyChangeEvent extends PropertyChangeEvent {
+ private static final long serialVersionUID = -320227448495806870L;
private int index;
diff --git a/jdk/src/share/classes/java/beans/IntrospectionException.java b/jdk/src/share/classes/java/beans/IntrospectionException.java
index cac0b20fc01..2f5a65eda73 100644
--- a/jdk/src/share/classes/java/beans/IntrospectionException.java
+++ b/jdk/src/share/classes/java/beans/IntrospectionException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-1998 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -36,6 +36,7 @@ package java.beans;
public
class IntrospectionException extends Exception {
+ private static final long serialVersionUID = -3728150539969542619L;
/**
* Constructs an IntrospectionException with a
diff --git a/jdk/src/share/classes/java/beans/PropertyChangeEvent.java b/jdk/src/share/classes/java/beans/PropertyChangeEvent.java
index 69f523d92e3..3e0c9cef6f9 100644
--- a/jdk/src/share/classes/java/beans/PropertyChangeEvent.java
+++ b/jdk/src/share/classes/java/beans/PropertyChangeEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -44,6 +44,7 @@ package java.beans;
*/
public class PropertyChangeEvent extends java.util.EventObject {
+ private static final long serialVersionUID = 7042693688939648123L;
/**
* Constructs a new PropertyChangeEvent.
diff --git a/jdk/src/share/classes/java/beans/PropertyVetoException.java b/jdk/src/share/classes/java/beans/PropertyVetoException.java
index f736b3bade5..73376496b53 100644
--- a/jdk/src/share/classes/java/beans/PropertyVetoException.java
+++ b/jdk/src/share/classes/java/beans/PropertyVetoException.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-1998 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -33,7 +33,7 @@ package java.beans;
public
class PropertyVetoException extends Exception {
-
+ private static final long serialVersionUID = 129596057694162164L;
/**
* Constructs a PropertyVetoException with a
diff --git a/jdk/src/share/classes/java/beans/beancontext/BeanContextEvent.java b/jdk/src/share/classes/java/beans/beancontext/BeanContextEvent.java
index 4574605a154..2530869534b 100644
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContextEvent.java
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1997-2003 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
@@ -48,6 +48,7 @@ import java.beans.beancontext.BeanContext;
*/
public abstract class BeanContextEvent extends EventObject {
+ private static final long serialVersionUID = 7267998073569045052L;
/**
* Contruct a BeanContextEvent
diff --git a/jdk/src/share/classes/java/beans/beancontext/BeanContextMembershipEvent.java b/jdk/src/share/classes/java/beans/beancontext/BeanContextMembershipEvent.java
index 7e6c1ae0a69..3752e390341 100644
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContextMembershipEvent.java
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextMembershipEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1997-2004 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
@@ -55,6 +55,7 @@ import java.util.Iterator;
* @see java.beans.beancontext.BeanContextMembershipListener
*/
public class BeanContextMembershipEvent extends BeanContextEvent {
+ private static final long serialVersionUID = 3499346510334590959L;
/**
* Contruct a BeanContextMembershipEvent
diff --git a/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceAvailableEvent.java b/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceAvailableEvent.java
index 558c7f9f363..7bb47a66033 100644
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceAvailableEvent.java
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceAvailableEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1998-2004 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1998-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
@@ -40,6 +40,7 @@ import java.util.Iterator;
*/
public class BeanContextServiceAvailableEvent extends BeanContextEvent {
+ private static final long serialVersionUID = -5333985775656400778L;
/**
* Construct a BeanContextAvailableServiceEvent.
diff --git a/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceRevokedEvent.java b/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceRevokedEvent.java
index a508f4ca157..50d888cdf7e 100644
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceRevokedEvent.java
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextServiceRevokedEvent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1998-2004 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1998-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
@@ -37,6 +37,7 @@ import java.beans.beancontext.BeanContextServices;
*
*/
public class BeanContextServiceRevokedEvent extends BeanContextEvent {
+ private static final long serialVersionUID = -1295543154724961754L;
/**
* Construct a BeanContextServiceEvent.
diff --git a/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java b/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java
index d9552c8a34e..54dfdd7d227 100644
--- a/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java
+++ b/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1998-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1998-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
@@ -60,6 +60,7 @@ import java.util.Locale;
public class BeanContextServicesSupport extends BeanContextSupport
implements BeanContextServices {
+ private static final long serialVersionUID = -8494482757288719206L;
/**
*
@@ -594,6 +595,7 @@ public class BeanContextServicesSupport extends BeanContextSupport
*/
protected static class BCSSServiceProvider implements Serializable {
+ private static final long serialVersionUID = 861278251667444782L;
BCSSServiceProvider(Class sc, BeanContextServiceProvider bcsp) {
super();
diff --git a/jdk/src/share/classes/sun/beans/editors/ColorEditor.java b/jdk/src/share/classes/sun/beans/editors/ColorEditor.java
index a3610e0ee2e..55dd9137be1 100644
--- a/jdk/src/share/classes/sun/beans/editors/ColorEditor.java
+++ b/jdk/src/share/classes/sun/beans/editors/ColorEditor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -29,6 +29,8 @@ import java.awt.*;
import java.beans.*;
public class ColorEditor extends Panel implements PropertyEditor {
+ private static final long serialVersionUID = 1781257185164716054L;
+
public ColorEditor() {
setLayout(null);
diff --git a/jdk/src/share/classes/sun/beans/editors/FontEditor.java b/jdk/src/share/classes/sun/beans/editors/FontEditor.java
index 88de9aea48f..04d4c187e22 100644
--- a/jdk/src/share/classes/sun/beans/editors/FontEditor.java
+++ b/jdk/src/share/classes/sun/beans/editors/FontEditor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -29,6 +29,7 @@ import java.awt.*;
import java.beans.*;
public class FontEditor extends Panel implements java.beans.PropertyEditor {
+ private static final long serialVersionUID = 6732704486002715933L;
public FontEditor() {
setLayout(null);
From 8f96eb9cea9b9b3886bb21a76da4aa9bcc5dc0a6 Mon Sep 17 00:00:00 2001
From: Sergey Malenkov
Date: Thu, 5 Feb 2009 17:00:57 +0300
Subject: [PATCH 03/80] 6669869: Beans.isDesignTime() and other queries should
be per-AppContext
Reviewed-by: peterz, rupashka
---
jdk/src/share/classes/java/beans/Beans.java | 96 ++++++++++---------
.../beans/Beans/6669869/TestDesignTime.java | 52 ++++++++++
.../beans/Beans/6669869/TestGuiAvailable.java | 53 ++++++++++
3 files changed, 158 insertions(+), 43 deletions(-)
create mode 100644 jdk/test/java/beans/Beans/6669869/TestDesignTime.java
create mode 100644 jdk/test/java/beans/Beans/6669869/TestGuiAvailable.java
diff --git a/jdk/src/share/classes/java/beans/Beans.java b/jdk/src/share/classes/java/beans/Beans.java
index f19b21aead2..8a750a8b15c 100644
--- a/jdk/src/share/classes/java/beans/Beans.java
+++ b/jdk/src/share/classes/java/beans/Beans.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -27,26 +27,41 @@ package java.beans;
import com.sun.beans.finder.ClassFinder;
-import java.applet.*;
+import java.applet.Applet;
+import java.applet.AppletContext;
+import java.applet.AppletStub;
+import java.applet.AudioClip;
-import java.awt.*;
-
-import java.beans.AppletInitializer;
+import java.awt.GraphicsEnvironment;
+import java.awt.Image;
import java.beans.beancontext.BeanContext;
-import java.io.*;
-
-import java.lang.reflect.Constructor;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+import java.io.StreamCorruptedException;
import java.net.URL;
-import java.lang.reflect.Array;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Vector;
+
+import sun.awt.AppContext;
/**
* This class provides some general purpose beans control methods.
*/
public class Beans {
+ private static final Object DESIGN_TIME = new Object();
+ private static final Object GUI_AVAILABLE = new Object();
/**
*
@@ -59,12 +74,12 @@ public class Beans {
* @param beanName the name of the bean within the class-loader.
* For example "sun.beanbox.foobah"
*
- * @exception java.lang.ClassNotFoundException if the class of a serialized
+ * @exception ClassNotFoundException if the class of a serialized
* object could not be found.
- * @exception java.io.IOException if an I/O error occurs.
+ * @exception IOException if an I/O error occurs.
*/
- public static Object instantiate(ClassLoader cls, String beanName) throws java.io.IOException, ClassNotFoundException {
+ public static Object instantiate(ClassLoader cls, String beanName) throws IOException, ClassNotFoundException {
return Beans.instantiate(cls, beanName, null, null);
}
@@ -80,12 +95,12 @@ public class Beans {
* For example "sun.beanbox.foobah"
* @param beanContext The BeanContext in which to nest the new bean
*
- * @exception java.lang.ClassNotFoundException if the class of a serialized
+ * @exception ClassNotFoundException if the class of a serialized
* object could not be found.
- * @exception java.io.IOException if an I/O error occurs.
+ * @exception IOException if an I/O error occurs.
*/
- public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext) throws java.io.IOException, ClassNotFoundException {
+ public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext) throws IOException, ClassNotFoundException {
return Beans.instantiate(cls, beanName, beanContext, null);
}
@@ -135,19 +150,19 @@ public class Beans {
* @param beanContext The BeanContext in which to nest the new bean
* @param initializer The AppletInitializer for the new bean
*
- * @exception java.lang.ClassNotFoundException if the class of a serialized
+ * @exception ClassNotFoundException if the class of a serialized
* object could not be found.
- * @exception java.io.IOException if an I/O error occurs.
+ * @exception IOException if an I/O error occurs.
*/
public static Object instantiate(ClassLoader cls, String beanName, BeanContext beanContext, AppletInitializer initializer)
- throws java.io.IOException, ClassNotFoundException {
+ throws IOException, ClassNotFoundException {
- java.io.InputStream ins;
- java.io.ObjectInputStream oins = null;
+ InputStream ins;
+ ObjectInputStream oins = null;
Object result = null;
boolean serialized = false;
- java.io.IOException serex = null;
+ IOException serex = null;
// If the given classloader is null, we check if an
// system classloader is available and (if so)
@@ -166,8 +181,8 @@ public class Beans {
// Try to find a serialized object with this name
final String serName = beanName.replace('.','/').concat(".ser");
final ClassLoader loader = cls;
- ins = (InputStream)java.security.AccessController.doPrivileged
- (new java.security.PrivilegedAction() {
+ ins = (InputStream)AccessController.doPrivileged
+ (new PrivilegedAction() {
public Object run() {
if (loader == null)
return ClassLoader.getSystemResourceAsStream(serName);
@@ -185,7 +200,7 @@ public class Beans {
result = oins.readObject();
serialized = true;
oins.close();
- } catch (java.io.IOException ex) {
+ } catch (IOException ex) {
ins.close();
// Drop through and try opening the class. But remember
// the exception in case we can't find the class either.
@@ -264,8 +279,8 @@ public class Beans {
final ClassLoader cloader = cls;
objectUrl = (URL)
- java.security.AccessController.doPrivileged
- (new java.security.PrivilegedAction() {
+ AccessController.doPrivileged
+ (new PrivilegedAction() {
public Object run() {
if (cloader == null)
return ClassLoader.getSystemResource
@@ -377,10 +392,11 @@ public class Beans {
* @return True if we are running in an application construction
* environment.
*
- * @see java.beans.DesignMode
+ * @see DesignMode
*/
public static boolean isDesignTime() {
- return designTime;
+ Object value = AppContext.getAppContext().get(DESIGN_TIME);
+ return (value instanceof Boolean) && (Boolean) value;
}
/**
@@ -393,11 +409,12 @@ public class Beans {
* false in a server environment or if an application is
* running as part of a batch job.
*
- * @see java.beans.Visibility
+ * @see Visibility
*
*/
public static boolean isGuiAvailable() {
- return guiAvailable;
+ Object value = AppContext.getAppContext().get(GUI_AVAILABLE);
+ return (value instanceof Boolean) ? (Boolean) value : !GraphicsEnvironment.isHeadless();
}
/**
@@ -423,7 +440,7 @@ public class Beans {
if (sm != null) {
sm.checkPropertiesAccess();
}
- designTime = isDesignTime;
+ AppContext.getAppContext().put(DESIGN_TIME, Boolean.valueOf(isDesignTime));
}
/**
@@ -449,14 +466,7 @@ public class Beans {
if (sm != null) {
sm.checkPropertiesAccess();
}
- guiAvailable = isGuiAvailable;
- }
-
-
- private static boolean designTime;
- private static boolean guiAvailable;
- static {
- guiAvailable = !GraphicsEnvironment.isHeadless();
+ AppContext.getAppContext().put(GUI_AVAILABLE, Boolean.valueOf(isGuiAvailable));
}
}
@@ -501,7 +511,7 @@ class ObjectInputStreamWithLoader extends ObjectInputStream
class BeansAppletContext implements AppletContext {
Applet target;
- java.util.Hashtable imageCache = new java.util.Hashtable();
+ Hashtable imageCache = new Hashtable();
BeansAppletContext(Applet target) {
this.target = target;
@@ -546,8 +556,8 @@ class BeansAppletContext implements AppletContext {
return null;
}
- public java.util.Enumeration getApplets() {
- java.util.Vector applets = new java.util.Vector();
+ public Enumeration getApplets() {
+ Vector applets = new Vector();
applets.addElement(target);
return applets.elements();
}
@@ -573,7 +583,7 @@ class BeansAppletContext implements AppletContext {
return null;
}
- public java.util.Iterator getStreamKeys(){
+ public Iterator getStreamKeys(){
// We do nothing.
return null;
}
diff --git a/jdk/test/java/beans/Beans/6669869/TestDesignTime.java b/jdk/test/java/beans/Beans/6669869/TestDesignTime.java
new file mode 100644
index 00000000000..e78142a2b90
--- /dev/null
+++ b/jdk/test/java/beans/Beans/6669869/TestDesignTime.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright 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
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6669869
+ * @summary Tests DesignTime property in different application contexts
+ * @author Sergey Malenkov
+ */
+
+import java.beans.Beans;
+import sun.awt.SunToolkit;
+
+public class TestDesignTime implements Runnable {
+ public static void main(String[] args) throws InterruptedException {
+ if (Beans.isDesignTime()) {
+ throw new Error("unexpected DesignTime property");
+ }
+ Beans.setDesignTime(!Beans.isDesignTime());
+ ThreadGroup group = new ThreadGroup("$$$");
+ Thread thread = new Thread(group, new TestDesignTime());
+ thread.start();
+ thread.join();
+ }
+
+ public void run() {
+ SunToolkit.createNewAppContext();
+ if (Beans.isDesignTime()) {
+ throw new Error("shared DesignTime property");
+ }
+ }
+}
diff --git a/jdk/test/java/beans/Beans/6669869/TestGuiAvailable.java b/jdk/test/java/beans/Beans/6669869/TestGuiAvailable.java
new file mode 100644
index 00000000000..7144b6fad3b
--- /dev/null
+++ b/jdk/test/java/beans/Beans/6669869/TestGuiAvailable.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 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
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6669869
+ * @summary Tests GuiAvailable property in different application contexts
+ * @author Sergey Malenkov
+ */
+
+import java.awt.GraphicsEnvironment;
+import java.beans.Beans;
+import sun.awt.SunToolkit;
+
+public class TestGuiAvailable implements Runnable {
+ public static void main(String[] args) throws InterruptedException {
+ if (Beans.isGuiAvailable() == GraphicsEnvironment.isHeadless()) {
+ throw new Error("unexpected GuiAvailable property");
+ }
+ Beans.setGuiAvailable(!Beans.isGuiAvailable());
+ ThreadGroup group = new ThreadGroup("$$$");
+ Thread thread = new Thread(group, new TestGuiAvailable());
+ thread.start();
+ thread.join();
+ }
+
+ public void run() {
+ SunToolkit.createNewAppContext();
+ if (Beans.isGuiAvailable() == GraphicsEnvironment.isHeadless()) {
+ throw new Error("shared GuiAvailable property");
+ }
+ }
+}
From a21476939e4a000ab5ee85f0939c99b4afb80312 Mon Sep 17 00:00:00 2001
From: Peter Zhelezniakov
Date: Thu, 5 Feb 2009 19:16:13 +0300
Subject: [PATCH 04/80] 6801769: 6588003 should be backed out from jdk7
Reviewed-by: alexp
---
.../classes/javax/swing/text/LayoutQueue.java | 31 ++++++-------------
1 file changed, 9 insertions(+), 22 deletions(-)
diff --git a/jdk/src/share/classes/javax/swing/text/LayoutQueue.java b/jdk/src/share/classes/javax/swing/text/LayoutQueue.java
index dbb5d00ccce..e02f9b0f9b6 100644
--- a/jdk/src/share/classes/javax/swing/text/LayoutQueue.java
+++ b/jdk/src/share/classes/javax/swing/text/LayoutQueue.java
@@ -25,7 +25,6 @@
package javax.swing.text;
import java.util.Vector;
-import sun.awt.AppContext;
/**
* A queue of text layout tasks.
@@ -36,10 +35,10 @@ import sun.awt.AppContext;
*/
public class LayoutQueue {
- private static final Object DEFAULT_QUEUE = new Object();
+ Vector tasks;
+ Thread worker;
- private Vector tasks;
- private Thread worker;
+ static LayoutQueue defaultQueue;
/**
* Construct a layout queue.
@@ -52,31 +51,19 @@ public class LayoutQueue {
* Fetch the default layout queue.
*/
public static LayoutQueue getDefaultQueue() {
- AppContext ac = AppContext.getAppContext();
- synchronized (DEFAULT_QUEUE) {
- LayoutQueue defaultQueue = (LayoutQueue) ac.get(DEFAULT_QUEUE);
- if (defaultQueue == null) {
- defaultQueue = new LayoutQueue();
- ac.put(DEFAULT_QUEUE, defaultQueue);
- }
- return defaultQueue;
+ if (defaultQueue == null) {
+ defaultQueue = new LayoutQueue();
}
+ return defaultQueue;
}
/**
* Set the default layout queue.
*
- * @param defaultQueue the new queue.
+ * @param q the new queue.
*/
- public static void setDefaultQueue(LayoutQueue defaultQueue) {
- synchronized (DEFAULT_QUEUE) {
- AppContext ac = AppContext.getAppContext();
- if (defaultQueue == null) {
- ac.remove(DEFAULT_QUEUE);
- } else {
- ac.put(DEFAULT_QUEUE, defaultQueue);
- }
- }
+ public static void setDefaultQueue(LayoutQueue q) {
+ defaultQueue = q;
}
/**
From e67e7cb5a7efd43e06e98039a581d0adcb593b23 Mon Sep 17 00:00:00 2001
From: Artem Ananiev
Date: Wed, 11 Feb 2009 17:07:06 +0300
Subject: [PATCH 05/80] 6633275: Need to support shaped/translucent windows
Forward-port from 6u14, no public API is introduced
Reviewed-by: anthony, dcherepanov
---
jdk/make/sun/awt/FILES_c_windows.gmk | 5 +-
jdk/make/sun/awt/Makefile | 3 +-
jdk/make/sun/awt/make.depend | 22 +-
jdk/make/sun/awt/mapfile-mawt-vers | 1 +
jdk/make/sun/awt/mapfile-vers-linux | 1 +
jdk/make/sun/xawt/mapfile-vers | 1 +
.../classes/com/sun/awt/AWTUtilities.java | 362 ++++++++++++-
jdk/src/share/classes/java/awt/Component.java | 69 ++-
jdk/src/share/classes/java/awt/Container.java | 5 +-
.../java/awt/DefaultKeyboardFocusManager.java | 2 +-
.../java/awt/GraphicsConfiguration.java | 18 +-
.../classes/java/awt/GraphicsDevice.java | 135 ++++-
.../java/awt/KeyboardFocusManager.java | 12 +-
jdk/src/share/classes/java/awt/Window.java | 288 +++++++++-
.../classes/java/awt/peer/WindowPeer.java | 26 +-
.../classes/javax/swing/RepaintManager.java | 45 +-
.../share/classes/sun/awt/AWTAccessor.java | 139 ++++-
.../share/classes/sun/awt/EmbeddedFrame.java | 11 +-
jdk/src/share/classes/sun/awt/SunToolkit.java | 117 +++-
jdk/src/share/native/sun/awt/utility/rect.c | 102 ++++
.../classes/sun/awt/X11/XNETProtocol.java | 10 +-
.../solaris/classes/sun/awt/X11/XToolkit.java | 34 +-
.../classes/sun/awt/X11/XWindowPeer.java | 67 ++-
.../awt/X11/generator/WrapperGenerator.java | 6 +-
.../sun/awt/X11/generator/xlibtypes.txt | 1 +
.../classes/sun/awt/X11GraphicsConfig.java | 11 +-
.../solaris/native/sun/awt/awt_GraphicsEnv.c | 102 +++-
jdk/src/solaris/native/sun/awt/awt_p.h | 3 +-
.../classes/sun/awt/Win32GraphicsConfig.java | 10 +-
.../sun/awt/Win32GraphicsEnvironment.java | 9 +-
.../awt/windows/TranslucentWindowPainter.java | 398 ++++++++++++++
.../classes/sun/awt/windows/WCanvasPeer.java | 27 +-
.../sun/awt/windows/WComponentPeer.java | 68 +--
.../sun/awt/windows/WFileDialogPeer.java | 8 +-
.../sun/awt/windows/WPrintDialogPeer.java | 8 +-
.../classes/sun/awt/windows/WToolkit.java | 32 +-
.../classes/sun/awt/windows/WWindowPeer.java | 181 ++++++-
.../sun/java2d/opengl/WGLSurfaceData.java | 12 +-
jdk/src/windows/native/sun/awt/utility/rect.h | 12 +-
.../native/sun/java2d/d3d/D3DSurfaceData.cpp | 14 +-
.../native/sun/java2d/opengl/WGLSurfaceData.c | 10 +-
.../native/sun/windows/awt_BitmapUtil.cpp | 226 +++++++-
.../native/sun/windows/awt_BitmapUtil.h | 28 +-
.../native/sun/windows/awt_Component.cpp | 33 +-
.../native/sun/windows/awt_Component.h | 11 +-
.../windows/native/sun/windows/awt_Window.cpp | 406 +++++++++++++-
.../windows/native/sun/windows/awt_Window.h | 38 +-
.../TranslucentJAppletTest.java | 103 ++++
.../TranslucentShapedFrameTest/TSFrame.java | 306 +++++++++++
.../TranslucentShapedFrameTest.form | 230 ++++++++
.../TranslucentShapedFrameTest.java | 359 ++++++++++++
.../sun/awt/Translucency/WindowOpacity.java | 461 ++++++++++++++++
jdk/test/sun/java2d/pipe/RegionOps.java | 510 ++++++++++++++++++
53 files changed, 4878 insertions(+), 220 deletions(-)
create mode 100644 jdk/src/share/native/sun/awt/utility/rect.c
create mode 100644 jdk/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java
create mode 100644 jdk/test/com/sun/awt/Translucency/TranslucentJAppletTest/TranslucentJAppletTest.java
create mode 100644 jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TSFrame.java
create mode 100644 jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TranslucentShapedFrameTest.form
create mode 100644 jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TranslucentShapedFrameTest.java
create mode 100644 jdk/test/com/sun/awt/Translucency/WindowOpacity.java
create mode 100644 jdk/test/sun/java2d/pipe/RegionOps.java
diff --git a/jdk/make/sun/awt/FILES_c_windows.gmk b/jdk/make/sun/awt/FILES_c_windows.gmk
index 1a9b3b6ad3c..835da687938 100644
--- a/jdk/make/sun/awt/FILES_c_windows.gmk
+++ b/jdk/make/sun/awt/FILES_c_windows.gmk
@@ -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
@@ -104,7 +104,8 @@ FILES_c = \
OGLVertexCache.c \
WGLGraphicsConfig.c \
WGLSurfaceData.c \
- AccelGlyphCache.c
+ AccelGlyphCache.c \
+ rect.c
FILES_cpp = \
CmdIDList.cpp \
diff --git a/jdk/make/sun/awt/Makefile b/jdk/make/sun/awt/Makefile
index 82a0a681de0..cd89650a597 100644
--- a/jdk/make/sun/awt/Makefile
+++ b/jdk/make/sun/awt/Makefile
@@ -1,5 +1,5 @@
#
-# Copyright 1995-2008 Sun Microsystems, Inc. All Rights Reserved.
+# Copyright 1995-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
@@ -219,6 +219,7 @@ vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/image/cvutils
vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/shell
vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/medialib
vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/debug
+vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/utility
vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/../java2d
vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/../java2d/loops
vpath %.c $(SHARE_SRC)/native/$(PKGDIR)/../java2d/pipe
diff --git a/jdk/make/sun/awt/make.depend b/jdk/make/sun/awt/make.depend
index 650e4c7fde8..df9d4c0f7c2 100644
--- a/jdk/make/sun/awt/make.depend
+++ b/jdk/make/sun/awt/make.depend
@@ -16,7 +16,7 @@ $(OBJDIR)/AnyShort.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h ../../../src/s
$(OBJDIR)/awt_AWTEvent.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_AWTEvent.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
-$(OBJDIR)/awt_BitmapUtil.obj:: ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awt_BitmapUtil.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/stdhdrs.h
+$(OBJDIR)/awt_BitmapUtil.obj:: ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awt_BitmapUtil.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/stdhdrs.h ../../../src/windows/native/sun/awt/utility/rect.h
$(OBJDIR)/awt_Brush.obj:: $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/stdhdrs.h
@@ -32,7 +32,7 @@ $(OBJDIR)/awt_Clipboard.obj:: $(CLASSHDRDIR)/sun_awt_windows_WClipboard.h $(CLAS
$(OBJDIR)/awt_Color.obj:: $(CLASSHDRDIR)/sun_awt_windows_WColor.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awt_Color.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/stdhdrs.h
-$(OBJDIR)/awt_Component.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Color.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_InputEvent.h $(CLASSHDRDIR)/java_awt_event_InputMethodEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_MouseWheelEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_FontMetrics.h $(CLASSHDRDIR)/java_awt_Frame.h $(CLASSHDRDIR)/java_awt_Insets.h $(CLASSHDRDIR)/java_awt_KeyboardFocusManager.h $(CLASSHDRDIR)/java_awt_Menu.h $(CLASSHDRDIR)/java_awt_MenuBar.h $(CLASSHDRDIR)/java_awt_MenuComponent.h $(CLASSHDRDIR)/java_awt_MenuItem.h $(CLASSHDRDIR)/java_awt_peer_MenuComponentPeer.h $(CLASSHDRDIR)/java_awt_Toolkit.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WFramePeer.h $(CLASSHDRDIR)/sun_awt_windows_WInputMethod.h $(CLASSHDRDIR)/sun_awt_windows_WMenuBarPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuItemPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuPeer.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WPanelPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jawt.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_AWTEvent.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Cursor.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Dimension.h ../../../src/windows/native/sun/windows/awt_DnDDT.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_Frame.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_InputEvent.h ../../../src/windows/native/sun/windows/awt_InputTextInfor.h ../../../src/windows/native/sun/windows/awt_Insets.h ../../../src/windows/native/sun/windows/awt_KeyboardFocusManager.h ../../../src/windows/native/sun/windows/awt_KeyEvent.h ../../../src/windows/native/sun/windows/awt_Menu.h ../../../src/windows/native/sun/windows/awt_MenuBar.h ../../../src/windows/native/sun/windows/awt_MenuItem.h ../../../src/windows/native/sun/windows/awt_MouseEvent.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/ComCtl32Util.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
+$(OBJDIR)/awt_Component.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Color.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_InputEvent.h $(CLASSHDRDIR)/java_awt_event_InputMethodEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_MouseWheelEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_FontMetrics.h $(CLASSHDRDIR)/java_awt_Frame.h $(CLASSHDRDIR)/java_awt_Insets.h $(CLASSHDRDIR)/java_awt_KeyboardFocusManager.h $(CLASSHDRDIR)/java_awt_Menu.h $(CLASSHDRDIR)/java_awt_MenuBar.h $(CLASSHDRDIR)/java_awt_MenuComponent.h $(CLASSHDRDIR)/java_awt_MenuItem.h $(CLASSHDRDIR)/java_awt_peer_MenuComponentPeer.h $(CLASSHDRDIR)/java_awt_Toolkit.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WFramePeer.h $(CLASSHDRDIR)/sun_awt_windows_WInputMethod.h $(CLASSHDRDIR)/sun_awt_windows_WMenuBarPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuItemPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuPeer.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WPanelPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jawt.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_AWTEvent.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Cursor.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Dimension.h ../../../src/windows/native/sun/windows/awt_DnDDT.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_Frame.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_InputEvent.h ../../../src/windows/native/sun/windows/awt_InputTextInfor.h ../../../src/windows/native/sun/windows/awt_Insets.h ../../../src/windows/native/sun/windows/awt_KeyboardFocusManager.h ../../../src/windows/native/sun/windows/awt_KeyEvent.h ../../../src/windows/native/sun/windows/awt_Menu.h ../../../src/windows/native/sun/windows/awt_MenuBar.h ../../../src/windows/native/sun/windows/awt_MenuItem.h ../../../src/windows/native/sun/windows/awt_MouseEvent.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/ComCtl32Util.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h ../../../src/windows/native/sun/awt/utility/rect.h
$(OBJDIR)/awt_Container.obj:: ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awt_Container.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/stdhdrs.h
@@ -144,9 +144,9 @@ $(OBJDIR)/awt_Win32GraphicsEnv.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSH
$(OBJDIR)/awt_Window.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Container.h $(CLASSHDRDIR)/java_awt_Dialog.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_ComponentEvent.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_FileDialog.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_FontMetrics.h $(CLASSHDRDIR)/java_awt_Frame.h $(CLASSHDRDIR)/java_awt_Insets.h $(CLASSHDRDIR)/java_awt_Menu.h $(CLASSHDRDIR)/java_awt_MenuBar.h $(CLASSHDRDIR)/java_awt_MenuComponent.h $(CLASSHDRDIR)/java_awt_MenuItem.h $(CLASSHDRDIR)/java_awt_peer_MenuComponentPeer.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WDialogPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFileDialogPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WFramePeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuBarPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuItemPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuPeer.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_BitmapUtil.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Container.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Dialog.h ../../../src/windows/native/sun/windows/awt_FileDialog.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_Frame.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_IconCursor.h ../../../src/windows/native/sun/windows/awt_Insets.h ../../../src/windows/native/sun/windows/awt_Menu.h ../../../src/windows/native/sun/windows/awt_MenuBar.h ../../../src/windows/native/sun/windows/awt_MenuItem.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Panel.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_PrintDialog.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
-$(OBJDIR)/Blit.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_Blit.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
+$(OBJDIR)/Blit.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_Blit.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/awt/utility/rect.h ../../../src/windows/native/sun/java2d/j2d_md.h
-$(OBJDIR)/BlitBg.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_BlitBg.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
+$(OBJDIR)/BlitBg.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_BlitBg.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/awt/utility/rect.h ../../../src/windows/native/sun/java2d/j2d_md.h
$(OBJDIR)/BufferedMaskBlit.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_pipe_BufferedMaskBlit.h $(CLASSHDRDIR)/sun_java2d_pipe_BufferedOpCodes.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/ByteGray.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/loops/IntArgb.h ../../../src/share/native/sun/java2d/loops/IntBgr.h ../../../src/share/native/sun/java2d/loops/IntDcm.h ../../../src/share/native/sun/java2d/loops/IntRgb.h ../../../src/share/native/sun/java2d/loops/UshortGray.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
@@ -240,11 +240,11 @@ $(OBJDIR)/GDIHashtable.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/j
$(OBJDIR)/GDIRenderer.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_geom_PathIterator.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_java2d_windows_GDIRenderer.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
-$(OBJDIR)/GDIWindowSurfaceData.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_java2d_windows_GDIWindowSurfaceData.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/Disposer.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/java2d/windows/WindowsFlags.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
+$(OBJDIR)/GDIWindowSurfaceData.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_java2d_windows_GDIWindowSurfaceData.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/Disposer.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/java2d/windows/WindowsFlags.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/awt/utility/rect.h ../../../src/windows/native/sun/windows/stdhdrs.h
$(OBJDIR)/gifdecoder.obj:: ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/jlong_md.h
-$(OBJDIR)/GraphicsPrimitiveMgr.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_GraphicsPrimitiveMgr.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/java2d/loops/AlphaMacros.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/ByteGray.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/loops/IntArgb.h ../../../src/share/native/sun/java2d/loops/IntDcm.h ../../../src/share/native/sun/java2d/loops/UshortGray.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
+$(OBJDIR)/GraphicsPrimitiveMgr.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_GraphicsPrimitiveMgr.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/java2d/loops/AlphaMacros.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/ByteGray.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/loops/IntArgb.h ../../../src/share/native/sun/java2d/loops/IntDcm.h ../../../src/share/native/sun/java2d/loops/UshortGray.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/awt/utility/rect.h ../../../src/windows/native/sun/java2d/j2d_md.h
$(OBJDIR)/Hashtable.obj:: $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/stdhdrs.h
@@ -272,7 +272,7 @@ $(OBJDIR)/IntRgb.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h ../../../src/sha
$(OBJDIR)/IntRgbx.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/sun/java2d/loops/AlphaMacros.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/AnyInt.h ../../../src/share/native/sun/java2d/loops/ByteGray.h ../../../src/share/native/sun/java2d/loops/ByteIndexed.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/loops/IntArgb.h ../../../src/share/native/sun/java2d/loops/IntArgbBm.h ../../../src/share/native/sun/java2d/loops/IntArgbPre.h ../../../src/share/native/sun/java2d/loops/IntDcm.h ../../../src/share/native/sun/java2d/loops/IntRgb.h ../../../src/share/native/sun/java2d/loops/IntRgbx.h ../../../src/share/native/sun/java2d/loops/LineUtils.h ../../../src/share/native/sun/java2d/loops/LoopMacros.h ../../../src/share/native/sun/java2d/loops/ThreeByteBgr.h ../../../src/share/native/sun/java2d/loops/UshortGray.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
-$(OBJDIR)/MaskBlit.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_MaskBlit.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
+$(OBJDIR)/MaskBlit.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_MaskBlit.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/java2d/j2d_md.h ../../../src/windows/native/sun/awt/utility/rect.h
$(OBJDIR)/MaskFill.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_MaskFill.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
@@ -284,7 +284,7 @@ $(OBJDIR)/OGLBlitLoops.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDR
$(OBJDIR)/OGLBufImgOps.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/java_awt_image_AffineTransformOp.h $(CLASSHDRDIR)/sun_java2d_opengl_OGLContext.h $(CLASSHDRDIR)/sun_java2d_opengl_OGLSurfaceData.h $(CLASSHDRDIR)/sun_java2d_pipe_BufferedContext.h $(CLASSHDRDIR)/sun_java2d_pipe_hw_AccelSurface.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/opengl/J2D_GL/gl.h ../../../src/share/native/sun/java2d/opengl/J2D_GL/glext.h ../../../src/share/native/sun/java2d/opengl/OGLBufImgOps.h ../../../src/share/native/sun/java2d/opengl/OGLContext.h ../../../src/share/native/sun/java2d/opengl/OGLFuncMacros.h ../../../src/share/native/sun/java2d/opengl/OGLFuncs.h ../../../src/share/native/sun/java2d/opengl/OGLRenderQueue.h ../../../src/share/native/sun/java2d/opengl/OGLSurfaceData.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h ../../../src/windows/native/sun/java2d/opengl/J2D_GL/wglext.h ../../../src/windows/native/sun/java2d/opengl/OGLFuncs_md.h
-$(OBJDIR)/OGLContext.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/java_awt_image_AffineTransformOp.h $(CLASSHDRDIR)/sun_java2d_opengl_OGLContext.h $(CLASSHDRDIR)/sun_java2d_opengl_OGLSurfaceData.h $(CLASSHDRDIR)/sun_java2d_pipe_BufferedContext.h $(CLASSHDRDIR)/sun_java2d_pipe_hw_AccelSurface.h $(CLASSHDRDIR)/sun_java2d_SunGraphics2D.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/opengl/J2D_GL/gl.h ../../../src/share/native/sun/java2d/opengl/J2D_GL/glext.h ../../../src/share/native/sun/java2d/opengl/OGLContext.h ../../../src/share/native/sun/java2d/opengl/OGLFuncMacros.h ../../../src/share/native/sun/java2d/opengl/OGLFuncs.h ../../../src/share/native/sun/java2d/opengl/OGLRenderQueue.h ../../../src/share/native/sun/java2d/opengl/OGLSurfaceData.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h ../../../src/windows/native/sun/java2d/opengl/J2D_GL/wglext.h ../../../src/windows/native/sun/java2d/opengl/OGLFuncs_md.h
+$(OBJDIR)/OGLContext.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/java_awt_image_AffineTransformOp.h $(CLASSHDRDIR)/sun_java2d_opengl_OGLContext.h $(CLASSHDRDIR)/sun_java2d_opengl_OGLSurfaceData.h $(CLASSHDRDIR)/sun_java2d_pipe_BufferedContext.h $(CLASSHDRDIR)/sun_java2d_pipe_hw_AccelSurface.h $(CLASSHDRDIR)/sun_java2d_SunGraphics2D.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/opengl/J2D_GL/gl.h ../../../src/share/native/sun/java2d/opengl/J2D_GL/glext.h ../../../src/share/native/sun/java2d/opengl/OGLContext.h ../../../src/share/native/sun/java2d/opengl/OGLFuncMacros.h ../../../src/share/native/sun/java2d/opengl/OGLFuncs.h ../../../src/share/native/sun/java2d/opengl/OGLRenderQueue.h ../../../src/share/native/sun/java2d/opengl/OGLSurfaceData.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h ../../../src/windows/native/sun/java2d/opengl/J2D_GL/wglext.h ../../../src/windows/native/sun/java2d/opengl/OGLFuncs_md.h ../../../src/windows/native/sun/awt/utility/rect.h
$(OBJDIR)/OGLFuncs.obj:: ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/java2d/opengl/J2D_GL/gl.h ../../../src/share/native/sun/java2d/opengl/J2D_GL/glext.h ../../../src/share/native/sun/java2d/opengl/OGLFuncMacros.h ../../../src/share/native/sun/java2d/opengl/OGLFuncs.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/opengl/J2D_GL/wglext.h ../../../src/windows/native/sun/java2d/opengl/OGLFuncs_md.h
@@ -306,11 +306,11 @@ $(OBJDIR)/OGLVertexCache.obj:: $(CLASSHDRDIR)/java_awt_image_AffineTransformOp.h
$(OBJDIR)/ProcessPath.obj:: $(CLASSHDRDIR)/java_awt_geom_PathIterator.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/java2d/loops/ProcessPath.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
-$(OBJDIR)/Region.obj:: ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/jlong_md.h
+$(OBJDIR)/Region.obj:: ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/awt/utility/rect.h
$(OBJDIR)/RenderBuffer.obj:: $(CLASSHDRDIR)/sun_java2d_pipe_RenderBuffer.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/jlong_md.h
-$(OBJDIR)/ScaledBlit.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_ScaledBlit.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
+$(OBJDIR)/ScaledBlit.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/sun_java2d_loops_ScaledBlit.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h ../../../src/windows/native/sun/awt/utility/rect.h
$(OBJDIR)/ShapeSpanIterator.obj:: $(CLASSHDRDIR)/java_awt_geom_PathIterator.h $(CLASSHDRDIR)/sun_java2d_pipe_ShapeSpanIterator.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/java2d/pipe/PathConsumer2D.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
@@ -326,7 +326,7 @@ $(OBJDIR)/ThreeByteBgr.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h ../../../s
$(OBJDIR)/Trace.obj:: ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h
-$(OBJDIR)/TransformHelper.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/java_awt_image_AffineTransformOp.h $(CLASSHDRDIR)/sun_java2d_loops_TransformHelper.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
+$(OBJDIR)/TransformHelper.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h $(CLASSHDRDIR)/java_awt_image_AffineTransformOp.h $(CLASSHDRDIR)/sun_java2d_loops_TransformHelper.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/j2d_md.h ../../../src/windows/native/sun/awt/utility/rect.h
$(OBJDIR)/Ushort4444Argb.obj:: $(CLASSHDRDIR)/java_awt_AlphaComposite.h ../../../src/share/javavm/export/jni.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/sun/java2d/loops/AlphaMacros.h ../../../src/share/native/sun/java2d/loops/AlphaMath.h ../../../src/share/native/sun/java2d/loops/AnyShort.h ../../../src/share/native/sun/java2d/loops/ByteGray.h ../../../src/share/native/sun/java2d/loops/ByteIndexed.h ../../../src/share/native/sun/java2d/loops/GlyphImageRef.h ../../../src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.h ../../../src/share/native/sun/java2d/loops/IntArgb.h ../../../src/share/native/sun/java2d/loops/IntArgbBm.h ../../../src/share/native/sun/java2d/loops/IntDcm.h ../../../src/share/native/sun/java2d/loops/IntRgb.h ../../../src/share/native/sun/java2d/loops/LineUtils.h ../../../src/share/native/sun/java2d/loops/LoopMacros.h ../../../src/share/native/sun/java2d/loops/ThreeByteBgr.h ../../../src/share/native/sun/java2d/loops/Ushort4444Argb.h ../../../src/share/native/sun/java2d/loops/UshortGray.h ../../../src/share/native/sun/java2d/pipe/SpanIterator.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/sun/java2d/j2d_md.h
diff --git a/jdk/make/sun/awt/mapfile-mawt-vers b/jdk/make/sun/awt/mapfile-mawt-vers
index ca3b430c57b..f24b57ec991 100644
--- a/jdk/make/sun/awt/mapfile-mawt-vers
+++ b/jdk/make/sun/awt/mapfile-mawt-vers
@@ -291,6 +291,7 @@ SUNWprivate_1.1 {
Java_sun_awt_X11GraphicsConfig_createBackBuffer;
Java_sun_awt_X11GraphicsConfig_destroyBackBuffer;
Java_sun_awt_X11GraphicsConfig_swapBuffers;
+ Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable;
Java_sun_awt_X11GraphicsDevice_isDBESupported;
Java_sun_awt_X11GraphicsDevice_getDisplay;
Java_sun_awt_X11GraphicsDevice_getDoubleBufferVisuals;
diff --git a/jdk/make/sun/awt/mapfile-vers-linux b/jdk/make/sun/awt/mapfile-vers-linux
index 83afeebc7f2..a1e88de623c 100644
--- a/jdk/make/sun/awt/mapfile-vers-linux
+++ b/jdk/make/sun/awt/mapfile-vers-linux
@@ -407,6 +407,7 @@ SUNWprivate_1.1 {
Java_sun_awt_X11GraphicsConfig_getNumColors;
Java_sun_awt_X11GraphicsConfig_getXResolution;
Java_sun_awt_X11GraphicsConfig_getYResolution;
+ Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable;
Java_sun_awt_X11GraphicsDevice_isDBESupported;
Java_sun_awt_X11GraphicsDevice_getDisplay;
Java_sun_awt_X11GraphicsDevice_getDoubleBufferVisuals;
diff --git a/jdk/make/sun/xawt/mapfile-vers b/jdk/make/sun/xawt/mapfile-vers
index 3f6bcdeb821..7bffbfd52bd 100644
--- a/jdk/make/sun/xawt/mapfile-vers
+++ b/jdk/make/sun/xawt/mapfile-vers
@@ -217,6 +217,7 @@ SUNWprivate_1.1 {
Java_sun_awt_X11GraphicsConfig_createBackBuffer;
Java_sun_awt_X11GraphicsConfig_destroyBackBuffer;
Java_sun_awt_X11GraphicsConfig_swapBuffers;
+ Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable;
Java_java_awt_Insets_initIDs;
Java_java_awt_KeyboardFocusManager_initIDs;
Java_java_awt_Font_initIDs;
diff --git a/jdk/src/share/classes/com/sun/awt/AWTUtilities.java b/jdk/src/share/classes/com/sun/awt/AWTUtilities.java
index 818ac6f53e0..bf0628b4712 100644
--- a/jdk/src/share/classes/com/sun/awt/AWTUtilities.java
+++ b/jdk/src/share/classes/com/sun/awt/AWTUtilities.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2008-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
@@ -26,17 +26,37 @@
package com.sun.awt;
import java.awt.*;
-import sun.awt.AWTAccessor;
+import sun.awt.AWTAccessor;
+import sun.awt.SunToolkit;
/**
* A collection of utility methods for AWT.
*
* The functionality provided by the static methods of the class includes:
*
+ *
Setting shapes on top-level windows
+ *
Setting a constant alpha value for each pixel of a top-level window
+ *
Making a window non-opaque, after that it paints only explicitly
+ * painted pixels on the screen, with arbitrary alpha values for every pixel.
*
Setting a 'mixing-cutout' shape for a component.
*
*
+ * A "top-level window" is an instance of the {@code Window} class (or its
+ * descendant, such as {@code JFrame}).
+ *
+ * Some of the mentioned features may not be supported by the native platform.
+ * To determine whether a particular feature is supported, the user must use
+ * the {@code isTranslucencySupported()} method of the class passing a desired
+ * translucency kind (a member of the {@code Translucency} enum) as an
+ * argument.
+ *
+ * The per-pixel alpha feature also requires the user to create her/his
+ * windows using a translucency-capable graphics configuration.
+ * The {@code isTranslucencyCapable()} method must
+ * be used to verify whether any given GraphicsConfiguration supports
+ * the trasnlcency effects.
+ *
* WARNING: This class is an implementation detail and only meant
* for limited use outside of the core platform. This API may change
* drastically between update release, and it may even be
@@ -50,6 +70,344 @@ public final class AWTUtilities {
private AWTUtilities() {
}
+ /** Kinds of translucency supported by the underlying system.
+ * @see #isTranslucencySupported
+ */
+ public static enum Translucency {
+ /**
+ * Represents support in the underlying system for windows each pixel
+ * of which is guaranteed to be either completely opaque, with
+ * an alpha value of 1.0, or completely transparent, with an alpha
+ * value of 0.0.
+ */
+ PERPIXEL_TRANSPARENT,
+
+ /**
+ * Represents support in the underlying system for windows all of
+ * the pixels of which have the same alpha value between or including
+ * 0.0 and 1.0.
+ */
+ TRANSLUCENT,
+
+ /**
+ * Represents support in the underlying system for windows that
+ * contain or might contain pixels with arbitrary alpha values
+ * between and including 0.0 and 1.0.
+ */
+ PERPIXEL_TRANSLUCENT;
+ }
+
+
+ /**
+ * Returns whether the given level of translucency is supported by
+ * the underlying system.
+ *
+ * Note that this method may sometimes return the value
+ * indicating that the particular level is supported, but
+ * the native windowing system may still not support the
+ * given level of translucency (due to the bugs in
+ * the windowing system).
+ *
+ * @param translucencyKind a kind of translucency support
+ * (either PERPIXEL_TRANSPARENT,
+ * TRANSLUCENT, or PERPIXEL_TRANSLUCENT)
+ * @return whether the given translucency kind is supported
+ */
+ public static boolean isTranslucencySupported(Translucency translucencyKind) {
+ switch (translucencyKind) {
+ case PERPIXEL_TRANSPARENT:
+ return isWindowShapingSupported();
+ case TRANSLUCENT:
+ return isWindowOpacitySupported();
+ case PERPIXEL_TRANSLUCENT:
+ return isWindowTranslucencySupported();
+ }
+ return false;
+ }
+
+
+ /**
+ * Returns whether the windowing system supports changing the opacity
+ * value of top-level windows.
+ * Note that this method may sometimes return true, but the native
+ * windowing system may still not support the concept of
+ * translucency (due to the bugs in the windowing system).
+ */
+ private static boolean isWindowOpacitySupported() {
+ Toolkit curToolkit = Toolkit.getDefaultToolkit();
+ if (!(curToolkit instanceof SunToolkit)) {
+ return false;
+ }
+ return ((SunToolkit)curToolkit).isWindowOpacitySupported();
+ }
+
+ /**
+ * Set the opacity of the window. The opacity is at the range [0..1].
+ * Note that setting the opacity level of 0 may or may not disable
+ * the mouse event handling on this window. This is
+ * a platform-dependent behavior.
+ *
+ * In order for this method to enable the translucency effect,
+ * the isTranslucencySupported() method should indicate that the
+ * TRANSLUCENT level of translucency is supported.
+ *
+ *
Also note that the window must not be in the full-screen mode
+ * when setting the opacity value < 1.0f. Otherwise
+ * the IllegalArgumentException is thrown.
+ *
+ * @param window the window to set the opacity level to
+ * @param opacity the opacity level to set to the window
+ * @throws NullPointerException if the window argument is null
+ * @throws IllegalArgumentException if the opacity is out of
+ * the range [0..1]
+ * @throws IllegalArgumentException if the window is in full screen mode,
+ * and the opacity is less than 1.0f
+ * @throws UnsupportedOperationException if the TRANSLUCENT translucency
+ * kind is not supported
+ */
+ public static void setWindowOpacity(Window window, float opacity) {
+ if (window == null) {
+ throw new NullPointerException(
+ "The window argument should not be null.");
+ }
+
+ AWTAccessor.getWindowAccessor().setOpacity(window, opacity);
+ }
+
+ /**
+ * Get the opacity of the window. If the opacity has not
+ * yet being set, this method returns 1.0.
+ *
+ * @param window the window to get the opacity level from
+ * @throws NullPointerException if the window argument is null
+ */
+ public static float getWindowOpacity(Window window) {
+ if (window == null) {
+ throw new NullPointerException(
+ "The window argument should not be null.");
+ }
+
+ return AWTAccessor.getWindowAccessor().getOpacity(window);
+ }
+
+ /**
+ * Returns whether the windowing system supports changing the shape
+ * of top-level windows.
+ * Note that this method may sometimes return true, but the native
+ * windowing system may still not support the concept of
+ * shaping (due to the bugs in the windowing system).
+ */
+ public static boolean isWindowShapingSupported() {
+ Toolkit curToolkit = Toolkit.getDefaultToolkit();
+ if (!(curToolkit instanceof SunToolkit)) {
+ return false;
+ }
+ return ((SunToolkit)curToolkit).isWindowShapingSupported();
+ }
+
+ /**
+ * Returns an object that implements the Shape interface and represents
+ * the shape previously set with the call to the setWindowShape() method.
+ * If no shape has been set yet, or the shape has been reset to null,
+ * this method returns null.
+ *
+ * @param window the window to get the shape from
+ * @return the current shape of the window
+ * @throws NullPointerException if the window argument is null
+ */
+ public static Shape getWindowShape(Window window) {
+ if (window == null) {
+ throw new NullPointerException(
+ "The window argument should not be null.");
+ }
+ return AWTAccessor.getWindowAccessor().getShape(window);
+ }
+
+ /**
+ * Sets a shape for the given window.
+ * If the shape argument is null, this methods restores
+ * the default shape making the window rectangular.
+ *
Note that in order to set a shape, the window must be undecorated.
+ * If the window is decorated, this method ignores the {@code shape}
+ * argument and resets the shape to null.
+ *
Also note that the window must not be in the full-screen mode
+ * when setting a non-null shape. Otherwise the IllegalArgumentException
+ * is thrown.
+ *
Depending on the platform, the method may return without
+ * effecting the shape of the window if the window has a non-null warning
+ * string ({@link Window#getWarningString()}). In this case the passed
+ * shape object is ignored.
+ *
+ * @param window the window to set the shape to
+ * @param shape the shape to set to the window
+ * @throws NullPointerException if the window argument is null
+ * @throws IllegalArgumentException if the window is in full screen mode,
+ * and the shape is not null
+ * @throws UnsupportedOperationException if the PERPIXEL_TRANSPARENT
+ * translucency kind is not supported
+ */
+ public static void setWindowShape(Window window, Shape shape) {
+ if (window == null) {
+ throw new NullPointerException(
+ "The window argument should not be null.");
+ }
+ AWTAccessor.getWindowAccessor().setShape(window, shape);
+ }
+
+ private static boolean isWindowTranslucencySupported() {
+ /*
+ * Per-pixel alpha is supported if all the conditions are TRUE:
+ * 1. The toolkit is a sort of SunToolkit
+ * 2. The toolkit supports translucency in general
+ * (isWindowTranslucencySupported())
+ * 3. There's at least one translucency-capable
+ * GraphicsConfiguration
+ */
+
+ Toolkit curToolkit = Toolkit.getDefaultToolkit();
+ if (!(curToolkit instanceof SunToolkit)) {
+ return false;
+ }
+
+ if (!((SunToolkit)curToolkit).isWindowTranslucencySupported()) {
+ return false;
+ }
+
+ GraphicsEnvironment env =
+ GraphicsEnvironment.getLocalGraphicsEnvironment();
+
+ // If the default GC supports translucency return true.
+ // It is important to optimize the verification this way,
+ // see CR 6661196 for more details.
+ if (isTranslucencyCapable(env.getDefaultScreenDevice()
+ .getDefaultConfiguration()))
+ {
+ return true;
+ }
+
+ // ... otherwise iterate through all the GCs.
+ GraphicsDevice[] devices = env.getScreenDevices();
+
+ for (int i = 0; i < devices.length; i++) {
+ GraphicsConfiguration[] configs = devices[i].getConfigurations();
+ for (int j = 0; j < configs.length; j++) {
+ if (isTranslucencyCapable(configs[j])) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Enables the per-pixel alpha support for the given window.
+ * Once the window becomes non-opaque (the isOpaque is set to false),
+ * the drawing sub-system is starting to respect the alpha value of each
+ * separate pixel. If a pixel gets painted with alpha color component
+ * equal to zero, it becomes visually transparent, if the alpha of the
+ * pixel is equal to 255, the pixel is fully opaque. Interim values
+ * of the alpha color component make the pixel semi-transparent (i.e.
+ * translucent).
+ *
Note that in order for the window to support the per-pixel alpha
+ * mode, the window must be created using the GraphicsConfiguration
+ * for which the {@link #isTranslucencyCapable}
+ * method returns true.
+ *
Also note that some native systems enable the per-pixel translucency
+ * mode for any window created using the translucency-compatible
+ * graphics configuration. However, it is highly recommended to always
+ * invoke the setWindowOpaque() method for these windows, at least for
+ * the sake of cross-platform compatibility reasons.
+ *
Also note that the window must not be in the full-screen mode
+ * when making it non-opaque. Otherwise the IllegalArgumentException
+ * is thrown.
+ *
If the window is a {@code Frame} or a {@code Dialog}, the window must
+ * be undecorated prior to enabling the per-pixel translucency effect (see
+ * {@link Frame#setUndecorated()} and/or {@link Dialog#setUndecorated()}).
+ * If the window becomes decorated through a subsequent call to the
+ * corresponding {@code setUndecorated()} method, the per-pixel
+ * translucency effect will be disabled and the opaque property reset to
+ * {@code true}.
+ *
Depending on the platform, the method may return without
+ * effecting the opaque property of the window if the window has a non-null
+ * warning string ({@link Window#getWarningString()}). In this case
+ * the passed 'isOpaque' value is ignored.
+ *
+ * @param window the window to set the shape to
+ * @param isOpaque whether the window must be opaque (true),
+ * or translucent (false)
+ * @throws NullPointerException if the window argument is null
+ * @throws IllegalArgumentException if the window uses
+ * a GraphicsConfiguration for which the
+ * {@code isTranslucencyCapable()}
+ * method returns false
+ * @throws IllegalArgumentException if the window is in full screen mode,
+ * and the isOpaque is false
+ * @throws IllegalArgumentException if the window is decorated and the
+ * isOpaque argument is {@code false}.
+ * @throws UnsupportedOperationException if the PERPIXEL_TRANSLUCENT
+ * translucency kind is not supported
+ */
+ public static void setWindowOpaque(Window window, boolean isOpaque) {
+ if (window == null) {
+ throw new NullPointerException(
+ "The window argument should not be null.");
+ }
+ if (!isOpaque && !isTranslucencySupported(Translucency.PERPIXEL_TRANSLUCENT)) {
+ throw new UnsupportedOperationException(
+ "The PERPIXEL_TRANSLUCENT translucency kind is not supported");
+ }
+ AWTAccessor.getWindowAccessor().setOpaque(window, isOpaque);
+ }
+
+ /**
+ * Returns whether the window is opaque or translucent.
+ *
+ * @param window the window to set the shape to
+ * @return whether the window is currently opaque (true)
+ * or translucent (false)
+ * @throws NullPointerException if the window argument is null
+ */
+ public static boolean isWindowOpaque(Window window) {
+ if (window == null) {
+ throw new NullPointerException(
+ "The window argument should not be null.");
+ }
+
+ return AWTAccessor.getWindowAccessor().isOpaque(window);
+ }
+
+ /**
+ * Verifies whether a given GraphicsConfiguration supports
+ * the PERPIXEL_TRANSLUCENT kind of translucency.
+ * All windows that are intended to be used with the {@link #setWindowOpaque}
+ * method must be created using a GraphicsConfiguration for which this method
+ * returns true.
+ *
Note that some native systems enable the per-pixel translucency
+ * mode for any window created using a translucency-capable
+ * graphics configuration. However, it is highly recommended to always
+ * invoke the setWindowOpaque() method for these windows, at least
+ * for the sake of cross-platform compatibility reasons.
+ *
+ * @param gc GraphicsConfiguration
+ * @throws NullPointerException if the gc argument is null
+ * @return whether the given GraphicsConfiguration supports
+ * the translucency effects.
+ */
+ public static boolean isTranslucencyCapable(GraphicsConfiguration gc) {
+ if (gc == null) {
+ throw new NullPointerException("The gc argument should not be null");
+ }
+ /*
+ return gc.isTranslucencyCapable();
+ */
+ Toolkit curToolkit = Toolkit.getDefaultToolkit();
+ if (!(curToolkit instanceof SunToolkit)) {
+ return false;
+ }
+ return ((SunToolkit)curToolkit).isTranslucencyCapable(gc);
+ }
+
/**
* Sets a 'mixing-cutout' shape for the given component.
*
diff --git a/jdk/src/share/classes/java/awt/Component.java b/jdk/src/share/classes/java/awt/Component.java
index afe091dccef..9828ddb5661 100644
--- a/jdk/src/share/classes/java/awt/Component.java
+++ b/jdk/src/share/classes/java/awt/Component.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1995-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1995-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
@@ -799,8 +799,24 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
}
+ // Whether this Component has had the background erase flag
+ // specified via SunToolkit.disableBackgroundErase(). This is
+ // needed in order to make this function work on X11 platforms,
+ // where currently there is no chance to interpose on the creation
+ // of the peer and therefore the call to XSetBackground.
+ transient boolean backgroundEraseDisabled;
+
static {
AWTAccessor.setComponentAccessor(new AWTAccessor.ComponentAccessor() {
+ public void setBackgroundEraseDisabled(Component comp, boolean disabled) {
+ comp.backgroundEraseDisabled = disabled;
+ }
+ public boolean getBackgroundEraseDisabled(Component comp) {
+ return comp.backgroundEraseDisabled;
+ }
+ public Rectangle getBounds(Component comp) {
+ return new Rectangle(comp.x, comp.y, comp.width, comp.height);
+ }
public void setMixingCutoutShape(Component comp, Shape shape) {
Region region = shape == null ? null :
Region.getInstance(shape, null);
@@ -7456,7 +7472,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
// sometimes most recent focus owner may be null, but focus owner is not
// e.g. we reset most recent focus owner if user removes focus owner
focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
- if (focusOwner != null && getContainingWindow(focusOwner) != window) {
+ if (focusOwner != null && focusOwner.getContainingWindow() != window) {
focusOwner = null;
}
}
@@ -8689,30 +8705,8 @@ public abstract class Component implements ImageObserver, MenuContainer,
* null, if component is not a part of window hierarchy
*/
Window getContainingWindow() {
- return getContainingWindow(this);
+ return SunToolkit.getContainingWindow(this);
}
- /**
- * Returns the Window ancestor of the component comp.
- * @return Window ancestor of the component or component by itself if it is Window;
- * null, if component is not a part of window hierarchy
- */
- static Window getContainingWindow(Component comp) {
- while (comp != null && !(comp instanceof Window)) {
- comp = comp.getParent();
- }
-
- return (Window)comp;
- }
-
-
-
-
-
-
-
-
-
-
/**
* Initialize JNI field and method IDs
@@ -9827,4 +9821,29 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
// ****************** END OF MIXING CODE ********************************
+
+ private static boolean doesClassImplement(Class cls, String interfaceName) {
+ if (cls == null) return false;
+
+ for (Class c : cls.getInterfaces()) {
+ if (c.getName().equals(interfaceName)) {
+ return true;
+ }
+ }
+ return doesClassImplement(cls.getSuperclass(), interfaceName);
+ }
+
+ /**
+ * Checks that the given object implements the given interface.
+ * @param obj Object to be checked
+ * @param interfaceName The name of the interface. Must be fully-qualified interface name.
+ * @return true, if this object implements the given interface,
+ * false, otherwise, or if obj or interfaceName is null
+ */
+ static boolean doesImplement(Object obj, String interfaceName) {
+ if (obj == null) return false;
+ if (interfaceName == null) return false;
+
+ return doesClassImplement(obj.getClass(), interfaceName);
+ }
}
diff --git a/jdk/src/share/classes/java/awt/Container.java b/jdk/src/share/classes/java/awt/Container.java
index 04425d5a45a..64de85477a7 100644
--- a/jdk/src/share/classes/java/awt/Container.java
+++ b/jdk/src/share/classes/java/awt/Container.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1995-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1995-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
@@ -167,6 +167,9 @@ public class Container extends Component {
transient int listeningBoundsChildren;
transient int descendantsCount;
+ /* Non-opaque window support -- see Window.setLayersOpaque */
+ transient Color preserveBackgroundColor = null;
+
/**
* JDK 1.1 serialVersionUID
*/
diff --git a/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java b/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java
index 5dd0d9061ff..71342bdaeed 100644
--- a/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java
+++ b/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java
@@ -479,7 +479,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
// that a Component outside of the focused Window receives a
// FOCUS_GAINED event. We synthesize a WINDOW_GAINED_FOCUS
// event in that case.
- final Window newFocusedWindow = Component.getContainingWindow(newFocusOwner);
+ final Window newFocusedWindow = SunToolkit.getContainingWindow(newFocusOwner);
final Window currentFocusedWindow = getGlobalFocusedWindow();
if (newFocusedWindow != null &&
newFocusedWindow != currentFocusedWindow)
diff --git a/jdk/src/share/classes/java/awt/GraphicsConfiguration.java b/jdk/src/share/classes/java/awt/GraphicsConfiguration.java
index 03b147f8a43..c520d310bbe 100644
--- a/jdk/src/share/classes/java/awt/GraphicsConfiguration.java
+++ b/jdk/src/share/classes/java/awt/GraphicsConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1997-2007 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
@@ -434,4 +434,20 @@ public abstract class GraphicsConfiguration {
}
return defaultImageCaps;
}
+
+ /**
+ * Returns whether this GraphicsConfiguration supports
+ * the {@link GraphicsDevice.WindowTranslucency#PERPIXEL_TRANSLUCENT
+ * PERPIXEL_TRANSLUCENT} kind of translucency.
+ *
+ * @param gc GraphicsConfiguration
+ * @throws NullPointerException if the gc argument is null
+ * @return whether the given GraphicsConfiguration supports
+ * the translucency effects.
+ * @see Window#setBackground(Color)
+ */
+ /*public */boolean isTranslucencyCapable() {
+ // Overridden in subclasses
+ return false;
}
+}
diff --git a/jdk/src/share/classes/java/awt/GraphicsDevice.java b/jdk/src/share/classes/java/awt/GraphicsDevice.java
index 47b578129dd..920687150d9 100644
--- a/jdk/src/share/classes/java/awt/GraphicsDevice.java
+++ b/jdk/src/share/classes/java/awt/GraphicsDevice.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
@@ -27,7 +27,10 @@
package java.awt;
import java.awt.image.ColorModel;
+
+import sun.awt.AWTAccessor;
import sun.awt.AppContext;
+import sun.awt.SunToolkit;
/**
* The GraphicsDevice class describes the graphics devices
@@ -109,6 +112,31 @@ public abstract class GraphicsDevice {
*/
public final static int TYPE_IMAGE_BUFFER = 2;
+ /** Kinds of translucency supported by the underlying system.
+ * @see #isTranslucencySupported
+ */
+ /*public */static enum WindowTranslucency {
+ /**
+ * Represents support in the underlying system for windows each pixel
+ * of which is guaranteed to be either completely opaque, with
+ * an alpha value of 1.0, or completely transparent, with an alpha
+ * value of 0.0.
+ */
+ PERPIXEL_TRANSPARENT,
+ /**
+ * Represents support in the underlying system for windows all of
+ * the pixels of which have the same alpha value between or including
+ * 0.0 and 1.0.
+ */
+ TRANSLUCENT,
+ /**
+ * Represents support in the underlying system for windows that
+ * contain or might contain pixels with arbitrary alpha values
+ * between and including 0.0 and 1.0.
+ */
+ PERPIXEL_TRANSLUCENT;
+ }
+
/**
* Returns the type of this GraphicsDevice.
* @return the type of this GraphicsDevice, which can
@@ -235,6 +263,21 @@ public abstract class GraphicsDevice {
* @since 1.4
*/
public void setFullScreenWindow(Window w) {
+ if (w != null) {
+ //XXX: The actions should be documented in some non-update release.
+ /*
+ if (w.getShape() != null) {
+ w.setShape(w, null);
+ }
+ if (!w.isOpaque()) {
+ w.setOpaque(false);
+ }
+ if (w.getOpacity() < 1.0f) {
+ w.setOpacity(1.0f);
+ }
+ */
+ }
+
if (fullScreenWindow != null && windowedModeBounds != null) {
// if the window went into fs mode before it was realized it may
// have (0,0) dimensions
@@ -424,4 +467,94 @@ public abstract class GraphicsDevice {
public int getAvailableAcceleratedMemory() {
return -1;
}
+
+ /**
+ * Returns whether the given level of translucency is supported
+ * this graphics device.
+ *
+ * @param translucencyKind a kind of translucency support
+ * @return whether the given translucency kind is supported
+ */
+ /*public */boolean isWindowTranslucencySupported(WindowTranslucency translucencyKind) {
+ switch (translucencyKind) {
+ case PERPIXEL_TRANSPARENT:
+ return isWindowShapingSupported();
+ case TRANSLUCENT:
+ return isWindowOpacitySupported();
+ case PERPIXEL_TRANSLUCENT:
+ return isWindowPerpixelTranslucencySupported();
+ }
+ return false;
+ }
+
+ /**
+ * Returns whether the windowing system supports changing the shape
+ * of top-level windows.
+ * Note that this method may sometimes return true, but the native
+ * windowing system may still not support the concept of
+ * shaping (due to the bugs in the windowing system).
+ */
+ static boolean isWindowShapingSupported() {
+ Toolkit curToolkit = Toolkit.getDefaultToolkit();
+ if (!(curToolkit instanceof SunToolkit)) {
+ return false;
+ }
+ return ((SunToolkit)curToolkit).isWindowShapingSupported();
+ }
+
+ /**
+ * Returns whether the windowing system supports changing the opacity
+ * value of top-level windows.
+ * Note that this method may sometimes return true, but the native
+ * windowing system may still not support the concept of
+ * translucency (due to the bugs in the windowing system).
+ */
+ static boolean isWindowOpacitySupported() {
+ Toolkit curToolkit = Toolkit.getDefaultToolkit();
+ if (!(curToolkit instanceof SunToolkit)) {
+ return false;
+ }
+ return ((SunToolkit)curToolkit).isWindowOpacitySupported();
+ }
+
+ boolean isWindowPerpixelTranslucencySupported() {
+ /*
+ * Per-pixel alpha is supported if all the conditions are TRUE:
+ * 1. The toolkit is a sort of SunToolkit
+ * 2. The toolkit supports translucency in general
+ * (isWindowTranslucencySupported())
+ * 3. There's at least one translucency-capable
+ * GraphicsConfiguration
+ */
+ Toolkit curToolkit = Toolkit.getDefaultToolkit();
+ if (!(curToolkit instanceof SunToolkit)) {
+ return false;
+ }
+ if (!((SunToolkit)curToolkit).isWindowTranslucencySupported()) {
+ return false;
+ }
+
+ // TODO: cache translucency capable GC
+ return getTranslucencyCapableGC() != null;
+ }
+
+ GraphicsConfiguration getTranslucencyCapableGC() {
+ // If the default GC supports translucency return true.
+ // It is important to optimize the verification this way,
+ // see CR 6661196 for more details.
+ GraphicsConfiguration defaultGC = getDefaultConfiguration();
+ if (defaultGC.isTranslucencyCapable()) {
+ return defaultGC;
+ }
+
+ // ... otherwise iterate through all the GCs.
+ GraphicsConfiguration[] configs = getConfigurations();
+ for (int j = 0; j < configs.length; j++) {
+ if (configs[j].isTranslucencyCapable()) {
+ return configs[j];
+ }
+ }
+
+ return null;
+ }
}
diff --git a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java
index b84b93b021e..268eba915be 100644
--- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java
+++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java
@@ -2208,7 +2208,7 @@ public abstract class KeyboardFocusManager
boolean temporary, boolean focusedWindowChangeAllowed,
long time)
{
- Window parentWindow = Component.getContainingWindow(heavyweight);
+ Window parentWindow = SunToolkit.getContainingWindow(heavyweight);
if (parentWindow == null || !parentWindow.syncLWRequests) {
return false;
}
@@ -2542,7 +2542,7 @@ public abstract class KeyboardFocusManager
(HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER);
Component activeWindow = ((hwFocusRequest != null)
- ? Component.getContainingWindow(hwFocusRequest.heavyweight)
+ ? SunToolkit.getContainingWindow(hwFocusRequest.heavyweight)
: nativeFocusedWindow);
while (activeWindow != null &&
!((activeWindow instanceof Frame) ||
@@ -3013,8 +3013,8 @@ public abstract class KeyboardFocusManager
}
private static boolean focusedWindowChanged(Component to, Component from) {
- Window wto = Component.getContainingWindow(to);
- Window wfrom = Component.getContainingWindow(from);
+ Window wto = SunToolkit.getContainingWindow(to);
+ Window wfrom = SunToolkit.getContainingWindow(from);
if (wto == null && wfrom == null) {
return true;
}
@@ -3028,8 +3028,8 @@ public abstract class KeyboardFocusManager
}
private static boolean isTemporary(Component to, Component from) {
- Window wto = Component.getContainingWindow(to);
- Window wfrom = Component.getContainingWindow(from);
+ Window wto = SunToolkit.getContainingWindow(to);
+ Window wfrom = SunToolkit.getContainingWindow(from);
if (wto == null && wfrom == null) {
return false;
}
diff --git a/jdk/src/share/classes/java/awt/Window.java b/jdk/src/share/classes/java/awt/Window.java
index 2651729f20d..64c611ac3c3 100644
--- a/jdk/src/share/classes/java/awt/Window.java
+++ b/jdk/src/share/classes/java/awt/Window.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1995-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1995-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
@@ -27,6 +27,7 @@ package java.awt;
import java.awt.event.*;
import java.awt.im.InputContext;
import java.awt.image.BufferStrategy;
+import java.awt.image.BufferedImage;
import java.awt.peer.ComponentPeer;
import java.awt.peer.WindowPeer;
import java.beans.PropertyChangeListener;
@@ -49,6 +50,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.accessibility.*;
+import sun.awt.AWTAccessor;
import sun.awt.AppContext;
import sun.awt.CausedFocusEvent;
import sun.awt.SunToolkit;
@@ -291,6 +293,25 @@ public class Window extends Container implements Accessible {
*/
transient boolean isInShow = false;
+ /*
+ * Opacity level of the window
+ *
+ * @see #setOpacity(float)
+ * @see #getOpacity()
+ * @since 1.7
+ */
+ private float opacity = 1.0f;
+
+ /*
+ * The shape assigned to this window. This field is set to null if
+ * no shape is set (rectangular window).
+ *
+ * @see #getShape()
+ * @see #setShape(Shape)
+ * @since 1.7
+ */
+ private Shape shape = null;
+
private static final String base = "win";
private static int nameCounter = 0;
@@ -666,9 +687,9 @@ public class Window extends Container implements Accessible {
}
if (peer == null) {
peer = getToolkit().createWindow(this);
- }
- synchronized (allWindows) {
- allWindows.add(this);
+ synchronized (allWindows) {
+ allWindows.add(this);
+ }
}
super.addNotify();
}
@@ -2849,6 +2870,8 @@ public class Window extends Container implements Accessible {
if(aot) {
setAlwaysOnTop(aot); // since 1.5; subject to permission check
}
+ shape = (Shape)f.get("shape", null);
+ opacity = (Float)f.get("opacity", 1.0f);
deserializeResources(s);
}
@@ -3016,7 +3039,7 @@ public class Window extends Container implements Accessible {
Dimension windowSize = getSize();
// search a top-level of c
- Window componentWindow = Component.getContainingWindow(c);
+ Window componentWindow = SunToolkit.getContainingWindow(c);
if ((c == null) || (componentWindow == null)) {
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
gc = ge.getDefaultScreenDevice().getDefaultConfiguration();
@@ -3304,6 +3327,225 @@ public class Window extends Container implements Accessible {
}
+ // ******************** SHAPES & TRANSPARENCY CODE ********************
+
+ /**
+ * JavaDoc
+ */
+ /*public */float getOpacity() {
+ synchronized (getTreeLock()) {
+ return opacity;
+ }
+ }
+
+ /**
+ * JavaDoc
+ */
+ /*public */void setOpacity(float opacity) {
+ synchronized (getTreeLock()) {
+ if (opacity < 0.0f || opacity > 1.0f) {
+ throw new IllegalArgumentException(
+ "The value of opacity should be in the range [0.0f .. 1.0f].");
+ }
+ GraphicsConfiguration gc = getGraphicsConfiguration();
+ GraphicsDevice gd = gc.getDevice();
+ if (!gd.isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency.TRANSLUCENT)) {
+ throw new UnsupportedOperationException(
+ "TRANSLUCENT translucency is not supported.");
+ }
+ if ((gc.getDevice().getFullScreenWindow() == this) && (opacity < 1.0f)) {
+ throw new IllegalArgumentException(
+ "Setting opacity for full-screen window is not supported.");
+ }
+ this.opacity = opacity;
+ WindowPeer peer = (WindowPeer)getPeer();
+ if (peer != null) {
+ peer.setOpacity(opacity);
+ }
+ }
+ }
+
+ /**
+ * JavaDoc
+ */
+ /*public */Shape getShape() {
+ synchronized (getTreeLock()) {
+ return shape;
+ }
+ }
+
+ /**
+ * JavaDoc
+ *
+ * @param window the window to set the shape to
+ * @param shape the shape to set to the window
+ * @throws IllegalArgumentException if the window is in full screen mode,
+ * and the shape is not null
+ */
+ /*public */void setShape(Shape shape) {
+ synchronized (getTreeLock()) {
+ GraphicsConfiguration gc = getGraphicsConfiguration();
+ GraphicsDevice gd = gc.getDevice();
+ if (!gd.isWindowTranslucencySupported(
+ GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSPARENT))
+ {
+ throw new UnsupportedOperationException(
+ "PERPIXEL_TRANSPARENT translucency is not supported.");
+ }
+ if ((gc.getDevice().getFullScreenWindow() == this) && (shape != null)) {
+ throw new IllegalArgumentException(
+ "Setting shape for full-screen window is not supported.");
+ }
+ this.shape = shape;
+ WindowPeer peer = (WindowPeer)getPeer();
+ if (peer != null) {
+ peer.applyShape(shape == null ? null : Region.getInstance(shape, null));
+ }
+ }
+ }
+
+ /**
+ * JavaDoc
+ */
+/*
+ @Override
+ public void setBackground(Color bgColor) {
+ int alpha = bgColor.getAlpha();
+ if (alpha < 255) { // non-opaque window
+ GraphicsConfiguration gc = getGraphicsConfiguration();
+ GraphicsDevice gd = gc.getDevice();
+ if (gc.getDevice().getFullScreenWindow() == this) {
+ throw new IllegalArgumentException(
+ "Making full-screen window non opaque is not supported.");
+ }
+ if (!gc.isTranslucencyCapable()) {
+ GraphicsConfiguration capableGC = gd.getTranslucencyCapableGC();
+ if (capableGC == null) {
+ throw new IllegalArgumentException(
+ "PERPIXEL_TRANSLUCENT translucency is not supported");
+ }
+ // TODO: change GC
+ }
+ setLayersOpaque(this, false);
+ }
+
+ super.setBackground(bgColor);
+
+ WindowPeer peer = (WindowPeer)getPeer();
+ if (peer != null) {
+ peer.setOpaque(alpha == 255);
+ }
+ }
+*/
+
+ private transient boolean opaque = true;
+
+ void setOpaque(boolean opaque) {
+ synchronized (getTreeLock()) {
+ GraphicsConfiguration gc = getGraphicsConfiguration();
+ if (!opaque && !com.sun.awt.AWTUtilities.isTranslucencyCapable(gc)) {
+ throw new IllegalArgumentException(
+ "The window must use a translucency-compatible graphics configuration");
+ }
+ if (!com.sun.awt.AWTUtilities.isTranslucencySupported(
+ com.sun.awt.AWTUtilities.Translucency.PERPIXEL_TRANSLUCENT))
+ {
+ throw new UnsupportedOperationException(
+ "PERPIXEL_TRANSLUCENT translucency is not supported.");
+ }
+ if ((gc.getDevice().getFullScreenWindow() == this) && !opaque) {
+ throw new IllegalArgumentException(
+ "Making full-screen window non opaque is not supported.");
+ }
+ setLayersOpaque(this, opaque);
+ this.opaque = opaque;
+ WindowPeer peer = (WindowPeer)getPeer();
+ if (peer != null) {
+ peer.setOpaque(opaque);
+ }
+ }
+ }
+
+ private void updateWindow(BufferedImage backBuffer) {
+ synchronized (getTreeLock()) {
+ WindowPeer peer = (WindowPeer)getPeer();
+ if (peer != null) {
+ peer.updateWindow(backBuffer);
+ }
+ }
+ }
+
+ private static final Color TRANSPARENT_BACKGROUND_COLOR = new Color(0, 0, 0, 0);
+
+ private static void setLayersOpaque(Component component, boolean isOpaque) {
+ // Shouldn't use instanceof to avoid loading Swing classes
+ // if it's a pure AWT application.
+ if (Component.doesImplement(component, "javax.swing.RootPaneContainer")) {
+ javax.swing.RootPaneContainer rpc = (javax.swing.RootPaneContainer)component;
+ javax.swing.JRootPane root = rpc.getRootPane();
+ javax.swing.JLayeredPane lp = root.getLayeredPane();
+ Container c = root.getContentPane();
+ javax.swing.JComponent content =
+ (c instanceof javax.swing.JComponent) ? (javax.swing.JComponent)c : null;
+ javax.swing.JComponent gp =
+ (rpc.getGlassPane() instanceof javax.swing.JComponent) ?
+ (javax.swing.JComponent)rpc.getGlassPane() : null;
+ if (gp != null) {
+ gp.setDoubleBuffered(isOpaque);
+ }
+ lp.setOpaque(isOpaque);
+ root.setOpaque(isOpaque);
+ root.setDoubleBuffered(isOpaque); //XXX: the "white rect" workaround
+ if (content != null) {
+ content.setOpaque(isOpaque);
+ content.setDoubleBuffered(isOpaque); //XXX: the "white rect" workaround
+
+ // Iterate down one level to see whether we have a JApplet
+ // (which is also a RootPaneContainer) which requires processing
+ int numChildren = content.getComponentCount();
+ if (numChildren > 0) {
+ Component child = content.getComponent(0);
+ // It's OK to use instanceof here because we've
+ // already loaded the RootPaneContainer class by now
+ if (child instanceof javax.swing.RootPaneContainer) {
+ setLayersOpaque(child, isOpaque);
+ }
+ }
+ }
+ }
+
+ Color bg = component.getBackground();
+ boolean hasTransparentBg = TRANSPARENT_BACKGROUND_COLOR.equals(bg);
+
+ Container container = null;
+ if (component instanceof Container) {
+ container = (Container) component;
+ }
+
+ if (isOpaque) {
+ if (hasTransparentBg) {
+ // Note: we use the SystemColor.window color as the default.
+ // This color is used in the WindowPeer implementations to
+ // initialize the background color of the window if it is null.
+ // (This might not be the right thing to do for other
+ // RootPaneContainers we might be invoked with)
+ Color newColor = null;
+ if (container != null && container.preserveBackgroundColor != null) {
+ newColor = container.preserveBackgroundColor;
+ } else {
+ newColor = SystemColor.window;
+ }
+ component.setBackground(newColor);
+ }
+ } else {
+ if (!hasTransparentBg && container != null) {
+ container.preserveBackgroundColor = bg;
+ }
+ component.setBackground(TRANSPARENT_BACKGROUND_COLOR);
+ }
+ }
+
+
// ************************** MIXING CODE *******************************
// A window has a parent, but it does NOT have a container
@@ -3341,6 +3583,42 @@ public class Window extends Container implements Accessible {
// ****************** END OF MIXING CODE ********************************
+ static {
+ AWTAccessor.setWindowAccessor(new AWTAccessor.WindowAccessor() {
+ public float getOpacity(Window window) {
+ return window.opacity;
+ }
+ public void setOpacity(Window window, float opacity) {
+ window.setOpacity(opacity);
+ }
+ public Shape getShape(Window window) {
+ return window.getShape();
+ }
+ public void setShape(Window window, Shape shape) {
+ window.setShape(shape);
+ }
+ public boolean isOpaque(Window window) {
+ /*
+ return window.getBackground().getAlpha() < 255;
+ */
+ synchronized (window.getTreeLock()) {
+ return window.opaque;
+ }
+ }
+ public void setOpaque(Window window, boolean opaque) {
+ /*
+ Color bg = window.getBackground();
+ window.setBackground(new Color(bg.getRed(), bg.getGreen(), bg.getBlue(),
+ opaque ? 255 : 0));
+ */
+ window.setOpaque(opaque);
+ }
+ public void updateWindow(Window window, BufferedImage backBuffer) {
+ window.updateWindow(backBuffer);
+ }
+ }); // WindowAccessor
+ } // static
+
} // class Window
diff --git a/jdk/src/share/classes/java/awt/peer/WindowPeer.java b/jdk/src/share/classes/java/awt/peer/WindowPeer.java
index 7b5da857f40..8a2589b9c8e 100644
--- a/jdk/src/share/classes/java/awt/peer/WindowPeer.java
+++ b/jdk/src/share/classes/java/awt/peer/WindowPeer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1995-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1995-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
@@ -27,6 +27,8 @@ package java.awt.peer;
import java.awt.*;
+import java.awt.image.BufferedImage;
+
/**
* The peer interface for {@link Window}.
*
@@ -92,4 +94,26 @@ public interface WindowPeer extends ContainerPeer {
* @see Window#setIconImages(java.util.List)
*/
void updateIconImages();
+
+ /**
+ * Sets the level of opacity for the window.
+ *
+ * @see Window#setOpacity(float)
+ */
+ void setOpacity(float opacity);
+
+ /**
+ * Enables the per-pixel alpha support for the window.
+ *
+ * @see Window#setBackground(Color)
+ */
+ void setOpaque(boolean isOpaque);
+
+ /**
+ * Updates the native part of non-opaque window using
+ * the given image with color+alpha values for each pixel.
+ *
+ * @see Window#setBackground(Color)
+ */
+ void updateWindow(BufferedImage backBuffer);
}
diff --git a/jdk/src/share/classes/javax/swing/RepaintManager.java b/jdk/src/share/classes/javax/swing/RepaintManager.java
index b0e6c048f62..5fc08a1ccdf 100644
--- a/jdk/src/share/classes/javax/swing/RepaintManager.java
+++ b/jdk/src/share/classes/javax/swing/RepaintManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1997-2007 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
@@ -34,6 +34,7 @@ import java.security.AccessController;
import java.util.*;
import java.applet.*;
+import sun.awt.AWTAccessor;
import sun.awt.AppContext;
import sun.awt.DisplayChangedListener;
import sun.awt.SunToolkit;
@@ -716,6 +717,44 @@ public class RepaintManager
}
}
+ private Map
+ updateWindows(Map dirtyComponents)
+ {
+ Toolkit toolkit = Toolkit.getDefaultToolkit();
+ if (!(toolkit instanceof SunToolkit &&
+ ((SunToolkit)toolkit).needUpdateWindow()))
+ {
+ return dirtyComponents;
+ }
+
+ Set windows = new HashSet();
+ Set dirtyComps = dirtyComponents.keySet();
+ for (Iterator it = dirtyComps.iterator(); it.hasNext();) {
+ Component dirty = it.next();
+ Window window = dirty instanceof Window ?
+ (Window)dirty :
+ SwingUtilities.getWindowAncestor(dirty);
+
+ if (window != null &&
+ !AWTAccessor.getWindowAccessor().isOpaque(window))
+ {
+ // if this component's toplevel is perpixel translucent, it will
+ // be repainted below
+ it.remove();
+ // add to the set of windows to update (so that we don't update
+ // the window many times for each component to be repainted that
+ // belongs to this window)
+ windows.add(window);
+ }
+ }
+
+ for (Window window : windows) {
+ AWTAccessor.getWindowAccessor().updateWindow(window, null);
+ }
+
+ return dirtyComponents;
+ }
+
/**
* Paint all of the components that have been marked dirty.
*
@@ -749,6 +788,10 @@ public class RepaintManager
int localBoundsW;
Enumeration keys;
+ // the components belonging to perpixel-translucent windows will be
+ // removed from the list
+ tmpDirtyComponents = updateWindows(tmpDirtyComponents);
+
roots = new ArrayList(count);
for (Component dirty : tmpDirtyComponents.keySet()) {
diff --git a/jdk/src/share/classes/sun/awt/AWTAccessor.java b/jdk/src/share/classes/sun/awt/AWTAccessor.java
index 41b933c4a61..94d0bb25f0b 100644
--- a/jdk/src/share/classes/sun/awt/AWTAccessor.java
+++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2009 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2008-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
@@ -26,6 +26,9 @@
package sun.awt;
import java.awt.*;
+import java.awt.geom.Point2D;
+import java.awt.image.BufferedImage;
+
import sun.misc.Unsafe;
/** The AWTAccessor utility class.
@@ -35,37 +38,124 @@ import sun.misc.Unsafe;
* for another example.
*/
public final class AWTAccessor {
+
private static final Unsafe unsafe = Unsafe.getUnsafe();
- /** We don't need any objects of this class.
+ /*
+ * We don't need any objects of this class.
* It's rather a collection of static methods
* and interfaces.
*/
private AWTAccessor() {
}
- /** An accessor for the java.awt.Component class.
+ /*
+ * An interface of accessor for the java.awt.Component class.
*/
public interface ComponentAccessor {
- // See 6797587
- // Also see: 6776743, 6768307, and 6768332.
- /**
+ /*
+ * Sets whether the native background erase for a component
+ * has been disabled via SunToolkit.disableBackgroundErase().
+ */
+ void setBackgroundEraseDisabled(Component comp, boolean disabled);
+ /*
+ * Indicates whether the native background erase for a
+ * component has been disabled via
+ * SunToolkit.disableBackgroundErase().
+ */
+ boolean getBackgroundEraseDisabled(Component comp);
+ /*
+ *
+ * Gets the bounds of this component in the form of a
+ * Rectangle object. The bounds specify this
+ * component's width, height, and location relative to
+ * its parent.
+ */
+ Rectangle getBounds(Component comp);
+ /*
* Sets the shape of a lw component to cut out from hw components.
+ *
+ * See 6797587, 6776743, 6768307, and 6768332 for details
*/
void setMixingCutoutShape(Component comp, Shape shape);
}
- /* The java.awt.Component class accessor object.
+ /*
+ * An interface of accessor for java.awt.Window class.
+ */
+ public interface WindowAccessor {
+ /*
+ * Get opacity level of the given window.
+ */
+ float getOpacity(Window window);
+ /*
+ * Set opacity level to the given window.
+ */
+ void setOpacity(Window window, float opacity);
+ /*
+ * Get a shape assigned to the given window.
+ */
+ Shape getShape(Window window);
+ /*
+ * Set a shape to the given window.
+ */
+ void setShape(Window window, Shape shape);
+ /*
+ * Identify whether the given window is opaque (true)
+ * or translucent (false).
+ */
+ boolean isOpaque(Window window);
+ /*
+ * Set the opaque preoperty to the given window.
+ */
+ void setOpaque(Window window, boolean isOpaque);
+ /*
+ * Update the image of a non-opaque (translucent) window.
+ */
+ void updateWindow(Window window, BufferedImage backBuffer);
+ }
+
+ /*
+ * An accessor for the AWTEvent class.
+ */
+ public interface AWTEventAccessor {
+ /*
+ *
+ * Sets the flag on this AWTEvent indicating that it was
+ * generated by the system.
+ */
+ void setSystemGenerated(AWTEvent ev);
+ /*
+ *
+ * Indicates whether this AWTEvent was generated by the system.
+ */
+ boolean isSystemGenerated(AWTEvent ev);
+ }
+
+ /*
+ * The java.awt.Component class accessor object.
*/
private static ComponentAccessor componentAccessor;
- /** Set an accessor object for the java.awt.Component class.
+ /*
+ * The java.awt.Window class accessor object.
+ */
+ private static WindowAccessor windowAccessor;
+
+ /*
+ * The java.awt.AWTEvent class accessor object.
+ */
+ private static AWTEventAccessor awtEventAccessor;
+
+ /*
+ * Set an accessor object for the java.awt.Component class.
*/
public static void setComponentAccessor(ComponentAccessor ca) {
componentAccessor = ca;
}
- /** Retrieve the accessor object for the java.awt.Window class.
+ /*
+ * Retrieve the accessor object for the java.awt.Window class.
*/
public static ComponentAccessor getComponentAccessor() {
if (componentAccessor == null) {
@@ -74,4 +164,35 @@ public final class AWTAccessor {
return componentAccessor;
}
+
+ /*
+ * Set an accessor object for the java.awt.Window class.
+ */
+ public static void setWindowAccessor(WindowAccessor wa) {
+ windowAccessor = wa;
+ }
+
+ /*
+ * Retrieve the accessor object for the java.awt.Window class.
+ */
+ public static WindowAccessor getWindowAccessor() {
+ if (windowAccessor == null) {
+ unsafe.ensureClassInitialized(Window.class);
+ }
+ return windowAccessor;
+ }
+
+ /*
+ * Set an accessor object for the java.awt.AWTEvent class.
+ */
+ public static void setAWTEventAccessor(AWTEventAccessor aea) {
+ awtEventAccessor = aea;
+ }
+
+ /*
+ * Retrieve the accessor object for the java.awt.AWTEvent class.
+ */
+ public static AWTEventAccessor getAWTEventAccessor() {
+ return awtEventAccessor;
+ }
}
diff --git a/jdk/src/share/classes/sun/awt/EmbeddedFrame.java b/jdk/src/share/classes/sun/awt/EmbeddedFrame.java
index d7450bebe1d..f636da47191 100644
--- a/jdk/src/share/classes/sun/awt/EmbeddedFrame.java
+++ b/jdk/src/share/classes/sun/awt/EmbeddedFrame.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -585,5 +585,12 @@ public abstract class EmbeddedFrame extends Frame
}
public void updateMinimumSize() {
}
- }
+
+ public void setOpacity(float opacity) {
+ }
+ public void setOpaque(boolean isOpaque) {
+ }
+ public void updateWindow(BufferedImage backBuffer) {
+ }
+ }
} // class EmbeddedFrame
diff --git a/jdk/src/share/classes/sun/awt/SunToolkit.java b/jdk/src/share/classes/sun/awt/SunToolkit.java
index 7c6f74856a9..ac375d836fd 100644
--- a/jdk/src/share/classes/sun/awt/SunToolkit.java
+++ b/jdk/src/share/classes/sun/awt/SunToolkit.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
@@ -32,14 +32,10 @@ import java.awt.dnd.peer.DragSourceContextPeer;
import java.awt.peer.*;
import java.awt.event.WindowEvent;
import java.awt.event.KeyEvent;
-import java.awt.im.spi.InputMethodDescriptor;
import java.awt.image.*;
-import java.awt.geom.AffineTransform;
import java.awt.TrayIcon;
import java.awt.SystemTray;
-import java.io.*;
import java.net.URL;
-import java.net.JarURLConnection;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
@@ -49,7 +45,6 @@ import java.util.logging.Logger;
import sun.misc.SoftCache;
import sun.font.FontDesignMetrics;
import sun.awt.im.InputContext;
-import sun.awt.im.SimpleInputMethodWindow;
import sun.awt.image.*;
import sun.security.action.GetPropertyAction;
import sun.security.action.GetBooleanAction;
@@ -824,16 +819,31 @@ public abstract class SunToolkit extends Toolkit
}
/**
- * Disables erasing of background on the canvas before painting
- * if this is supported by the current toolkit.
- *
- * @throws IllegalStateException if the canvas is not displayable
- * @see java.awt.Component#isDisplayable
+ * Disables erasing of background on the canvas before painting if
+ * this is supported by the current toolkit. It is recommended to
+ * call this method early, before the Canvas becomes displayable,
+ * because some Toolkit implementations do not support changing
+ * this property once the Canvas becomes displayable.
*/
public void disableBackgroundErase(Canvas canvas) {
- if (!canvas.isDisplayable()) {
- throw new IllegalStateException("Canvas must have a valid peer");
- }
+ disableBackgroundEraseImpl(canvas);
+ }
+
+ /**
+ * Disables the native erasing of the background on the given
+ * component before painting if this is supported by the current
+ * toolkit. This only has an effect for certain components such as
+ * Canvas, Panel and Window. It is recommended to call this method
+ * early, before the Component becomes displayable, because some
+ * Toolkit implementations do not support changing this property
+ * once the Component becomes displayable.
+ */
+ public void disableBackgroundErase(Component component) {
+ disableBackgroundEraseImpl(component);
+ }
+
+ private void disableBackgroundEraseImpl(Component component) {
+ AWTAccessor.getComponentAccessor().setBackgroundEraseDisabled(component, true);
}
/**
@@ -1972,6 +1982,18 @@ public abstract class SunToolkit extends Toolkit
AWTAutoShutdown.getInstance().dumpPeers(aLog);
}
+ /**
+ * Returns the Window ancestor of the component comp.
+ * @return Window ancestor of the component or component by itself if it is Window;
+ * null, if component is not a part of window hierarchy
+ */
+ public static Window getContainingWindow(Component comp) {
+ while (comp != null && !(comp instanceof Window)) {
+ comp = comp.getParent();
+ }
+ return (Window)comp;
+ }
+
private static Boolean sunAwtDisableMixing = null;
/**
@@ -1995,6 +2017,73 @@ public abstract class SunToolkit extends Toolkit
public boolean isNativeGTKAvailable() {
return false;
}
+
+ // Cosntant alpha
+ public boolean isWindowOpacitySupported() {
+ return false;
+ }
+
+ // Shaping
+ public boolean isWindowShapingSupported() {
+ return false;
+ }
+
+ // Per-pixel alpha
+ public boolean isWindowTranslucencySupported() {
+ return false;
+ }
+
+ public boolean isTranslucencyCapable(GraphicsConfiguration gc) {
+ return false;
+ }
+
+ /**
+ * Returns whether or not a containing top level window for the passed
+ * component is
+ * {@link com.sun.awt.AWTUtilities.Translucency#PERPIXEL_TRANSLUCENT PERPIXEL_TRANSLUCENT}.
+ *
+ * @param c a Component which toplevel's to check
+ * @return {@code true} if the passed component is not null and has a
+ * containing toplevel window which is opaque (so per-pixel translucency
+ * is not enabled), {@code false} otherwise
+ * @see com.sun.awt.AWTUtilities.Translucency#PERPIXEL_TRANSLUCENT
+ * @see com.sun.awt.AWTUtilities#isWindowOpaque(Window)
+ */
+ public static boolean isContainingTopLevelOpaque(Component c) {
+ Window w = getContainingWindow(c);
+ // return w != null && (w).isOpaque();
+ return w != null && com.sun.awt.AWTUtilities.isWindowOpaque(w);
+ }
+
+ /**
+ * Returns whether or not a containing top level window for the passed
+ * component is
+ * {@link com.sun.awt.AWTUtilities.Translucency#TRANSLUCENT TRANSLUCENT}.
+ *
+ * @param c a Component which toplevel's to check
+ * @return {@code true} if the passed component is not null and has a
+ * containing toplevel window which has opacity less than
+ * 1.0f (which means that it is translucent), {@code false} otherwise
+ * @see com.sun.awt.AWTUtilities.Translucency#TRANSLUCENT
+ * @see com.sun.awt.AWTUtilities#getWindowOpacity(Window)
+ */
+ public static boolean isContainingTopLevelTranslucent(Component c) {
+ Window w = getContainingWindow(c);
+ // return w != null && (w).getOpacity() < 1.0f;
+ return w != null && com.sun.awt.AWTUtilities.getWindowOpacity((Window)w) < 1.0f;
+ }
+
+ /**
+ * Returns whether the native system requires using the peer.updateWindow()
+ * method to update the contents of a non-opaque window, or if usual
+ * painting procedures are sufficient. The default return value covers
+ * the X11 systems. On MS Windows this method is overriden in WToolkit
+ * to return true.
+ */
+ public boolean needUpdateWindow() {
+ return false;
+ }
+
} // class SunToolkit
diff --git a/jdk/src/share/native/sun/awt/utility/rect.c b/jdk/src/share/native/sun/awt/utility/rect.c
new file mode 100644
index 00000000000..00bbecb6e11
--- /dev/null
+++ b/jdk/src/share/native/sun/awt/utility/rect.c
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2008-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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+#include "utility/rect.h"
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+/**
+ * bitsPerPixel must be 32 for now.
+ * outBuf must be large enough to conatin all the rectangles.
+ */
+int BitmapToYXBandedRectangles(int bitsPerPixel, int width, int height, unsigned char * buf, RECT_T * outBuf)
+{
+ //XXX: we might want to reuse the code in the splashscreen library,
+ // though we'd have to deal with the ALPHA_THRESHOLD and different
+ // image formats in this case.
+ int widthBytes = width * bitsPerPixel / 8;
+ int alignedWidth = (((widthBytes - 1) / 4) + 1) * 4;
+
+ RECT_T * out = outBuf;
+
+ RECT_T *pPrevLine = NULL, *pFirst = out, *pThis = pFirst;
+ int i, j, i0;
+ int length;
+
+ for (j = 0; j < height; j++) {
+ /* generate data for a scanline */
+
+ unsigned char *pSrc = (unsigned char *) buf + j * alignedWidth;
+ RECT_T *pLine = pThis;
+
+ i = 0;
+
+ do {
+ // pSrc[0,1,2] == B,G,R; pSrc[3] == Alpha
+ while (i < width && !pSrc[3]) {
+ pSrc += 4;
+ ++i;
+ }
+ if (i >= width)
+ break;
+ i0 = i;
+ while (i < width && pSrc[3]) {
+ pSrc += 4;
+ ++i;
+ }
+ RECT_SET(*pThis, i0, j, i - i0, 1);
+ ++pThis;
+ } while (i < width);
+
+ /* check if the previous scanline is exactly the same, merge if so
+ (this is the only optimization we can use for YXBanded rectangles,
+ and win32 supports YXBanded only */
+
+ length = pThis - pLine;
+ if (pPrevLine && pLine - pPrevLine == length) {
+ for (i = 0; i < length && RECT_EQ_X(pPrevLine[i], pLine[i]); ++i) {
+ }
+ if (i == pLine - pPrevLine) {
+ // do merge
+ for (i = 0; i < length; i++) {
+ RECT_INC_HEIGHT(pPrevLine[i]);
+ }
+ pThis = pLine;
+ continue;
+ }
+ }
+ /* or else use the generated scanline */
+
+ pPrevLine = pLine;
+ }
+
+ return pThis - pFirst;
+}
+
+#if defined(__cplusplus)
+}
+#endif
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java b/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java
index 68145a74f79..e145cd98206 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2008 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
@@ -252,6 +252,8 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
XAtom XA_NET_WM_WINDOW_TYPE = XAtom.get("_NET_WM_WINDOW_TYPE");
XAtom XA_NET_WM_WINDOW_TYPE_DIALOG = XAtom.get("_NET_WM_WINDOW_TYPE_DIALOG");
+ XAtom XA_NET_WM_WINDOW_OPACITY = XAtom.get("_NET_WM_WINDOW_OPACITY");
+
/* For _NET_WM_STATE ClientMessage requests */
final static int _NET_WM_STATE_REMOVE =0; /* remove/unset property */
final static int _NET_WM_STATE_ADD =1; /* add/set property */
@@ -289,6 +291,12 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
boolean res = active() && checkProtocol(XA_NET_SUPPORTED, XA_NET_WM_STATE_MODAL);
return res;
}
+
+ boolean doOpacityProtocol() {
+ boolean res = active() && checkProtocol(XA_NET_SUPPORTED, XA_NET_WM_WINDOW_OPACITY);
+ return res;
+ }
+
boolean isWMName(String name) {
if (!active()) {
return false;
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java
index c3011dfa6a2..65324290213 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2002-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
@@ -2273,4 +2273,36 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
public boolean areExtraMouseButtonsEnabled() throws HeadlessException {
return areExtraMouseButtonsEnabled;
}
+
+ @Override
+ public boolean isWindowOpacitySupported() {
+ XNETProtocol net_protocol = XWM.getWM().getNETProtocol();
+
+ if (net_protocol == null) {
+ return false;
+ }
+
+ return net_protocol.doOpacityProtocol();
+ }
+
+ @Override
+ public boolean isWindowShapingSupported() {
+ return XlibUtil.isShapingSupported();
+ }
+
+ @Override
+ public boolean isWindowTranslucencySupported() {
+ //NOTE: it may not be supported. The actual check is being performed
+ // at com.sun.awt.AWTUtilities(). In X11 we need to check
+ // whether there's any translucency-capable GC available.
+ return true;
+ }
+
+ @Override
+ public boolean isTranslucencyCapable(GraphicsConfiguration gc) {
+ if (!(gc instanceof X11GraphicsConfig)) {
+ return false;
+ }
+ return ((X11GraphicsConfig)gc).isTranslucencyCapable();
+ }
}
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java
index 5666cab8cda..619ff8a9c9b 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2002-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
@@ -30,6 +30,8 @@ import java.awt.event.ComponentEvent;
import java.awt.event.FocusEvent;
import java.awt.event.WindowEvent;
+import java.awt.image.BufferedImage;
+
import java.awt.peer.ComponentPeer;
import java.awt.peer.WindowPeer;
@@ -42,6 +44,7 @@ import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
+import sun.awt.AWTAccessor;
import sun.awt.ComponentAccessor;
import sun.awt.WindowAccessor;
import sun.awt.DisplayChangedListener;
@@ -49,6 +52,8 @@ import sun.awt.SunToolkit;
import sun.awt.X11GraphicsDevice;
import sun.awt.X11GraphicsEnvironment;
+import sun.java2d.pipe.Region;
+
class XWindowPeer extends XPanelPeer implements WindowPeer,
DisplayChangedListener {
@@ -260,6 +265,10 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
setSaveUnder(true);
updateIconImages();
+
+ updateShape();
+ updateOpacity();
+ // no need in updateOpaque() as it is no-op
}
public void updateIconImages() {
@@ -417,6 +426,22 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
return defaultIconInfo;
}
+ private void updateShape() {
+ // Shape shape = ((Window)target).getShape();
+ Shape shape = AWTAccessor.getWindowAccessor().getShape((Window)target);
+ if (shape != null) {
+ applyShape(Region.getInstance(shape, null));
+ }
+ }
+
+ private void updateOpacity() {
+ // float opacity = ((Window)target).getOpacity();
+ float opacity = AWTAccessor.getWindowAccessor().getOpacity((Window)target);
+ if (opacity < 1.0f) {
+ setOpacity(opacity);
+ }
+ }
+
public void updateMinimumSize() {
//This function only saves minimumSize value in XWindowPeer
//Setting WMSizeHints is implemented in XDecoratedPeer
@@ -2064,4 +2089,44 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
}
super.handleButtonPressRelease(xev);
}
+
+ public void print(Graphics g) {
+ // We assume we print the whole frame,
+ // so we expect no clip was set previously
+ Shape shape = AWTAccessor.getWindowAccessor().getShape((Window)target);
+ if (shape != null) {
+ g.setClip(shape);
+ }
+ super.print(g);
+ }
+
+ @Override
+ public void setOpacity(float opacity) {
+ final long maxOpacity = 0xffffffffl;
+ long iOpacity = (long)(opacity * maxOpacity);
+ if (iOpacity < 0) {
+ iOpacity = 0;
+ }
+ if (iOpacity > maxOpacity) {
+ iOpacity = maxOpacity;
+ }
+
+ XAtom netWmWindowOpacityAtom = XAtom.get("_NET_WM_WINDOW_OPACITY");
+
+ if (iOpacity == maxOpacity) {
+ netWmWindowOpacityAtom.DeleteProperty(getWindow());
+ } else {
+ netWmWindowOpacityAtom.setCard32Property(getWindow(), iOpacity);
+ }
+ }
+
+ @Override
+ public void setOpaque(boolean isOpaque) {
+ // no-op
+ }
+
+ @Override
+ public void updateWindow(BufferedImage backBuffer) {
+ // no-op
+ }
}
diff --git a/jdk/src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java b/jdk/src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java
index 84cfa254e4c..7aa039546fa 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2007 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
@@ -859,14 +859,14 @@ public class WrapperGenerator {
pw.println("\n\tlong pData;");
pw.println("\n\tpublic long getPData() { return pData; }");
- pw.println("\n\n\t" + stp.getJavaClassName() + "(long addr) {");
+ pw.println("\n\n\tpublic " + stp.getJavaClassName() + "(long addr) {");
if (generateLog) {
pw.println("\t\tlog.finest(\"Creating\");");
}
pw.println("\t\tpData=addr;");
pw.println("\t\tshould_free_memory = false;");
pw.println("\t}");
- pw.println("\n\n\t" + stp.getJavaClassName() + "() {");
+ pw.println("\n\n\tpublic " + stp.getJavaClassName() + "() {");
if (generateLog) {
pw.println("\t\tlog.finest(\"Creating\");");
}
diff --git a/jdk/src/solaris/classes/sun/awt/X11/generator/xlibtypes.txt b/jdk/src/solaris/classes/sun/awt/X11/generator/xlibtypes.txt
index 21bc3ce02a9..7ef8fd44790 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/generator/xlibtypes.txt
+++ b/jdk/src/solaris/classes/sun/awt/X11/generator/xlibtypes.txt
@@ -750,6 +750,7 @@ AwtGraphicsConfigData
pixelStride int
color_data pointer ColorData
glxInfo pointer
+ isTranslucencySupported int
AwtScreenData
numConfigs int
diff --git a/jdk/src/solaris/classes/sun/awt/X11GraphicsConfig.java b/jdk/src/solaris/classes/sun/awt/X11GraphicsConfig.java
index 8ea5717ac2a..aa4b527208b 100644
--- a/jdk/src/solaris/classes/sun/awt/X11GraphicsConfig.java
+++ b/jdk/src/solaris/classes/sun/awt/X11GraphicsConfig.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
@@ -450,4 +450,13 @@ public class X11GraphicsConfig extends GraphicsConfiguration
return 0x00; // UNDEFINED
}
}
+
+ /*
+ @Override
+ */
+ public boolean isTranslucencyCapable() {
+ return isTranslucencyCapable(getAData());
+ }
+
+ private native boolean isTranslucencyCapable(long x11ConfigData);
}
diff --git a/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c b/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c
index 03f5c23d144..2e80cf7206d 100644
--- a/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c
+++ b/jdk/src/solaris/native/sun/awt/awt_GraphicsEnv.c
@@ -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
@@ -354,6 +354,48 @@ makeDefaultConfig(JNIEnv *env, int screen) {
return NULL;
}
+/* Note: until we include the explicitly
+ * we have to define a couple of things ourselves.
+ */
+typedef unsigned long PictFormat;
+#define PictTypeIndexed 0
+#define PictTypeDirect 1
+
+typedef struct {
+ short red;
+ short redMask;
+ short green;
+ short greenMask;
+ short blue;
+ short blueMask;
+ short alpha;
+ short alphaMask;
+} XRenderDirectFormat;
+
+typedef struct {
+ PictFormat id;
+ int type;
+ int depth;
+ XRenderDirectFormat direct;
+ Colormap colormap;
+} XRenderPictFormat;
+
+#define PictFormatID (1 << 0)
+#define PictFormatType (1 << 1)
+#define PictFormatDepth (1 << 2)
+#define PictFormatRed (1 << 3)
+#define PictFormatRedMask (1 << 4)
+#define PictFormatGreen (1 << 5)
+#define PictFormatGreenMask (1 << 6)
+#define PictFormatBlue (1 << 7)
+#define PictFormatBlueMask (1 << 8)
+#define PictFormatAlpha (1 << 9)
+#define PictFormatAlphaMask (1 << 10)
+#define PictFormatColormap (1 << 11)
+
+typedef XRenderPictFormat *
+XRenderFindVisualFormatFunc (Display *dpy, _Xconst Visual *visual);
+
static void
getAllConfigs (JNIEnv *env, int screen, AwtScreenDataPtr screenDataPtr) {
@@ -367,6 +409,9 @@ getAllConfigs (JNIEnv *env, int screen, AwtScreenDataPtr screenDataPtr) {
int ind;
char errmsg[128];
int xinawareScreen;
+ void* xrenderLibHandle = NULL;
+ XRenderFindVisualFormatFunc *XRenderFindVisualFormat = NULL;
+ int major_opcode, first_event, first_error;
if (usingXinerama) {
xinawareScreen = 0;
@@ -449,6 +494,26 @@ getAllConfigs (JNIEnv *env, int screen, AwtScreenDataPtr screenDataPtr) {
graphicsConfigs[0] = defaultConfig;
nConfig = 1; /* reserve index 0 for default config */
+ // Only use the RENDER extension if it is available on the X server
+ if (XQueryExtension(awt_display, "RENDER",
+ &major_opcode, &first_event, &first_error))
+ {
+ xrenderLibHandle = dlopen("libXrender.so.1", RTLD_LAZY | RTLD_GLOBAL);
+
+#ifndef __linux__ /* SOLARIS */
+ if (xrenderLibHandle == NULL) {
+ xrenderLibHandle = dlopen("/usr/sfw/lib/libXrender.so.1",
+ RTLD_LAZY | RTLD_GLOBAL);
+ }
+#endif
+
+ if (xrenderLibHandle != NULL) {
+ XRenderFindVisualFormat =
+ (XRenderFindVisualFormatFunc*)dlsym(xrenderLibHandle,
+ "XRenderFindVisualFormat");
+ }
+ }
+
for (i = 0; i < nTrue; i++) {
if (XVisualIDFromVisual(pVITrue[i].visual) ==
XVisualIDFromVisual(defaultConfig->awt_visInfo.visual) ||
@@ -462,6 +527,21 @@ getAllConfigs (JNIEnv *env, int screen, AwtScreenDataPtr screenDataPtr) {
graphicsConfigs [ind]->awt_depth = pVITrue [i].depth;
memcpy (&graphicsConfigs [ind]->awt_visInfo, &pVITrue [i],
sizeof (XVisualInfo));
+ if (XRenderFindVisualFormat != NULL) {
+ XRenderPictFormat *format = XRenderFindVisualFormat (awt_display,
+ pVITrue [i].visual);
+ if (format &&
+ format->type == PictTypeDirect &&
+ format->direct.alphaMask)
+ {
+ graphicsConfigs [ind]->isTranslucencySupported = 1;
+ }
+ }
+ }
+
+ if (xrenderLibHandle != NULL) {
+ dlclose(xrenderLibHandle);
+ xrenderLibHandle = NULL;
}
for (i = 0; i < n8p; i++) {
@@ -1505,6 +1585,26 @@ Java_sun_awt_X11GraphicsConfig_swapBuffers
AWT_FLUSH_UNLOCK();
}
+/*
+ * Class: sun_awt_X11GraphicsConfig
+ * Method: isTranslucencyCapable
+ * Signature: (J)V
+ */
+JNIEXPORT jboolean JNICALL
+Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable
+ (JNIEnv *env, jobject this, jlong configData)
+{
+#ifdef HEADLESS
+ return JNI_FALSE;
+#else
+ AwtGraphicsConfigDataPtr aData = (AwtGraphicsConfigDataPtr)jlong_to_ptr(configData);
+ if (aData == NULL) {
+ return JNI_FALSE;
+ }
+ return (jboolean)aData->isTranslucencySupported;
+#endif
+}
+
/*
* Class: sun_awt_X11GraphicsDevice
* Method: isDBESupported
diff --git a/jdk/src/solaris/native/sun/awt/awt_p.h b/jdk/src/solaris/native/sun/awt/awt_p.h
index fb4f513f79f..73e5dd0a88e 100644
--- a/jdk/src/solaris/native/sun/awt/awt_p.h
+++ b/jdk/src/solaris/native/sun/awt/awt_p.h
@@ -1,5 +1,5 @@
/*
- * Copyright 1995-2005 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1995-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
@@ -135,6 +135,7 @@ typedef struct _AwtGraphicsConfigData {
int pixelStride; /* Used in X11SurfaceData.c */
ColorData *color_data;
struct _GLXGraphicsConfigInfo *glxInfo;
+ int isTranslucencySupported; /* Uses Xrender to find this out. */
} AwtGraphicsConfigData;
typedef AwtGraphicsConfigData* AwtGraphicsConfigDataPtr;
diff --git a/jdk/src/windows/classes/sun/awt/Win32GraphicsConfig.java b/jdk/src/windows/classes/sun/awt/Win32GraphicsConfig.java
index d24ce0eb1bb..2eefb33f1ce 100644
--- a/jdk/src/windows/classes/sun/awt/Win32GraphicsConfig.java
+++ b/jdk/src/windows/classes/sun/awt/Win32GraphicsConfig.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
@@ -331,4 +331,12 @@ public class Win32GraphicsConfig extends GraphicsConfiguration
}
// the rest of the flip actions are not supported
}
+
+ /*
+ @Override
+ */
+ public boolean isTranslucencyCapable() {
+ //XXX: worth checking if 8-bit? Anyway, it doesn't hurt.
+ return true;
+ }
}
diff --git a/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java b/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java
index 80ee7747004..5c53d79d4d4 100644
--- a/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.java
+++ b/jdk/src/windows/classes/sun/awt/Win32GraphicsEnvironment.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
@@ -393,4 +393,11 @@ public class Win32GraphicsEnvironment
private static void dwmCompositionChanged(boolean enabled) {
isDWMCompositionEnabled = enabled;
}
+
+ /**
+ * Used to find out if the OS is Windows Vista or later.
+ *
+ * @return {@code true} if the OS is Vista or later, {@code false} otherwise
+ */
+ public static native boolean isVistaOS();
}
diff --git a/jdk/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java b/jdk/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java
new file mode 100644
index 00000000000..9f8193f9920
--- /dev/null
+++ b/jdk/src/windows/classes/sun/awt/windows/TranslucentWindowPainter.java
@@ -0,0 +1,398 @@
+/*
+ * Copyright 2008-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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+package sun.awt.windows;
+
+import java.awt.AlphaComposite;
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.Image;
+import java.awt.Window;
+import java.awt.image.BufferedImage;
+import java.awt.image.DataBufferInt;
+import java.awt.image.VolatileImage;
+import java.lang.ref.WeakReference;
+import java.security.AccessController;
+import sun.awt.image.BufImgSurfaceData;
+import sun.java2d.DestSurfaceProvider;
+import sun.java2d.InvalidPipeException;
+import sun.java2d.Surface;
+import sun.java2d.pipe.RenderQueue;
+import sun.java2d.pipe.hw.AccelGraphicsConfig;
+import sun.java2d.pipe.hw.AccelSurface;
+import sun.security.action.GetPropertyAction;
+
+import static java.awt.image.VolatileImage.*;
+import static java.awt.Transparency.*;
+import static sun.java2d.pipe.hw.AccelSurface.*;
+import static sun.java2d.pipe.hw.ContextCapabilities.*;
+
+/**
+ * This class handles the updates of the non-opaque windows.
+ * The window associated with the peer is updated either given an image or
+ * the window is repainted to an internal buffer which is then used to update
+ * the window.
+ *
+ * Note: this class does not attempt to be thread safe, it is expected to be
+ * called from a single thread (EDT).
+ */
+public abstract class TranslucentWindowPainter {
+
+ protected Window window;
+ protected WWindowPeer peer;
+
+ // REMIND: we probably would want to remove this later
+ private static final boolean forceOpt =
+ Boolean.valueOf(AccessController.doPrivileged(
+ new GetPropertyAction("sun.java2d.twp.forceopt", "false")));
+ private static final boolean forceSW =
+ Boolean.valueOf(AccessController.doPrivileged(
+ new GetPropertyAction("sun.java2d.twp.forcesw", "false")));
+
+ /**
+ * Creates an instance of the painter for particular peer.
+ */
+ public static TranslucentWindowPainter createInstance(WWindowPeer peer) {
+ GraphicsConfiguration gc = peer.getGraphicsConfiguration();
+ if (!forceSW && gc instanceof AccelGraphicsConfig) {
+ String gcName = gc.getClass().getSimpleName();
+ AccelGraphicsConfig agc = (AccelGraphicsConfig)gc;
+ // this is a heuristic to check that we have a pcix board
+ // (those have higher transfer rate from gpu to cpu)
+ if ((agc.getContextCapabilities().getCaps() & CAPS_PS30) != 0 ||
+ forceOpt)
+ {
+ // we check for name to avoid loading classes unnecessarily if
+ // a pipeline isn't enabled
+ if (gcName.startsWith("D3D")) {
+ return new VIOptD3DWindowPainter(peer);
+ } else if (forceOpt && gcName.startsWith("WGL")) {
+ // on some boards (namely, ATI, even on pcix bus) ogl is
+ // very slow reading pixels back so for now it is disabled
+ // unless forced
+ return new VIOptWGLWindowPainter(peer);
+ }
+ }
+ }
+ return new BIWindowPainter(peer);
+ }
+
+ protected TranslucentWindowPainter(WWindowPeer peer) {
+ this.peer = peer;
+ this.window = (Window)peer.getTarget();
+ }
+
+ /**
+ * Creates (if needed), clears and returns the buffer for this painter.
+ */
+ protected abstract Image getBackBuffer();
+
+ /**
+ * Updates the the window associated with this painter with the contents
+ * of the passed image.
+ * The image can not be null, and NPE will be thrown if it is.
+ */
+ protected abstract boolean update(Image bb);
+
+ /**
+ * Flushes the resources associated with the painter. They will be
+ * recreated as needed.
+ */
+ public abstract void flush();
+
+ /**
+ * Updates the window associated with the painter given the passed image.
+ * If the passed image is null the painter will use its own buffer for
+ * rendering the contents of the window into it and updating the window.
+ *
+ * If the passed buffer has dimensions different from the window, it is
+ * copied into the internal buffer first and the latter is used to update
+ * the window.
+ *
+ * @param bb the image to update the non opaque window with, or null.
+ * If not null, the image must be of ARGB_PRE type.
+ */
+ public void updateWindow(Image bb) {
+ boolean done = false;
+ if (bb != null && (window.getWidth() != bb.getWidth(null) ||
+ window.getHeight() != bb.getHeight(null)))
+ {
+ Image ourBB = getBackBuffer();
+ Graphics2D g = (Graphics2D)ourBB.getGraphics();
+ g.drawImage(bb, 0, 0, null);
+ g.dispose();
+ bb = ourBB;
+ }
+ do {
+ if (bb == null) {
+ bb = getBackBuffer();
+ Graphics2D g = (Graphics2D)bb.getGraphics();
+ try {
+ window.paintAll(g);
+ } finally {
+ g.dispose();
+ }
+ }
+
+ peer.paintAppletWarning((Graphics2D)bb.getGraphics(),
+ bb.getWidth(null), bb.getHeight(null));
+
+ done = update(bb);
+ // in case they passed us a lost VI, next time around we'll use our
+ // own bb because we can not validate and restore the contents of
+ // their VI
+ if (!done) {
+ bb = null;
+ }
+ } while (!done);
+ }
+
+ private static final Image clearImage(Image bb) {
+ Graphics2D g = (Graphics2D)bb.getGraphics();
+ int w = bb.getWidth(null);
+ int h = bb.getHeight(null);
+
+ g.setComposite(AlphaComposite.Src);
+ g.setColor(new Color(0, 0, 0, 0));
+ g.fillRect(0, 0, w, h);
+
+ return bb;
+ }
+
+ /**
+ * A painter which uses BufferedImage as the internal buffer. The window
+ * is painted into this buffer, and the contents then are uploaded
+ * into the layered window.
+ *
+ * This painter handles all types of images passed to its paint(Image)
+ * method (VI, BI, regular Images).
+ */
+ private static class BIWindowPainter extends TranslucentWindowPainter {
+ private WeakReference biRef;
+
+ protected BIWindowPainter(WWindowPeer peer) {
+ super(peer);
+ }
+
+ private BufferedImage getBIBackBuffer() {
+ int w = window.getWidth();
+ int h = window.getHeight();
+ BufferedImage bb = biRef == null ? null : biRef.get();
+ if (bb == null || bb.getWidth() != w || bb.getHeight() != h) {
+ if (bb != null) {
+ bb.flush();
+ bb = null;
+ }
+ bb = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB_PRE);
+ biRef = new WeakReference(bb);
+ }
+ return (BufferedImage)clearImage(bb);
+ }
+
+ @Override
+ protected Image getBackBuffer() {
+ return getBIBackBuffer();
+ }
+
+ @Override
+ protected boolean update(Image bb) {
+ VolatileImage viBB = null;
+
+ if (bb instanceof BufferedImage) {
+ BufferedImage bi = (BufferedImage)bb;
+ int data[] =
+ ((DataBufferInt)bi.getRaster().getDataBuffer()).getData();
+ peer.updateWindowImpl(data, bi.getWidth(), bi.getHeight());
+ return true;
+ } else if (bb instanceof VolatileImage) {
+ viBB = (VolatileImage)bb;
+ if (bb instanceof DestSurfaceProvider) {
+ Surface s = ((DestSurfaceProvider)bb).getDestSurface();
+ if (s instanceof BufImgSurfaceData) {
+ // the image is probably lost, upload the data from the
+ // backup surface to avoid creating another heap-based
+ // image (the parent's buffer)
+ int w = viBB.getWidth();
+ int h = viBB.getHeight();
+ BufImgSurfaceData bisd = (BufImgSurfaceData)s;
+ int data[] = ((DataBufferInt)bisd.getRaster(0,0,w,h).
+ getDataBuffer()).getData();
+ peer.updateWindowImpl(data, w, h);
+ return true;
+ }
+ }
+ }
+
+ // copy the passed image into our own buffer, then upload
+ BufferedImage bi = getBIBackBuffer();
+ Graphics2D g = (Graphics2D)bi.getGraphics();
+ g.setComposite(AlphaComposite.Src);
+ g.drawImage(bb, 0, 0, null);
+
+ int data[] =
+ ((DataBufferInt)bi.getRaster().getDataBuffer()).getData();
+ peer.updateWindowImpl(data, bi.getWidth(), bi.getHeight());
+
+ return (viBB != null ? !viBB.contentsLost() : true);
+ }
+
+ public void flush() {
+ if (biRef != null) {
+ biRef.clear();
+ }
+ }
+ }
+
+ /**
+ * A version of the painter which uses VolatileImage as the internal buffer.
+ * The window is painted into this VI and then copied into the parent's
+ * Java heap-based buffer (which is then uploaded to the layered window)
+ */
+ private static class VIWindowPainter extends BIWindowPainter {
+ private WeakReference viRef;
+
+ protected VIWindowPainter(WWindowPeer peer) {
+ super(peer);
+ }
+
+ @Override
+ protected Image getBackBuffer() {
+ int w = window.getWidth();
+ int h = window.getHeight();
+ GraphicsConfiguration gc = peer.getGraphicsConfiguration();
+
+ VolatileImage viBB = viRef == null ? null : viRef.get();
+
+ if (viBB == null || viBB.getWidth() != w || viBB.getHeight() != h ||
+ viBB.validate(gc) == IMAGE_INCOMPATIBLE)
+ {
+ if (viBB != null) {
+ viBB.flush();
+ viBB = null;
+ }
+
+ if (gc instanceof AccelGraphicsConfig) {
+ AccelGraphicsConfig agc = ((AccelGraphicsConfig)gc);
+ viBB = agc.createCompatibleVolatileImage(w, h,
+ TRANSLUCENT,
+ RT_PLAIN);
+ }
+ if (viBB == null) {
+ viBB = gc.createCompatibleVolatileImage(w, h, TRANSLUCENT);
+ }
+ viBB.validate(gc);
+ viRef = new WeakReference(viBB);
+ }
+
+ return clearImage(viBB);
+ }
+
+ @Override
+ public void flush() {
+ if (viRef != null) {
+ VolatileImage viBB = viRef.get();
+ if (viBB != null) {
+ viBB.flush();
+ viBB = null;
+ }
+ viRef.clear();
+ }
+ }
+ }
+
+ /**
+ * Optimized version of hw painter. Uses VolatileImages for the
+ * buffer, and uses an optimized path to pull the data from those into
+ * the layered window, bypassing Java heap-based image.
+ */
+ private abstract static class VIOptWindowPainter extends VIWindowPainter {
+
+ protected VIOptWindowPainter(WWindowPeer peer) {
+ super(peer);
+ }
+
+ protected abstract boolean updateWindowAccel(long psdops, int w, int h);
+
+ @Override
+ protected boolean update(Image bb) {
+ if (bb instanceof DestSurfaceProvider) {
+ Surface s = ((DestSurfaceProvider)bb).getDestSurface();
+ if (s instanceof AccelSurface) {
+ final int w = bb.getWidth(null);
+ final int h = bb.getHeight(null);
+ final boolean arr[] = { false };
+ final AccelSurface as = (AccelSurface)s;
+ RenderQueue rq = as.getContext().getRenderQueue();
+ rq.lock();
+ try {
+ as.getContext().validateContext(as);
+ rq.flushAndInvokeNow(new Runnable() {
+ public void run() {
+ long psdops = as.getNativeOps();
+ arr[0] = updateWindowAccel(psdops, w, h);
+ }
+ });
+ } catch (InvalidPipeException e) {
+ // ignore, false will be returned
+ } finally {
+ rq.unlock();
+ }
+ return arr[0];
+ }
+ }
+ return super.update(bb);
+ }
+ }
+
+ private static class VIOptD3DWindowPainter extends VIOptWindowPainter {
+
+ protected VIOptD3DWindowPainter(WWindowPeer peer) {
+ super(peer);
+ }
+
+ @Override
+ protected boolean updateWindowAccel(long psdops, int w, int h) {
+ // note: this method is executed on the toolkit thread, no sync is
+ // necessary at the native level, and a pointer to peer can be used
+ return sun.java2d.d3d.D3DSurfaceData.
+ updateWindowAccelImpl(psdops, peer.getData(), w, h);
+ }
+ }
+
+ private static class VIOptWGLWindowPainter extends VIOptWindowPainter {
+
+ protected VIOptWGLWindowPainter(WWindowPeer peer) {
+ super(peer);
+ }
+
+ @Override
+ protected boolean updateWindowAccel(long psdops, int w, int h) {
+ // note: part of this method which deals with GDI will be on the
+ // toolkit thread
+ return sun.java2d.opengl.WGLSurfaceData.
+ updateWindowAccelImpl(psdops, peer, w, h);
+ }
+ }
+}
diff --git a/jdk/src/windows/classes/sun/awt/windows/WCanvasPeer.java b/jdk/src/windows/classes/sun/awt/windows/WCanvasPeer.java
index 5d88a0c3703..e1657102900 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WCanvasPeer.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WCanvasPeer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -28,6 +28,7 @@ import java.awt.*;
import java.awt.peer.*;
import java.lang.ref.WeakReference;
import java.lang.reflect.Method;
+import sun.awt.AWTAccessor;
import sun.awt.ComponentAccessor;
import sun.awt.SunToolkit;
import sun.awt.Win32GraphicsDevice;
@@ -110,16 +111,20 @@ class WCanvasPeer extends WComponentPeer implements CanvasPeer {
}
public void print(Graphics g) {
- Dimension d = ((Component)target).getSize();
- if (g instanceof Graphics2D ||
- g instanceof sun.awt.Graphics2Delegate) {
- // background color is setup correctly, so just use clearRect
- g.clearRect(0, 0, d.width, d.height);
- } else {
- // emulate clearRect
- g.setColor(((Component)target).getBackground());
- g.fillRect(0, 0, d.width, d.height);
- g.setColor(((Component)target).getForeground());
+ if (!(target instanceof Window) ||
+ AWTAccessor.getWindowAccessor().isOpaque((Window)target))
+ {
+ Dimension d = ((Component)target).getSize();
+ if (g instanceof Graphics2D ||
+ g instanceof sun.awt.Graphics2Delegate) {
+ // background color is setup correctly, so just use clearRect
+ g.clearRect(0, 0, d.width, d.height);
+ } else {
+ // emulate clearRect
+ g.setColor(((Component)target).getBackground());
+ g.fillRect(0, 0, d.width, d.height);
+ g.setColor(((Component)target).getForeground());
+ }
}
super.print(g);
}
diff --git a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java
index afbd170cc7f..3a414d1c328 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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,21 +39,22 @@ import java.awt.event.PaintEvent;
import java.awt.event.InvocationEvent;
import java.awt.event.KeyEvent;
import sun.awt.Win32GraphicsConfig;
+import sun.awt.Win32GraphicsEnvironment;
import sun.java2d.InvalidPipeException;
import sun.java2d.SurfaceData;
-import sun.java2d.d3d.D3DScreenUpdateManager;
-import static sun.java2d.d3d.D3DSurfaceData.*;
import sun.java2d.ScreenUpdateManager;
+import sun.java2d.d3d.D3DSurfaceData;
import sun.java2d.opengl.OGLSurfaceData;
+import sun.java2d.pipe.Region;
import sun.awt.DisplayChangedListener;
import sun.awt.PaintEventDispatcher;
+import sun.awt.SunToolkit;
import sun.awt.event.IgnorePaintEvent;
import java.awt.dnd.DropTarget;
import java.awt.dnd.peer.DropTargetPeer;
import sun.awt.ComponentAccessor;
-
import java.util.logging.*;
@@ -186,7 +187,7 @@ public abstract class WComponentPeer extends WObjectPeer
cont.invalidate();
cont.validate();
- if (surfaceData instanceof D3DWindowSurfaceData ||
+ if (surfaceData instanceof D3DSurfaceData.D3DWindowSurfaceData ||
surfaceData instanceof OGLSurfaceData)
{
// When OGL or D3D is enabled, it is necessary to
@@ -258,7 +259,7 @@ public abstract class WComponentPeer extends WObjectPeer
int[] pix = createPrintedPixels(0, startY, totalW, h);
if (pix != null) {
BufferedImage bim = new BufferedImage(totalW, h,
- BufferedImage.TYPE_INT_RGB);
+ BufferedImage.TYPE_INT_ARGB);
bim.setRGB(0, 0, totalW, h, pix, 0, totalW);
g.drawImage(bim, 0, startY, null);
bim.flush();
@@ -895,9 +896,29 @@ public abstract class WComponentPeer extends WObjectPeer
public void setBoundsOperation(int operation) {
}
+ /**
+ * Returns whether this component is capable of being hw accelerated.
+ * More specifically, whether rendering to this component or a
+ * BufferStrategy's back-buffer for this component can be hw accelerated.
+ *
+ * Conditions which could prevent hw acceleration include the toplevel
+ * window containing this component being
+ * {@link com.sun.awt.AWTUtilities.Translucency#TRANSLUCENT TRANSLUCENT}.
+ *
+ * @return {@code true} if this component is capable of being hw
+ * accelerated, {@code false} otherwise
+ * @see com.sun.awt.AWTUtilities.Translucency#TRANSLUCENT
+ */
+ public boolean isAccelCapable() {
+ boolean isTranslucent =
+ SunToolkit.isContainingTopLevelTranslucent((Component)target);
+ // D3D/OGL and translucent windows interacted poorly in Windows XP;
+ // these problems are no longer present in Vista
+ return !isTranslucent || Win32GraphicsEnvironment.isVistaOS();
+ }
native void setRectangularShape(int lox, int loy, int hix, int hiy,
- sun.java2d.pipe.Region region);
+ Region region);
// REMIND: Temp workaround for issues with using HW acceleration
@@ -914,42 +935,11 @@ public abstract class WComponentPeer extends WObjectPeer
return ((WEmbeddedFramePeer)c.getPeer()).isAccelCapable();
}
- /**
- * Returns whether this component is capable of being hw accelerated.
- * More specifically, whether rendering to this component or a
- * BufferStrategy's back-buffer for this component can be hw accelerated.
- *
- * Conditions which could prevent hw acceleration include the toplevel
- * window containing this component being
- * {@link com.sun.awt.AWTUtilities.Translucency#TRANSLUCENT TRANSLUCENT}.
- *
- * @return {@code true} if this component is capable of being hw
- * accelerated, {@code false} otherwise
- * @see com.sun.awt.AWTUtilities.Translucency#TRANSLUCENT
- */
- public boolean isAccelCapable() {
- // REMIND: Temp workaround for issues with using HW acceleration
- // in the browser on Vista when DWM is enabled
- if (!isContainingTopLevelAccelCapable((Component)target)) {
- return false;
- }
-
- // REMIND: translucent windows support-related
-/*
- boolean isTranslucent =
- SunToolkit.isContainingTopLevelTranslucent((Component)target);
- // D3D/OGL and translucent windows interacted poorly in Windows XP;
- // these problems are no longer present in Vista
- return !isTranslucent || Win32GraphicsEnvironment.isVistaOS();
-*/
- return true;
- }
-
/**
* Applies the shape to the native component window.
* @since 1.7
*/
- public void applyShape(sun.java2d.pipe.Region shape) {
+ public void applyShape(Region shape) {
if (shapeLog.isLoggable(Level.FINER)) {
shapeLog.finer(
"*** INFO: Setting shape: PEER: " + this
diff --git a/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java b/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java
index 548dc3d41ee..2d4dfccf7a1 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -244,4 +244,10 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
public boolean isRestackSupported() {
return false;
}
+
+ // The effects are not supported for system dialogs.
+ public void applyShape(sun.java2d.pipe.Region shape) {}
+ public void setOpacity(float opacity) {}
+ public void setOpaque(boolean isOpaque) {}
+ public void updateWindow(java.awt.image.BufferedImage backBuffer) {}
}
diff --git a/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java b/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java
index c1e06f53cb5..939d54520b6 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1999-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
@@ -156,4 +156,10 @@ public class WPrintDialogPeer extends WWindowPeer implements DialogPeer {
public boolean isRestackSupported() {
return false;
}
+
+ // The effects are not supported for system dialogs.
+ public void applyShape(sun.java2d.pipe.Region shape) {}
+ public void setOpacity(float opacity) {}
+ public void setOpaque(boolean isOpaque) {}
+ public void updateWindow(java.awt.image.BufferedImage backBuffer) {}
}
diff --git a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java
index 55c1dde092d..5376e8ff720 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -975,4 +975,34 @@ public class WToolkit extends SunToolkit implements Runnable {
public boolean areExtraMouseButtonsEnabled() throws HeadlessException {
return areExtraMouseButtonsEnabled;
}
+
+ @Override
+ public boolean isWindowOpacitySupported() {
+ // supported in Win2K and later
+ return true;
+ }
+
+ @Override
+ public boolean isWindowShapingSupported() {
+ return true;
+ }
+
+ @Override
+ public boolean isWindowTranslucencySupported() {
+ // supported in Win2K and later
+ return true;
+ }
+
+ @Override
+ public boolean isTranslucencyCapable(GraphicsConfiguration gc) {
+ //XXX: worth checking if 8-bit? Anyway, it doesn't hurt.
+ return true;
+ }
+
+ // On MS Windows one must use the peer.updateWindow() to implement
+ // non-opaque windows.
+ @Override
+ public boolean needUpdateWindow() {
+ return true;
+ }
}
diff --git a/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java b/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java
index 6afdb2be6b9..79818431063 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -31,17 +31,15 @@ import java.awt.peer.*;
import java.beans.*;
-import java.lang.ref.*;
import java.lang.reflect.*;
-import java.security.*;
-
import java.util.*;
import java.util.List;
import java.util.logging.*;
import sun.awt.*;
-import sun.awt.image.*;
+
+import sun.java2d.pipe.Region;
public class WWindowPeer extends WPanelPeer implements WindowPeer {
@@ -52,6 +50,10 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer {
// extends WWindowPeer, not WDialogPeer
private WWindowPeer modalBlocker = null;
+ private boolean isOpaque;
+
+ private volatile TranslucentWindowPainter painter;
+
/*
* A key used for storing a list of active windows in AppContext. The value
* is a list of windows, sorted by the time of activation: later a window is
@@ -91,9 +93,18 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer {
l.remove(this);
}
}
+
// Remove ourself from the Map of DisplayChangeListeners
GraphicsConfiguration gc = getGraphicsConfiguration();
((Win32GraphicsDevice)gc.getDevice()).removeDisplayChangedListener(this);
+
+ TranslucentWindowPainter currentPainter = painter;
+ if (currentPainter != null) {
+ currentPainter.flush();
+ // don't set the current one to null here; reduces the chances of
+ // MT issues (like NPEs)
+ }
+
super.disposeImpl();
}
@@ -158,6 +169,10 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer {
initActiveWindowsTracking((Window)target);
updateIconImages();
+
+ updateShape();
+ updateOpacity();
+ updateOpaque();
}
native void createAwtWindow(WComponentPeer parent);
@@ -191,6 +206,8 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer {
if (((Window)target).isAlwaysOnTopSupported() && alwaysOnTop) {
setAlwaysOnTop(alwaysOnTop);
}
+
+ updateWindow(null);
}
// Synchronize the insets members (here & in helper) with actual window
@@ -273,6 +290,31 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer {
}
}
+ private void updateShape() {
+ // Shape shape = ((Window)target).getShape();
+ Shape shape = AWTAccessor.getWindowAccessor().getShape((Window)target);
+ if (shape != null) {
+ applyShape(Region.getInstance(shape, null));
+ }
+ }
+
+ private void updateOpacity() {
+ // float opacity = ((Window)target).getOpacity();
+ float opacity = AWTAccessor.getWindowAccessor().getOpacity((Window)target);
+ if (opacity < 1.0f) {
+ setOpacity(opacity);
+ }
+ }
+
+ private void updateOpaque() {
+ this.isOpaque = true;
+ // boolean opaque = ((Window)target).isOpaque();
+ boolean opaque = AWTAccessor.getWindowAccessor().isOpaque((Window)target);
+ if (!opaque) {
+ setOpaque(opaque);
+ }
+ }
+
native void setMinSize(int width, int height);
/*
@@ -525,6 +567,135 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer {
super.setBounds(newBounds.x, newBounds.y, newBounds.width, newBounds.height, op);
}
+ @Override
+ public void print(Graphics g) {
+ // We assume we print the whole frame,
+ // so we expect no clip was set previously
+ Shape shape = AWTAccessor.getWindowAccessor().getShape((Window)target);
+ if (shape != null) {
+ g.setClip(shape);
+ }
+ super.print(g);
+ }
+
+ private void replaceSurfaceDataRecursively(Component c) {
+ if (c instanceof Container) {
+ for (Component child : ((Container)c).getComponents()) {
+ replaceSurfaceDataRecursively(child);
+ }
+ }
+ ComponentPeer cp = c.getPeer();
+ if (cp instanceof WComponentPeer) {
+ ((WComponentPeer)cp).replaceSurfaceDataLater();
+ }
+ }
+
+ private native void setOpacity(int iOpacity);
+
+ public void setOpacity(float opacity) {
+ if (!((SunToolkit)((Window)target).getToolkit()).
+ isWindowOpacitySupported())
+ {
+ return;
+ }
+
+ replaceSurfaceDataRecursively((Component)getTarget());
+
+ final int maxOpacity = 0xff;
+ int iOpacity = (int)(opacity * maxOpacity);
+ if (iOpacity < 0) {
+ iOpacity = 0;
+ }
+ if (iOpacity > maxOpacity) {
+ iOpacity = maxOpacity;
+ }
+
+ setOpacity(iOpacity);
+ updateWindow(null);
+ }
+
+ private native void setOpaqueImpl(boolean isOpaque);
+
+ public void setOpaque(boolean isOpaque) {
+ Window target = (Window)getTarget();
+
+ SunToolkit sunToolkit = (SunToolkit)target.getToolkit();
+ if (!sunToolkit.isWindowTranslucencySupported() ||
+ !sunToolkit.isTranslucencyCapable(target.getGraphicsConfiguration()))
+ {
+ return;
+ }
+
+ boolean opaqueChanged = this.isOpaque != isOpaque;
+ boolean isVistaOS = Win32GraphicsEnvironment.isVistaOS();
+
+ if (opaqueChanged && !isVistaOS){
+ // non-Vista OS: only replace the surface data if the opacity
+ // status changed (see WComponentPeer.isAccelCapable() for more)
+ replaceSurfaceDataRecursively(target);
+ }
+
+ this.isOpaque = isOpaque;
+
+ setOpaqueImpl(isOpaque);
+
+ if (opaqueChanged) {
+ if (isOpaque) {
+ TranslucentWindowPainter currentPainter = painter;
+ if (currentPainter != null) {
+ currentPainter.flush();
+ painter = null;
+ }
+ } else {
+ painter = TranslucentWindowPainter.createInstance(this);
+ }
+ }
+
+ if (opaqueChanged && isVistaOS) {
+ // On Vista: setting the window non-opaque makes the window look
+ // rectangular, though still catching the mouse clicks within
+ // its shape only. To restore the correct visual appearance
+ // of the window (i.e. w/ the correct shape) we have to reset
+ // the shape.
+ Shape shape = AWTAccessor.getWindowAccessor().getShape(target);
+ if (shape != null) {
+ AWTAccessor.getWindowAccessor().setShape(target, shape);
+ }
+ }
+
+ updateWindow(null);
+ }
+
+ public native void updateWindowImpl(int[] data, int width, int height);
+
+ public void updateWindow(BufferedImage backBuffer) {
+ if (isOpaque) {
+ return;
+ }
+
+ TranslucentWindowPainter currentPainter = painter;
+ if (currentPainter != null) {
+ currentPainter.updateWindow(backBuffer);
+ } else if (log.isLoggable(Level.FINER)) {
+ log.log(Level.FINER,
+ "Translucent window painter is null in updateWindow");
+ }
+ }
+
+ /**
+ * Paints the Applet Warning into the passed Graphics2D. This method is
+ * called by the TranslucentWindowPainter before updating the layered
+ * window.
+ *
+ * @param g Graphics context to paint the warning to
+ * @param w the width of the area
+ * @param h the height of the area
+ * @see TranslucentWindowPainter
+ */
+ public void paintAppletWarning(Graphics2D g, int w, int h) {
+ // REMIND: the applet warning needs to be painted here
+ }
+
/*
* The method maps the list of the active windows to the window's AppContext,
* then the method registers ActiveWindowListener, GuiDisposedListener listeners;
diff --git a/jdk/src/windows/classes/sun/java2d/opengl/WGLSurfaceData.java b/jdk/src/windows/classes/sun/java2d/opengl/WGLSurfaceData.java
index 27997aa8c59..4164264a164 100644
--- a/jdk/src/windows/classes/sun/java2d/opengl/WGLSurfaceData.java
+++ b/jdk/src/windows/classes/sun/java2d/opengl/WGLSurfaceData.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2004-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2004-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
@@ -72,9 +72,8 @@ public abstract class WGLSurfaceData extends OGLSurfaceData {
// the OGL pipeline can render directly to the screen and interfere
// with layered windows, which is why we don't allow accelerated
// surfaces in this case
- if (!peer.isAccelCapable())
- // REMIND: commented until toplevel translucency is implemented
-// || !SunToolkit.isContainingTopLevelOpaque((Component)peer.getTarget()))
+ if (!peer.isAccelCapable() ||
+ !SunToolkit.isContainingTopLevelOpaque((Component)peer.getTarget()))
{
return null;
}
@@ -93,9 +92,8 @@ public abstract class WGLSurfaceData extends OGLSurfaceData {
// the OGL pipeline can render directly to the screen and interfere
// with layered windows, which is why we don't allow accelerated
// surfaces in this case
- if (!peer.isAccelCapable())
- // REMIND: commented until toplevel translucency is implemented
-// || !SunToolkit.isContainingTopLevelOpaque((Component)peer.getTarget()))
+ if (!peer.isAccelCapable() ||
+ !SunToolkit.isContainingTopLevelOpaque((Component)peer.getTarget()))
{
return null;
}
diff --git a/jdk/src/windows/native/sun/awt/utility/rect.h b/jdk/src/windows/native/sun/awt/utility/rect.h
index bc250e2ac1b..a8e9fc28bea 100644
--- a/jdk/src/windows/native/sun/awt/utility/rect.h
+++ b/jdk/src/windows/native/sun/awt/utility/rect.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2007-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
@@ -43,5 +43,15 @@ typedef RECT RECT_T;
#define RECT_INC_HEIGHT(r) (r).bottom++
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+int BitmapToYXBandedRectangles(int bitsPerPixel, int width, int height,
+ unsigned char * buf, RECT_T * outBuf);
+
+#if defined(__cplusplus)
+}
+#endif
#endif // _AWT_RECT_H
diff --git a/jdk/src/windows/native/sun/java2d/d3d/D3DSurfaceData.cpp b/jdk/src/windows/native/sun/java2d/d3d/D3DSurfaceData.cpp
index 9c865dc971b..c6d4bb1b3eb 100644
--- a/jdk/src/windows/native/sun/java2d/d3d/D3DSurfaceData.cpp
+++ b/jdk/src/windows/native/sun/java2d/d3d/D3DSurfaceData.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2007-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
@@ -613,17 +613,15 @@ JNICALL Java_sun_java2d_d3d_D3DSurfaceData_updateWindowAccelImpl
res = pTmpSurface->LockRect(&lockedRect, NULL, D3DLOCK_NOSYSLOCK);
if (SUCCEEDED(res)) {
- // REMIND: commented until translucent window support is integrated
-// hBitmap =
-// BitmapUtil::CreateBitmapFromARGBPre(w, h,
-// lockedRect.Pitch,
-// (int*)lockedRect.pBits);
+ hBitmap =
+ BitmapUtil::CreateBitmapFromARGBPre(w, h,
+ lockedRect.Pitch,
+ (int*)lockedRect.pBits);
pTmpSurface->UnlockRect();
}
RETURN_STATUS_IF_NULL(hBitmap, JNI_FALSE);
- // REMIND: commented until translucent window support is integrated
-// window->UpdateWindow(env, NULL, w, h, hBitmap);
+ window->UpdateWindow(env, NULL, w, h, hBitmap);
// hBitmap is released in UpdateWindow
diff --git a/jdk/src/windows/native/sun/java2d/opengl/WGLSurfaceData.c b/jdk/src/windows/native/sun/java2d/opengl/WGLSurfaceData.c
index 71d5e876406..3c3e09cecea 100644
--- a/jdk/src/windows/native/sun/java2d/opengl/WGLSurfaceData.c
+++ b/jdk/src/windows/native/sun/java2d/opengl/WGLSurfaceData.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2004-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2004-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
@@ -625,17 +625,15 @@ JNIEXPORT jboolean JNICALL
j2d_glPixelStorei(GL_PACK_ALIGNMENT, 4);
// the pixels read from the surface are already premultiplied
- // REMIND: commented until translucent window support is integrated
-// hBitmap = BitmapUtil_CreateBitmapFromARGBPre(w, h, scanStride,
-// (int*)pDst);
+ hBitmap = BitmapUtil_CreateBitmapFromARGBPre(w, h, scanStride,
+ (int*)pDst);
free(pDst);
if (hBitmap == NULL) {
return JNI_FALSE;
}
- // REMIND: commented until translucent window support is integrated
- // AwtWindow_UpdateWindow(env, peer, w, h, hBitmap);
+ AwtWindow_UpdateWindow(env, peer, w, h, hBitmap);
// hBitmap is released in UpdateWindow
diff --git a/jdk/src/windows/native/sun/windows/awt_BitmapUtil.cpp b/jdk/src/windows/native/sun/windows/awt_BitmapUtil.cpp
index 64c52e2f8f8..10e71b3e61e 100644
--- a/jdk/src/windows/native/sun/windows/awt_BitmapUtil.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_BitmapUtil.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2006-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
@@ -28,9 +28,14 @@
#include
#include
+#include "GraphicsPrimitiveMgr.h"
+
#include "awt.h"
#include "awt_BitmapUtil.h"
+// Platform-dependent RECT_[EQ | SET | INC_HEIGHT] macros
+#include "utility/rect.h"
+
HBITMAP BitmapUtil::CreateTransparencyMaskFromARGB(int width, int height, int* imageData)
{
//Scan lines should be aligned to word boundary
@@ -148,3 +153,222 @@ HBITMAP BitmapUtil::CreateV4BitmapFromARGB(int width, int height, int* imageData
::GdiFlush();
return hBitmap;
}
+
+/*
+ * Creates 32-bit premultiplied ARGB bitmap from specified ARGBPre data.
+ * This function may not work on OS prior to Win95.
+ * See MSDN articles for CreateDIBitmap, BITMAPINFOHEADER,
+ * BITMAPV4HEADER, BITMAPV5HEADER for additional info.
+ */
+HBITMAP BitmapUtil::CreateBitmapFromARGBPre(int width, int height,
+ int srcStride,
+ int* imageData)
+{
+ BITMAPINFOHEADER bmi;
+ void *bitmapBits = NULL;
+
+ ZeroMemory(&bmi, sizeof(bmi));
+ bmi.biSize = sizeof(bmi);
+ bmi.biWidth = width;
+ bmi.biHeight = -height;
+ bmi.biPlanes = 1;
+ bmi.biBitCount = 32;
+ bmi.biCompression = BI_RGB;
+
+ HBITMAP hBitmap =
+ ::CreateDIBSection(NULL, (BITMAPINFO *) & bmi, DIB_RGB_COLORS,
+ &bitmapBits, NULL, 0);
+
+ if (!bitmapBits) {
+ return NULL;
+ }
+
+ int dstStride = width * 4;
+
+ if (srcStride == dstStride) {
+ memcpy(bitmapBits, (void*)imageData, srcStride * height);
+ } else if (height > 0) {
+ void *pSrcPixels = (void*)imageData;
+ void *pDstPixels = bitmapBits;
+ do {
+ memcpy(pDstPixels, pSrcPixels, dstStride);
+ pSrcPixels = PtrAddBytes(pSrcPixels, srcStride);
+ pDstPixels = PtrAddBytes(pDstPixels, dstStride);
+ } while (--height > 0);
+ }
+
+ return hBitmap;
+}
+
+extern "C" {
+
+/**
+ * This method is called from the WGL pipeline when it needs to create a bitmap
+ * needed to update the layered window.
+ */
+HBITMAP BitmapUtil_CreateBitmapFromARGBPre(int width, int height,
+ int srcStride,
+ int* imageData)
+{
+ return BitmapUtil::CreateBitmapFromARGBPre(width, height,
+ srcStride, imageData);
+
+}
+
+} /* extern "C" */
+
+
+/**
+ * Transforms the given bitmap into an HRGN representing the transparency
+ * of the bitmap. The bitmap MUST BE 32bpp. Alpha value == 0 is considered
+ * transparent, alpha > 0 - opaque.
+ */
+HRGN BitmapUtil::BitmapToRgn(HBITMAP hBitmap)
+{
+ HDC hdc = ::CreateCompatibleDC(NULL);
+ ::SelectObject(hdc, hBitmap);
+
+ BITMAPINFOEX bi;
+ ::ZeroMemory(&bi, sizeof(bi));
+
+ bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+
+ BOOL r = ::GetDIBits(hdc, hBitmap, 0, 0, NULL,
+ reinterpret_cast(&bi), DIB_RGB_COLORS);
+
+ if (!r || bi.bmiHeader.biBitCount != 32)
+ {
+ ::DeleteDC(hdc);
+ return NULL;
+ }
+
+ UINT width = bi.bmiHeader.biWidth;
+ UINT height = abs(bi.bmiHeader.biHeight);
+
+ BYTE * buf = (BYTE*)safe_Malloc(bi.bmiHeader.biSizeImage);
+ bi.bmiHeader.biHeight = -height;
+ ::GetDIBits(hdc, hBitmap, 0, height, buf,
+ reinterpret_cast(&bi), DIB_RGB_COLORS);
+
+ /* reserving memory for the worst case */
+ RGNDATA * pRgnData = (RGNDATA *) safe_Malloc(sizeof(RGNDATAHEADER) +
+ sizeof(RECT) * (width / 2 + 1) * height);
+ RGNDATAHEADER * pRgnHdr = (RGNDATAHEADER *) pRgnData;
+ pRgnHdr->dwSize = sizeof(RGNDATAHEADER);
+ pRgnHdr->iType = RDH_RECTANGLES;
+ pRgnHdr->nRgnSize = 0;
+ pRgnHdr->rcBound.top = 0;
+ pRgnHdr->rcBound.left = 0;
+ pRgnHdr->rcBound.bottom = height;
+ pRgnHdr->rcBound.right = width;
+
+ pRgnHdr->nCount = BitmapToYXBandedRectangles(32, width, height, buf,
+ (RECT_T *) (((BYTE *) pRgnData) + sizeof(RGNDATAHEADER)));
+
+ HRGN rgn = ::ExtCreateRegion(NULL,
+ sizeof(RGNDATAHEADER) + sizeof(RECT_T) * pRgnHdr->nCount,
+ pRgnData);
+
+ free(pRgnData);
+ ::DeleteDC(hdc);
+ free(buf);
+
+ return rgn;
+}
+
+/**
+ * Makes a copy of the given bitmap. Blends every pixel of the source
+ * with the given blendColor and alpha. If alpha == 0, the function
+ * simply makes a plain copy of the source without any blending.
+ */
+HBITMAP BitmapUtil::BlendCopy(HBITMAP hSrcBitmap, COLORREF blendColor,
+ BYTE alpha)
+{
+ HDC hdc = ::CreateCompatibleDC(NULL);
+ HBITMAP oldBitmap = (HBITMAP)::SelectObject(hdc, hSrcBitmap);
+
+ BITMAPINFOEX bi;
+ ::ZeroMemory(&bi, sizeof(bi));
+
+ bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+
+ BOOL r = ::GetDIBits(hdc, hSrcBitmap, 0, 0, NULL,
+ reinterpret_cast(&bi), DIB_RGB_COLORS);
+
+ if (!r || bi.bmiHeader.biBitCount != 32)
+ {
+ ::DeleteDC(hdc);
+ return NULL;
+ }
+
+ UINT width = bi.bmiHeader.biWidth;
+ UINT height = abs(bi.bmiHeader.biHeight);
+
+ BYTE * buf = (BYTE*)safe_Malloc(bi.bmiHeader.biSizeImage);
+ bi.bmiHeader.biHeight = -height;
+ ::GetDIBits(hdc, hSrcBitmap, 0, height, buf,
+ reinterpret_cast(&bi), DIB_RGB_COLORS);
+
+ UINT widthBytes = width * bi.bmiHeader.biBitCount / 8;
+ UINT alignedWidth = (((widthBytes - 1) / 4) + 1) * 4;
+ UINT i, j;
+
+ for (j = 0; j < height; j++) {
+ BYTE *pSrc = (BYTE *) buf + j * alignedWidth;
+ for (i = 0; i < width; i++, pSrc += 4) {
+ // Note: if the current alpha is zero, the other three color
+ // components may (theoretically) contain some uninitialized
+ // data. The developer does not expect to display them,
+ // hence we handle this situation differently.
+ if (pSrc[3] == 0) {
+ pSrc[0] = GetBValue(blendColor) * alpha / 255;
+ pSrc[1] = GetGValue(blendColor) * alpha / 255;
+ pSrc[2] = GetRValue(blendColor) * alpha / 255;
+ pSrc[3] = alpha;
+ } else {
+ pSrc[0] = (GetBValue(blendColor) * alpha / 255) +
+ (pSrc[0] * (255 - alpha) / 255);
+ pSrc[1] = (GetGValue(blendColor) * alpha / 255) +
+ (pSrc[1] * (255 - alpha) / 255);
+ pSrc[2] = (GetRValue(blendColor) * alpha / 255) +
+ (pSrc[2] * (255 - alpha) / 255);
+ pSrc[3] = (alpha * alpha / 255) +
+ (pSrc[3] * (255 - alpha) / 255);
+ }
+ }
+ }
+
+ HBITMAP hDstBitmap = ::CreateDIBitmap(hdc,
+ reinterpret_cast(&bi),
+ CBM_INIT,
+ buf,
+ reinterpret_cast(&bi),
+ DIB_RGB_COLORS
+ );
+
+ ::SelectObject(hdc, oldBitmap);
+ ::DeleteDC(hdc);
+ free(buf);
+
+ return hDstBitmap;
+}
+
+/**
+ * Creates a 32 bit ARGB bitmap. Returns the bitmap handle. The *bitmapBits
+ * contains the pointer to the bitmap data or NULL if an error occured.
+ */
+HBITMAP BitmapUtil::CreateARGBBitmap(int width, int height, void ** bitmapBitsPtr)
+{
+ BITMAPINFOHEADER bmi;
+
+ ::ZeroMemory(&bmi, sizeof(bmi));
+ bmi.biSize = sizeof(BITMAPINFOHEADER);
+ bmi.biWidth = width;
+ bmi.biHeight = -height;
+ bmi.biPlanes = 1;
+ bmi.biBitCount = 32;
+ bmi.biCompression = BI_RGB;
+
+ return ::CreateDIBSection(NULL, (BITMAPINFO *) & bmi, DIB_RGB_COLORS,
+ bitmapBitsPtr, NULL, 0);
+}
diff --git a/jdk/src/windows/native/sun/windows/awt_BitmapUtil.h b/jdk/src/windows/native/sun/windows/awt_BitmapUtil.h
index b32f3fe0a41..2c039232fcb 100644
--- a/jdk/src/windows/native/sun/windows/awt_BitmapUtil.h
+++ b/jdk/src/windows/native/sun/windows/awt_BitmapUtil.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2006-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
@@ -45,6 +45,32 @@ public:
*/
static HBITMAP CreateV4BitmapFromARGB(int width, int height, int* imageData);
+ /**
+ * Creates 32-bit premultiplied ARGB V4 Bitmap (Win95-compatible) from
+ * specified ARGB Pre input data.
+ */
+ static HBITMAP CreateBitmapFromARGBPre(int width, int height,
+ int srcStride,
+ int* imageData);
+
+ /**
+ * Transforms the given bitmap into an HRGN representing the transparency
+ * of the bitmap.
+ */
+ static HRGN BitmapToRgn(HBITMAP hBitmap);
+
+ /**
+ * Makes a copy of the given bitmap. Blends every pixel of the source
+ * with the given blendColor and alpha. If alpha == 0, the function
+ * simply makes a plain copy of the source without any blending.
+ */
+ static HBITMAP BlendCopy(HBITMAP hSrcBitmap, COLORREF blendColor, BYTE alpha);
+
+ /**
+ * Creates a 32 bit ARGB bitmap. Returns the bitmap handle.
+ * The pointer to the bitmap data is stored into bitmapBitsPtr.
+ */
+ static HBITMAP CreateARGBBitmap(int width, int height, void ** bitmapBitsPtr);
};
#endif
diff --git a/jdk/src/windows/native/sun/windows/awt_Component.cpp b/jdk/src/windows/native/sun/windows/awt_Component.cpp
index 6f0df2e449f..a49ae839459 100644
--- a/jdk/src/windows/native/sun/windows/awt_Component.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Component.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -199,9 +199,6 @@ BOOL AwtComponent::sm_rtl = PRIMARYLANGID(GetInputLanguage()) == LANG_ARABIC ||
BOOL AwtComponent::sm_rtlReadingOrder =
PRIMARYLANGID(GetInputLanguage()) == LANG_ARABIC;
-UINT AwtComponent::sm_95WheelMessage = WM_NULL;
-UINT AwtComponent::sm_95WheelSupport = WM_NULL;
-
HWND AwtComponent::sm_cursorOn;
BOOL AwtComponent::m_QueryNewPaletteCalled = FALSE;
@@ -4562,6 +4559,25 @@ HDC AwtComponent::GetDCFromComponent()
return hdc;
}
+void AwtComponent::FillBackground(HDC hMemoryDC, SIZE &size)
+{
+ RECT eraseR = { 0, 0, size.cx, size.cy };
+ VERIFY(::FillRect(hMemoryDC, &eraseR, GetBackgroundBrush()));
+}
+
+void AwtComponent::FillAlpha(void *bitmapBits, SIZE &size, BYTE alpha)
+{
+ if (bitmapBits) {
+ DWORD* dest = (DWORD*)bitmapBits;
+ //XXX: might be optimized to use one loop (cy*cx -> 0).
+ for (int i = 0; i < size.cy; i++ ) {
+ for (int j = 0; j < size.cx; j++ ) {
+ ((BYTE*)(dest++))[3] = alpha;
+ }
+ }
+ }
+}
+
jintArray AwtComponent::CreatePrintedPixels(SIZE &loc, SIZE &size) {
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
@@ -6107,15 +6123,12 @@ void AwtComponent::_SetRectangularShape(void *param)
AwtComponent *c = NULL;
-
-
PDATA pData;
JNI_CHECK_PEER_GOTO(self, ret);
- c = (AwtComponent *)pData;
- if (::IsWindow(c->GetHWnd()))
- {
- HRGN hRgn = NULL;
+ c = (AwtComponent *)pData;
+ if (::IsWindow(c->GetHWnd())) {
+ HRGN hRgn = NULL;
if (region || x1 || x2 || y1 || y2) {
// If all the params are zeros, the shape must be simply reset.
// Otherwise, convert it into a region.
diff --git a/jdk/src/windows/native/sun/windows/awt_Component.h b/jdk/src/windows/native/sun/windows/awt_Component.h
index 0c18961ed49..2c9c0318cad 100644
--- a/jdk/src/windows/native/sun/windows/awt_Component.h
+++ b/jdk/src/windows/native/sun/windows/awt_Component.h
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -434,9 +434,6 @@ public:
/* Functions for MouseWheel support on Windows95
* These should only be called if running on 95
*/
- static void Wheel95Init();
- INLINE static UINT Wheel95GetMsg() {return sm_95WheelMessage;}
- static UINT Wheel95GetScrLines();
/* Determines whether the component is obscured by another window */
// Called on Toolkit thread
@@ -715,9 +712,9 @@ protected:
virtual void SetDragCapture(UINT flags);
virtual void ReleaseDragCapture(UINT flags);
- // 95 support for mouse wheel
- static UINT sm_95WheelMessage;
- static UINT sm_95WheelSupport;
+ //These functions are overridden in AwtWindow to handle non-opaque windows.
+ virtual void FillBackground(HDC hMemoryDC, SIZE &size);
+ virtual void FillAlpha(void *bitmapBits, SIZE &size, BYTE alpha);
private:
/* A bitmask keeps the button's numbers as MK_LBUTTON, MK_MBUTTON, MK_RBUTTON
diff --git a/jdk/src/windows/native/sun/windows/awt_Window.cpp b/jdk/src/windows/native/sun/windows/awt_Window.cpp
index 0c9bce1210d..8d635b5d00d 100644
--- a/jdk/src/windows/native/sun/windows/awt_Window.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Window.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -25,6 +25,8 @@
#include "awt.h"
+#include
+
#include "awt_Component.h"
#include "awt_Container.h"
#include "awt_Frame.h"
@@ -88,7 +90,6 @@ struct ReshapeFrameStruct {
jint x, y;
jint w, h;
};
-
// struct for _SetIconImagesData
struct SetIconImagesDataStruct {
jobject window;
@@ -97,7 +98,6 @@ struct SetIconImagesDataStruct {
jintArray smallIconRaster;
jint smw, smh;
};
-
// struct for _SetMinSize() method
// and other methods setting sizes
struct SizeStruct {
@@ -114,6 +114,24 @@ struct ModalDisableStruct {
jobject window;
jlong blockerHWnd;
};
+// struct for _SetOpacity() method
+struct OpacityStruct {
+ jobject window;
+ jint iOpacity;
+};
+// struct for _SetOpaque() method
+struct OpaqueStruct {
+ jobject window;
+ jboolean isOpaque;
+};
+// struct for _UpdateWindow() method
+struct UpdateWindowStruct {
+ jobject window;
+ jintArray data;
+ HBITMAP hBitmap;
+ jint width, height;
+};
+
/************************************************************************
* AwtWindow fields
*/
@@ -162,6 +180,11 @@ AwtWindow::AwtWindow() {
::SetWindowsHookEx(WH_CBT, (HOOKPROC)AwtWindow::CBTFilter,
0, AwtToolkit::MainThread());
}
+
+ m_opaque = TRUE;
+ m_opacity = 0xff;
+
+ ::InitializeCriticalSection(&contentBitmapCS);
}
AwtWindow::~AwtWindow()
@@ -1839,6 +1862,216 @@ void AwtWindow::DoUpdateIcon()
//Does nothing for windows, is overriden for frames and dialogs
}
+void AwtWindow::RedrawWindow()
+{
+ if (isOpaque()) {
+ ::RedrawWindow(GetHWnd(), NULL, NULL,
+ RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN);
+ } else {
+ ::EnterCriticalSection(&contentBitmapCS);
+ if (hContentBitmap != NULL) {
+ UpdateWindowImpl(contentWidth, contentHeight, hContentBitmap);
+ }
+ ::LeaveCriticalSection(&contentBitmapCS);
+ }
+}
+
+void AwtWindow::SetTranslucency(BYTE opacity, BOOL opaque)
+{
+ BYTE old_opacity = getOpacity();
+ BOOL old_opaque = isOpaque();
+
+ if (opacity == old_opacity && opaque == old_opaque) {
+ return;
+ }
+
+ setOpacity(opacity);
+ setOpaque(opaque);
+
+ HWND hwnd = GetHWnd();
+
+ LONG ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE);
+
+ if (opaque != old_opaque) {
+ ::EnterCriticalSection(&contentBitmapCS);
+ if (hContentBitmap != NULL) {
+ ::DeleteObject(hContentBitmap);
+ hContentBitmap = NULL;
+ }
+ ::LeaveCriticalSection(&contentBitmapCS);
+ }
+
+ if (opaque && opacity == 0xff) {
+ // Turn off all the effects
+ ::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style & ~WS_EX_LAYERED);
+ // Ask the window to repaint itself and all the children
+ RedrawWindow();
+ } else {
+ // We're going to enable some effects
+ if (!(ex_style & WS_EX_LAYERED)) {
+ ::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style | WS_EX_LAYERED);
+ } else {
+ if ((opaque && opacity < 0xff) ^ (old_opaque && old_opacity < 0xff)) {
+ // _One_ of the modes uses the SetLayeredWindowAttributes.
+ // Need to reset the style in this case.
+ // If both modes are simple (i.e. just changing the opacity level),
+ // no need to reset the style.
+ ::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style & ~WS_EX_LAYERED);
+ ::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style | WS_EX_LAYERED);
+ }
+ }
+
+ if (opaque) {
+ // Simple opacity mode
+ ::SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), opacity, LWA_ALPHA);
+ }
+ }
+}
+
+static HBITMAP CreateBitmapFromRaster(JNIEnv* env, jintArray raster, jint w, jint h)
+{
+ HBITMAP image = NULL;
+ if (raster != NULL) {
+ int* rasterBuffer = NULL;
+ try {
+ rasterBuffer = (int *)env->GetPrimitiveArrayCritical(raster, 0);
+ JNI_CHECK_NULL_GOTO(rasterBuffer, "raster data", done);
+ image = BitmapUtil::CreateBitmapFromARGBPre(w, h, w*4, rasterBuffer);
+ } catch (...) {
+ if (rasterBuffer != NULL) {
+ env->ReleasePrimitiveArrayCritical(raster, rasterBuffer, 0);
+ }
+ throw;
+ }
+ if (rasterBuffer != NULL) {
+ env->ReleasePrimitiveArrayCritical(raster, rasterBuffer, 0);
+ }
+ }
+done:
+ return image;
+}
+
+void AwtWindow::UpdateWindowImpl(int width, int height, HBITMAP hBitmap)
+{
+ if (isOpaque()) {
+ return;
+ }
+
+ HWND hWnd = GetHWnd();
+ HDC hdcDst = ::GetDC(NULL);
+ HDC hdcSrc = ::CreateCompatibleDC(NULL);
+ HBITMAP hOldBitmap = (HBITMAP)::SelectObject(hdcSrc, hBitmap);
+
+ //XXX: this code doesn't paint the children (say, the java.awt.Button)!
+ //So, if we ever want to support HWs here, we need to repaint them
+ //in some other way...
+ //::SendMessage(hWnd, WM_PRINT, (WPARAM)hdcSrc, /*PRF_CHECKVISIBLE |*/
+ // PRF_CHILDREN /*| PRF_CLIENT | PRF_NONCLIENT*/);
+
+ POINT ptSrc;
+ ptSrc.x = ptSrc.y = 0;
+
+ RECT rect;
+ POINT ptDst;
+ SIZE size;
+
+ ::GetWindowRect(hWnd, &rect);
+ ptDst.x = rect.left;
+ ptDst.y = rect.top;
+ size.cx = width;
+ size.cy = height;
+
+ BLENDFUNCTION bf;
+
+ bf.SourceConstantAlpha = getOpacity();
+ bf.AlphaFormat = AC_SRC_ALPHA;
+ bf.BlendOp = AC_SRC_OVER;
+ bf.BlendFlags = 0;
+
+ ::UpdateLayeredWindow(hWnd, hdcDst, &ptDst, &size, hdcSrc, &ptSrc,
+ RGB(0, 0, 0), &bf, ULW_ALPHA);
+
+ ::ReleaseDC(NULL, hdcDst);
+ ::SelectObject(hdcSrc, hOldBitmap);
+ ::DeleteDC(hdcSrc);
+}
+
+void AwtWindow::UpdateWindow(JNIEnv* env, jintArray data, int width, int height,
+ HBITMAP hNewBitmap)
+{
+ if (isOpaque()) {
+ return;
+ }
+
+ HBITMAP hBitmap;
+ if (hNewBitmap == NULL) {
+ if (data == NULL) {
+ return;
+ }
+ hBitmap = CreateBitmapFromRaster(env, data, width, height);
+ if (hBitmap == NULL) {
+ return;
+ }
+ } else {
+ hBitmap = hNewBitmap;
+ }
+
+ ::EnterCriticalSection(&contentBitmapCS);
+ if (hContentBitmap != NULL) {
+ ::DeleteObject(hContentBitmap);
+ }
+ hContentBitmap = hBitmap;
+ contentWidth = width;
+ contentHeight = height;
+ UpdateWindowImpl(width, height, hBitmap);
+ ::LeaveCriticalSection(&contentBitmapCS);
+}
+
+void AwtWindow::FillBackground(HDC hMemoryDC, SIZE &size)
+{
+ if (isOpaque()) {
+ AwtCanvas::FillBackground(hMemoryDC, size);
+ }
+}
+
+void AwtWindow::FillAlpha(void *bitmapBits, SIZE &size, BYTE alpha)
+{
+ if (isOpaque()) {
+ AwtCanvas::FillAlpha(bitmapBits, size, alpha);
+ }
+}
+
+/*
+ * Fixed 6353381: it's improved fix for 4792958
+ * which was backed-out to avoid 5059656
+ */
+BOOL AwtWindow::HasValidRect()
+{
+ RECT inside;
+ RECT outside;
+
+ if (::IsIconic(GetHWnd())) {
+ return FALSE;
+ }
+
+ ::GetClientRect(GetHWnd(), &inside);
+ ::GetWindowRect(GetHWnd(), &outside);
+
+ BOOL isZeroClientArea = (inside.right == 0 && inside.bottom == 0);
+ BOOL isInvalidLocation = ((outside.left == -32000 && outside.top == -32000) || // Win2k && WinXP
+ (outside.left == 32000 && outside.top == 32000) || // Win95 && Win98
+ (outside.left == 3000 && outside.top == 3000)); // Win95 && Win98
+
+ // the bounds correspond to iconic state
+ if (isZeroClientArea && isInvalidLocation)
+ {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+
void AwtWindow::_SetIconImagesData(void * param)
{
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
@@ -2009,36 +2242,68 @@ void AwtWindow::_ModalEnable(void *param)
env->DeleteGlobalRef(self);
}
-/*
- * Fixed 6353381: it's improved fix for 4792958
- * which was backed-out to avoid 5059656
- */
-BOOL AwtWindow::HasValidRect()
+void AwtWindow::_SetOpacity(void* param)
{
- RECT inside;
- RECT outside;
+ JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- if (::IsIconic(GetHWnd())) {
- return FALSE;
- }
+ OpacityStruct *os = (OpacityStruct *)param;
+ jobject self = os->window;
+ BYTE iOpacity = (BYTE)os->iOpacity;
- ::GetClientRect(GetHWnd(), &inside);
- ::GetWindowRect(GetHWnd(), &outside);
+ PDATA pData;
+ JNI_CHECK_PEER_GOTO(self, ret);
+ AwtWindow *window = (AwtWindow *)pData;
- BOOL isZeroClientArea = (inside.right == 0 && inside.bottom == 0);
- BOOL isInvalidLocation = ((outside.left == -32000 && outside.top == -32000) || // Win2k && WinXP
- (outside.left == 32000 && outside.top == 32000) || // Win95 && Win98
- (outside.left == 3000 && outside.top == 3000)); // Win95 && Win98
+ window->SetTranslucency(iOpacity, window->isOpaque());
- // the bounds correspond to iconic state
- if (isZeroClientArea && isInvalidLocation)
- {
- return FALSE;
- }
-
- return TRUE;
+ ret:
+ env->DeleteGlobalRef(self);
+ delete os;
}
+void AwtWindow::_SetOpaque(void* param)
+{
+ JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
+
+ OpaqueStruct *os = (OpaqueStruct *)param;
+ jobject self = os->window;
+ BOOL isOpaque = (BOOL)os->isOpaque;
+
+ PDATA pData;
+ JNI_CHECK_PEER_GOTO(self, ret);
+ AwtWindow *window = (AwtWindow *)pData;
+
+ window->SetTranslucency(window->getOpacity(), isOpaque);
+
+ ret:
+ env->DeleteGlobalRef(self);
+ delete os;
+}
+
+void AwtWindow::_UpdateWindow(void* param)
+{
+ JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
+
+ UpdateWindowStruct *uws = (UpdateWindowStruct *)param;
+ jobject self = uws->window;
+ jintArray data = uws->data;
+
+ PDATA pData;
+ JNI_CHECK_PEER_GOTO(self, ret);
+ AwtWindow *window = (AwtWindow *)pData;
+
+ window->UpdateWindow(env, data, (int)uws->width, (int)uws->height,
+ uws->hBitmap);
+
+ ret:
+ env->DeleteGlobalRef(self);
+ if (data != NULL) {
+ env->DeleteGlobalRef(data);
+ }
+ delete uws;
+}
+
+
extern "C" {
/*
@@ -2489,4 +2754,93 @@ Java_sun_awt_windows_WWindowPeer_nativeUngrab(JNIEnv *env, jobject self)
CATCH_BAD_ALLOC;
}
+/*
+ * Class: sun_awt_windows_WWindowPeer
+ * Method: setOpacity
+ * Signature: (I)V
+ */
+JNIEXPORT void JNICALL
+Java_sun_awt_windows_WWindowPeer_setOpacity(JNIEnv *env, jobject self,
+ jint iOpacity)
+{
+ TRY;
+
+ OpacityStruct *os = new OpacityStruct;
+ os->window = env->NewGlobalRef(self);
+ os->iOpacity = iOpacity;
+
+ AwtToolkit::GetInstance().SyncCall(AwtWindow::_SetOpacity, os);
+ // global refs and mds are deleted in _SetMinSize
+
+ CATCH_BAD_ALLOC;
+}
+
+/*
+ * Class: sun_awt_windows_WWindowPeer
+ * Method: setOpaqueImpl
+ * Signature: (Z)V
+ */
+JNIEXPORT void JNICALL
+Java_sun_awt_windows_WWindowPeer_setOpaqueImpl(JNIEnv *env, jobject self,
+ jboolean isOpaque)
+{
+ TRY;
+
+ OpaqueStruct *os = new OpaqueStruct;
+ os->window = env->NewGlobalRef(self);
+ os->isOpaque = isOpaque;
+
+ AwtToolkit::GetInstance().SyncCall(AwtWindow::_SetOpaque, os);
+ // global refs and mds are deleted in _SetMinSize
+
+ CATCH_BAD_ALLOC;
+}
+
+/*
+ * Class: sun_awt_windows_WWindowPeer
+ * Method: updateWindowImpl
+ * Signature: ([III)V
+ */
+JNIEXPORT void JNICALL
+Java_sun_awt_windows_WWindowPeer_updateWindowImpl(JNIEnv *env, jobject self,
+ jintArray data,
+ jint width, jint height)
+{
+ TRY;
+
+ UpdateWindowStruct *uws = new UpdateWindowStruct;
+ uws->window = env->NewGlobalRef(self);
+ uws->data = (jintArray)env->NewGlobalRef(data);
+ uws->hBitmap = NULL;
+ uws->width = width;
+ uws->height = height;
+
+ AwtToolkit::GetInstance().InvokeFunction(AwtWindow::_UpdateWindow, uws);
+ // global refs and mds are deleted in _UpdateWindow
+
+ CATCH_BAD_ALLOC;
+}
+
+/**
+ * This method is called from the WGL pipeline when it needs to update
+ * the layered window WindowPeer's C++ level object.
+ */
+void AwtWindow_UpdateWindow(JNIEnv *env, jobject peer,
+ jint width, jint height, HBITMAP hBitmap)
+{
+ TRY;
+
+ UpdateWindowStruct *uws = new UpdateWindowStruct;
+ uws->window = env->NewGlobalRef(peer);
+ uws->data = NULL;
+ uws->hBitmap = hBitmap;
+ uws->width = width;
+ uws->height = height;
+
+ AwtToolkit::GetInstance().InvokeFunction(AwtWindow::_UpdateWindow, uws);
+ // global refs and mds are deleted in _UpdateWindow
+
+ CATCH_BAD_ALLOC;
+}
+
} /* extern "C" */
diff --git a/jdk/src/windows/native/sun/windows/awt_Window.h b/jdk/src/windows/native/sun/windows/awt_Window.h
index 9a252a25ce1..a3d57db7b2d 100644
--- a/jdk/src/windows/native/sun/windows/awt_Window.h
+++ b/jdk/src/windows/native/sun/windows/awt_Window.h
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -182,6 +182,9 @@ public:
void moveToDefaultLocation(); /* moves Window to X,Y specified by Window Manger */
+ void UpdateWindow(JNIEnv* env, jintArray data, int width, int height,
+ HBITMAP hNewBitmap = NULL);
+
INLINE virtual BOOL IsTopLevel() { return TRUE; }
static AwtWindow * GetGrabbedWindow() { return m_grabbedWindow; }
@@ -204,6 +207,9 @@ public:
static void _SetModalExcludedNativeProp(void *param);
static void _ModalDisable(void *param);
static void _ModalEnable(void *param);
+ static void _SetOpacity(void* param);
+ static void _SetOpaque(void* param);
+ static void _UpdateWindow(void* param);
inline static BOOL IsResizing() {
return sm_resizing;
@@ -228,6 +234,32 @@ private:
// from its hierarchy when shown. Currently applied to instances of
// javax/swing/Popup$HeavyWeightWindow class.
+ BYTE m_opacity; // The opacity level. == 0xff by default (when opacity mode is disabled)
+ BOOL m_opaque; // Whether the window uses the perpixel translucency (false), or not (true).
+
+ inline BYTE getOpacity() {
+ return m_opacity;
+ }
+ inline void setOpacity(BYTE opacity) {
+ m_opacity = opacity;
+ }
+
+ inline BOOL isOpaque() {
+ return m_opaque;
+ }
+ inline void setOpaque(BOOL opaque) {
+ m_opaque = opaque;
+ }
+
+ CRITICAL_SECTION contentBitmapCS;
+ HBITMAP hContentBitmap;
+ UINT contentWidth;
+ UINT contentHeight;
+
+ void RedrawWindow();
+ void SetTranslucency(BYTE opacity, BOOL opaque);
+ void UpdateWindowImpl(int width, int height, HBITMAP hBitmap);
+
protected:
BOOL m_isResizable;
static AwtWindow* m_grabbedWindow; // Current grabbing window
@@ -236,6 +268,10 @@ protected:
BOOL m_iconInherited; /* TRUE if icon is inherited from the owner */
BOOL m_filterFocusAndActivation; /* Used in the WH_CBT hook */
+ //These are used in AwtComponent::CreatePrintedPixels. They are overridden
+ //here to handle non-opaque windows.
+ virtual void FillBackground(HDC hMemoryDC, SIZE &size);
+ virtual void FillAlpha(void *bitmapBits, SIZE &size, BYTE alpha);
private:
int m_screenNum;
diff --git a/jdk/test/com/sun/awt/Translucency/TranslucentJAppletTest/TranslucentJAppletTest.java b/jdk/test/com/sun/awt/Translucency/TranslucentJAppletTest/TranslucentJAppletTest.java
new file mode 100644
index 00000000000..08cbe4069a3
--- /dev/null
+++ b/jdk/test/com/sun/awt/Translucency/TranslucentJAppletTest/TranslucentJAppletTest.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2008-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
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test %I% %E%
+ * @bug 6683728
+ * @summary Tests that a JApplet in a translucent JFrame works properly
+ * @author Kenneth.Russell@sun.com: area=Graphics
+ * @compile -XDignore.symbol.file=true TranslucentJAppletTest.java
+ * @run main/manual/othervm TranslucentJAppletTest
+ */
+
+import java.awt.*;
+import java.awt.image.*;
+
+import javax.swing.*;
+
+public class TranslucentJAppletTest {
+
+ private static JFrame frame;
+ private static volatile boolean paintComponentCalled = false;
+
+ private static void initAndShowGUI() {
+ frame = new JFrame();
+ JApplet applet = new JApplet();
+ JPanel panel = new JPanel() {
+ protected void paintComponent(Graphics g) {
+ paintComponentCalled = true;
+ g.setColor(Color.RED);
+ g.fillOval(0, 0, getWidth(), getHeight());
+ }
+ };
+ panel.setDoubleBuffered(false);
+ panel.setOpaque(false);
+ applet.add(panel);
+ frame.add(applet);
+ frame.setBounds(100, 100, 200, 200);
+ frame.setUndecorated(true);
+ com.sun.awt.AWTUtilities.setWindowOpaque(frame, false);
+ frame.setVisible(true);
+ }
+
+ public static void main(String[] args)
+ throws Exception
+ {
+ sun.awt.SunToolkit tk = (sun.awt.SunToolkit)Toolkit.getDefaultToolkit();
+
+ Robot r = new Robot();
+ Color color1 = r.getPixelColor(100, 100); // (0, 0) in frame coordinates
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ initAndShowGUI();
+ }
+ });
+ tk.realSync();
+
+ if (!paintComponentCalled) {
+ throw new RuntimeException("Test FAILED: panel's paintComponent() method is not called");
+ }
+
+ Color newColor1 = r.getPixelColor(100, 100);
+ // unfortunately, robot.getPixelColor() doesn't work for some unknown reason
+ // Color newColor2 = r.getPixelColor(200, 200);
+ BufferedImage bim = r.createScreenCapture(new Rectangle(200, 200, 1, 1));
+ Color newColor2 = new Color(bim.getRGB(0, 0));
+
+ // Frame must be transparent at (100, 100) in screen coords
+ if (!color1.equals(newColor1)) {
+ System.err.println("color1 = " + color1);
+ System.err.println("newColor1 = " + newColor1);
+ throw new RuntimeException("Test FAILED: frame pixel at (0, 0) is not transparent");
+ }
+
+ // Frame must be RED at (200, 200) in screen coords
+ if (!newColor2.equals(Color.RED)) {
+ System.err.println("newColor2 = " + newColor2);
+ throw new RuntimeException("Test FAILED: frame pixel at (100, 100) is not red (transparent?)");
+ }
+
+ System.out.println("Test PASSED");
+ }
+}
diff --git a/jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TSFrame.java b/jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TSFrame.java
new file mode 100644
index 00000000000..1e9cf74658e
--- /dev/null
+++ b/jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TSFrame.java
@@ -0,0 +1,306 @@
+/*
+ * Copyright 2008-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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+import com.sun.awt.AWTUtilities;
+import static com.sun.awt.AWTUtilities.Translucency.*;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsEnvironment;
+import java.awt.RenderingHints;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.awt.event.WindowAdapter;
+import java.awt.event.WindowEvent;
+import java.awt.Canvas;
+import java.awt.Component;
+import java.awt.GradientPaint;
+import java.awt.Graphics2D;
+import java.awt.Paint;
+import java.util.Random;
+import java.awt.geom.Ellipse2D;
+import javax.swing.JApplet;
+import javax.swing.JButton;
+import javax.swing.JComponent;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.SwingUtilities;
+
+public class TSFrame {
+
+ static volatile boolean done = false;
+
+ static final boolean useSwing = System.getProperty("useswing") != null;
+ static final boolean useShape = System.getProperty("useshape") != null;
+ static final boolean useTransl = System.getProperty("usetransl") != null;
+ static final boolean useNonOpaque = System.getProperty("usenonop") != null;
+
+ static final Random rnd = new Random();
+ private static void render(Graphics g, int w, int h, boolean useNonOpaque) {
+ if (useNonOpaque) {
+ Graphics2D g2d = (Graphics2D)g;
+ GradientPaint p =
+ new GradientPaint(0.0f, 0.0f,
+ new Color(rnd.nextInt(0xffffff)),
+ w, h,
+ new Color(rnd.nextInt(0xff),
+ rnd.nextInt(0xff),
+ rnd.nextInt(0xff), 0),
+ true);
+ g2d.setPaint(p);
+ g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+ RenderingHints.VALUE_ANTIALIAS_ON);
+ g2d.fillOval(0, 0, w, h);
+ } else {
+ g.setColor(new Color(rnd.nextInt(0xffffff)));
+ g.fillRect(0, 0, w, h);
+ }
+ }
+
+ private static class MyCanvas extends Canvas {
+ @Override
+ public void paint(Graphics g) {
+ render(g, getWidth(), getHeight(), false);
+ }
+ @Override
+ public Dimension getPreferredSize() {
+ return new Dimension(200, 100);
+ }
+ }
+ private static class NonOpaqueJFrame extends JFrame {
+ NonOpaqueJFrame(GraphicsConfiguration gc) {
+ super("NonOpaque Swing JFrame", gc);
+ JPanel p = new JPanel() {
+ public void paintComponent(Graphics g) {
+ super.paintComponent(g);
+ render(g, getWidth(), getHeight(), true);
+ g.setColor(Color.red);
+ g.drawString("Non-Opaque Swing JFrame", 10, 15);
+ }
+ };
+ p.setDoubleBuffered(false);
+ p.setOpaque(false);
+ add(p);
+ setUndecorated(true);
+ }
+ }
+ private static class NonOpaqueJAppletFrame extends JFrame {
+ JPanel p;
+ NonOpaqueJAppletFrame(GraphicsConfiguration gc) {
+ super("NonOpaque Swing JAppletFrame", gc);
+ JApplet ja = new JApplet() {
+ public void paint(Graphics g) {
+ super.paint(g);
+ System.err.println("JAppletFrame paint called");
+ }
+ };
+ p = new JPanel() {
+ public void paintComponent(Graphics g) {
+ super.paintComponent(g);
+ render(g, getWidth(), getHeight(), true);
+ g.setColor(Color.red);
+ g.drawString("Non-Opaque Swing JFrame", 10, 15);
+ }
+ };
+ p.setDoubleBuffered(false);
+ p.setOpaque(false);
+ ja.add(p);
+ add(ja);
+ setUndecorated(true);
+ }
+ }
+ private static class NonOpaqueFrame extends Frame {
+ NonOpaqueFrame(GraphicsConfiguration gc) {
+ super("NonOpaque AWT Frame", gc);
+ // uncomment to test with hw child
+// setLayout(null);
+// Component c = new Panel() {
+// public void paint(Graphics g) {
+// g.setColor(new Color(1.0f, 1.0f, 1.0f, 0.5f));
+// g.fillRect(0, 0, getWidth(), getHeight());
+// }
+// };
+// c.setSize(100, 100);
+// c.setBackground(Color.red);
+// c.setForeground(Color.red);
+// add(c);
+// c.setLocation(130, 130);
+ }
+ @Override
+ public void paint(Graphics g) {
+ render(g, getWidth(), getHeight(), true);
+ g.setColor(Color.red);
+ g.drawString("Non-Opaque AWT Frame", 10, 15);
+ }
+ }
+
+ private static class MyJPanel extends JPanel {
+ @Override
+ public void paintComponent(Graphics g) {
+ render(g, getWidth(), getHeight(), false);
+ }
+ }
+
+ public static Frame createGui(GraphicsConfiguration gc,
+ final boolean useSwing,
+ final boolean useShape,
+ final boolean useTransl,
+ final boolean useNonOpaque,
+ final float factor)
+ {
+ Frame frame;
+ done = false;
+
+ if (gc == null) {
+ gc = GraphicsEnvironment.getLocalGraphicsEnvironment().
+ getDefaultScreenDevice().getDefaultConfiguration();
+ }
+
+ if (useNonOpaque) {
+ if (useSwing) {
+ frame = new NonOpaqueJFrame(gc);
+// frame = new NonOpaqueJAppletFrame(gc);
+ } else {
+ frame = new NonOpaqueFrame(gc);
+ }
+ animateComponent(frame);
+ } else if (useSwing) {
+ frame = new JFrame("Swing Frame", gc);
+ JComponent p = new JButton("Swing!");
+ p.setPreferredSize(new Dimension(200, 100));
+ frame.add("North", p);
+ p = new MyJPanel();
+ animateComponent(p);
+ frame.add("Center", p);
+ } else {
+ frame = new Frame("AWT Frame", gc) {
+ public void paint(Graphics g) {
+ g.setColor(Color.red);
+ g.fillRect(0, 0, 100, 100);
+ }
+ };
+ frame.setLayout(new BorderLayout());
+ Canvas c = new MyCanvas();
+ frame.add("North", c);
+ animateComponent(c);
+ c = new MyCanvas();
+ frame.add("Center", c);
+ animateComponent(c);
+ c = new MyCanvas();
+ frame.add("South", c);
+ animateComponent(c);
+ }
+ final Frame finalFrame = frame;
+ frame.addWindowListener(new WindowAdapter() {
+ @Override
+ public void windowClosing(WindowEvent e) {
+ finalFrame.dispose();
+ done = true;
+ }
+ });
+ frame.addMouseListener(new MouseAdapter() {
+ @Override
+ public void mouseClicked(MouseEvent e) {
+ finalFrame.dispose();
+ done = true;
+ }
+ });
+ frame.setPreferredSize(new Dimension(800, 600));
+
+ if (useShape) {
+ frame.setUndecorated(true);
+ }
+
+ frame.setLocation(450, 10);
+ frame.pack();
+
+ if (useShape) {
+ if (AWTUtilities.isTranslucencySupported(PERPIXEL_TRANSPARENT)) {
+ System.out.println("applying PERPIXEL_TRANSPARENT");
+ AWTUtilities.setWindowShape(frame,
+ new Ellipse2D.Double(0, 0, frame.getWidth(),
+ frame.getHeight()/3));
+ frame.setTitle("PERPIXEL_TRANSPARENT");
+ } else {
+ System.out.println("Passed: PERPIXEL_TRANSPARENT unsupported");
+ }
+ }
+ if (useTransl) {
+ if (AWTUtilities.isTranslucencySupported(TRANSLUCENT)) {
+ System.out.println("applying TRANSLUCENT");
+ AWTUtilities.setWindowOpacity(frame, factor);
+ frame.setTitle("TRANSLUCENT");
+ } else {
+ System.out.println("Passed: TRANSLUCENT unsupported");
+ }
+ }
+ if (useNonOpaque) {
+ if (AWTUtilities.isTranslucencySupported(PERPIXEL_TRANSLUCENT) &&
+ AWTUtilities.isTranslucencyCapable(gc))
+ {
+ System.out.println("applying PERPIXEL_TRANSLUCENT");
+ AWTUtilities.setWindowOpaque(frame, false);
+ frame.setTitle("PERPIXEL_TRANSLUCENT");
+ } else {
+ System.out.println("Passed: PERPIXEL_TRANSLUCENT unsupported");
+ }
+ }
+ frame.setVisible(true);
+ return frame;
+ }
+
+ public static void stopThreads() {
+ done = true;
+ }
+
+ private static void animateComponent(final Component comp) {
+ Thread t = new Thread(new Runnable() {
+ public void run() {
+ do {
+ try {
+ Thread.sleep(50);
+ } catch (InterruptedException ex) {}
+ comp.repaint();
+ } while (!done);
+ }
+ });
+ t.start();
+ }
+
+ public static void main(String[] args) throws Exception {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ TSFrame.createGui(null, useSwing,
+ useShape,
+ useTransl,
+ useNonOpaque,
+ 0.7f);
+ }
+ });
+ }
+}
diff --git a/jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TranslucentShapedFrameTest.form b/jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TranslucentShapedFrameTest.form
new file mode 100644
index 00000000000..4291e0eeaac
--- /dev/null
+++ b/jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TranslucentShapedFrameTest.form
@@ -0,0 +1,230 @@
+
+
+
diff --git a/jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TranslucentShapedFrameTest.java b/jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TranslucentShapedFrameTest.java
new file mode 100644
index 00000000000..edb58ff67b8
--- /dev/null
+++ b/jdk/test/com/sun/awt/Translucency/TranslucentShapedFrameTest/TranslucentShapedFrameTest.java
@@ -0,0 +1,359 @@
+/*
+ * Copyright 2008-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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test %I% %E%
+ * @bug 6655001 6670649 6687141
+ * @summary Tests that hw acceleration doesn't affect translucent/shaped windows
+ * @author Dmitri.Trembovetski@sun.com: area=Graphics
+ * @compile -XDignore.symbol.file=true TranslucentShapedFrameTest.java
+ * @compile -XDignore.symbol.file=true TSFrame.java
+ * @run main/manual/othervm TranslucentShapedFrameTest
+ * @run main/manual/othervm -Dsun.java2d.noddraw=true TranslucentShapedFrameTest
+ * @run main/manual/othervm -Dsun.java2d.opengl=True TranslucentShapedFrameTest
+ */
+import com.sun.awt.AWTUtilities;
+import static com.sun.awt.AWTUtilities.Translucency.*;
+import java.awt.Frame;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.awt.Shape;
+import java.awt.geom.Ellipse2D;
+import java.util.concurrent.CountDownLatch;
+import javax.swing.JSlider;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+
+public class TranslucentShapedFrameTest extends javax.swing.JFrame {
+ Frame testFrame;
+ static CountDownLatch done;
+ static volatile boolean failed = false;
+ GraphicsConfiguration gcToUse = null;
+
+ /**
+ * Creates new form TranslucentShapedFrameTest
+ */
+ public TranslucentShapedFrameTest() {
+ // not necessary, but we just look nicer
+ try {
+ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
+ } catch (Exception ex) {}
+
+ initComponents();
+ checkEffects();
+
+ SwingUtilities.updateComponentTreeUI(this);
+ }
+
+ /** This method is called from within the constructor to
+ * initialize the form.
+ * WARNING: Do NOT modify this code. The content of this method is
+ * always regenerated by the Form Editor.
+ */
+ // //GEN-BEGIN:initComponents
+ private void initComponents() {
+ createDisposeGrp = new javax.swing.ButtonGroup();
+ jLabel1 = new javax.swing.JLabel();
+ transparencySld = new javax.swing.JSlider();
+ shapedCb = new javax.swing.JCheckBox();
+ nonOpaqueChb = new javax.swing.JCheckBox();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ jTextArea1 = new javax.swing.JTextArea();
+ jLabel2 = new javax.swing.JLabel();
+ passedBtn = new javax.swing.JButton();
+ failedBtn = new javax.swing.JButton();
+ createFrameBtn = new javax.swing.JToggleButton();
+ disposeFrameBtn = new javax.swing.JToggleButton();
+ useSwingCb = new javax.swing.JCheckBox();
+
+ setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+ setTitle("TranslucentShapedFrameTest");
+ jLabel1.setText("Frame Opacity:");
+
+ transparencySld.setMajorTickSpacing(10);
+ transparencySld.setMinorTickSpacing(5);
+ transparencySld.setPaintLabels(true);
+ transparencySld.setPaintTicks(true);
+ transparencySld.setValue(100);
+ transparencySld.addChangeListener(new javax.swing.event.ChangeListener() {
+ public void stateChanged(javax.swing.event.ChangeEvent evt) {
+ transparencySldStateChanged(evt);
+ }
+ });
+
+ shapedCb.setText("Shaped Frame");
+ shapedCb.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
+ shapedCb.setMargin(new java.awt.Insets(0, 0, 0, 0));
+ shapedCb.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ shapedCbActionPerformed(evt);
+ }
+ });
+
+ nonOpaqueChb.setText("Non Opaque Frame");
+ nonOpaqueChb.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
+ nonOpaqueChb.setMargin(new java.awt.Insets(0, 0, 0, 0));
+ nonOpaqueChb.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ nonOpaqueChbActionPerformed(evt);
+ }
+ });
+
+ jTextArea1.setColumns(20);
+ jTextArea1.setRows(5);
+ jTextArea1.setText("Create translucent and/or shaped, or\nnon-opaque frame. Make sure it behaves\ncorrectly (no artifacts left on the screen\nwhen dragging - if dragging is possible).\nClick \"Passed\" if the test behaves correctly,\n\"Falied\" otherwise.");
+ jScrollPane1.setViewportView(jTextArea1);
+
+ jLabel2.setText("Instructions:");
+
+ passedBtn.setBackground(new java.awt.Color(129, 255, 100));
+ passedBtn.setText("Passed");
+ passedBtn.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ passedBtnActionPerformed(evt);
+ }
+ });
+
+ failedBtn.setBackground(java.awt.Color.red);
+ failedBtn.setText("Failed");
+ failedBtn.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ failedBtnActionPerformed(evt);
+ }
+ });
+
+ createDisposeGrp.add(createFrameBtn);
+ createFrameBtn.setText("Create Frame");
+ createFrameBtn.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ createFrameBtnActionPerformed(evt);
+ }
+ });
+
+ createDisposeGrp.add(disposeFrameBtn);
+ disposeFrameBtn.setSelected(true);
+ disposeFrameBtn.setText("Dispose Frame");
+ disposeFrameBtn.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ disposeFrameBtnActionPerformed(evt);
+ }
+ });
+
+ useSwingCb.setText("Use JFrame");
+ useSwingCb.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
+ useSwingCb.setMargin(new java.awt.Insets(0, 0, 0, 0));
+
+ javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(transparencySld, javax.swing.GroupLayout.DEFAULT_SIZE, 375, Short.MAX_VALUE)
+ .addContainerGap())
+ .addComponent(jLabel1)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(shapedCb)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(nonOpaqueChb)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(useSwingCb)
+ .addContainerGap(102, Short.MAX_VALUE))
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(jLabel2)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 314, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(passedBtn)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(failedBtn)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 241, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 375, Short.MAX_VALUE)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(createFrameBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 187, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(disposeFrameBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 182, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addContainerGap())))
+ );
+ layout.setVerticalGroup(
+ layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jLabel1)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(transparencySld, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(shapedCb)
+ .addComponent(nonOpaqueChb)
+ .addComponent(useSwingCb))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(disposeFrameBtn)
+ .addComponent(createFrameBtn))
+ .addGap(17, 17, 17)
+ .addComponent(jLabel2)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(passedBtn)
+ .addComponent(failedBtn))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ );
+ pack();
+ }// //GEN-END:initComponents
+
+ private void nonOpaqueChbActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nonOpaqueChbActionPerformed
+ if (testFrame != null) {
+ // REMIND: this path in the test doesn't work well (test bug)
+// AWTUtilities.setWindowOpaque(testFrame, !nonOpaqueChb.isSelected());
+ }
+ }//GEN-LAST:event_nonOpaqueChbActionPerformed
+
+ private void shapedCbActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_shapedCbActionPerformed
+ if (testFrame != null) {
+ Shape s = null;
+ if (shapedCb.isSelected()) {
+ s = new Ellipse2D.Double(0, 0,
+ testFrame.getWidth(),
+ testFrame.getHeight());
+ }
+ AWTUtilities.setWindowShape(testFrame, s);
+ }
+ }//GEN-LAST:event_shapedCbActionPerformed
+
+ private void transparencySldStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_transparencySldStateChanged
+ JSlider source = (JSlider)evt.getSource();
+ int transl = transparencySld.getValue();
+ if (testFrame != null) {
+ AWTUtilities.setWindowOpacity(testFrame, (float)transl/100f);
+ }
+ }//GEN-LAST:event_transparencySldStateChanged
+
+ private void failedBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_failedBtnActionPerformed
+ disposeFrameBtnActionPerformed(evt);
+ dispose();
+ failed = true;
+ done.countDown();
+ }//GEN-LAST:event_failedBtnActionPerformed
+
+ private void disposeFrameBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_disposeFrameBtnActionPerformed
+ TSFrame.stopThreads();
+ if (testFrame != null) {
+ testFrame.dispose();
+ testFrame = null;
+ }
+ }//GEN-LAST:event_disposeFrameBtnActionPerformed
+
+ private void createFrameBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createFrameBtnActionPerformed
+ disposeFrameBtnActionPerformed(evt);
+ int transl = transparencySld.getValue();
+ testFrame = TSFrame.createGui(gcToUse,
+ useSwingCb.isSelected(), shapedCb.isSelected(),
+ (transl < 100), nonOpaqueChb.isSelected(),
+ (float)transl/100f);
+ }//GEN-LAST:event_createFrameBtnActionPerformed
+
+ private void passedBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_passedBtnActionPerformed
+ disposeFrameBtnActionPerformed(evt);
+ dispose();
+ done.countDown();
+ }//GEN-LAST:event_passedBtnActionPerformed
+
+ /**
+ * @param args the command line arguments
+ */
+ public static void main(String args[]) {
+ done = new CountDownLatch(1);
+ java.awt.EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ new TranslucentShapedFrameTest().setVisible(true);
+ }
+ });
+ try {
+ done.await();
+ } catch (InterruptedException ex) {}
+ if (failed) {
+ throw new RuntimeException("Test FAILED");
+ }
+ System.out.println("Test PASSED");
+ }
+
+ private void checkEffects() {
+ if (!AWTUtilities.isTranslucencySupported(PERPIXEL_TRANSPARENT)) {
+ shapedCb.setEnabled(false);
+ }
+
+ if (!AWTUtilities.isTranslucencySupported(TRANSLUCENT)) {
+ transparencySld.setEnabled(false);
+ }
+
+ GraphicsConfiguration gc = null;
+ if (AWTUtilities.isTranslucencySupported(PERPIXEL_TRANSLUCENT)) {
+ gc = findGraphicsConfig();
+ if (gc == null) {
+ nonOpaqueChb.setEnabled(false);
+ }
+ }
+
+ gcToUse = gc;
+ }
+
+ private GraphicsConfiguration findGraphicsConfig() {
+ GraphicsDevice gd =
+ GraphicsEnvironment.getLocalGraphicsEnvironment().
+ getDefaultScreenDevice();
+ GraphicsConfiguration gcs[] = gd.getConfigurations();
+ for (GraphicsConfiguration gc : gcs) {
+ if (AWTUtilities.isTranslucencyCapable(gc)) {
+ return gc;
+ }
+ }
+ return null;
+ }
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.ButtonGroup createDisposeGrp;
+ private javax.swing.JToggleButton createFrameBtn;
+ private javax.swing.JToggleButton disposeFrameBtn;
+ private javax.swing.JButton failedBtn;
+ private javax.swing.JLabel jLabel1;
+ private javax.swing.JLabel jLabel2;
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JTextArea jTextArea1;
+ private javax.swing.JCheckBox nonOpaqueChb;
+ private javax.swing.JButton passedBtn;
+ private javax.swing.JCheckBox shapedCb;
+ private javax.swing.JSlider transparencySld;
+ private javax.swing.JCheckBox useSwingCb;
+ // End of variables declaration//GEN-END:variables
+
+}
diff --git a/jdk/test/com/sun/awt/Translucency/WindowOpacity.java b/jdk/test/com/sun/awt/Translucency/WindowOpacity.java
new file mode 100644
index 00000000000..d5d8a11d3d9
--- /dev/null
+++ b/jdk/test/com/sun/awt/Translucency/WindowOpacity.java
@@ -0,0 +1,461 @@
+/*
+ * Copyright 2008-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
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ @test %W% %E%
+ @bug 6594131
+ @summary Tests the AWTUtilities.get/setWindowOpacity() methods
+ @author anthony.petrov@...: area=awt.toplevel
+ @run main WindowOpacity
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+
+import com.sun.awt.AWTUtilities;
+import sun.awt.SunToolkit;
+
+public class WindowOpacity
+{
+ //*** test-writer defined static variables go here ***
+
+ private static void realSync() {
+ ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+ }
+
+
+ private static void init()
+ {
+ //*** Create instructions for the user here ***
+ String[] instructions =
+ {
+ "This is an AUTOMATIC test, simply wait until it is done.",
+ "The result (passed or failed) will be shown in the",
+ "message window below."
+ };
+ Sysout.createDialog( );
+ Sysout.printInstructions( instructions );
+
+ if (!AWTUtilities.isTranslucencySupported(AWTUtilities.Translucency.TRANSLUCENT)) {
+ System.out.println("Either the Toolkit or the native system does not support controlling the window opacity level.");
+ pass();
+ }
+
+ boolean passed;
+
+ Frame f = new Frame("Opacity test");
+
+ passed = false;
+ try {
+ AWTUtilities.getWindowOpacity(null);
+ } catch (NullPointerException e) {
+ passed = true;
+ }
+ if (!passed) {
+ fail("getWindowOpacity() allows passing null.");
+ }
+
+
+ passed = false;
+ try {
+ AWTUtilities.setWindowOpacity(null, 0.5f);
+ } catch (NullPointerException e) {
+ passed = true;
+ }
+ if (!passed) {
+ fail("setWindowOpacity() allows passing null.");
+ }
+
+
+ float curOpacity = AWTUtilities.getWindowOpacity(f);
+ if (curOpacity < 1.0f || curOpacity > 1.0f) {
+ fail("getWindowOpacity() reports the initial opacity level other than 1.0: " + curOpacity);
+ }
+
+
+
+ passed = false;
+ try {
+ AWTUtilities.setWindowOpacity(f, -0.5f);
+ } catch (IllegalArgumentException e) {
+ passed = true;
+ }
+ if (!passed) {
+ fail("setWindowOpacity() allows passing negative opacity level.");
+ }
+
+
+
+ passed = false;
+ try {
+ AWTUtilities.setWindowOpacity(f, 1.5f);
+ } catch (IllegalArgumentException e) {
+ passed = true;
+ }
+ if (!passed) {
+ fail("setWindowOpacity() allows passing opacity level greater than 1.0.");
+ }
+
+
+ AWTUtilities.setWindowOpacity(f, 0.5f);
+
+ curOpacity = AWTUtilities.getWindowOpacity(f);
+ if (curOpacity < 0.5f || curOpacity > 0.5f) {
+ fail("getWindowOpacity() reports the opacity level that differs from the value set with setWindowOpacity: " + curOpacity);
+ }
+
+
+ AWTUtilities.setWindowOpacity(f, 0.75f);
+
+ curOpacity = AWTUtilities.getWindowOpacity(f);
+ if (curOpacity < 0.75f || curOpacity > 0.75f) {
+ fail("getWindowOpacity() reports the opacity level that differs from the value set with setWindowOpacity the second time: " + curOpacity);
+ }
+
+
+ f.setBounds(100, 100, 300, 200);
+ f.setVisible(true);
+
+ realSync();
+
+ curOpacity = AWTUtilities.getWindowOpacity(f);
+ if (curOpacity < 0.75f || curOpacity > 0.75f) {
+ fail("getWindowOpacity() reports the opacity level that differs from the value set with setWindowOpacity before showing the frame: " + curOpacity);
+ }
+
+
+
+ AWTUtilities.setWindowOpacity(f, 0.5f);
+ realSync();
+
+ curOpacity = AWTUtilities.getWindowOpacity(f);
+ if (curOpacity < 0.5f || curOpacity > 0.5f) {
+ fail("getWindowOpacity() reports the opacity level that differs from the value set with setWindowOpacity after showing the frame: " + curOpacity);
+ }
+
+ WindowOpacity.pass();
+
+ }//End init()
+
+
+
+ /*****************************************************
+ * Standard Test Machinery Section
+ * DO NOT modify anything in this section -- it's a
+ * standard chunk of code which has all of the
+ * synchronisation necessary for the test harness.
+ * By keeping it the same in all tests, it is easier
+ * to read and understand someone else's test, as
+ * well as insuring that all tests behave correctly
+ * with the test harness.
+ * There is a section following this for test-
+ * classes
+ ******************************************************/
+ private static boolean theTestPassed = false;
+ private static boolean testGeneratedInterrupt = false;
+ private static String failureMessage = "";
+
+ private static Thread mainThread = null;
+
+ private static int sleepTime = 300000;
+
+ // Not sure about what happens if multiple of this test are
+ // instantiated in the same VM. Being static (and using
+ // static vars), it aint gonna work. Not worrying about
+ // it for now.
+ public static void main( String args[] ) throws InterruptedException
+ {
+ mainThread = Thread.currentThread();
+ try
+ {
+ init();
+ }
+ catch( TestPassedException e )
+ {
+ //The test passed, so just return from main and harness will
+ // interepret this return as a pass
+ return;
+ }
+ //At this point, neither test pass nor test fail has been
+ // called -- either would have thrown an exception and ended the
+ // test, so we know we have multiple threads.
+
+ //Test involves other threads, so sleep and wait for them to
+ // called pass() or fail()
+ try
+ {
+ Thread.sleep( sleepTime );
+ //Timed out, so fail the test
+ throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
+ }
+ catch (InterruptedException e)
+ {
+ //The test harness may have interrupted the test. If so, rethrow the exception
+ // so that the harness gets it and deals with it.
+ if( ! testGeneratedInterrupt ) throw e;
+
+ //reset flag in case hit this code more than once for some reason (just safety)
+ testGeneratedInterrupt = false;
+
+ if ( theTestPassed == false )
+ {
+ throw new RuntimeException( failureMessage );
+ }
+ }
+
+ }//main
+
+ public static synchronized void setTimeoutTo( int seconds )
+ {
+ sleepTime = seconds * 1000;
+ }
+
+ public static synchronized void pass()
+ {
+ Sysout.println( "The test passed." );
+ Sysout.println( "The test is over, hit Ctl-C to stop Java VM" );
+ //first check if this is executing in main thread
+ if ( mainThread == Thread.currentThread() )
+ {
+ //Still in the main thread, so set the flag just for kicks,
+ // and throw a test passed exception which will be caught
+ // and end the test.
+ theTestPassed = true;
+ throw new TestPassedException();
+ }
+ theTestPassed = true;
+ testGeneratedInterrupt = true;
+ mainThread.interrupt();
+ }//pass()
+
+ public static synchronized void fail()
+ {
+ //test writer didn't specify why test failed, so give generic
+ fail( "it just plain failed! :-)" );
+ }
+
+ public static synchronized void fail( String whyFailed )
+ {
+ Sysout.println( "The test failed: " + whyFailed );
+ Sysout.println( "The test is over, hit Ctl-C to stop Java VM" );
+ //check if this called from main thread
+ if ( mainThread == Thread.currentThread() )
+ {
+ //If main thread, fail now 'cause not sleeping
+ throw new RuntimeException( whyFailed );
+ }
+ theTestPassed = false;
+ testGeneratedInterrupt = true;
+ failureMessage = whyFailed;
+ mainThread.interrupt();
+ }//fail()
+
+}// class WindowOpacity
+
+//This exception is used to exit from any level of call nesting
+// when it's determined that the test has passed, and immediately
+// end the test.
+class TestPassedException extends RuntimeException
+{
+}
+
+//*********** End Standard Test Machinery Section **********
+
+
+//************ Begin classes defined for the test ****************
+
+// if want to make listeners, here is the recommended place for them, then instantiate
+// them in init()
+
+/* Example of a class which may be written as part of a test
+class NewClass implements anInterface
+ {
+ static int newVar = 0;
+
+ public void eventDispatched(AWTEvent e)
+ {
+ //Counting events to see if we get enough
+ eventCount++;
+
+ if( eventCount == 20 )
+ {
+ //got enough events, so pass
+
+ WindowOpacity.pass();
+ }
+ else if( tries == 20 )
+ {
+ //tried too many times without getting enough events so fail
+
+ WindowOpacity.fail();
+ }
+
+ }// eventDispatched()
+
+ }// NewClass class
+
+*/
+
+
+//************** End classes defined for the test *******************
+
+
+
+
+/****************************************************
+ 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 );
+ System.out.println(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();
+
+ setVisible(true);
+ }// 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
diff --git a/jdk/test/sun/java2d/pipe/RegionOps.java b/jdk/test/sun/java2d/pipe/RegionOps.java
new file mode 100644
index 00000000000..30f8c223a25
--- /dev/null
+++ b/jdk/test/sun/java2d/pipe/RegionOps.java
@@ -0,0 +1,510 @@
+/*
+ * @test %W% %E%
+ * @bug 6504874
+ * @summary This test verifies the operation (and performance) of the
+ * various CAG operations on the internal Region class.
+ * @run main RegionOps
+ */
+
+import java.awt.Rectangle;
+import java.awt.geom.Area;
+import java.awt.geom.AffineTransform;
+import java.awt.image.BufferedImage;
+import java.util.Random;
+import sun.java2d.pipe.Region;
+
+public class RegionOps {
+ public static final int DEFAULT_NUMREGIONS = 50;
+ public static final int DEFAULT_MINSUBRECTS = 1;
+ public static final int DEFAULT_MAXSUBRECTS = 10;
+
+ public static final int MINCOORD = -20;
+ public static final int MAXCOORD = 20;
+
+ public static boolean useArea;
+
+ static int numops;
+ static int numErrors;
+ static Random rand = new Random();
+ static boolean skipCheck;
+ static boolean countErrors;
+
+ static {
+ // Instantiating BufferedImage initializes sun.java2d
+ BufferedImage bimg =
+ new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
+ }
+
+ public static void usage(String error) {
+ if (error != null) {
+ System.err.println("Error: "+error);
+ }
+ System.err.println("Usage: java RegionOps "+
+ "[-regions N] [-rects M] "+
+ "[-[min|max]rects M] [-area]");
+ System.err.println(" "+
+ "[-add|union] [-sub|diff] "+
+ "[-int[ersect]] [-xor]");
+ System.err.println(" "+
+ "[-seed S] [-nocheck] [-count[errors]] [-help]");
+ System.exit((error != null) ? 1 : 0);
+ }
+
+ public static void error(RectListImpl a, RectListImpl b, String problem) {
+ System.err.println("Operating on: "+a);
+ if (b != null) {
+ System.err.println("and: "+b);
+ }
+ if (countErrors) {
+ System.err.println(problem);
+ numErrors++;
+ } else {
+ throw new RuntimeException(problem);
+ }
+ }
+
+ public static void main(String argv[]) {
+ int numregions = DEFAULT_NUMREGIONS;
+ int minsubrects = DEFAULT_MINSUBRECTS;
+ int maxsubrects = DEFAULT_MAXSUBRECTS;
+ boolean doUnion = false;
+ boolean doIntersect = false;
+ boolean doSubtract = false;
+ boolean doXor = false;
+
+ for (int i = 0; i < argv.length; i++) {
+ String arg = argv[i];
+ if (arg.equalsIgnoreCase("-regions")) {
+ if (i+1 >= argv.length) {
+ usage("missing arg for -regions");
+ }
+ numregions = Integer.parseInt(argv[++i]);
+ } else if (arg.equalsIgnoreCase("-rects")) {
+ if (i+1 >= argv.length) {
+ usage("missing arg for -rects");
+ }
+ minsubrects = maxsubrects = Integer.parseInt(argv[++i]);
+ } else if (arg.equalsIgnoreCase("-minrects")) {
+ if (i+1 >= argv.length) {
+ usage("missing arg for -minrects");
+ }
+ minsubrects = Integer.parseInt(argv[++i]);
+ } else if (arg.equalsIgnoreCase("-maxrects")) {
+ if (i+1 >= argv.length) {
+ usage("missing arg for -maxrects");
+ }
+ maxsubrects = Integer.parseInt(argv[++i]);
+ } else if (arg.equalsIgnoreCase("-area")) {
+ useArea = true;
+ } else if (arg.equalsIgnoreCase("-add") ||
+ arg.equalsIgnoreCase("-union"))
+ {
+ doUnion = true;
+ } else if (arg.equalsIgnoreCase("-sub") ||
+ arg.equalsIgnoreCase("-diff"))
+ {
+ doSubtract = true;
+ } else if (arg.equalsIgnoreCase("-int") ||
+ arg.equalsIgnoreCase("-intersect"))
+ {
+ doIntersect = true;
+ } else if (arg.equalsIgnoreCase("-xor")) {
+ doXor = true;
+ } else if (arg.equalsIgnoreCase("-seed")) {
+ if (i+1 >= argv.length) {
+ usage("missing arg for -seed");
+ }
+ rand.setSeed(Long.decode(argv[++i]).longValue());
+ } else if (arg.equalsIgnoreCase("-nocheck")) {
+ skipCheck = true;
+ } else if (arg.equalsIgnoreCase("-count") ||
+ arg.equalsIgnoreCase("-counterrors"))
+ {
+ countErrors = true;
+ } else if (arg.equalsIgnoreCase("-help")) {
+ usage(null);
+ } else {
+ usage("Unknown argument: "+arg);
+ }
+ }
+
+ if (maxsubrects < minsubrects) {
+ usage("maximum number of subrectangles less than minimum");
+ }
+
+ if (minsubrects <= 0) {
+ usage("minimum number of subrectangles must be positive");
+ }
+
+ if (!doUnion && !doSubtract && !doIntersect && !doXor) {
+ doUnion = doSubtract = doIntersect = doXor = true;
+ }
+
+ long start = System.currentTimeMillis();
+ RectListImpl rlist[] = new RectListImpl[numregions];
+ int totalrects = 0;
+ for (int i = 0; i < rlist.length; i++) {
+ RectListImpl rli = RectListImpl.getInstance();
+ int numsubrects =
+ minsubrects + rand.nextInt(maxsubrects - minsubrects + 1);
+ for (int j = 0; j < numsubrects; j++) {
+ addRectTo(rli);
+ totalrects++;
+ }
+ rlist[i] = rli;
+ }
+ long end = System.currentTimeMillis();
+ System.out.println((end-start)+"ms to create "+
+ rlist.length+" regions containing "+
+ totalrects+" subrectangles");
+
+ start = System.currentTimeMillis();
+ for (int i = 0; i < rlist.length; i++) {
+ RectListImpl a = rlist[i];
+ testTranslate(a);
+ for (int j = i; j < rlist.length; j++) {
+ RectListImpl b = rlist[j];
+ if (doUnion) testUnion(a, b);
+ if (doSubtract) testDifference(a, b);
+ if (doIntersect) testIntersection(a, b);
+ if (doXor) testExclusiveOr(a, b);
+ }
+ }
+ end = System.currentTimeMillis();
+ System.out.println(numops+" ops took "+(end-start)+"ms");
+
+ if (numErrors > 0) {
+ throw new RuntimeException(numErrors+" errors encountered");
+ }
+ }
+
+ public static void addRectTo(RectListImpl rli) {
+ int lox = MINCOORD + rand.nextInt(MAXCOORD - MINCOORD + 1);
+ int hix = MINCOORD + rand.nextInt(MAXCOORD - MINCOORD + 1);
+ int loy = MINCOORD + rand.nextInt(MAXCOORD - MINCOORD + 1);
+ int hiy = MINCOORD + rand.nextInt(MAXCOORD - MINCOORD + 1);
+ rli.addRect(lox, loy, hix, hiy);
+ }
+
+ public static void checkEqual(RectListImpl a, RectListImpl b,
+ String optype)
+ {
+ if (a.hashCode() != b.hashCode()) {
+ error(a, b, "hashcode failed for "+optype);
+ }
+ if (!a.equals(b)) {
+ error(a, b, "equals failed for "+optype);
+ }
+ }
+
+ public static void testTranslate(RectListImpl a) {
+ RectListImpl maxTrans =
+ a.getTranslation(Integer.MAX_VALUE, Integer.MAX_VALUE)
+ .getTranslation(Integer.MAX_VALUE, Integer.MAX_VALUE)
+ .getTranslation(Integer.MAX_VALUE, Integer.MAX_VALUE);
+ if (!maxTrans.checkTransEmpty()) {
+ error(maxTrans, null, "overflow translated RectList not empty");
+ }
+ RectListImpl minTrans =
+ a.getTranslation(Integer.MIN_VALUE, Integer.MIN_VALUE)
+ .getTranslation(Integer.MIN_VALUE, Integer.MIN_VALUE)
+ .getTranslation(Integer.MIN_VALUE, Integer.MIN_VALUE);
+ if (!minTrans.checkTransEmpty()) {
+ error(minTrans, null, "overflow translated RectList not empty");
+ }
+ testTranslate(a, Integer.MAX_VALUE, Integer.MAX_VALUE, false,
+ MINCOORD, 0, MINCOORD, 0);
+ testTranslate(a, Integer.MAX_VALUE, Integer.MIN_VALUE, false,
+ MINCOORD, 0, 0, MAXCOORD);
+ testTranslate(a, Integer.MIN_VALUE, Integer.MAX_VALUE, false,
+ 0, MAXCOORD, MINCOORD, 0);
+ testTranslate(a, Integer.MIN_VALUE, Integer.MIN_VALUE, false,
+ 0, MAXCOORD, 0, MAXCOORD);
+ for (int dy = -100; dy <= 100; dy += 50) {
+ for (int dx = -100; dx <= 100; dx += 50) {
+ testTranslate(a, dx, dy, true,
+ MINCOORD, MAXCOORD,
+ MINCOORD, MAXCOORD);
+ }
+ }
+ }
+
+ public static void testTranslate(RectListImpl a, int dx, int dy,
+ boolean isNonDestructive,
+ int xmin, int xmax,
+ int ymin, int ymax)
+ {
+ RectListImpl theTrans = a.getTranslation(dx, dy); numops++;
+ if (skipCheck) return;
+ RectListImpl unTrans = theTrans.getTranslation(-dx, -dy);
+ if (isNonDestructive) checkEqual(a, unTrans, "Translate");
+ for (int x = xmin; x < xmax; x++) {
+ for (int y = ymin; y < ymax; y++) {
+ boolean inside = a.contains(x, y);
+ if (theTrans.contains(x+dx, y+dy) != inside) {
+ error(a, null, "translation failed for "+
+ dx+", "+dy+" at "+x+", "+y);
+ }
+ }
+ }
+ }
+
+ public static void testUnion(RectListImpl a, RectListImpl b) {
+ RectListImpl aUb = a.getUnion(b); numops++;
+ RectListImpl bUa = b.getUnion(a); numops++;
+ if (skipCheck) return;
+ checkEqual(aUb, bUa, "Union");
+ testUnion(a, b, aUb);
+ testUnion(a, b, bUa);
+ }
+
+ public static void testUnion(RectListImpl a, RectListImpl b,
+ RectListImpl theUnion)
+ {
+ for (int x = MINCOORD; x < MAXCOORD; x++) {
+ for (int y = MINCOORD; y < MAXCOORD; y++) {
+ boolean inside = (a.contains(x, y) || b.contains(x, y));
+ if (theUnion.contains(x, y) != inside) {
+ error(a, b, "union failed at "+x+", "+y);
+ }
+ }
+ }
+ }
+
+ public static void testDifference(RectListImpl a, RectListImpl b) {
+ RectListImpl aDb = a.getDifference(b); numops++;
+ RectListImpl bDa = b.getDifference(a); numops++;
+ if (skipCheck) return;
+ // Note that difference is not commutative so we cannot check equals
+ // checkEqual(a, b, "Difference");
+ testDifference(a, b, aDb);
+ testDifference(b, a, bDa);
+ }
+
+ public static void testDifference(RectListImpl a, RectListImpl b,
+ RectListImpl theDifference)
+ {
+ for (int x = MINCOORD; x < MAXCOORD; x++) {
+ for (int y = MINCOORD; y < MAXCOORD; y++) {
+ boolean inside = (a.contains(x, y) && !b.contains(x, y));
+ if (theDifference.contains(x, y) != inside) {
+ error(a, b, "difference failed at "+x+", "+y);
+ }
+ }
+ }
+ }
+
+ public static void testIntersection(RectListImpl a, RectListImpl b) {
+ RectListImpl aIb = a.getIntersection(b); numops++;
+ RectListImpl bIa = b.getIntersection(a); numops++;
+ if (skipCheck) return;
+ checkEqual(aIb, bIa, "Intersection");
+ testIntersection(a, b, aIb);
+ testIntersection(a, b, bIa);
+ }
+
+ public static void testIntersection(RectListImpl a, RectListImpl b,
+ RectListImpl theIntersection)
+ {
+ for (int x = MINCOORD; x < MAXCOORD; x++) {
+ for (int y = MINCOORD; y < MAXCOORD; y++) {
+ boolean inside = (a.contains(x, y) && b.contains(x, y));
+ if (theIntersection.contains(x, y) != inside) {
+ error(a, b, "intersection failed at "+x+", "+y);
+ }
+ }
+ }
+ }
+
+ public static void testExclusiveOr(RectListImpl a, RectListImpl b) {
+ RectListImpl aXb = a.getExclusiveOr(b); numops++;
+ RectListImpl bXa = b.getExclusiveOr(a); numops++;
+ if (skipCheck) return;
+ checkEqual(aXb, bXa, "ExclusiveOr");
+ testExclusiveOr(a, b, aXb);
+ testExclusiveOr(a, b, bXa);
+ }
+
+ public static void testExclusiveOr(RectListImpl a, RectListImpl b,
+ RectListImpl theExclusiveOr)
+ {
+ for (int x = MINCOORD; x < MAXCOORD; x++) {
+ for (int y = MINCOORD; y < MAXCOORD; y++) {
+ boolean inside = (a.contains(x, y) != b.contains(x, y));
+ if (theExclusiveOr.contains(x, y) != inside) {
+ error(a, b, "xor failed at "+x+", "+y);
+ }
+ }
+ }
+ }
+
+ public abstract static class RectListImpl {
+ public static RectListImpl getInstance() {
+ if (useArea) {
+ return new AreaImpl();
+ } else {
+ return new RegionImpl();
+ }
+ }
+
+ public abstract void addRect(int lox, int loy, int hix, int hiy);
+
+ public abstract RectListImpl getTranslation(int dx, int dy);
+
+ public abstract RectListImpl getIntersection(RectListImpl rli);
+ public abstract RectListImpl getExclusiveOr(RectListImpl rli);
+ public abstract RectListImpl getDifference(RectListImpl rli);
+ public abstract RectListImpl getUnion(RectListImpl rli);
+
+ // Used for making sure that 3xMAX translates yields an empty region
+ public abstract boolean checkTransEmpty();
+
+ public abstract boolean contains(int x, int y);
+
+ public abstract int hashCode();
+ public abstract boolean equals(RectListImpl other);
+ }
+
+ public static class AreaImpl extends RectListImpl {
+ Area theArea;
+
+ public AreaImpl() {
+ }
+
+ public AreaImpl(Area a) {
+ theArea = a;
+ }
+
+ public void addRect(int lox, int loy, int hix, int hiy) {
+ Area a2 = new Area(new Rectangle(lox, loy, hix-lox, hiy-loy));
+ if (theArea == null) {
+ theArea = a2;
+ } else {
+ theArea.add(a2);
+ }
+ }
+
+ public RectListImpl getTranslation(int dx, int dy) {
+ AffineTransform at = AffineTransform.getTranslateInstance(dx, dy);
+ return new AreaImpl(theArea.createTransformedArea(at));
+ }
+
+ public RectListImpl getIntersection(RectListImpl rli) {
+ Area a2 = new Area(theArea);
+ a2.intersect(((AreaImpl) rli).theArea);
+ return new AreaImpl(a2);
+ }
+
+ public RectListImpl getExclusiveOr(RectListImpl rli) {
+ Area a2 = new Area(theArea);
+ a2.exclusiveOr(((AreaImpl) rli).theArea);
+ return new AreaImpl(a2);
+ }
+
+ public RectListImpl getDifference(RectListImpl rli) {
+ Area a2 = new Area(theArea);
+ a2.subtract(((AreaImpl) rli).theArea);
+ return new AreaImpl(a2);
+ }
+
+ public RectListImpl getUnion(RectListImpl rli) {
+ Area a2 = new Area(theArea);
+ a2.add(((AreaImpl) rli).theArea);
+ return new AreaImpl(a2);
+ }
+
+ // Used for making sure that 3xMAX translates yields an empty region
+ public boolean checkTransEmpty() {
+ // Area objects will actually survive 3 MAX translates so just
+ // pretend that it had the intended effect...
+ return true;
+ }
+
+ public boolean contains(int x, int y) {
+ return theArea.contains(x, y);
+ }
+
+ public int hashCode() {
+ // Area does not override hashCode...
+ return 0;
+ }
+
+ public boolean equals(RectListImpl other) {
+ return theArea.equals(((AreaImpl) other).theArea);
+ }
+
+ public String toString() {
+ return theArea.toString();
+ }
+ }
+
+ public static class RegionImpl extends RectListImpl {
+ Region theRegion;
+
+ public RegionImpl() {
+ }
+
+ public RegionImpl(Region r) {
+ theRegion = r;
+ }
+
+ public void addRect(int lox, int loy, int hix, int hiy) {
+ Region r2 = Region.getInstanceXYXY(lox, loy, hix, hiy);
+ if (theRegion == null) {
+ theRegion = r2;
+ } else {
+ theRegion = theRegion.getUnion(r2);
+ }
+ }
+
+ public RectListImpl getTranslation(int dx, int dy) {
+ return new RegionImpl(theRegion.getTranslatedRegion(dx, dy));
+ }
+
+ public RectListImpl getIntersection(RectListImpl rli) {
+ Region r2 = ((RegionImpl) rli).theRegion;
+ r2 = theRegion.getIntersection(r2);
+ return new RegionImpl(r2);
+ }
+
+ public RectListImpl getExclusiveOr(RectListImpl rli) {
+ Region r2 = ((RegionImpl) rli).theRegion;
+ r2 = theRegion.getExclusiveOr(r2);
+ return new RegionImpl(r2);
+ }
+
+ public RectListImpl getDifference(RectListImpl rli) {
+ Region r2 = ((RegionImpl) rli).theRegion;
+ r2 = theRegion.getDifference(r2);
+ return new RegionImpl(r2);
+ }
+
+ public RectListImpl getUnion(RectListImpl rli) {
+ Region r2 = ((RegionImpl) rli).theRegion;
+ r2 = theRegion.getUnion(r2);
+ return new RegionImpl(r2);
+ }
+
+ // Used for making sure that 3xMAX translates yields an empty region
+ public boolean checkTransEmpty() {
+ // Region objects should be empty after 3 MAX translates...
+ return theRegion.isEmpty();
+ }
+
+ public boolean contains(int x, int y) {
+ return theRegion.contains(x, y);
+ }
+
+ public int hashCode() {
+ return theRegion.hashCode();
+ }
+
+ public boolean equals(RectListImpl other) {
+ return theRegion.equals(((RegionImpl) other).theRegion);
+ }
+
+ public String toString() {
+ return theRegion.toString();
+ }
+ }
+}
From b8af3d50192f8bc98d83f8102f0fd1989f302e32 Mon Sep 17 00:00:00 2001
From: Artem Ananiev
Date: Thu, 12 Feb 2009 14:19:06 +0300
Subject: [PATCH 06/80] 6799345: JFC demos threw exception in the Java Console
when applets are closed
Reviewed-by: alexp, peterz
---
.../classes/javax/swing/SwingWorker.java | 50 +++--
.../share/classes/javax/swing/TimerQueue.java | 9 +-
.../swing/system/6799345/TestShutdown.java | 203 ++++++++++++++++++
3 files changed, 234 insertions(+), 28 deletions(-)
create mode 100644 jdk/test/javax/swing/system/6799345/TestShutdown.java
diff --git a/jdk/src/share/classes/javax/swing/SwingWorker.java b/jdk/src/share/classes/javax/swing/SwingWorker.java
index 9eca7d535f6..263284acc4e 100644
--- a/jdk/src/share/classes/javax/swing/SwingWorker.java
+++ b/jdk/src/share/classes/javax/swing/SwingWorker.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2005-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2005-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
@@ -778,35 +778,33 @@ public abstract class SwingWorker implements RunnableFuture {
threadFactory);
appContext.put(SwingWorker.class, executorService);
- //register shutdown hook for this executor service
+ // Don't use ShutdownHook here as it's not enough. We should track
+ // AppContext disposal instead of JVM shutdown, see 6799345 for details
final ExecutorService es = executorService;
- final Runnable shutdownHook =
- new Runnable() {
- final WeakReference executorServiceRef =
- new WeakReference(es);
- public void run() {
- final ExecutorService executorService =
- executorServiceRef.get();
- if (executorService != null) {
- AccessController.doPrivileged(
- new PrivilegedAction() {
- public Void run() {
- executorService.shutdown();
- return null;
+ appContext.addPropertyChangeListener(AppContext.DISPOSED_PROPERTY_NAME,
+ new PropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent pce) {
+ boolean disposed = (Boolean)pce.getNewValue();
+ if (disposed) {
+ final WeakReference executorServiceRef =
+ new WeakReference(es);
+ final ExecutorService executorService =
+ executorServiceRef.get();
+ if (executorService != null) {
+ AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public Void run() {
+ executorService.shutdown();
+ return null;
+ }
}
- });
+ );
+ }
}
}
- };
-
- AccessController.doPrivileged(
- new PrivilegedAction() {
- public Void run() {
- Runtime.getRuntime().addShutdownHook(
- new Thread(shutdownHook));
- return null;
- }
- });
+ }
+ );
}
return executorService;
}
diff --git a/jdk/src/share/classes/javax/swing/TimerQueue.java b/jdk/src/share/classes/javax/swing/TimerQueue.java
index f68f4e99688..642bc56bac7 100644
--- a/jdk/src/share/classes/javax/swing/TimerQueue.java
+++ b/jdk/src/share/classes/javax/swing/TimerQueue.java
@@ -1,5 +1,5 @@
/*
- * Copyright 1997-2007 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
@@ -191,7 +191,12 @@ class TimerQueue implements Runnable
} finally {
timer.getLock().unlock();
}
- } catch (InterruptedException ignore) {
+ } catch (InterruptedException ie) {
+ // Shouldn't ignore InterruptedExceptions here, so AppContext
+ // is disposed gracefully, see 6799345 for details
+ if (AppContext.getAppContext().isDisposed()) {
+ break;
+ }
}
}
}
diff --git a/jdk/test/javax/swing/system/6799345/TestShutdown.java b/jdk/test/javax/swing/system/6799345/TestShutdown.java
new file mode 100644
index 00000000000..694df3eac01
--- /dev/null
+++ b/jdk/test/javax/swing/system/6799345/TestShutdown.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright 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
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ @bug 6799345
+ @summary Tests that no exceptions are thrown from TimerQueue and
+SwingWorker on AppContext shutdown
+ @author art
+ @run main TestShutdown
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+
+import java.util.*;
+
+import javax.swing.*;
+
+import sun.awt.*;
+
+public class TestShutdown
+{
+ private static AppContext targetAppContext;
+
+ private static JFrame f;
+ private static JTextField tf;
+
+ private static volatile boolean exceptionsOccurred = false;
+ private static volatile boolean appcontextInitDone = false;
+
+ private static int timerValue = 0;
+
+ public static void main(String[] args)
+ throws Exception
+ {
+ ThreadGroup tg = new TestThreadGroup("TTG");
+ Thread t = new Thread(tg, new TestRunnable(), "InitThread");
+ t.start();
+
+ while (!appcontextInitDone)
+ {
+ Thread.sleep(500);
+ }
+
+ targetAppContext.dispose();
+
+ if (exceptionsOccurred)
+ {
+ throw new RuntimeException("Test FAILED: some exceptions occurred");
+ }
+ }
+
+ static void initGUI()
+ {
+ f = new JFrame("F");
+ f.setBounds(100, 100, 200, 100);
+ tf = new JTextField("Test");
+ f.add(tf);
+ f.setVisible(true);
+ }
+
+ static void startGUI()
+ {
+ // caret blink Timer
+ tf.requestFocusInWindow();
+
+ // misc Timer
+ ActionListener al = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent ae)
+ {
+ System.out.println("Timer tick: " + timerValue++);
+ }
+ };
+ new javax.swing.Timer(30, al).start();
+ }
+
+ static class TestThreadGroup extends ThreadGroup
+ {
+ public TestThreadGroup(String name)
+ {
+ super(name);
+ }
+
+ @Override
+ public synchronized void uncaughtException(Thread thread, Throwable t)
+ {
+ if (t instanceof ThreadDeath)
+ {
+ // this one is expected, rethrow
+ throw (ThreadDeath)t;
+ }
+ System.err.println("Test FAILED: an exception is caught in the " +
+ "target thread group on thread " + thread.getName());
+ t.printStackTrace(System.err);
+ exceptionsOccurred = true;
+ }
+ }
+
+ static class TestRunnable implements Runnable
+ {
+ @Override
+ public void run()
+ {
+ SunToolkit stk = (SunToolkit)Toolkit.getDefaultToolkit();
+ targetAppContext = stk.createNewAppContext();
+
+ // create and show frame and text field
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ initGUI();
+ }
+ });
+ stk.realSync();
+
+ // start some Timers
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ startGUI();
+ }
+ });
+ stk.realSync();
+
+ // start multiple SwingWorkers
+ while (!Thread.interrupted())
+ {
+ try
+ {
+ new TestSwingWorker().execute();
+ Thread.sleep(40);
+ }
+ catch (Exception e)
+ {
+ // exception here is expected, skip
+ break;
+ }
+ }
+ }
+ }
+
+ static class TestSwingWorker extends SwingWorker
+ {
+ @Override
+ public String doInBackground()
+ {
+ Random r = new Random();
+ for (int i = 0; i < 10; i++)
+ {
+ try
+ {
+ int delay = r.nextInt() % 50;
+ Thread.sleep(delay);
+ publish(delay);
+ }
+ catch (Exception z)
+ {
+ break;
+ }
+ }
+ if (!appcontextInitDone)
+ {
+ appcontextInitDone = true;
+ }
+ return "Done";
+ }
+
+ @Override
+ public void process(java.util.List chunks)
+ {
+ for (Integer i : chunks)
+ {
+ System.err.println("Processed: " + i);
+ }
+ }
+ }
+}
From 3ca96fa4452cd6ae18e07df6a10740c362c1e790 Mon Sep 17 00:00:00 2001
From: Artem Ananiev
Date: Thu, 12 Feb 2009 17:27:39 +0300
Subject: [PATCH 07/80] 6804680: Solaris AMD64 build fails after the fix for
6633275/7
Addition to the fix for 6633275
Reviewed-by: yan
---
.../classes/sun/awt/X11/generator/sizes.64-solaris-i386 | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/jdk/src/solaris/classes/sun/awt/X11/generator/sizes.64-solaris-i386 b/jdk/src/solaris/classes/sun/awt/X11/generator/sizes.64-solaris-i386
index 38ec9071b05..f6e3beb3f1c 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/generator/sizes.64-solaris-i386
+++ b/jdk/src/solaris/classes/sun/awt/X11/generator/sizes.64-solaris-i386
@@ -774,7 +774,8 @@ AwtGraphicsConfigData.monoPixmapGC 128
AwtGraphicsConfigData.pixelStride 136
AwtGraphicsConfigData.color_data 144
AwtGraphicsConfigData.glxInfo 152
-AwtGraphicsConfigData 160
+AwtGraphicsConfigData.isTranslucencySupported 160
+AwtGraphicsConfigData 168
XColor.pixel 0
XColor.red 8
XColor.green 10
From ce1993bf8e883ea3571235bd6c314f01aa0baf57 Mon Sep 17 00:00:00 2001
From: Dmitry Cherepanov
Date: Thu, 12 Feb 2009 18:24:35 +0300
Subject: [PATCH 08/80] 6724890: Deadlock between AWT-EventQueue-1 and AWT-XAWT
threads during IDE start
Reviewed-by: art, ant
---
jdk/src/share/classes/java/awt/Frame.java | 36 ++++++++++++++-----
.../share/classes/sun/awt/AWTAccessor.java | 36 +++++++++++++++++++
.../classes/sun/awt/X11/XFramePeer.java | 20 ++++++++---
.../classes/sun/awt/windows/WFramePeer.java | 29 ++++++++++++---
.../windows/native/sun/windows/awt_Frame.cpp | 35 ++++++++++++++----
.../windows/native/sun/windows/awt_Frame.h | 12 +++----
6 files changed, 138 insertions(+), 30 deletions(-)
diff --git a/jdk/src/share/classes/java/awt/Frame.java b/jdk/src/share/classes/java/awt/Frame.java
index 290f7f9bb3d..761b9b8420b 100644
--- a/jdk/src/share/classes/java/awt/Frame.java
+++ b/jdk/src/share/classes/java/awt/Frame.java
@@ -36,6 +36,7 @@ import java.io.ObjectInputStream;
import java.io.IOException;
import sun.awt.AppContext;
import sun.awt.SunToolkit;
+import sun.awt.AWTAccessor;
import java.lang.ref.WeakReference;
import javax.accessibility.*;
@@ -738,11 +739,15 @@ public class Frame extends Window implements MenuContainer {
* @since 1.4
* @see java.awt.Window#addWindowStateListener
*/
- public synchronized void setExtendedState(int state) {
+ public void setExtendedState(int state) {
if ( !isFrameStateSupported( state ) ) {
return;
}
- this.state = state;
+ synchronized (getObjectLock()) {
+ this.state = state;
+ }
+ // peer.setState must be called outside of object lock
+ // synchronization block to avoid possible deadlock
FramePeer peer = (FramePeer)this.peer;
if (peer != null) {
peer.setState(state);
@@ -804,12 +809,27 @@ public class Frame extends Window implements MenuContainer {
* @see #setExtendedState(int)
* @since 1.4
*/
- public synchronized int getExtendedState() {
- FramePeer peer = (FramePeer)this.peer;
- if (peer != null) {
- state = peer.getState();
+ public int getExtendedState() {
+ synchronized (getObjectLock()) {
+ return state;
}
- return state;
+ }
+
+ static {
+ AWTAccessor.setFrameAccessor(
+ new AWTAccessor.FrameAccessor() {
+ public void setExtendedState(Frame frame, int state) {
+ synchronized(frame.getObjectLock()) {
+ frame.state = state;
+ }
+ }
+ public int getExtendedState(Frame frame) {
+ synchronized(frame.getObjectLock()) {
+ return frame.state;
+ }
+ }
+ }
+ );
}
/**
@@ -967,7 +987,7 @@ public class Frame extends Window implements MenuContainer {
if (resizable) {
str += ",resizable";
}
- getExtendedState(); // sync with peer
+ int state = getExtendedState();
if (state == NORMAL) {
str += ",normal";
}
diff --git a/jdk/src/share/classes/sun/awt/AWTAccessor.java b/jdk/src/share/classes/sun/awt/AWTAccessor.java
index 94d0bb25f0b..2145f0f10a4 100644
--- a/jdk/src/share/classes/sun/awt/AWTAccessor.java
+++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java
@@ -132,6 +132,20 @@ public final class AWTAccessor {
boolean isSystemGenerated(AWTEvent ev);
}
+ /*
+ * An accessor for the java.awt.Frame class.
+ */
+ public interface FrameAccessor {
+ /*
+ * Sets the state of this frame.
+ */
+ void setExtendedState(Frame frame, int state);
+ /*
+ * Gets the state of this frame.
+ */
+ int getExtendedState(Frame frame);
+ }
+
/*
* The java.awt.Component class accessor object.
*/
@@ -147,6 +161,11 @@ public final class AWTAccessor {
*/
private static AWTEventAccessor awtEventAccessor;
+ /*
+ * The java.awt.Frame class accessor object.
+ */
+ private static FrameAccessor frameAccessor;
+
/*
* Set an accessor object for the java.awt.Component class.
*/
@@ -195,4 +214,21 @@ public final class AWTAccessor {
public static AWTEventAccessor getAWTEventAccessor() {
return awtEventAccessor;
}
+
+ /*
+ * Set an accessor object for the java.awt.Frame class.
+ */
+ public static void setFrameAccessor(FrameAccessor fa) {
+ frameAccessor = fa;
+ }
+
+ /*
+ * Retrieve the accessor object for the java.awt.Frame class.
+ */
+ public static FrameAccessor getFrameAccessor() {
+ if (frameAccessor == null) {
+ unsafe.ensureClassInitialized(Frame.class);
+ }
+ return frameAccessor;
+ }
}
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java b/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java
index 3820bf61013..22cb163ebbb 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java
@@ -36,6 +36,7 @@ import java.awt.Rectangle;
import java.awt.peer.FramePeer;
import java.util.logging.Level;
import java.util.logging.Logger;
+import sun.awt.AWTAccessor;
class XFramePeer extends XDecoratedPeer implements FramePeer {
private static Logger log = Logger.getLogger("sun.awt.X11.XFramePeer");
@@ -231,13 +232,19 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
}
}
- public int getState() { return state; }
+ public int getState() {
+ synchronized(getStateLock()) {
+ return state;
+ }
+ }
public void setState(int newState) {
- if (!isShowing()) {
- stateLog.finer("Frame is not showing");
- state = newState;
- return;
+ synchronized(getStateLock()) {
+ if (!isShowing()) {
+ stateLog.finer("Frame is not showing");
+ state = newState;
+ return;
+ }
}
changeState(newState);
}
@@ -296,6 +303,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
int old_state = state;
state = newState;
+ // sync target with peer
+ AWTAccessor.getFrameAccessor().setExtendedState((Frame)target, state);
+
if ((changed & Frame.ICONIFIED) != 0) {
if ((state & Frame.ICONIFIED) != 0) {
stateLog.finer("Iconified");
diff --git a/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java b/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java
index 2353daf3d29..79bf6b77e41 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WFramePeer.java
@@ -25,27 +25,46 @@
package sun.awt.windows;
import java.util.Vector;
+
import java.awt.*;
import java.awt.peer.*;
import java.awt.image.ImageObserver;
-import sun.awt.image.ImageRepresentation;
-import sun.awt.image.IntegerComponentRaster;
-import sun.awt.image.ToolkitImage;
+
import java.awt.image.Raster;
import java.awt.image.DataBuffer;
import java.awt.image.DataBufferInt;
import java.awt.image.BufferedImage;
-import sun.awt.im.*;
-import sun.awt.Win32GraphicsDevice;
+
import java.awt.image.ColorModel;
+import sun.awt.image.ImageRepresentation;
+import sun.awt.image.IntegerComponentRaster;
+import sun.awt.image.ToolkitImage;
+import sun.awt.im.*;
+import sun.awt.Win32GraphicsDevice;
+import sun.awt.AWTAccessor;
class WFramePeer extends WWindowPeer implements FramePeer {
+ static {
+ initIDs();
+ }
+
+ // initialize JNI field and method IDs
+ private static native void initIDs();
+
// FramePeer implementation
public native void setState(int state);
public native int getState();
+ // sync target and peer
+ public void setExtendedState(int state) {
+ AWTAccessor.getFrameAccessor().setExtendedState((Frame)target, state);
+ }
+ public int getExtendedState() {
+ return AWTAccessor.getFrameAccessor().getExtendedState((Frame)target);
+ }
+
// Convenience methods to save us from trouble of extracting
// Rectangle fields in native code.
private native void setMaximizedBounds(int x, int y, int w, int h);
diff --git a/jdk/src/windows/native/sun/windows/awt_Frame.cpp b/jdk/src/windows/native/sun/windows/awt_Frame.cpp
index 60738e69357..888ed50b5cb 100644
--- a/jdk/src/windows/native/sun/windows/awt_Frame.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Frame.cpp
@@ -90,8 +90,10 @@ struct BlockedThreadStruct {
*/
jfieldID AwtFrame::handleID;
-jfieldID AwtFrame::stateID;
+
jfieldID AwtFrame::undecoratedID;
+jmethodID AwtFrame::getExtendedStateMID;
+jmethodID AwtFrame::setExtendedStateMID;
jmethodID AwtFrame::activateEmbeddingTopLevelMID;
@@ -232,7 +234,7 @@ AwtFrame* AwtFrame::Create(jobject self, jobject parent)
frame->InitPeerGraphicsConfig(env, self);
AwtToolkit::GetInstance().RegisterEmbedderProcessId(hwndParent);
} else {
- jint state = env->GetIntField(target, AwtFrame::stateID);
+ jint state = env->CallIntMethod(self, AwtFrame::getExtendedStateMID);
DWORD exStyle;
DWORD style;
@@ -883,6 +885,11 @@ MsgRouting AwtFrame::WmSize(UINT type, int w, int h)
if (changed != 0) {
DTRACE_PRINTLN2("AwtFrame::WmSize: reporting state change %x -> %x",
oldState, newState);
+
+ // sync target with peer
+ JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
+ env->CallVoidMethod(GetPeer(env), AwtFrame::setExtendedStateMID, newState);
+
// report (de)iconification to old clients
if (changed & java_awt_Frame_ICONIFIED) {
if (newState & java_awt_Frame_ICONIFIED) {
@@ -1594,7 +1601,7 @@ void AwtFrame::_NotifyModalBlocked(void *param)
extern "C" {
/*
- * Class: sun_awt_windows_WFramePeer
+ * Class: java_awt_Frame
* Method: initIDs
* Signature: ()V
*/
@@ -1603,15 +1610,31 @@ Java_java_awt_Frame_initIDs(JNIEnv *env, jclass cls)
{
TRY;
- AwtFrame::stateID = env->GetFieldID(cls, "state", "I");
- DASSERT(AwtFrame::stateID != NULL);
-
AwtFrame::undecoratedID = env->GetFieldID(cls,"undecorated","Z");
DASSERT(AwtFrame::undecoratedID != NULL);
CATCH_BAD_ALLOC;
}
+/*
+ * Class: sun_awt_windows_WFramePeer
+ * Method: initIDs
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL
+Java_sun_awt_windows_WFramePeer_initIDs(JNIEnv *env, jclass cls)
+{
+ TRY;
+
+ AwtFrame::setExtendedStateMID = env->GetMethodID(cls, "setExtendedState", "(I)V");
+ AwtFrame::getExtendedStateMID = env->GetMethodID(cls, "getExtendedState", "()I");
+
+ DASSERT(AwtFrame::setExtendedStateMID);
+ DASSERT(AwtFrame::getExtendedStateMID);
+
+ CATCH_BAD_ALLOC;
+}
+
/*
* Class: sun_awt_windows_WFramePeer
* Method: setState
diff --git a/jdk/src/windows/native/sun/windows/awt_Frame.h b/jdk/src/windows/native/sun/windows/awt_Frame.h
index 3634f95924d..65a21655a03 100644
--- a/jdk/src/windows/native/sun/windows/awt_Frame.h
+++ b/jdk/src/windows/native/sun/windows/awt_Frame.h
@@ -48,14 +48,14 @@ public:
FRAME_SETMENUBAR
};
- /* int handle field for sun.awt.windows.WEmbeddedFrame */
+ /* java.awt.Frame fields and method IDs */
+ static jfieldID undecoratedID;
+
+ /* sun.awt.windows.WEmbeddedFrame fields and method IDs */
static jfieldID handleID;
- /* int state field for java.awt.Frame */
- static jfieldID stateID;
-
- /* boolean undecorated field for java.awt.Frame */
- static jfieldID undecoratedID;
+ static jmethodID setExtendedStateMID;
+ static jmethodID getExtendedStateMID;
/* method id for WEmbeddedFrame.requestActivate() method */
static jmethodID activateEmbeddingTopLevelMID;
From 022fb387d9bf5ea16e6599f2f5b55e6802c21310 Mon Sep 17 00:00:00 2001
From: Artem Ananiev
Date: Tue, 17 Feb 2009 10:42:12 +0300
Subject: [PATCH 09/80] 6806035: Fix for 6804680 is incomplete
Reviewed-by: yan
---
.../solaris/classes/sun/awt/X11/generator/sizes.64-solaris-i386 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/jdk/src/solaris/classes/sun/awt/X11/generator/sizes.64-solaris-i386 b/jdk/src/solaris/classes/sun/awt/X11/generator/sizes.64-solaris-i386
index f6e3beb3f1c..29d6603890e 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/generator/sizes.64-solaris-i386
+++ b/jdk/src/solaris/classes/sun/awt/X11/generator/sizes.64-solaris-i386
@@ -774,7 +774,7 @@ AwtGraphicsConfigData.monoPixmapGC 128
AwtGraphicsConfigData.pixelStride 136
AwtGraphicsConfigData.color_data 144
AwtGraphicsConfigData.glxInfo 152
-AwtGraphicsConfigData.isTranslucencySupported 160
+AwtGraphicsConfigData.isTranslucencySupported 160
AwtGraphicsConfigData 168
XColor.pixel 0
XColor.red 8
From 0d79cc7529927349921b4e825f529cb9160beb72 Mon Sep 17 00:00:00 2001
From: Dmitry Cherepanov
Date: Tue, 17 Feb 2009 14:27:03 +0300
Subject: [PATCH 10/80] 6769607: PIT : Modal frame hangs for a while for few
seconds in 6u12 b01 pit build
Reviewed-by: art, anthony
---
jdk/src/share/classes/java/awt/Window.java | 6 +-
.../windows/native/sun/windows/awt_Dialog.cpp | 100 ++++++++++--------
.../windows/native/sun/windows/awt_Dialog.h | 3 +
3 files changed, 64 insertions(+), 45 deletions(-)
diff --git a/jdk/src/share/classes/java/awt/Window.java b/jdk/src/share/classes/java/awt/Window.java
index 64c611ac3c3..e1ff8db14c3 100644
--- a/jdk/src/share/classes/java/awt/Window.java
+++ b/jdk/src/share/classes/java/awt/Window.java
@@ -687,9 +687,9 @@ public class Window extends Container implements Accessible {
}
if (peer == null) {
peer = getToolkit().createWindow(this);
- synchronized (allWindows) {
- allWindows.add(this);
- }
+ }
+ synchronized (allWindows) {
+ allWindows.add(this);
}
super.addNotify();
}
diff --git a/jdk/src/windows/native/sun/windows/awt_Dialog.cpp b/jdk/src/windows/native/sun/windows/awt_Dialog.cpp
index ecf74549d46..77f80b7fac6 100644
--- a/jdk/src/windows/native/sun/windows/awt_Dialog.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Dialog.cpp
@@ -230,25 +230,8 @@ LRESULT CALLBACK AwtDialog::ModalFilterProc(int code,
if (::IsIconic(hWnd)) {
::ShowWindow(hWnd, SW_RESTORE);
}
- HWND topMostBlocker = blocker;
- HWND toolkitHWnd = AwtToolkit::GetInstance().GetHWnd();
- while (::IsWindow(blocker)) {
- topMostBlocker = blocker;
- // fix for 6494032: restore the blocker if it was minimized
- // together with its parent frame; in such cases the check
- // ::IsIconic() for the blocker returns false, so we use
- // ::IsWindowVisible() instead
- if (!::IsWindowVisible(topMostBlocker) &&
- (topMostBlocker != toolkitHWnd))
- {
- ::ShowWindow(topMostBlocker, SW_SHOWNA);
- }
- ::BringWindowToTop(blocker);
- blocker = AwtWindow::GetModalBlocker(blocker);
- }
- if (topMostBlocker != toolkitHWnd) {
- ::SetForegroundWindow(topMostBlocker);
- }
+ PopupAllDialogs(blocker, TRUE, ::GetForegroundWindow(), FALSE);
+ // return 1 to prevent the system from allowing the operation
return 1;
}
return CallNextHookEx(0, code, wParam, lParam);
@@ -271,30 +254,11 @@ LRESULT CALLBACK AwtDialog::MouseHookProc(int nCode,
(wParam == WM_NCRBUTTONDOWN))
{
HWND blocker = AwtWindow::GetModalBlocker(AwtComponent::GetTopLevelParentForWindow(hWnd));
- HWND topMostBlocker = blocker;
- HWND prevForegroundWindow = ::GetForegroundWindow();
if (::IsWindow(blocker)) {
- ::BringWindowToTop(hWnd);
- }
- while (::IsWindow(blocker)) {
- topMostBlocker = blocker;
- ::BringWindowToTop(blocker);
- blocker = AwtWindow::GetModalBlocker(blocker);
- }
- if (::IsWindow(topMostBlocker)) {
- // no beep/flash if the mouse was clicked in the taskbar menu
- // or the dialog is currently inactive
- if ((::WindowFromPoint(mhs->pt) == hWnd) &&
- (prevForegroundWindow == topMostBlocker))
- {
- ::MessageBeep(MB_OK);
- // some heuristics: 3 times x 64 milliseconds
- AwtWindow::FlashWindowEx(topMostBlocker, 3, 64, FLASHW_CAPTION);
- }
- if (topMostBlocker != AwtToolkit::GetInstance().GetHWnd()) {
- ::BringWindowToTop(topMostBlocker);
- ::SetForegroundWindow(topMostBlocker);
- }
+ BOOL onTaskbar = !(::WindowFromPoint(mhs->pt) == hWnd);
+ PopupAllDialogs(hWnd, FALSE, ::GetForegroundWindow(), onTaskbar);
+ // return a nonzero value to prevent the system from passing
+ // the message to the target window procedure
return 1;
}
}
@@ -303,6 +267,58 @@ LRESULT CALLBACK AwtDialog::MouseHookProc(int nCode,
return CallNextHookEx(0, nCode, wParam, lParam);
}
+/*
+ * 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.
+ */
+void AwtDialog::PopupAllDialogs(HWND dialog, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar)
+{
+ HWND blocker = AwtWindow::GetModalBlocker(dialog);
+ BOOL isBlocked = ::IsWindow(blocker);
+ if (isBlocked) {
+ PopupAllDialogs(blocker, isModalHook, prevFGWindow, onTaskbar);
+ }
+ PopupOneDialog(dialog, blocker, 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.
+ */
+void AwtDialog::PopupOneDialog(HWND dialog, HWND blocker, BOOL isModalHook, HWND prevFGWindow, BOOL onTaskbar)
+{
+ if (dialog == AwtToolkit::GetInstance().GetHWnd()) {
+ return;
+ }
+
+ // fix for 6494032
+ if (isModalHook && !::IsWindowVisible(dialog)) {
+ ::ShowWindow(dialog, SW_SHOWNA);
+ }
+
+ BOOL isBlocked = ::IsWindow(blocker);
+ UINT flags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE;
+
+ if (isBlocked) {
+ ::SetWindowPos(dialog, blocker, 0, 0, 0, 0, flags);
+ } else {
+ ::SetWindowPos(dialog, 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)) {
+ ::MessageBeep(MB_OK);
+ // some heuristics: 3 times x 64 milliseconds
+ AwtWindow::FlashWindowEx(dialog, 3, 64, FLASHW_CAPTION);
+ }
+ ::BringWindowToTop(dialog);
+ ::SetForegroundWindow(dialog);
+ }
+}
+
LRESULT CALLBACK AwtDialog::MouseHookProc_NonTT(int nCode,
WPARAM wParam, LPARAM lParam)
{
diff --git a/jdk/src/windows/native/sun/windows/awt_Dialog.h b/jdk/src/windows/native/sun/windows/awt_Dialog.h
index 41ab6ad05b0..5f181e63422 100644
--- a/jdk/src/windows/native/sun/windows/awt_Dialog.h
+++ b/jdk/src/windows/native/sun/windows/awt_Dialog.h
@@ -113,6 +113,9 @@ private:
*/
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);
+
public:
// WH_CBT hook procedure used in modality, prevents modal
From e05fd5d6f5d9aa6aac7874903c290400c2d2501a Mon Sep 17 00:00:00 2001
From: Dmitry Cherepanov
Date: Tue, 17 Feb 2009 14:30:52 +0300
Subject: [PATCH 11/80] 6792023: Print suspends on Windows 2000 Pro since 6u12
b01
Reviewed-by: art, anthony
---
.../windows/native/sun/windows/awt_FileDialog.cpp | 12 ++++++++----
.../windows/native/sun/windows/awt_PrintDialog.cpp | 12 ++++++++----
jdk/src/windows/native/sun/windows/awt_PrintJob.cpp | 12 ++++++++----
jdk/src/windows/native/sun/windows/awt_Window.h | 1 +
4 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp b/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp
index 84339e40eee..080e8d42741 100644
--- a/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_FileDialog.cpp
@@ -101,7 +101,8 @@ LRESULT CALLBACK FileDialogWndProc(HWND hWnd, UINT message,
}
}
- return ComCtl32Util::GetInstance().DefWindowProc(NULL, hWnd, message, wParam, lParam);
+ WNDPROC lpfnWndProc = (WNDPROC)(::GetProp(hWnd, NativeDialogWndProcProp));
+ return ComCtl32Util::GetInstance().DefWindowProc(lpfnWndProc, hWnd, message, wParam, lParam);
}
static UINT_PTR CALLBACK
@@ -135,16 +136,19 @@ FileDialogHookProc(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
}
// subclass dialog's parent to receive additional messages
- ComCtl32Util::GetInstance().SubclassHWND(parent,
- FileDialogWndProc);
+ WNDPROC lpfnWndProc = ComCtl32Util::GetInstance().SubclassHWND(parent,
+ FileDialogWndProc);
+ ::SetProp(parent, NativeDialogWndProcProp, reinterpret_cast(lpfnWndProc));
break;
}
case WM_DESTROY: {
+ WNDPROC lpfnWndProc = (WNDPROC)(::GetProp(parent, NativeDialogWndProcProp));
ComCtl32Util::GetInstance().UnsubclassHWND(parent,
FileDialogWndProc,
- NULL);
+ lpfnWndProc);
::RemoveProp(parent, ModalDialogPeerProp);
+ ::RemoveProp(parent, NativeDialogWndProcProp);
break;
}
case WM_NOTIFY: {
diff --git a/jdk/src/windows/native/sun/windows/awt_PrintDialog.cpp b/jdk/src/windows/native/sun/windows/awt_PrintDialog.cpp
index 762ae2673eb..12b208b9493 100644
--- a/jdk/src/windows/native/sun/windows/awt_PrintDialog.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_PrintDialog.cpp
@@ -65,7 +65,8 @@ LRESULT CALLBACK PrintDialogWndProc(HWND hWnd, UINT message,
}
}
- return ComCtl32Util::GetInstance().DefWindowProc(NULL, hWnd, message, wParam, lParam);
+ WNDPROC lpfnWndProc = (WNDPROC)(::GetProp(hWnd, NativeDialogWndProcProp));
+ return ComCtl32Util::GetInstance().DefWindowProc(lpfnWndProc, hWnd, message, wParam, lParam);
}
static UINT_PTR CALLBACK
@@ -99,16 +100,19 @@ PrintDialogHookProc(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
}
// subclass dialog's parent to receive additional messages
- ComCtl32Util::GetInstance().SubclassHWND(hdlg,
- PrintDialogWndProc);
+ WNDPROC lpfnWndProc = ComCtl32Util::GetInstance().SubclassHWND(hdlg,
+ PrintDialogWndProc);
+ ::SetProp(hdlg, NativeDialogWndProcProp, reinterpret_cast(lpfnWndProc));
break;
}
case WM_DESTROY: {
+ WNDPROC lpfnWndProc = (WNDPROC)(::GetProp(hdlg, NativeDialogWndProcProp));
ComCtl32Util::GetInstance().UnsubclassHWND(hdlg,
PrintDialogWndProc,
- NULL);
+ lpfnWndProc);
::RemoveProp(hdlg, ModalDialogPeerProp);
+ ::RemoveProp(hdlg, NativeDialogWndProcProp);
break;
}
}
diff --git a/jdk/src/windows/native/sun/windows/awt_PrintJob.cpp b/jdk/src/windows/native/sun/windows/awt_PrintJob.cpp
index 9136b786412..c3339778695 100644
--- a/jdk/src/windows/native/sun/windows/awt_PrintJob.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_PrintJob.cpp
@@ -2885,7 +2885,8 @@ LRESULT CALLBACK PageDialogWndProc(HWND hWnd, UINT message,
}
}
- return ComCtl32Util::GetInstance().DefWindowProc(NULL, hWnd, message, wParam, lParam);
+ WNDPROC lpfnWndProc = (WNDPROC)(::GetProp(hWnd, NativeDialogWndProcProp));
+ return ComCtl32Util::GetInstance().DefWindowProc(lpfnWndProc, hWnd, message, wParam, lParam);
}
/**
@@ -2919,16 +2920,19 @@ static UINT CALLBACK pageDlgHook(HWND hDlg, UINT msg,
}
// subclass dialog's parent to receive additional messages
- ComCtl32Util::GetInstance().SubclassHWND(hDlg,
- PageDialogWndProc);
+ WNDPROC lpfnWndProc = ComCtl32Util::GetInstance().SubclassHWND(hDlg,
+ PageDialogWndProc);
+ ::SetProp(hDlg, NativeDialogWndProcProp, reinterpret_cast(lpfnWndProc));
break;
}
case WM_DESTROY: {
+ WNDPROC lpfnWndProc = (WNDPROC)(::GetProp(hDlg, NativeDialogWndProcProp));
ComCtl32Util::GetInstance().UnsubclassHWND(hDlg,
PageDialogWndProc,
- NULL);
+ lpfnWndProc);
::RemoveProp(hDlg, ModalDialogPeerProp);
+ ::RemoveProp(hDlg, NativeDialogWndProcProp);
break;
}
}
diff --git a/jdk/src/windows/native/sun/windows/awt_Window.h b/jdk/src/windows/native/sun/windows/awt_Window.h
index a3d57db7b2d..17f05ec164a 100644
--- a/jdk/src/windows/native/sun/windows/awt_Window.h
+++ b/jdk/src/windows/native/sun/windows/awt_Window.h
@@ -34,6 +34,7 @@
// property name tagging windows disabled by modality
static LPCTSTR ModalBlockerProp = TEXT("SunAwtModalBlockerProp");
static LPCTSTR ModalDialogPeerProp = TEXT("SunAwtModalDialogPeerProp");
+static LPCTSTR NativeDialogWndProcProp = TEXT("SunAwtNativeDialogWndProcProp");
#ifndef WH_MOUSE_LL
#define WH_MOUSE_LL 14
From c59552fc2d58cc2393a9f865e2ae13c1f926d5a1 Mon Sep 17 00:00:00 2001
From: Dmitry Cherepanov
Date: Tue, 17 Feb 2009 14:44:58 +0300
Subject: [PATCH 12/80] 6723941: Crash in sun.awt.windows.WToolkit.eventLoop()
Reviewed-by: art, ant
---
jdk/src/windows/native/sun/windows/awt_Frame.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/jdk/src/windows/native/sun/windows/awt_Frame.cpp b/jdk/src/windows/native/sun/windows/awt_Frame.cpp
index 888ed50b5cb..94bb0050c9e 100644
--- a/jdk/src/windows/native/sun/windows/awt_Frame.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Frame.cpp
@@ -321,7 +321,8 @@ LRESULT CALLBACK AwtFrame::ProxyWindowProc(HWND hwnd, UINT message,
AwtComponent::GetComponentImpl(::GetParent(hwnd));
if (!parent || parent->GetProxyFocusOwner() != hwnd ||
- message == AwtComponent::WmAwtIsComponent)
+ message == AwtComponent::WmAwtIsComponent ||
+ message == WM_GETOBJECT)
{
return ComCtl32Util::GetInstance().DefWindowProc(NULL, hwnd, message, wParam, lParam);
}
From a1117d31b6e286fb36264f36827c1cd7efb41373 Mon Sep 17 00:00:00 2001
From: Dmitry Cherepanov
Date: Thu, 19 Feb 2009 14:10:19 +0300
Subject: [PATCH 13/80] 6806224: PIT : Getting java.lang.NullPointerException
while opening Filedialog
Reviewed-by: art, dav
---
.../classes/sun/awt/X11/XComponentPeer.java | 6 +---
.../classes/sun/awt/X11/XFileDialogPeer.java | 30 ++++++++-----------
2 files changed, 14 insertions(+), 22 deletions(-)
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
index 8a14cfe5f0f..46c4a8768f0 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
@@ -166,7 +166,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
enableLog.log(Level.FINE, "Initial enable state: {0}", new Object[] {Boolean.valueOf(enabled)});
if (target.isVisible()) {
- show();
+ setVisible(true);
}
}
@@ -496,10 +496,6 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
xSetVisible(b);
}
- public void show() {
- setVisible(true);
- }
-
public void hide() {
setVisible(false);
}
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java
index 0675847af79..0b8085e759d 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java
@@ -739,7 +739,17 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe
this.filter = filter;
}
- public void show() {
+
+ public void dispose() {
+ FileDialog fd = (FileDialog)fileDialog;
+ if (fd != null) {
+ fd.removeAll();
+ }
+ super.dispose();
+ }
+
+ // 03/02/2005 b5097243 Pressing 'ESC' on a file dlg does not dispose the dlg on Xtoolkit
+ public void setVisible(boolean b){
if (fileDialog == null) {
init((FileDialog)target);
}
@@ -754,34 +764,20 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe
setFile(savedFile);
}
- super.show();
- selectionField.requestFocusInWindow();
- }
-
- public void dispose() {
- FileDialog fd = (FileDialog)fileDialog;
- if (fd != null) {
- fd.removeAll();
- }
- super.dispose();
- }
-
- // 03/02/2005 b5097243 Pressing 'ESC' on a file dlg does not dispose the dlg on Xtoolkit
- public void setVisible(boolean b){
super.setVisible(b);
if (b == true){
// See 6240074 for more information
XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer();
choicePeer.addXChoicePeerListener(this);
-
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this);
}else{
// See 6240074 for more information
XChoicePeer choicePeer = (XChoicePeer)pathChoice.getPeer();
choicePeer.removeXChoicePeerListener();
-
KeyboardFocusManager.getCurrentKeyboardFocusManager().removeKeyEventDispatcher(this);
}
+
+ selectionField.requestFocusInWindow();
}
/*
From f9a987bf43ae09a989b51e70a88f5c14ae14ac39 Mon Sep 17 00:00:00 2001
From: Anthony Petrov
Date: Fri, 20 Feb 2009 17:34:16 +0300
Subject: [PATCH 14/80] 6804747: Ensure consistent graphicsConfig member across
components hierarchy
Reviewed-by: art, dcherepanov
---
jdk/src/share/classes/java/awt/Canvas.java | 13 +++-
jdk/src/share/classes/java/awt/Component.java | 51 ++++--------
jdk/src/share/classes/java/awt/Container.java | 18 +++++
jdk/src/share/classes/java/awt/Window.java | 71 +++++++----------
.../classes/java/awt/peer/CanvasPeer.java | 10 +++
.../classes/java/awt/peer/ComponentPeer.java | 6 ++
.../share/classes/sun/awt/AWTAccessor.java | 5 ++
.../classes/sun/awt/ComponentAccessor.java | 16 ----
.../classes/sun/awt/NullComponentPeer.java | 8 ++
.../classes/sun/awt/X11/XCanvasPeer.java | 78 ++++++++-----------
.../classes/sun/awt/X11/XComponentPeer.java | 5 ++
.../sun/awt/X11/XEmbedChildProxyPeer.java | 2 +
.../classes/sun/awt/X11/XPanelPeer.java | 33 --------
.../classes/sun/awt/X11/XWindowPeer.java | 24 +++---
.../solaris/native/sun/awt/awt_Component.h | 5 --
jdk/src/solaris/native/sun/awt/awt_Window.h | 1 -
jdk/src/solaris/native/sun/xawt/XToolkit.c | 6 --
.../classes/sun/awt/Win32GraphicsDevice.java | 1 -
.../classes/sun/awt/windows/WCanvasPeer.java | 38 ++-------
.../sun/awt/windows/WComponentPeer.java | 20 +----
.../classes/sun/awt/windows/WPanelPeer.java | 28 -------
.../classes/sun/awt/windows/WWindowPeer.java | 37 +++++----
22 files changed, 181 insertions(+), 295 deletions(-)
diff --git a/jdk/src/share/classes/java/awt/Canvas.java b/jdk/src/share/classes/java/awt/Canvas.java
index 04b3bc2dca4..86315e7c12e 100644
--- a/jdk/src/share/classes/java/awt/Canvas.java
+++ b/jdk/src/share/classes/java/awt/Canvas.java
@@ -25,6 +25,7 @@
package java.awt;
import java.awt.image.BufferStrategy;
+import java.awt.peer.CanvasPeer;
import javax.accessibility.*;
/**
@@ -65,7 +66,17 @@ public class Canvas extends Component implements Accessible {
*/
public Canvas(GraphicsConfiguration config) {
this();
- graphicsConfig = config;
+ setGraphicsConfiguration(config);
+ }
+
+ @Override
+ void setGraphicsConfiguration(GraphicsConfiguration gc) {
+ CanvasPeer peer = (CanvasPeer)getPeer();
+ if (peer != null) {
+ gc = peer.getAppropriateGraphicsConfiguration(gc);
+ }
+
+ super.setGraphicsConfiguration(gc);
}
/**
diff --git a/jdk/src/share/classes/java/awt/Component.java b/jdk/src/share/classes/java/awt/Component.java
index 9828ddb5661..e59d37a5826 100644
--- a/jdk/src/share/classes/java/awt/Component.java
+++ b/jdk/src/share/classes/java/awt/Component.java
@@ -300,7 +300,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
* @see GraphicsConfiguration
* @see #getGraphicsConfiguration
*/
- transient GraphicsConfiguration graphicsConfig = null;
+ private transient GraphicsConfiguration graphicsConfig = null;
/**
* A reference to a BufferStrategy object
@@ -845,6 +845,12 @@ public abstract class Component implements ImageObserver, MenuContainer,
}
}
}
+
+ public void setGraphicsConfiguration(Component comp,
+ GraphicsConfiguration gc)
+ {
+ comp.setGraphicsConfiguration(gc);
+ }
});
}
@@ -1012,50 +1018,21 @@ public abstract class Component implements ImageObserver, MenuContainer,
*/
public GraphicsConfiguration getGraphicsConfiguration() {
synchronized(getTreeLock()) {
- if (graphicsConfig != null) {
- return graphicsConfig;
- } else if (getParent() != null) {
- return getParent().getGraphicsConfiguration();
- } else {
- return null;
- }
+ return getGraphicsConfiguration_NoClientCode();
}
}
final GraphicsConfiguration getGraphicsConfiguration_NoClientCode() {
- GraphicsConfiguration graphicsConfig = this.graphicsConfig;
- Container parent = this.parent;
- if (graphicsConfig != null) {
- return graphicsConfig;
- } else if (parent != null) {
- return parent.getGraphicsConfiguration_NoClientCode();
- } else {
- return null;
- }
+ return graphicsConfig;
}
- /**
- * Resets this Component's
- * GraphicsConfiguration back to a default
- * value. For most componenets, this is null.
- * Called from the Toolkit thread, so NO CLIENT CODE.
- */
- void resetGC() {
+ void setGraphicsConfiguration(GraphicsConfiguration gc) {
synchronized(getTreeLock()) {
- graphicsConfig = null;
- }
- }
+ graphicsConfig = gc;
- /*
- * Not called on Component, but needed for Canvas and Window
- */
- void setGCFromPeer() {
- synchronized(getTreeLock()) {
- if (peer != null) { // can't imagine how this will be false,
- // but just in case
- graphicsConfig = peer.getGraphicsConfiguration();
- } else {
- graphicsConfig = null;
+ ComponentPeer peer = getPeer();
+ if (peer != null) {
+ peer.updateGraphicsData(gc);
}
}
}
diff --git a/jdk/src/share/classes/java/awt/Container.java b/jdk/src/share/classes/java/awt/Container.java
index 64de85477a7..fb520547e1e 100644
--- a/jdk/src/share/classes/java/awt/Container.java
+++ b/jdk/src/share/classes/java/awt/Container.java
@@ -506,6 +506,7 @@ public class Container extends Component {
adjustDescendants(-(comp.countHierarchyMembers()));
comp.parent = null;
+ comp.setGraphicsConfiguration(null);
component.remove(index);
invalidateIfValid();
@@ -789,6 +790,7 @@ public class Container extends Component {
component.add(index, comp);
}
comp.parent = this;
+ comp.setGraphicsConfiguration(getGraphicsConfiguration());
adjustListeningChildren(AWTEvent.HIERARCHY_EVENT_MASK,
comp.numListening(AWTEvent.HIERARCHY_EVENT_MASK));
@@ -1056,6 +1058,7 @@ public class Container extends Component {
component.add(index, comp);
}
comp.parent = this;
+ comp.setGraphicsConfiguration(thisGC);
adjustListeningChildren(AWTEvent.HIERARCHY_EVENT_MASK,
comp.numListening(AWTEvent.HIERARCHY_EVENT_MASK));
@@ -1094,6 +1097,19 @@ public class Container extends Component {
}
}
+ @Override
+ void setGraphicsConfiguration(GraphicsConfiguration gc) {
+ synchronized (getTreeLock()) {
+ super.setGraphicsConfiguration(gc);
+
+ for (Component comp : component) {
+ if (comp != null) {
+ comp.setGraphicsConfiguration(gc);
+ }
+ }
+ }
+ }
+
/**
* Checks that all Components that this Container contains are on
* the same GraphicsDevice as this Container. If not, throws an
@@ -1151,6 +1167,7 @@ public class Container extends Component {
comp.parent = null;
component.remove(index);
+ comp.setGraphicsConfiguration(null);
invalidateIfValid();
if (containerListener != null ||
@@ -1227,6 +1244,7 @@ public class Container extends Component {
layoutMgr.removeLayoutComponent(comp);
}
comp.parent = null;
+ comp.setGraphicsConfiguration(null);
if (containerListener != null ||
(eventMask & AWTEvent.CONTAINER_EVENT_MASK) != 0 ||
Toolkit.enabledOnToolkit(AWTEvent.CONTAINER_EVENT_MASK)) {
diff --git a/jdk/src/share/classes/java/awt/Window.java b/jdk/src/share/classes/java/awt/Window.java
index e1ff8db14c3..062870fe101 100644
--- a/jdk/src/share/classes/java/awt/Window.java
+++ b/jdk/src/share/classes/java/awt/Window.java
@@ -394,6 +394,18 @@ public class Window extends Container implements Accessible {
}
}
+ private GraphicsConfiguration initGC(GraphicsConfiguration gc) {
+ GraphicsEnvironment.checkHeadless();
+
+ if (gc == null) {
+ gc = GraphicsEnvironment.getLocalGraphicsEnvironment().
+ getDefaultScreenDevice().getDefaultConfiguration();
+ }
+ setGraphicsConfiguration(gc);
+
+ return gc;
+ }
+
private void init(GraphicsConfiguration gc) {
GraphicsEnvironment.checkHeadless();
@@ -405,14 +417,10 @@ public class Window extends Container implements Accessible {
setWarningString();
this.cursor = Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR);
this.visible = false;
- if (gc == null) {
- this.graphicsConfig =
- GraphicsEnvironment.getLocalGraphicsEnvironment().
- getDefaultScreenDevice().getDefaultConfiguration();
- } else {
- this.graphicsConfig = gc;
- }
- if (graphicsConfig.getDevice().getType() !=
+
+ gc = initGC(gc);
+
+ if (gc.getDevice().getType() !=
GraphicsDevice.TYPE_RASTER_SCREEN) {
throw new IllegalArgumentException("not a screen device");
}
@@ -420,8 +428,8 @@ public class Window extends Container implements Accessible {
/* offset the initial location with the original of the screen */
/* and any insets */
- Rectangle screenBounds = graphicsConfig.getBounds();
- Insets screenInsets = getToolkit().getScreenInsets(graphicsConfig);
+ Rectangle screenBounds = gc.getBounds();
+ Insets screenInsets = getToolkit().getScreenInsets(gc);
int x = getX() + screenBounds.x + screenInsets.left;
int y = getY() + screenBounds.y + screenInsets.top;
if (x != this.x || y != this.y) {
@@ -2765,7 +2773,7 @@ public class Window extends Container implements Accessible {
sun.java2d.Disposer.addRecord(anchor, new WindowDisposerRecord(appContext, this));
addToWindowList();
-
+ initGC(null);
}
private void deserializeResources(ObjectInputStream s)
@@ -2939,41 +2947,18 @@ public class Window extends Container implements Accessible {
} // inner class AccessibleAWTWindow
- /**
- * This method returns the GraphicsConfiguration used by this Window.
- * @since 1.3
- */
- public GraphicsConfiguration getGraphicsConfiguration() {
- //NOTE: for multiscreen, this will need to take into account
- //which screen the window is on/mostly on instead of returning the
- //default or constructor argument config.
- synchronized(getTreeLock()) {
- if (graphicsConfig == null && !GraphicsEnvironment.isHeadless()) {
- graphicsConfig =
- GraphicsEnvironment. getLocalGraphicsEnvironment().
- getDefaultScreenDevice().
- getDefaultConfiguration();
- }
- return graphicsConfig;
- }
- }
-
- /**
- * Reset this Window's GraphicsConfiguration to match its peer.
- */
- void resetGC() {
- if (!GraphicsEnvironment.isHeadless()) {
- // use the peer's GC
- setGCFromPeer();
- // if it's still null, use the default
- if (graphicsConfig == null) {
- graphicsConfig = GraphicsEnvironment.
+ @Override
+ void setGraphicsConfiguration(GraphicsConfiguration gc) {
+ if (gc == null) {
+ gc = GraphicsEnvironment.
getLocalGraphicsEnvironment().
getDefaultScreenDevice().
getDefaultConfiguration();
- }
+ }
+ synchronized (getTreeLock()) {
+ super.setGraphicsConfiguration(gc);
if (log.isLoggable(Level.FINER)) {
- log.finer("+ Window.resetGC(): new GC is \n+ " + graphicsConfig + "\n+ this is " + this);
+ log.finer("+ Window.setGraphicsConfiguration(): new GC is \n+ " + getGraphicsConfiguration_NoClientCode() + "\n+ this is " + this);
}
}
}
@@ -3033,7 +3018,7 @@ public class Window extends Container implements Accessible {
// target location
int dx = 0, dy = 0;
// target GC
- GraphicsConfiguration gc = this.graphicsConfig;
+ GraphicsConfiguration gc = getGraphicsConfiguration_NoClientCode();
Rectangle gcBounds = gc.getBounds();
Dimension windowSize = getSize();
diff --git a/jdk/src/share/classes/java/awt/peer/CanvasPeer.java b/jdk/src/share/classes/java/awt/peer/CanvasPeer.java
index bbf6a111086..94b8d189d8d 100644
--- a/jdk/src/share/classes/java/awt/peer/CanvasPeer.java
+++ b/jdk/src/share/classes/java/awt/peer/CanvasPeer.java
@@ -25,6 +25,7 @@
package java.awt.peer;
import java.awt.Canvas;
+import java.awt.GraphicsConfiguration;
/**
* The peer interface for {@link Canvas}.
@@ -36,4 +37,13 @@ import java.awt.Canvas;
* instances.
*/
public interface CanvasPeer extends ComponentPeer {
+ /**
+ * Requests a GC that best suits this Canvas. The returned GC may differ
+ * from the requested GC passed as the argument to this method. This method
+ * must return a non-null value (given the argument is non-null as well).
+ *
+ * @since 1.7
+ */
+ GraphicsConfiguration getAppropriateGraphicsConfiguration(
+ GraphicsConfiguration gc);
}
diff --git a/jdk/src/share/classes/java/awt/peer/ComponentPeer.java b/jdk/src/share/classes/java/awt/peer/ComponentPeer.java
index e71ab27f7ac..3a2845f37fa 100644
--- a/jdk/src/share/classes/java/awt/peer/ComponentPeer.java
+++ b/jdk/src/share/classes/java/awt/peer/ComponentPeer.java
@@ -539,4 +539,10 @@ public interface ComponentPeer {
*/
void applyShape(Region shape);
+ /**
+ * Updates internal data structures related to the component's GC.
+ *
+ * @since 1.7
+ */
+ void updateGraphicsData(GraphicsConfiguration gc);
}
diff --git a/jdk/src/share/classes/sun/awt/AWTAccessor.java b/jdk/src/share/classes/sun/awt/AWTAccessor.java
index 2145f0f10a4..767b4147778 100644
--- a/jdk/src/share/classes/sun/awt/AWTAccessor.java
+++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java
@@ -78,6 +78,11 @@ public final class AWTAccessor {
* See 6797587, 6776743, 6768307, and 6768332 for details
*/
void setMixingCutoutShape(Component comp, Shape shape);
+
+ /**
+ * Sets GraphicsConfiguration value for the component.
+ */
+ void setGraphicsConfiguration(Component comp, GraphicsConfiguration gc);
}
/*
diff --git a/jdk/src/share/classes/sun/awt/ComponentAccessor.java b/jdk/src/share/classes/sun/awt/ComponentAccessor.java
index af3abcf8a95..49a383815db 100644
--- a/jdk/src/share/classes/sun/awt/ComponentAccessor.java
+++ b/jdk/src/share/classes/sun/awt/ComponentAccessor.java
@@ -73,7 +73,6 @@ public class ComponentAccessor
private static Field fieldPacked;
private static Field fieldIgnoreRepaint;
private static Field fieldPeer;
- private static Method methodResetGC;
private static Field fieldVisible;
private static Method methodIsEnabledImpl;
private static Method methodGetCursorNoClientCode;
@@ -124,9 +123,6 @@ public class ComponentAccessor
fieldPeer = componentClass.getDeclaredField("peer");
fieldPeer.setAccessible(true);
- methodResetGC = componentClass.getDeclaredMethod("resetGC", (Class[]) null);
- methodResetGC.setAccessible(true);
-
fieldVisible = componentClass.getDeclaredField("visible");
fieldVisible.setAccessible(true);
@@ -425,18 +421,6 @@ public class ComponentAccessor
return false;
}
- public static void resetGC(Component c) {
- try {
- methodResetGC.invoke(c, (Object[]) null);
- }
- catch (IllegalAccessException e) {
- log.log(Level.FINE, "Unable to access the Component object", e);
- }
- catch (InvocationTargetException e) {
- log.log(Level.FINE, "Unable to invoke on the Component object", e);
- }
- }
-
public static boolean getVisible(Component c) {
try {
return fieldVisible.getBoolean(c);
diff --git a/jdk/src/share/classes/sun/awt/NullComponentPeer.java b/jdk/src/share/classes/sun/awt/NullComponentPeer.java
index 8818c472877..2feea7b518c 100644
--- a/jdk/src/share/classes/sun/awt/NullComponentPeer.java
+++ b/jdk/src/share/classes/sun/awt/NullComponentPeer.java
@@ -305,4 +305,12 @@ public class NullComponentPeer implements LightweightPeer,
*/
public void applyShape(Region shape) {
}
+
+ public void updateGraphicsData(GraphicsConfiguration gc) {}
+
+ public GraphicsConfiguration getAppropriateGraphicsConfiguration(
+ GraphicsConfiguration gc)
+ {
+ return gc;
+ }
}
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XCanvasPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XCanvasPeer.java
index 4c38c88b9fc..8fc6f1f7d28 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XCanvasPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XCanvasPeer.java
@@ -27,7 +27,6 @@ package sun.awt.X11;
import java.awt.*;
import java.awt.peer.*;
-import sun.awt.ComponentAccessor;
import sun.awt.SunToolkit;
import sun.awt.X11GraphicsConfig;
@@ -54,60 +53,45 @@ class XCanvasPeer extends XComponentPeer implements CanvasPeer {
}
}
- void resetTargetGC(Component target) {
- ComponentAccessor.resetGC(target);
- }
-
- /*
- * Called when the Window this
- * Canvas is on is moved onto another Xinerama screen.
- *
- * Canvases can be created with a non-defulat GraphicsConfiguration. The
- * GraphicsConfiguration needs to be changed to one on the new screen,
- * preferably with the same visual ID.
- *
- * Up-called for other windows peer instances (XPanelPeer, XWindowPeer).
- *
- * Should only be called from the event thread.
- */
- public void displayChanged(int screenNum) {
- resetLocalGC(screenNum);
- resetTargetGC(target);
- }
-
- /* Set graphicsConfig to a GraphicsConfig with the same visual on the new
+ /* Get a GraphicsConfig with the same visual on the new
* screen, which should be easy in Xinerama mode.
- *
- * Should only be called from displayChanged(), and therefore only from
- * the event thread.
*/
- void resetLocalGC(int screenNum) {
+ public GraphicsConfiguration getAppropriateGraphicsConfiguration(
+ GraphicsConfiguration gc)
+ {
+ if (graphicsConfig == null || gc == null) {
+ return gc;
+ }
// Opt: Only need to do if we're not using the default GC
- if (graphicsConfig != null) {
- X11GraphicsConfig parentgc;
- // save vis id of current gc
- int visual = graphicsConfig.getVisual();
- X11GraphicsDevice newDev = (X11GraphicsDevice) GraphicsEnvironment.
- getLocalGraphicsEnvironment().
- getScreenDevices()[screenNum];
+ int screenNum = ((X11GraphicsDevice)gc.getDevice()).getScreen();
- for (int i = 0; i < newDev.getNumConfigs(screenNum); i++) {
- if (visual == newDev.getConfigVisualId(i, screenNum)) {
- // use that
- graphicsConfig = (X11GraphicsConfig)newDev.getConfigurations()[i];
- break;
- }
- }
- // just in case...
- if (graphicsConfig == null) {
- graphicsConfig = (X11GraphicsConfig) GraphicsEnvironment.
- getLocalGraphicsEnvironment().
- getScreenDevices()[screenNum].
- getDefaultConfiguration();
+ X11GraphicsConfig parentgc;
+ // save vis id of current gc
+ int visual = graphicsConfig.getVisual();
+
+ X11GraphicsDevice newDev = (X11GraphicsDevice) GraphicsEnvironment.
+ getLocalGraphicsEnvironment().
+ getScreenDevices()[screenNum];
+
+ for (int i = 0; i < newDev.getNumConfigs(screenNum); i++) {
+ if (visual == newDev.getConfigVisualId(i, screenNum)) {
+ // use that
+ graphicsConfig = (X11GraphicsConfig)newDev.getConfigurations()[i];
+ break;
}
}
+ // just in case...
+ if (graphicsConfig == null) {
+ graphicsConfig = (X11GraphicsConfig) GraphicsEnvironment.
+ getLocalGraphicsEnvironment().
+ getScreenDevices()[screenNum].
+ getDefaultConfiguration();
+ }
+
+ return graphicsConfig;
}
+
protected boolean shouldFocusOnClick() {
// Canvas should always be able to be focused by mouse clicks.
return true;
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
index 46c4a8768f0..4c83ac750c8 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
@@ -35,6 +35,7 @@ import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
+import java.awt.GraphicsConfiguration;
import java.awt.Image;
import java.awt.Insets;
import java.awt.KeyboardFocusManager;
@@ -1556,4 +1557,8 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
}
}
}
+
+ public void updateGraphicsData(GraphicsConfiguration gc) {
+ initGraphicsConfiguration();
+ }
}
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java
index e4500043ae1..eae300aee08 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java
@@ -379,4 +379,6 @@ public class XEmbedChildProxyPeer implements ComponentPeer, XEventDispatcher{
public void applyShape(Region shape) {
}
+
+ public void updateGraphicsData(GraphicsConfiguration gc) {}
}
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XPanelPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XPanelPeer.java
index aac632569ad..c070fcf3ad8 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XPanelPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XPanelPeer.java
@@ -130,39 +130,6 @@ public class XPanelPeer extends XCanvasPeer implements PanelPeer {
return getInsets();
}
- /*
- * This method is called from XWindowPeer.displayChanged, when
- * the window this Panel is on is moved to the new screen, or
- * display mode is changed.
- *
- * The notification is propagated to the child Canvas components.
- * Top-level windows and other Panels are notified too as their
- * peers are subclasses of XCanvasPeer.
- */
- public void displayChanged(int screenNum) {
- super.displayChanged(screenNum);
- displayChanged((Container)target, screenNum);
- }
-
- /*
- * Recursively iterates through all the HW and LW children
- * of the container and calls displayChanged() for HW peers.
- * Iteration through children peers only is not enough as the
- * displayChanged notification may not be propagated to HW
- * components inside LW containers, see 4452373 for details.
- */
- private static void displayChanged(Container target, int screenNum) {
- Component children[] = ((Container)target).getComponents();
- for (Component child : children) {
- ComponentPeer cpeer = child.getPeer();
- if (cpeer instanceof XCanvasPeer) {
- ((XCanvasPeer)cpeer).displayChanged(screenNum);
- } else if (child instanceof Container) {
- displayChanged((Container)child, screenNum);
- }
- }
- }
-
public void dispose() {
if (embedder != null) {
embedder.deinstall();
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java
index 619ff8a9c9b..4f9fa56fd8f 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java
@@ -47,6 +47,7 @@ import java.util.logging.Logger;
import sun.awt.AWTAccessor;
import sun.awt.ComponentAccessor;
import sun.awt.WindowAccessor;
+import sun.awt.AWTAccessor;
import sun.awt.DisplayChangedListener;
import sun.awt.SunToolkit;
import sun.awt.X11GraphicsDevice;
@@ -711,6 +712,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
int curScreenNum = ((X11GraphicsDevice)getGraphicsConfiguration().getDevice()).getScreen();
int newScreenNum = 0;
GraphicsDevice gds[] = XToolkit.localEnv.getScreenDevices();
+ GraphicsConfiguration newGC = null;
Rectangle screenBounds;
for (int i = 0; i < gds.length; i++) {
@@ -726,11 +728,13 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
if (intAmt == area) {
// Completely on this screen - done!
newScreenNum = i;
+ newGC = gds[i].getDefaultConfiguration();
break;
}
if (intAmt > largestAmt) {
largestAmt = intAmt;
newScreenNum = i;
+ newGC = gds[i].getDefaultConfiguration();
}
}
}
@@ -738,28 +742,20 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
if (log.isLoggable(Level.FINEST)) {
log.finest("XWindowPeer: Moved to a new screen");
}
- draggedToNewScreen(newScreenNum);
+ executeDisplayChangedOnEDT(newGC);
}
}
- /* Xinerama
- * called to update our GC when dragged onto another screen
- */
- public void draggedToNewScreen(int screenNum) {
- executeDisplayChangedOnEDT(screenNum);
- }
-
/**
* Helper method that executes the displayChanged(screen) method on
* the event dispatch thread. This method is used in the Xinerama case
* and after display mode change events.
*/
- private void executeDisplayChangedOnEDT(final int screenNum) {
+ private void executeDisplayChangedOnEDT(final GraphicsConfiguration gc) {
Runnable dc = new Runnable() {
public void run() {
- // Updates this window's GC and notifies all the children.
- // See XPanelPeer/XCanvasPeer.displayChanged(int) for details.
- displayChanged(screenNum);
+ AWTAccessor.getComponentAccessor().
+ setGraphicsConfiguration((Component)target, gc);
}
};
SunToolkit.executeOnEventHandlerThread((Component)target, dc);
@@ -770,9 +766,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
* X11GraphicsDevice when the display mode has been changed.
*/
public void displayChanged() {
- GraphicsConfiguration gc = getGraphicsConfiguration();
- int curScreenNum = ((X11GraphicsDevice)gc.getDevice()).getScreen();
- executeDisplayChangedOnEDT(curScreenNum);
+ executeDisplayChangedOnEDT(getGraphicsConfiguration());
}
/**
diff --git a/jdk/src/solaris/native/sun/awt/awt_Component.h b/jdk/src/solaris/native/sun/awt/awt_Component.h
index 8ee7fe82f45..d6ee776be01 100644
--- a/jdk/src/solaris/native/sun/awt/awt_Component.h
+++ b/jdk/src/solaris/native/sun/awt/awt_Component.h
@@ -41,7 +41,6 @@ struct ComponentIDs {
jfieldID appContext;
jmethodID getParent;
jmethodID getLocationOnScreen;
- jmethodID resetGCMID;
};
/* field and method IDs for Container */
@@ -65,7 +64,3 @@ struct MComponentPeerIDs {
extern void processTree(Widget from, Widget to, Boolean action);
#endif // HEADLESS
-/* fieldIDs for Canvas fields that may be accessed from C */
-struct CanvasIDs {
- jmethodID setGCFromPeerMID;
-};
diff --git a/jdk/src/solaris/native/sun/awt/awt_Window.h b/jdk/src/solaris/native/sun/awt/awt_Window.h
index 875f55b2fa1..a93e4ad34d1 100644
--- a/jdk/src/solaris/native/sun/awt/awt_Window.h
+++ b/jdk/src/solaris/native/sun/awt/awt_Window.h
@@ -28,7 +28,6 @@
/* fieldIDs for Window fields that may be accessed from C */
struct WindowIDs {
jfieldID warningString;
- jmethodID resetGCMID;
jfieldID locationByPlatform;
jfieldID isAutoRequestFocus;
};
diff --git a/jdk/src/solaris/native/sun/xawt/XToolkit.c b/jdk/src/solaris/native/sun/xawt/XToolkit.c
index ac3fecc0c76..3b9669cb92b 100644
--- a/jdk/src/solaris/native/sun/xawt/XToolkit.c
+++ b/jdk/src/solaris/native/sun/xawt/XToolkit.c
@@ -182,9 +182,6 @@ Java_java_awt_Component_initIDs
(*env)->GetMethodID(env, cls, "getLocationOnScreen_NoTreeLock",
"()Ljava/awt/Point;");
- componentIDs.resetGCMID =
- (*env)->GetMethodID(env, cls, "resetGC", "()V");
-
keyclass = (*env)->FindClass(env, "java/awt/event/KeyEvent");
DASSERT (keyclass != NULL);
@@ -197,9 +194,6 @@ Java_java_awt_Component_initIDs
"Lsun/awt/AppContext;");
(*env)->DeleteLocalRef(env, keyclass);
-
- DASSERT(componentIDs.resetGCMID);
-
}
diff --git a/jdk/src/windows/classes/sun/awt/Win32GraphicsDevice.java b/jdk/src/windows/classes/sun/awt/Win32GraphicsDevice.java
index ba4769813d8..1da339ce9f1 100644
--- a/jdk/src/windows/classes/sun/awt/Win32GraphicsDevice.java
+++ b/jdk/src/windows/classes/sun/awt/Win32GraphicsDevice.java
@@ -380,7 +380,6 @@ public class Win32GraphicsDevice extends GraphicsDevice implements
// fix for 4868278
peer.updateGC();
- peer.resetTargetGC();
}
}
diff --git a/jdk/src/windows/classes/sun/awt/windows/WCanvasPeer.java b/jdk/src/windows/classes/sun/awt/windows/WCanvasPeer.java
index e1657102900..b97a3787b64 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WCanvasPeer.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WCanvasPeer.java
@@ -38,44 +38,12 @@ class WCanvasPeer extends WComponentPeer implements CanvasPeer {
private boolean eraseBackground;
- Method resetGCMethod;
-
// Toolkit & peer internals
WCanvasPeer(Component target) {
super(target);
}
- /*
- * From the DisplayChangedListener interface.
- *
- * Overrides WComponentPeer version because Canvases can be created with
- * a non-defulat GraphicsConfiguration, which is no longer valid.
- * Up-called for other windows peer instances (WPanelPeer, WWindowPeer).
- */
- public void displayChanged() {
- clearLocalGC();
- resetTargetGC();
- super.displayChanged();
- }
-
- /*
- * Reset the graphicsConfiguration member of our target Component.
- * Component.resetGC() is a package-private method, so we have to call it
- * through reflection.
- */
- public void resetTargetGC() {
- ComponentAccessor.resetGC((Component)target);
- }
-
- /*
- * Clears the peer's winGraphicsConfig member.
- * Overridden by WWindowPeer, which shouldn't have a null winGraphicsConfig.
- */
- void clearLocalGC() {
- winGraphicsConfig = null;
- }
-
native void create(WComponentPeer parent);
void initialize() {
@@ -152,4 +120,10 @@ class WCanvasPeer extends WComponentPeer implements CanvasPeer {
*/
private native void setNativeBackgroundErase(boolean doErase,
boolean doEraseOnResize);
+
+ public GraphicsConfiguration getAppropriateGraphicsConfiguration(
+ GraphicsConfiguration gc)
+ {
+ return gc;
+ }
}
diff --git a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java
index 3a414d1c328..56eb45fa3f5 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java
@@ -59,7 +59,7 @@ import java.util.logging.*;
public abstract class WComponentPeer extends WObjectPeer
- implements ComponentPeer, DropTargetPeer, DisplayChangedListener
+ implements ComponentPeer, DropTargetPeer
{
/**
* Handle to native window
@@ -452,15 +452,8 @@ public abstract class WComponentPeer extends WObjectPeer
}
}
- /**
- * From the DisplayChangedListener interface.
- *
- * Called after a change in the display mode. This event
- * triggers replacing the surfaceData object (since that object
- * reflects the current display depth information, which has
- * just changed).
- */
- public void displayChanged() {
+ public void updateGraphicsData(GraphicsConfiguration gc) {
+ winGraphicsConfig = (Win32GraphicsConfig)gc;
try {
replaceSurfaceData();
} catch (InvalidPipeException e) {
@@ -468,13 +461,6 @@ public abstract class WComponentPeer extends WObjectPeer
}
}
- /**
- * Part of the DisplayChangedListener interface: components
- * do not need to react to this event
- */
- public void paletteChanged() {
- }
-
//This will return null for Components not yet added to a Container
public ColorModel getColorModel() {
GraphicsConfiguration gc = getGraphicsConfiguration();
diff --git a/jdk/src/windows/classes/sun/awt/windows/WPanelPeer.java b/jdk/src/windows/classes/sun/awt/windows/WPanelPeer.java
index 8a0d7ffbcc1..10ca423146c 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WPanelPeer.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WPanelPeer.java
@@ -100,34 +100,6 @@ class WPanelPeer extends WCanvasPeer implements PanelPeer {
return getInsets();
}
- /*
- * From the DisplayChangedListener interface. Often is
- * up-called from a WWindowPeer instance.
- */
- public void displayChanged() {
- super.displayChanged();
- displayChanged((Container)target);
- }
-
- /*
- * Recursively iterates through all the HW and LW children
- * of the container and calls displayChanged() for HW peers.
- * Iteration through children peers only is not enough as the
- * displayChanged notification may not be propagated to HW
- * components inside LW containers, see 4452373 for details.
- */
- private static void displayChanged(Container target) {
- Component children[] = ((Container)target).getComponents();
- for (Component child : children) {
- ComponentPeer cpeer = child.getPeer();
- if (cpeer instanceof WComponentPeer) {
- ((WComponentPeer)cpeer).displayChanged();
- } else if (child instanceof Container) {
- displayChanged((Container)child);
- }
- }
- }
-
private native void pRestack(Object[] peers);
private void restack(Container cont, Vector peers) {
for (int i = 0; i < cont.getComponentCount(); i++) {
diff --git a/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java b/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java
index 79818431063..73f9e3f811f 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java
@@ -41,7 +41,9 @@ import sun.awt.*;
import sun.java2d.pipe.Region;
-public class WWindowPeer extends WPanelPeer implements WindowPeer {
+public class WWindowPeer extends WPanelPeer implements WindowPeer,
+ DisplayChangedListener
+{
private static final Logger log = Logger.getLogger("sun.awt.windows.WWindowPeer");
private static final Logger screenLog = Logger.getLogger("sun.awt.windows.screen.WWindowPeer");
@@ -198,7 +200,6 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer {
// super.displayChanged() in WWindowPeer.displayChanged() regardless of whether
// GraphicsDevice was really changed, or not. So we need to track it here.
updateGC();
- resetTargetGC();
realShow();
updateMinimumSize();
@@ -400,14 +401,6 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer {
});
}
-
- /*
- * Called from WCanvasPeer.displayChanged().
- * Override to do nothing - Window and WWindowPeer GC must never be set to
- * null!
- */
- void clearLocalGC() {}
-
public void updateGC() {
int scrn = getScreenImOn();
if (screenLog.isLoggable(Level.FINER)) {
@@ -446,18 +439,36 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer {
oldDev.removeDisplayChangedListener(this);
newDev.addDisplayChangedListener(this);
}
+
+ SunToolkit.executeOnEventHandlerThread((Component)target,
+ new Runnable() {
+ public void run() {
+ AWTAccessor.getComponentAccessor().
+ setGraphicsConfiguration((Component)target, winGraphicsConfig);
+ }
+ });
}
- /*
- * From the DisplayChangedListener interface
+ /**
+ * From the DisplayChangedListener interface.
*
* This method handles a display change - either when the display settings
* are changed, or when the window has been dragged onto a different
* display.
+ * Called after a change in the display mode. This event
+ * triggers replacing the surfaceData object (since that object
+ * reflects the current display depth information, which has
+ * just changed).
*/
public void displayChanged() {
updateGC();
- super.displayChanged();
+ }
+
+ /**
+ * Part of the DisplayChangedListener interface: components
+ * do not need to react to this event
+ */
+ public void paletteChanged() {
}
private native int getScreenImOn();
From 07338e17b5b23fc0d5df60d6ef839a5facd1fae3 Mon Sep 17 00:00:00 2001
From: Peter Zhelezniakov
Date: Tue, 24 Feb 2009 19:17:51 +0300
Subject: [PATCH 15/80] 6804221: Three tests for JTabbedPane produce VM crash
on rhel3
Reviewed-by: stayer, campbell
---
jdk/src/solaris/native/sun/awt/gtk2_interface.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/jdk/src/solaris/native/sun/awt/gtk2_interface.c b/jdk/src/solaris/native/sun/awt/gtk2_interface.c
index cfbc5ef6f6e..1afeeef173b 100644
--- a/jdk/src/solaris/native/sun/awt/gtk2_interface.c
+++ b/jdk/src/solaris/native/sun/awt/gtk2_interface.c
@@ -93,6 +93,7 @@ static int gtk2_pixbuf_height = 0;
/* Static buffer for conversion from java.lang.String to UTF-8 */
static char convertionBuffer[CONV_BUFFER_SIZE];
+static gboolean new_combo = TRUE;
const char ENV_PREFIX[] = "GTK_MODULES=";
/*******************/
@@ -608,6 +609,7 @@ gboolean gtk2_load()
dlsym(gtk2_libhandle, "gtk_combo_box_entry_new");
if (fp_gtk_combo_box_entry_new == NULL) {
fp_gtk_combo_box_entry_new = dl_symbol("gtk_combo_new");
+ new_combo = FALSE;
}
fp_gtk_separator_tool_item_new =
@@ -1423,17 +1425,13 @@ static GtkWidget *gtk2_get_widget(WidgetType widget_type)
*/
GtkWidget *combo = (*fp_gtk_combo_box_entry_new)();
- if (widget_type == COMBO_BOX_TEXT_FIELD)
- (*fp_gtk_container_add)((GtkContainer *)combo, result);
- else
- {
+ if (new_combo && widget_type == COMBO_BOX_ARROW_BUTTON) {
(*fp_gtk_widget_set_parent)(result, combo);
((GtkBin*)combo)->child = result;
+ } else {
+ (*fp_gtk_container_add)((GtkContainer *)combo, result);
}
-
(*fp_gtk_container_add)((GtkContainer *)gtk2_fixed, combo);
- (*fp_gtk_widget_realize)(result);
- return result;
}
else if (widget_type != TOOL_TIP &&
widget_type != INTERNAL_FRAME &&
From 95a3c4a81f7e58041681cfc6da30f9a016bf6b92 Mon Sep 17 00:00:00 2001
From: Pavel Porvatov
Date: Thu, 26 Feb 2009 11:44:43 +0300
Subject: [PATCH 16/80] 6794831: Infinite loop while painting ticks on Slider
with maximum=MAX_INT
Reviewed-by: malenkov
---
.../javax/swing/plaf/basic/BasicSliderUI.java | 66 +++++++----
.../swing/JSlider/6794831/bug6794831.java | 105 ++++++++++++++++++
2 files changed, 148 insertions(+), 23 deletions(-)
create mode 100644 jdk/test/javax/swing/JSlider/6794831/bug6794831.java
diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java
index 864ad13264a..0a858d41c18 100644
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicSliderUI.java
@@ -1004,47 +1004,62 @@ public class BasicSliderUI extends SliderUI{
g.setColor(DefaultLookup.getColor(slider, this, "Slider.tickColor", Color.black));
if ( slider.getOrientation() == JSlider.HORIZONTAL ) {
- g.translate( 0, tickBounds.y);
+ g.translate(0, tickBounds.y);
- int value = slider.getMinimum();
- int xPos;
+ if (slider.getMinorTickSpacing() > 0) {
+ int value = slider.getMinimum();
- if ( slider.getMinorTickSpacing() > 0 ) {
while ( value <= slider.getMaximum() ) {
- xPos = xPositionForValue( value );
+ int xPos = xPositionForValue(value);
paintMinorTickForHorizSlider( g, tickBounds, xPos );
+
+ // Overflow checking
+ if (Integer.MAX_VALUE - slider.getMinorTickSpacing() < value) {
+ break;
+ }
+
value += slider.getMinorTickSpacing();
}
}
- if ( slider.getMajorTickSpacing() > 0 ) {
- value = slider.getMinimum();
+ if (slider.getMajorTickSpacing() > 0) {
+ int value = slider.getMinimum();
while ( value <= slider.getMaximum() ) {
- xPos = xPositionForValue( value );
+ int xPos = xPositionForValue(value);
paintMajorTickForHorizSlider( g, tickBounds, xPos );
+
+ // Overflow checking
+ if (Integer.MAX_VALUE - slider.getMajorTickSpacing() < value) {
+ break;
+ }
+
value += slider.getMajorTickSpacing();
}
}
g.translate( 0, -tickBounds.y);
- }
- else {
- g.translate(tickBounds.x, 0);
+ } else {
+ g.translate(tickBounds.x, 0);
- int value = slider.getMinimum();
- int yPos;
-
- if ( slider.getMinorTickSpacing() > 0 ) {
+ if (slider.getMinorTickSpacing() > 0) {
int offset = 0;
if(!BasicGraphicsUtils.isLeftToRight(slider)) {
offset = tickBounds.width - tickBounds.width / 2;
g.translate(offset, 0);
}
- while ( value <= slider.getMaximum() ) {
- yPos = yPositionForValue( value );
+ int value = slider.getMinimum();
+
+ while (value <= slider.getMaximum()) {
+ int yPos = yPositionForValue(value);
paintMinorTickForVertSlider( g, tickBounds, yPos );
+
+ // Overflow checking
+ if (Integer.MAX_VALUE - slider.getMinorTickSpacing() < value) {
+ break;
+ }
+
value += slider.getMinorTickSpacing();
}
@@ -1053,15 +1068,22 @@ public class BasicSliderUI extends SliderUI{
}
}
- if ( slider.getMajorTickSpacing() > 0 ) {
- value = slider.getMinimum();
+ if (slider.getMajorTickSpacing() > 0) {
if(!BasicGraphicsUtils.isLeftToRight(slider)) {
g.translate(2, 0);
}
- while ( value <= slider.getMaximum() ) {
- yPos = yPositionForValue( value );
+ int value = slider.getMinimum();
+
+ while (value <= slider.getMaximum()) {
+ int yPos = yPositionForValue(value);
paintMajorTickForVertSlider( g, tickBounds, yPos );
+
+ // Overflow checking
+ if (Integer.MAX_VALUE - slider.getMajorTickSpacing() < value) {
+ break;
+ }
+
value += slider.getMajorTickSpacing();
}
@@ -1775,8 +1797,6 @@ public class BasicSliderUI extends SliderUI{
thumbMiddle = thumbLeft + halfThumbWidth;
slider.setValue(valueForXPosition(thumbMiddle));
break;
- default:
- return;
}
}
diff --git a/jdk/test/javax/swing/JSlider/6794831/bug6794831.java b/jdk/test/javax/swing/JSlider/6794831/bug6794831.java
new file mode 100644
index 00000000000..a147987d417
--- /dev/null
+++ b/jdk/test/javax/swing/JSlider/6794831/bug6794831.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright 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
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ * @bug 6794831
+ * @summary Infinite loop while painting ticks on Slider with maximum=MAX_INT
+ * @author Pavel Porvatov
+ @run main bug6794831
+ */
+
+import javax.swing.*;
+import javax.swing.plaf.basic.BasicSliderUI;
+import java.awt.image.BufferedImage;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+public class bug6794831 {
+ private final CountDownLatch countDownLatch = new CountDownLatch(1);
+
+ public static void main(String args[]) throws InterruptedException {
+ new bug6794831().run();
+ }
+
+ private void run() throws InterruptedException {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ for (UIManager.LookAndFeelInfo lookAndFeelInfo : UIManager.getInstalledLookAndFeels()) {
+ try {
+ UIManager.setLookAndFeel(lookAndFeelInfo.getClassName());
+ } catch (Exception e) {
+ fail(e.getMessage());
+ }
+
+ BufferedImage image = new BufferedImage(300, 200, BufferedImage.TYPE_INT_ARGB);
+
+ // Test 1
+ JSlider slider = new JSlider(0, Integer.MAX_VALUE - 1, 0);
+
+ slider.setMajorTickSpacing((Integer.MAX_VALUE - 1) / 4);
+ slider.setPaintTicks(true);
+
+ ((BasicSliderUI) slider.getUI()).paintTicks(image.getGraphics());
+
+ // Test 2
+ slider = new JSlider(0, Integer.MAX_VALUE - 1, 0);
+
+ slider.setMinorTickSpacing((Integer.MAX_VALUE - 1) / 4);
+ slider.setPaintTicks(true);
+
+ ((BasicSliderUI) slider.getUI()).paintTicks(image.getGraphics());
+
+ // Test 3
+ slider = new JSlider(0, Integer.MAX_VALUE - 1, 0);
+
+ slider.setOrientation(JSlider.VERTICAL);
+ slider.setMajorTickSpacing((Integer.MAX_VALUE - 1) / 4);
+ slider.setPaintTicks(true);
+
+ ((BasicSliderUI) slider.getUI()).paintTicks(image.getGraphics());
+
+ // Test 4
+ slider = new JSlider(0, Integer.MAX_VALUE - 1, 0);
+
+ slider.setOrientation(JSlider.VERTICAL);
+ slider.setMinorTickSpacing((Integer.MAX_VALUE - 1) / 4);
+ slider.setPaintTicks(true);
+
+ ((BasicSliderUI) slider.getUI()).paintTicks(image.getGraphics());
+
+ countDownLatch.countDown();
+ }
+ }
+ });
+
+ if (countDownLatch.await(3000, TimeUnit.MILLISECONDS)) {
+ System.out.println("bug6794831 passed");
+ } else {
+ fail("bug6794831 failed");
+ }
+ }
+
+ private static void fail(String msg) {
+ throw new RuntimeException(msg);
+ }
+}
From 7a593ea8955194943cab02b9d4ea9d859e0bdb6d Mon Sep 17 00:00:00 2001
From: Anthony Petrov
Date: Tue, 3 Mar 2009 13:54:47 +0300
Subject: [PATCH 17/80] 6811674: Container.setComponentZOrder throws NPE
Reviewed-by: art, dcherepanov
---
jdk/src/share/classes/java/awt/Container.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/jdk/src/share/classes/java/awt/Container.java b/jdk/src/share/classes/java/awt/Container.java
index fb520547e1e..2a4050880de 100644
--- a/jdk/src/share/classes/java/awt/Container.java
+++ b/jdk/src/share/classes/java/awt/Container.java
@@ -506,7 +506,9 @@ public class Container extends Component {
adjustDescendants(-(comp.countHierarchyMembers()));
comp.parent = null;
- comp.setGraphicsConfiguration(null);
+ if (needRemoveNotify) {
+ comp.setGraphicsConfiguration(null);
+ }
component.remove(index);
invalidateIfValid();
From 8a7cd86a288a89723188e53a5468f28623ec5d69 Mon Sep 17 00:00:00 2001
From: Dmitry Cherepanov
Date: Wed, 4 Mar 2009 13:05:56 +0300
Subject: [PATCH 18/80] 6809227: poor performance on Panel.Add() method in jdk6
Reviewed-by: art, anthony
---
jdk/make/sun/xawt/mapfile-vers | 1 +
jdk/src/share/classes/java/awt/Component.java | 39 ++++++----
jdk/src/share/classes/java/awt/Container.java | 26 +------
.../classes/java/awt/peer/ComponentPeer.java | 6 ++
.../classes/java/awt/peer/ContainerPeer.java | 17 ----
.../classes/sun/awt/NullComponentPeer.java | 20 ++---
.../classes/sun/awt/X11/XComponentPeer.java | 60 +++-----------
.../sun/awt/X11/XEmbedChildProxyPeer.java | 3 +
.../classes/sun/awt/X11/XlibWrapper.java | 1 +
jdk/src/solaris/native/sun/xawt/XlibWrapper.c | 28 +++++++
.../sun/awt/windows/WComponentPeer.java | 11 +++
.../sun/awt/windows/WFileDialogPeer.java | 14 ----
.../sun/awt/windows/WPrintDialogPeer.java | 14 ----
.../sun/awt/windows/WScrollPanePeer.java | 6 --
.../native/sun/windows/awt_Component.cpp | 47 +++++++++++
.../native/sun/windows/awt_Component.h | 1 +
.../windows/native/sun/windows/awt_Panel.cpp | 78 -------------------
.../windows/native/sun/windows/awt_Panel.h | 3 -
18 files changed, 141 insertions(+), 234 deletions(-)
diff --git a/jdk/make/sun/xawt/mapfile-vers b/jdk/make/sun/xawt/mapfile-vers
index 15342fbb404..dcea098e5e7 100644
--- a/jdk/make/sun/xawt/mapfile-vers
+++ b/jdk/make/sun/xawt/mapfile-vers
@@ -93,6 +93,7 @@ SUNWprivate_1.1 {
Java_sun_awt_X11_XlibWrapper_XGetWMHints;
Java_sun_awt_X11_XlibWrapper_XShapeQueryExtension;
Java_sun_awt_X11_XlibWrapper_SetRectangularShape;
+ Java_sun_awt_X11_XlibWrapper_SetZOrder;
Java_sun_awt_X11_XToolkit_initIDs;
Java_sun_awt_X11_XWindow_getNativeColor;
Java_sun_awt_X11_XWindow_getWMInsets;
diff --git a/jdk/src/share/classes/java/awt/Component.java b/jdk/src/share/classes/java/awt/Component.java
index e59d37a5826..26cfc9ef6f2 100644
--- a/jdk/src/share/classes/java/awt/Component.java
+++ b/jdk/src/share/classes/java/awt/Component.java
@@ -6656,23 +6656,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
// Update stacking order
- if (parent != null && parent.peer != null) {
- ContainerPeer parentContPeer = (ContainerPeer) parent.peer;
- // if our parent is lightweight and we are not
- // we should call restack on nearest heavyweight
- // container.
- if (parentContPeer instanceof LightweightPeer
- && ! (peer instanceof LightweightPeer))
- {
- Container hwParent = getNativeContainer();
- if (hwParent != null && hwParent.peer != null) {
- parentContPeer = (ContainerPeer) hwParent.peer;
- }
- }
- if (parentContPeer.isRestackSupported()) {
- parentContPeer.restack();
- }
- }
+ peer.setZOrder(getHWPeerAboveMe());
if (!isAddNotifyComplete) {
mixOnShowing();
@@ -9546,6 +9530,27 @@ public abstract class Component implements ImageObserver, MenuContainer,
return nextAbove < 0 ? -1 : nextAbove;
}
+ final ComponentPeer getHWPeerAboveMe() {
+ checkTreeLock();
+
+ Container cont = getContainer();
+ int indexAbove = getSiblingIndexAbove();
+
+ while (cont != null) {
+ for (int i = indexAbove; i > -1; i--) {
+ Component comp = cont.getComponent(i);
+ if (comp != null && comp.isDisplayable() && !comp.isLightweight()) {
+ return comp.getPeer();
+ }
+ }
+
+ indexAbove = cont.getSiblingIndexAbove();
+ cont = cont.getContainer();
+ }
+
+ return null;
+ }
+
final int getSiblingIndexBelow() {
checkTreeLock();
Container parent = getContainer();
diff --git a/jdk/src/share/classes/java/awt/Container.java b/jdk/src/share/classes/java/awt/Container.java
index 2a4050880de..dcaa4fdfb16 100644
--- a/jdk/src/share/classes/java/awt/Container.java
+++ b/jdk/src/share/classes/java/awt/Container.java
@@ -649,10 +649,7 @@ public class Container extends Component {
// each HW descendant independently.
return !comp.peer.isReparentSupported();
} else {
- // if container didn't change we still might need to recreate component's window as
- // changes to zorder should be reflected in native window stacking order and it might
- // not be supported by the platform. This is important only for heavyweight child
- return !((ContainerPeer)(newNativeContainer.peer)).isRestackSupported();
+ return false;
}
}
@@ -809,11 +806,6 @@ public class Container extends Component {
if (peer != null) {
if (comp.peer == null) { // Remove notify was called or it didn't have peer - create new one
comp.addNotify();
- // New created peer creates component on top of the stacking order
- Container newNativeContainer = getHeavyweightContainer();
- if (((ContainerPeer)newNativeContainer.getPeer()).isRestackSupported()) {
- ((ContainerPeer)newNativeContainer.getPeer()).restack();
- }
} else { // Both container and child have peers, it means child peer should be reparented.
// In both cases we need to reparent native widgets.
Container newNativeContainer = getHeavyweightContainer();
@@ -822,13 +814,8 @@ public class Container extends Component {
// Native container changed - need to reparent native widgets
newNativeContainer.reparentChild(comp);
}
- // If component still has a peer and it is either container or heavyweight
- // and restack is supported we have to restack native windows since order might have changed
- if ((!comp.isLightweight() || (comp instanceof Container))
- && ((ContainerPeer)newNativeContainer.getPeer()).isRestackSupported())
- {
- ((ContainerPeer)newNativeContainer.getPeer()).restack();
- }
+ comp.peer.setZOrder(comp.getHWPeerAboveMe());
+
if (!comp.isLightweight() && isLightweight()) {
// If component is heavyweight and one of the containers is lightweight
// the location of the component should be fixed.
@@ -2607,13 +2594,6 @@ public class Container extends Component {
for (int i = 0; i < component.size(); i++) {
component.get(i).addNotify();
}
- // Update stacking order if native platform allows
- ContainerPeer cpeer = (ContainerPeer)peer;
- if (cpeer.isRestackSupported()) {
- cpeer.restack();
- }
-
-
}
}
diff --git a/jdk/src/share/classes/java/awt/peer/ComponentPeer.java b/jdk/src/share/classes/java/awt/peer/ComponentPeer.java
index 3a2845f37fa..3c26d5c4fae 100644
--- a/jdk/src/share/classes/java/awt/peer/ComponentPeer.java
+++ b/jdk/src/share/classes/java/awt/peer/ComponentPeer.java
@@ -539,6 +539,12 @@ public interface ComponentPeer {
*/
void applyShape(Region shape);
+ /**
+ * Lowers this component at the bottom of the above HW peer. If the above parameter
+ * is null then the method places this component at the top of the Z-order.
+ */
+ void setZOrder(ComponentPeer above);
+
/**
* Updates internal data structures related to the component's GC.
*
diff --git a/jdk/src/share/classes/java/awt/peer/ContainerPeer.java b/jdk/src/share/classes/java/awt/peer/ContainerPeer.java
index 092a54f2a24..8bb3f10c1f1 100644
--- a/jdk/src/share/classes/java/awt/peer/ContainerPeer.java
+++ b/jdk/src/share/classes/java/awt/peer/ContainerPeer.java
@@ -76,21 +76,4 @@ public interface ContainerPeer extends ComponentPeer {
* @see Container#validateTree()
*/
void endLayout();
-
- /**
- * Restacks native windows - children of this native window - according to
- * Java container order.
- *
- * @since 1.5
- */
- void restack();
-
- /**
- * Indicates availability of restacking operation in this container.
- *
- * @return Returns true if restack is supported, false otherwise
- *
- * @since 1.5
- */
- boolean isRestackSupported();
}
diff --git a/jdk/src/share/classes/sun/awt/NullComponentPeer.java b/jdk/src/share/classes/sun/awt/NullComponentPeer.java
index 2feea7b518c..471aa75b51c 100644
--- a/jdk/src/share/classes/sun/awt/NullComponentPeer.java
+++ b/jdk/src/share/classes/sun/awt/NullComponentPeer.java
@@ -278,19 +278,6 @@ public class NullComponentPeer implements LightweightPeer,
throw new UnsupportedOperationException();
}
- /**
- * @see java.awt.peer.ContainerPeer#restack
- */
- public void restack() {
- throw new UnsupportedOperationException();
- }
-
- /**
- * @see java.awt.peer.ContainerPeer#isRestackSupported
- */
- public boolean isRestackSupported() {
- return false;
- }
public void layout() {
}
@@ -306,6 +293,13 @@ public class NullComponentPeer implements LightweightPeer,
public void applyShape(Region shape) {
}
+ /**
+ * Lowers this component at the bottom of the above HW peer. If the above parameter
+ * is null then the method places this component at the top of the Z-order.
+ */
+ public void setZOrder(ComponentPeer above) {
+ }
+
public void updateGraphicsData(GraphicsConfiguration gc) {}
public GraphicsConfiguration getAppropriateGraphicsConfiguration(
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
index 4c83ac750c8..75b0b6ca308 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
@@ -1415,59 +1415,21 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
}
}
- public void restack() {
- synchronized(target.getTreeLock()) {
- // Build the list of X windows in the window corresponding to this container
- // This list is already in correct Java stacking order
- Container cont = (Container)target;
- Vector order = new Vector(cont.getComponentCount());
- HashSet set = new HashSet();
+ /**
+ * Lowers this component at the bottom of the above HW peer. If the above parameter
+ * is null then the method places this component at the top of the Z-order.
+ */
+ public void setZOrder(ComponentPeer above) {
+ long aboveWindow = (above != null) ? ((XComponentPeer)above).getWindow() : 0;
- addTree(order, set, cont);
-
- XToolkit.awtLock();
- try {
- // Get the current list of X window in X window. Some of the windows
- // might be only native
- XQueryTree qt = new XQueryTree(getContentWindow());
- try {
- if (qt.execute() != 0) {
- if (qt.get_nchildren() != 0) {
- long pchildren = qt.get_children();
- int j = 0; // index to insert
- for (int i = 0; i < qt.get_nchildren(); i++) {
- Long w = Long.valueOf(Native.getLong(pchildren, i));
- if (!set.contains(w)) {
- set.add(w);
- order.add(j++, w);
- }
- }
- }
- }
-
- if (order.size() != 0) {
- // Create native array of the windows
- long windows = Native.allocateLongArray(order.size());
- Native.putLong(windows, order);
-
- // Restack native window according to the new order
- XlibWrapper.XRestackWindows(XToolkit.getDisplay(), windows, order.size());
-
- XlibWrapper.unsafe.freeMemory(windows);
- }
- } finally {
- qt.dispose();
- }
- } finally {
- XToolkit.awtUnlock();
- }
+ XToolkit.awtLock();
+ try{
+ XlibWrapper.SetZOrder(XToolkit.getDisplay(), getWindow(), aboveWindow);
+ }finally{
+ XToolkit.awtUnlock();
}
}
- public boolean isRestackSupported() {
- return true;
- }
-
private void addTree(Collection order, Set set, Container cont) {
for (int i = 0; i < cont.getComponentCount(); i++) {
Component comp = cont.getComponent(i);
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java
index eae300aee08..8b44a7293ac 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java
@@ -380,5 +380,8 @@ public class XEmbedChildProxyPeer implements ComponentPeer, XEventDispatcher{
public void applyShape(Region shape) {
}
+ public void setZOrder(ComponentPeer above) {
+ }
+
public void updateGraphicsData(GraphicsConfiguration gc) {}
}
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XlibWrapper.java b/jdk/src/solaris/classes/sun/awt/X11/XlibWrapper.java
index eb6d5e77510..e20dfe731dc 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XlibWrapper.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XlibWrapper.java
@@ -533,6 +533,7 @@ static native String XSetLocaleModifiers(String modifier_list);
static native void SetRectangularShape(long display, long window,
int lox, int loy, int hix, int hiy,
sun.java2d.pipe.Region region);
+ static native void SetZOrder(long display, long window, long above);
/* Global memory area used for X lib parameter passing */
diff --git a/jdk/src/solaris/native/sun/xawt/XlibWrapper.c b/jdk/src/solaris/native/sun/xawt/XlibWrapper.c
index aee5cf9b080..bcb8a5fbf89 100644
--- a/jdk/src/solaris/native/sun/xawt/XlibWrapper.c
+++ b/jdk/src/solaris/native/sun/xawt/XlibWrapper.c
@@ -1945,3 +1945,31 @@ Java_sun_awt_X11_XlibWrapper_SetRectangularShape
ShapeBounding, 0, 0, None, ShapeSet);
}
}
+
+/*
+ * Class: XlibWrapper
+ * Method: SetZOrder
+ */
+
+JNIEXPORT void JNICALL
+Java_sun_awt_X11_XlibWrapper_SetZOrder
+(JNIEnv *env, jclass clazz, jlong display, jlong window, jlong above)
+{
+ AWT_CHECK_HAVE_LOCK();
+
+ XWindowChanges wc;
+ wc.sibling = (Window)jlong_to_ptr(above);
+
+ unsigned int value_mask = CWStackMode;
+
+ if (above == 0) {
+ wc.stack_mode = Above;
+ } else {
+ wc.stack_mode = Below;
+ value_mask |= CWSibling;
+ }
+
+ XConfigureWindow((Display *)jlong_to_ptr(display),
+ (Window)jlong_to_ptr(window),
+ value_mask, &wc );
+}
diff --git a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java
index 56eb45fa3f5..6f2837739f8 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java
@@ -941,4 +941,15 @@ public abstract class WComponentPeer extends WObjectPeer
}
}
+ /**
+ * Lowers this component at the bottom of the above component. If the above parameter
+ * is null then the method places this component at the top of the Z-order.
+ */
+ public void setZOrder(ComponentPeer above) {
+ long aboveHWND = (above != null) ? ((WComponentPeer)above).getHWnd() : 0;
+
+ setZOrder(aboveHWND);
+ }
+
+ private native void setZOrder(long above);
}
diff --git a/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java b/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java
index 2d4dfccf7a1..1c90ae2e566 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WFileDialogPeer.java
@@ -231,20 +231,6 @@ public class WFileDialogPeer extends WWindowPeer implements FileDialogPeer {
*/
private static native void initIDs();
- /**
- * WFileDialogPeer doesn't have native pData so we don't do restack on it
- * @see java.awt.peer.ContainerPeer#restack
- */
- public void restack() {
- }
-
- /**
- * @see java.awt.peer.ContainerPeer#isRestackSupported
- */
- public boolean isRestackSupported() {
- return false;
- }
-
// The effects are not supported for system dialogs.
public void applyShape(sun.java2d.pipe.Region shape) {}
public void setOpacity(float opacity) {}
diff --git a/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java b/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java
index 939d54520b6..90ca88279fc 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WPrintDialogPeer.java
@@ -143,20 +143,6 @@ public class WPrintDialogPeer extends WWindowPeer implements DialogPeer {
*/
private static native void initIDs();
- /**
- * WPrintDialogPeer doesn't have native pData so we don't do restack on it
- * @see java.awt.peer.ContainerPeer#restack
- */
- public void restack() {
- }
-
- /**
- * @see java.awt.peer.ContainerPeer#isRestackSupported
- */
- public boolean isRestackSupported() {
- return false;
- }
-
// The effects are not supported for system dialogs.
public void applyShape(sun.java2d.pipe.Region shape) {}
public void setOpacity(float opacity) {}
diff --git a/jdk/src/windows/classes/sun/awt/windows/WScrollPanePeer.java b/jdk/src/windows/classes/sun/awt/windows/WScrollPanePeer.java
index 70b3725cf80..2e8c5e60bd5 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WScrollPanePeer.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WScrollPanePeer.java
@@ -269,10 +269,4 @@ class WScrollPanePeer extends WPanelPeer implements ScrollPanePeer {
}
}
- /**
- * @see java.awt.peer.ContainerPeer#restack
- */
- public void restack() {
- // Since ScrollPane can only have one child its restacking does nothing.
- }
}
diff --git a/jdk/src/windows/native/sun/windows/awt_Component.cpp b/jdk/src/windows/native/sun/windows/awt_Component.cpp
index a49ae839459..e2eaf995123 100644
--- a/jdk/src/windows/native/sun/windows/awt_Component.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Component.cpp
@@ -149,6 +149,11 @@ struct GetInsetsStruct {
jobject window;
RECT *insets;
};
+// Struct for _SetZOrder function
+struct SetZOrderStruct {
+ jobject component;
+ jlong above;
+};
/************************************************************************/
//////////////////////////////////////////////////////////////////////////
@@ -6170,6 +6175,33 @@ ret:
delete data;
}
+void AwtComponent::_SetZOrder(void *param) {
+ JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
+
+ SetZOrderStruct *data = (SetZOrderStruct *)param;
+ jobject self = data->component;
+ HWND above = HWND_TOP;
+ if (data->above != 0) {
+ above = reinterpret_cast(data->above);
+ }
+
+ AwtComponent *c = NULL;
+
+ PDATA pData;
+ JNI_CHECK_PEER_GOTO(self, ret);
+
+ c = (AwtComponent *)pData;
+ if (::IsWindow(c->GetHWnd())) {
+ ::SetWindowPos(c->GetHWnd(), above, 0, 0, 0, 0,
+ SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_DEFERERASE | SWP_ASYNCWINDOWPOS);
+ }
+
+ret:
+ env->DeleteGlobalRef(self);
+
+ delete data;
+}
+
void AwtComponent::PostUngrabEvent() {
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
jobject target = GetTarget(env);
@@ -6896,6 +6928,21 @@ Java_sun_awt_windows_WComponentPeer_setRectangularShape(JNIEnv* env, jobject sel
CATCH_BAD_ALLOC;
}
+JNIEXPORT void JNICALL
+Java_sun_awt_windows_WComponentPeer_setZOrder(JNIEnv* env, jobject self, jlong above)
+{
+ TRY;
+
+ SetZOrderStruct * data = new SetZOrderStruct;
+ data->component = env->NewGlobalRef(self);
+ data->above = above;
+
+ AwtToolkit::GetInstance().SyncCall(AwtComponent::_SetZOrder, data);
+ // global refs and data are deleted in _SetLower
+
+ CATCH_BAD_ALLOC;
+}
+
} /* extern "C" */
diff --git a/jdk/src/windows/native/sun/windows/awt_Component.h b/jdk/src/windows/native/sun/windows/awt_Component.h
index 2c9c0318cad..31e8be2c879 100644
--- a/jdk/src/windows/native/sun/windows/awt_Component.h
+++ b/jdk/src/windows/native/sun/windows/awt_Component.h
@@ -680,6 +680,7 @@ public:
static jintArray _CreatePrintedPixels(void *param);
static jboolean _NativeHandlesWheelScrolling(void *param);
static void _SetRectangularShape(void *param);
+ static void _SetZOrder(void *param);
static HWND sm_focusOwner;
static HWND sm_focusedWindow;
diff --git a/jdk/src/windows/native/sun/windows/awt_Panel.cpp b/jdk/src/windows/native/sun/windows/awt_Panel.cpp
index 62c90bf5469..5f0e42673b0 100644
--- a/jdk/src/windows/native/sun/windows/awt_Panel.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Panel.cpp
@@ -34,70 +34,6 @@
jfieldID AwtPanel::insets_ID;
-static char* AWTPANEL_RESTACK_MSG_1 = "Peers array is null";
-static char* AWTPANEL_RESTACK_MSG_2 = "Peer null in JNI";
-static char* AWTPANEL_RESTACK_MSG_3 = "Native resources unavailable";
-static char* AWTPANEL_RESTACK_MSG_4 = "Child peer is null";
-
-void* AwtPanel::Restack(void * param) {
- TRY;
-
- JNIEnv* env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- jobjectArray peers = (jobjectArray)param;
-
- int peerCount = env->GetArrayLength(peers);
- if (peerCount < 1) {
- env->DeleteGlobalRef(peers);
- return AWTPANEL_RESTACK_MSG_1;
- }
-
- jobject self = env->GetObjectArrayElement(peers, 0);
- // It's entirely possible that our native resources have been destroyed
- // before our java peer - if we're dispose()d, for instance.
- // Alert caller w/ IllegalComponentStateException.
- if (self == NULL) {
- env->DeleteGlobalRef(peers);
- return AWTPANEL_RESTACK_MSG_2;
- }
- PDATA pData = JNI_GET_PDATA(self);
- if (pData == NULL) {
- env->DeleteGlobalRef(peers);
- env->DeleteLocalRef(self);
- return AWTPANEL_RESTACK_MSG_3;
- }
-
- AwtPanel* panel = (AwtPanel*)pData;
-
- HWND prevWindow = 0;
-
- for (int i = 1; i < peerCount; i++) {
- jobject peer = env->GetObjectArrayElement(peers, i);
- if (peer == NULL) {
- // Nonsense
- env->DeleteGlobalRef(peers);
- env->DeleteLocalRef(self);
- return AWTPANEL_RESTACK_MSG_4;
- }
- PDATA child_pData = JNI_GET_PDATA(peer);
- if (child_pData == NULL) {
- env->DeleteLocalRef(peer);
- env->DeleteGlobalRef(peers);
- env->DeleteLocalRef(self);
- return AWTPANEL_RESTACK_MSG_3;
- }
- AwtComponent* child_comp = (AwtComponent*)child_pData;
- ::SetWindowPos(child_comp->GetHWnd(), prevWindow, 0, 0, 0, 0,
- SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_DEFERERASE | SWP_ASYNCWINDOWPOS);
- prevWindow = child_comp->GetHWnd();
- env->DeleteLocalRef(peer);
- }
- env->DeleteGlobalRef(peers);
- env->DeleteLocalRef(self);
-
- CATCH_BAD_ALLOC_RET("Allocation error");
- return NULL;
-}
-
/************************************************************************
* AwtPanel native methods
*/
@@ -116,18 +52,4 @@ Java_sun_awt_windows_WPanelPeer_initIDs(JNIEnv *env, jclass cls) {
CATCH_BAD_ALLOC;
}
-JNIEXPORT void JNICALL
-Java_sun_awt_windows_WPanelPeer_pRestack(JNIEnv *env, jobject self, jobjectArray peers) {
-
- TRY;
-
- const char * error = (const char*)AwtToolkit::GetInstance().InvokeFunction(AwtPanel::Restack, env->NewGlobalRef(peers));
- if (error != NULL) {
- JNU_ThrowByName(env, "java/awt/IllegalComponentStateException", error);
- }
-
- CATCH_BAD_ALLOC;
-}
-
-
} /* extern "C" */
diff --git a/jdk/src/windows/native/sun/windows/awt_Panel.h b/jdk/src/windows/native/sun/windows/awt_Panel.h
index 2e9ed6649c8..93084c71685 100644
--- a/jdk/src/windows/native/sun/windows/awt_Panel.h
+++ b/jdk/src/windows/native/sun/windows/awt_Panel.h
@@ -35,11 +35,8 @@
class AwtPanel {
public:
- static void* Restack(void * param);
-
/* java.awt.Panel field ids */
static jfieldID insets_ID;
-
};
#endif // AWT_PANEL_H
From e63a1bf46057e7879660c2af8bf0d1e81ceebb0a Mon Sep 17 00:00:00 2001
From: Artem Ananiev
Date: Wed, 4 Mar 2009 18:10:48 +0300
Subject: [PATCH 19/80] 6784816: Remove AWT tree lock from Container methods:
getComponent, getComponents, getComponentCount
Reviewed-by: anthony, dav
---
jdk/src/share/classes/java/awt/Container.java | 157 ++++++++++--------
1 file changed, 92 insertions(+), 65 deletions(-)
diff --git a/jdk/src/share/classes/java/awt/Container.java b/jdk/src/share/classes/java/awt/Container.java
index dcaa4fdfb16..9a184a7a2ea 100644
--- a/jdk/src/share/classes/java/awt/Container.java
+++ b/jdk/src/share/classes/java/awt/Container.java
@@ -270,9 +270,13 @@ public class Container extends Component {
/**
* Gets the number of components in this panel.
+ *
+ * Note: This method should be called under AWT tree lock.
+ *
* @return the number of components in this panel.
* @see #getComponent
* @since JDK1.1
+ * @see Component#getTreeLock()
*/
public int getComponentCount() {
return countComponents();
@@ -284,43 +288,65 @@ public class Container extends Component {
*/
@Deprecated
public int countComponents() {
- synchronized (getTreeLock()) {
- return component.size();
- }
+ // This method is not synchronized under AWT tree lock.
+ // Instead, the calling code is responsible for the
+ // synchronization. See 6784816 for details.
+ return component.size();
}
/**
* Gets the nth component in this container.
+ *
+ * Note: This method should be called under AWT tree lock.
+ *
* @param n the index of the component to get.
* @return the nth component in this container.
* @exception ArrayIndexOutOfBoundsException
* if the nth value does not exist.
+ * @see Component#getTreeLock()
*/
public Component getComponent(int n) {
- synchronized (getTreeLock()) {
- if ((n < 0) || (n >= component.size())) {
- throw new ArrayIndexOutOfBoundsException("No such child: " + n);
- }
+ // This method is not synchronized under AWT tree lock.
+ // Instead, the calling code is responsible for the
+ // synchronization. See 6784816 for details.
+ try {
return component.get(n);
+ } catch (IndexOutOfBoundsException z) {
+ throw new ArrayIndexOutOfBoundsException("No such child: " + n);
}
}
/**
* Gets all the components in this container.
+ *
+ * Note: This method should be called under AWT tree lock.
+ *
* @return an array of all the components in this container.
+ * @see Component#getTreeLock()
*/
public Component[] getComponents() {
+ // This method is not synchronized under AWT tree lock.
+ // Instead, the calling code is responsible for the
+ // synchronization. See 6784816 for details.
return getComponents_NoClientCode();
}
+
// NOTE: This method may be called by privileged threads.
// This functionality is implemented in a package-private method
// to insure that it cannot be overridden by client subclasses.
// DO NOT INVOKE CLIENT CODE ON THIS THREAD!
final Component[] getComponents_NoClientCode() {
+ return component.toArray(EMPTY_ARRAY);
+ }
+
+ /*
+ * Wrapper for getComponents() method with a proper synchronization.
+ */
+ Component[] getComponentsSync() {
synchronized (getTreeLock()) {
- return component.toArray(EMPTY_ARRAY);
+ return getComponents();
}
- } // getComponents_NoClientCode()
+ }
/**
* Determines the insets of this container, which indicate the size
@@ -1028,9 +1054,9 @@ public class Container extends Component {
}
checkAddToSelf(comp);
checkNotAWindow(comp);
- if (thisGC != null) {
- comp.checkGD(thisGC.getDevice().getIDstring());
- }
+ if (thisGC != null) {
+ comp.checkGD(thisGC.getDevice().getIDstring());
+ }
/* Reparent the component and tidy up the tree's state. */
if (comp.parent != null) {
@@ -1349,7 +1375,7 @@ public class Container extends Component {
}
private int getListenersCount(int id, boolean enabledOnToolkit) {
- assert Thread.holdsLock(getTreeLock());
+ checkTreeLock();
if (enabledOnToolkit) {
return descendantsCount;
}
@@ -1367,7 +1393,7 @@ public class Container extends Component {
final int createHierarchyEvents(int id, Component changed,
Container changedParent, long changeFlags, boolean enabledOnToolkit)
{
- assert Thread.holdsLock(getTreeLock());
+ checkTreeLock();
int listeners = getListenersCount(id, enabledOnToolkit);
for (int count = listeners, i = 0; count > 0; i++) {
@@ -1382,7 +1408,7 @@ public class Container extends Component {
final void createChildHierarchyEvents(int id, long changeFlags,
boolean enabledOnToolkit)
{
- assert Thread.holdsLock(getTreeLock());
+ checkTreeLock();
if (component.isEmpty()) {
return;
}
@@ -1517,6 +1543,7 @@ public class Container extends Component {
* @see #validate
*/
protected void validateTree() {
+ checkTreeLock();
if (!isValid()) {
if (peer instanceof ContainerPeer) {
((ContainerPeer)peer).beginLayout();
@@ -1793,7 +1820,7 @@ public class Container extends Component {
// super.paint(); -- Don't bother, since it's a NOP.
GraphicsCallback.PaintCallback.getInstance().
- runComponents(component.toArray(EMPTY_ARRAY), g, GraphicsCallback.LIGHTWEIGHTS);
+ runComponents(getComponentsSync(), g, GraphicsCallback.LIGHTWEIGHTS);
}
}
@@ -1848,7 +1875,7 @@ public class Container extends Component {
}
GraphicsCallback.PrintCallback.getInstance().
- runComponents(component.toArray(EMPTY_ARRAY), g, GraphicsCallback.LIGHTWEIGHTS);
+ runComponents(getComponentsSync(), g, GraphicsCallback.LIGHTWEIGHTS);
}
}
@@ -1861,7 +1888,7 @@ public class Container extends Component {
public void paintComponents(Graphics g) {
if (isShowing()) {
GraphicsCallback.PaintAllCallback.getInstance().
- runComponents(component.toArray(EMPTY_ARRAY), g, GraphicsCallback.TWO_PASSES);
+ runComponents(getComponentsSync(), g, GraphicsCallback.TWO_PASSES);
}
}
@@ -1883,8 +1910,8 @@ public class Container extends Component {
void paintHeavyweightComponents(Graphics g) {
if (isShowing()) {
GraphicsCallback.PaintHeavyweightComponentsCallback.getInstance().
- runComponents(component.toArray(EMPTY_ARRAY), g, GraphicsCallback.LIGHTWEIGHTS |
- GraphicsCallback.HEAVYWEIGHTS);
+ runComponents(getComponentsSync(), g,
+ GraphicsCallback.LIGHTWEIGHTS | GraphicsCallback.HEAVYWEIGHTS);
}
}
@@ -1897,7 +1924,7 @@ public class Container extends Component {
public void printComponents(Graphics g) {
if (isShowing()) {
GraphicsCallback.PrintAllCallback.getInstance().
- runComponents(component.toArray(EMPTY_ARRAY), g, GraphicsCallback.TWO_PASSES);
+ runComponents(getComponentsSync(), g, GraphicsCallback.TWO_PASSES);
}
}
@@ -1919,8 +1946,8 @@ public class Container extends Component {
void printHeavyweightComponents(Graphics g) {
if (isShowing()) {
GraphicsCallback.PrintHeavyweightComponentsCallback.getInstance().
- runComponents(component.toArray(EMPTY_ARRAY), g, GraphicsCallback.LIGHTWEIGHTS |
- GraphicsCallback.HEAVYWEIGHTS);
+ runComponents(getComponentsSync(), g,
+ GraphicsCallback.LIGHTWEIGHTS | GraphicsCallback.HEAVYWEIGHTS);
}
}
@@ -2470,9 +2497,7 @@ public class Container extends Component {
* @since 1.2
*/
public Component findComponentAt(int x, int y) {
- synchronized (getTreeLock()) {
- return findComponentAt(x, y, true);
- }
+ return findComponentAt(x, y, true);
}
/**
@@ -2485,58 +2510,60 @@ public class Container extends Component {
* The addition of this feature is temporary, pending the
* adoption of new, public API which exports this feature.
*/
- final Component findComponentAt(int x, int y, boolean ignoreEnabled)
- {
- if (isRecursivelyVisible()){
- return findComponentAtImpl(x, y, ignoreEnabled);
+ final Component findComponentAt(int x, int y, boolean ignoreEnabled) {
+ synchronized (getTreeLock()) {
+ if (isRecursivelyVisible()){
+ return findComponentAtImpl(x, y, ignoreEnabled);
+ }
}
return null;
}
final Component findComponentAtImpl(int x, int y, boolean ignoreEnabled){
+ checkTreeLock();
+
if (!(contains(x, y) && visible && (ignoreEnabled || enabled))) {
return null;
}
// Two passes: see comment in sun.awt.SunGraphicsCallback
- synchronized (getTreeLock()) {
- for (int i = 0; i < component.size(); i++) {
- Component comp = component.get(i);
- if (comp != null &&
- !(comp.peer instanceof LightweightPeer)) {
- if (comp instanceof Container) {
- comp = ((Container)comp).findComponentAtImpl(x - comp.x,
- y - comp.y,
- ignoreEnabled);
- } else {
- comp = comp.locate(x - comp.x, y - comp.y);
- }
- if (comp != null && comp.visible &&
- (ignoreEnabled || comp.enabled))
- {
- return comp;
- }
+ for (int i = 0; i < component.size(); i++) {
+ Component comp = component.get(i);
+ if (comp != null &&
+ !(comp.peer instanceof LightweightPeer)) {
+ if (comp instanceof Container) {
+ comp = ((Container)comp).findComponentAtImpl(x - comp.x,
+ y - comp.y,
+ ignoreEnabled);
+ } else {
+ comp = comp.locate(x - comp.x, y - comp.y);
}
- }
- for (int i = 0; i < component.size(); i++) {
- Component comp = component.get(i);
- if (comp != null &&
- comp.peer instanceof LightweightPeer) {
- if (comp instanceof Container) {
- comp = ((Container)comp).findComponentAtImpl(x - comp.x,
- y - comp.y,
- ignoreEnabled);
- } else {
- comp = comp.locate(x - comp.x, y - comp.y);
- }
- if (comp != null && comp.visible &&
- (ignoreEnabled || comp.enabled))
- {
- return comp;
- }
+ if (comp != null && comp.visible &&
+ (ignoreEnabled || comp.enabled))
+ {
+ return comp;
}
}
}
+ for (int i = 0; i < component.size(); i++) {
+ Component comp = component.get(i);
+ if (comp != null &&
+ comp.peer instanceof LightweightPeer) {
+ if (comp instanceof Container) {
+ comp = ((Container)comp).findComponentAtImpl(x - comp.x,
+ y - comp.y,
+ ignoreEnabled);
+ } else {
+ comp = comp.locate(x - comp.x, y - comp.y);
+ }
+ if (comp != null && comp.visible &&
+ (ignoreEnabled || comp.enabled))
+ {
+ return comp;
+ }
+ }
+ }
+
return this;
}
@@ -3491,7 +3518,7 @@ public class Container extends Component {
private void writeObject(ObjectOutputStream s) throws IOException {
ObjectOutputStream.PutField f = s.putFields();
f.put("ncomponents", component.size());
- f.put("component", component.toArray(EMPTY_ARRAY));
+ f.put("component", getComponentsSync());
f.put("layoutMgr", layoutMgr);
f.put("dispatcher", dispatcher);
f.put("maxSize", maxSize);
From 56f4a68e6b303e79ed7a12ad3061b93ef9039905 Mon Sep 17 00:00:00 2001
From: Anton Tarasov
Date: Tue, 10 Mar 2009 18:33:29 +0300
Subject: [PATCH 20/80] 6806217: implement synthetic focus model for MS Windows
Reviewed-by: art, dcherepanov
---
jdk/make/sun/awt/make.depend | 22 +-
jdk/src/share/classes/java/awt/Component.java | 10 +-
.../java/awt/KeyboardFocusManager.java | 99 +---
.../share/classes/sun/awt/AWTAccessor.java | 62 ++-
.../classes/sun/awt/HeadlessToolkit.java | 6 +-
.../sun/awt/KeyboardFocusManagerPeerImpl.java | 163 +++++-
jdk/src/share/classes/sun/awt/SunToolkit.java | 6 +-
.../classes/sun/awt/X11/XComponentPeer.java | 137 +----
.../sun/awt/X11/XEmbedChildProxyPeer.java | 9 +-
.../awt/X11/XKeyboardFocusManagerPeer.java | 154 ++----
.../classes/sun/awt/windows/WChoicePeer.java | 36 ++
.../sun/awt/windows/WComponentPeer.java | 113 +++-
.../windows/WKeyboardFocusManagerPeer.java | 75 +++
.../classes/sun/awt/windows/WToolkit.java | 6 +
.../classes/sun/awt/windows/WWindowPeer.java | 61 ++-
.../windows/native/sun/windows/awt_Button.cpp | 61 +--
.../windows/native/sun/windows/awt_Button.h | 6 +-
.../windows/native/sun/windows/awt_Canvas.cpp | 27 +-
.../native/sun/windows/awt_Checkbox.cpp | 46 +-
.../windows/native/sun/windows/awt_Checkbox.h | 3 +-
.../windows/native/sun/windows/awt_Choice.cpp | 190 +++++--
.../windows/native/sun/windows/awt_Choice.h | 12 +-
.../native/sun/windows/awt_Component.cpp | 513 +++++-------------
.../native/sun/windows/awt_Component.h | 77 +--
.../windows/native/sun/windows/awt_Frame.cpp | 199 +++----
.../windows/native/sun/windows/awt_Frame.h | 19 +-
.../sun/windows/awt_KeyboardFocusManager.cpp | 97 +---
.../sun/windows/awt_KeyboardFocusManager.h | 43 --
.../windows/native/sun/windows/awt_List.cpp | 123 +----
jdk/src/windows/native/sun/windows/awt_List.h | 9 +-
.../native/sun/windows/awt_PrintDialog.cpp | 2 +-
.../native/sun/windows/awt_ScrollPane.cpp | 16 +-
.../native/sun/windows/awt_ScrollPane.h | 3 +-
.../native/sun/windows/awt_Scrollbar.cpp | 65 +--
.../native/sun/windows/awt_Scrollbar.h | 7 +-
.../native/sun/windows/awt_TextArea.cpp | 53 +-
.../native/sun/windows/awt_TextComponent.cpp | 30 +-
.../native/sun/windows/awt_TextComponent.h | 7 +-
.../native/sun/windows/awt_TextField.cpp | 242 ++++-----
.../windows/native/sun/windows/awt_Window.cpp | 173 +++++-
.../windows/native/sun/windows/awt_Window.h | 18 +-
jdk/src/windows/native/sun/windows/awtmsg.h | 3 +-
.../ClearGlobalFocusOwnerTest.java | 95 ++++
.../IconifiedFrameFocusChangeTest.java | 8 +-
.../RemoveAfterRequest.java | 102 ++++
45 files changed, 1632 insertions(+), 1576 deletions(-)
create mode 100644 jdk/src/windows/classes/sun/awt/windows/WKeyboardFocusManagerPeer.java
delete mode 100644 jdk/src/windows/native/sun/windows/awt_KeyboardFocusManager.h
create mode 100644 jdk/test/java/awt/Focus/ClearGlobalFocusOwnerTest/ClearGlobalFocusOwnerTest.java
create mode 100644 jdk/test/java/awt/Focus/RemoveAfterRequest/RemoveAfterRequest.java
diff --git a/jdk/make/sun/awt/make.depend b/jdk/make/sun/awt/make.depend
index df9d4c0f7c2..c9507be1f14 100644
--- a/jdk/make/sun/awt/make.depend
+++ b/jdk/make/sun/awt/make.depend
@@ -20,19 +20,19 @@ $(OBJDIR)/awt_BitmapUtil.obj:: ../../../src/share/javavm/export/jni.h ../../../s
$(OBJDIR)/awt_Brush.obj:: $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/stdhdrs.h
-$(OBJDIR)/awt_Button.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Button.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WButtonPeer.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Button.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_KeyboardFocusManager.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
+$(OBJDIR)/awt_Button.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Button.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WButtonPeer.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Button.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
-$(OBJDIR)/awt_Canvas.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_KeyboardFocusManager.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsConfig.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
+$(OBJDIR)/awt_Canvas.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsConfig.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
-$(OBJDIR)/awt_Checkbox.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Checkbox.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WCheckboxPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Checkbox.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_KeyboardFocusManager.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
+$(OBJDIR)/awt_Checkbox.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Checkbox.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WCheckboxPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Checkbox.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
-$(OBJDIR)/awt_Choice.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Choice.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_InputEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_FontMetrics.h $(CLASSHDRDIR)/java_awt_Toolkit.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WChoicePeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Choice.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Container.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Dimension.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_KeyboardFocusManager.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
+$(OBJDIR)/awt_Choice.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Choice.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_InputEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_FontMetrics.h $(CLASSHDRDIR)/java_awt_Toolkit.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WChoicePeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Choice.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Container.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Dimension.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
$(OBJDIR)/awt_Clipboard.obj:: $(CLASSHDRDIR)/sun_awt_windows_WClipboard.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Clipboard.h ../../../src/windows/native/sun/windows/awt_DataTransferer.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/stdhdrs.h
$(OBJDIR)/awt_Color.obj:: $(CLASSHDRDIR)/sun_awt_windows_WColor.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awt_Color.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/stdhdrs.h
-$(OBJDIR)/awt_Component.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Color.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_InputEvent.h $(CLASSHDRDIR)/java_awt_event_InputMethodEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_MouseWheelEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_FontMetrics.h $(CLASSHDRDIR)/java_awt_Frame.h $(CLASSHDRDIR)/java_awt_Insets.h $(CLASSHDRDIR)/java_awt_KeyboardFocusManager.h $(CLASSHDRDIR)/java_awt_Menu.h $(CLASSHDRDIR)/java_awt_MenuBar.h $(CLASSHDRDIR)/java_awt_MenuComponent.h $(CLASSHDRDIR)/java_awt_MenuItem.h $(CLASSHDRDIR)/java_awt_peer_MenuComponentPeer.h $(CLASSHDRDIR)/java_awt_Toolkit.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WFramePeer.h $(CLASSHDRDIR)/sun_awt_windows_WInputMethod.h $(CLASSHDRDIR)/sun_awt_windows_WMenuBarPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuItemPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuPeer.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WPanelPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jawt.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_AWTEvent.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Cursor.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Dimension.h ../../../src/windows/native/sun/windows/awt_DnDDT.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_Frame.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_InputEvent.h ../../../src/windows/native/sun/windows/awt_InputTextInfor.h ../../../src/windows/native/sun/windows/awt_Insets.h ../../../src/windows/native/sun/windows/awt_KeyboardFocusManager.h ../../../src/windows/native/sun/windows/awt_KeyEvent.h ../../../src/windows/native/sun/windows/awt_Menu.h ../../../src/windows/native/sun/windows/awt_MenuBar.h ../../../src/windows/native/sun/windows/awt_MenuItem.h ../../../src/windows/native/sun/windows/awt_MouseEvent.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/ComCtl32Util.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h ../../../src/windows/native/sun/awt/utility/rect.h
+$(OBJDIR)/awt_Component.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Color.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_InputEvent.h $(CLASSHDRDIR)/java_awt_event_InputMethodEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_MouseWheelEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_FontMetrics.h $(CLASSHDRDIR)/java_awt_Frame.h $(CLASSHDRDIR)/java_awt_Insets.h $(CLASSHDRDIR)/java_awt_Menu.h $(CLASSHDRDIR)/java_awt_MenuBar.h $(CLASSHDRDIR)/java_awt_MenuComponent.h $(CLASSHDRDIR)/java_awt_MenuItem.h $(CLASSHDRDIR)/java_awt_peer_MenuComponentPeer.h $(CLASSHDRDIR)/java_awt_Toolkit.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WFramePeer.h $(CLASSHDRDIR)/sun_awt_windows_WInputMethod.h $(CLASSHDRDIR)/sun_awt_windows_WMenuBarPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuItemPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuPeer.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WPanelPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jawt.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/pipe/Region.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_AWTEvent.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Cursor.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Dimension.h ../../../src/windows/native/sun/windows/awt_DnDDT.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_Frame.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_InputEvent.h ../../../src/windows/native/sun/windows/awt_InputTextInfor.h ../../../src/windows/native/sun/windows/awt_Insets.h ../../../src/windows/native/sun/windows/awt_KeyEvent.h ../../../src/windows/native/sun/windows/awt_Menu.h ../../../src/windows/native/sun/windows/awt_MenuBar.h ../../../src/windows/native/sun/windows/awt_MenuItem.h ../../../src/windows/native/sun/windows/awt_MouseEvent.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/ComCtl32Util.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h ../../../src/windows/native/sun/awt/utility/rect.h
$(OBJDIR)/awt_Container.obj:: ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awt_Container.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/stdhdrs.h
@@ -80,13 +80,13 @@ $(OBJDIR)/awt_InputTextInfor.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDR
$(OBJDIR)/awt_Insets.obj:: ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Insets.h ../../../src/windows/native/sun/windows/stdhdrs.h
-$(OBJDIR)/awt_KeyboardFocusManager.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_KeyboardFocusManager.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_KeyboardFocusManager.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
+$(OBJDIR)/awt_KeyboardFocusManager.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
$(OBJDIR)/awt_KeyEvent.obj:: ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_KeyEvent.h ../../../src/windows/native/sun/windows/stdhdrs.h
$(OBJDIR)/awt_Label.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_Label.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WLabelPeer.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_Label.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
-$(OBJDIR)/awt_List.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_List.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WListPeer.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Dimension.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_KeyboardFocusManager.h ../../../src/windows/native/sun/windows/awt_List.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/ComCtl32Util.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
+$(OBJDIR)/awt_List.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_List.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WListPeer.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Dimension.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_List.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/ComCtl32Util.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
$(OBJDIR)/awt_Menu.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_FontMetrics.h $(CLASSHDRDIR)/java_awt_Frame.h $(CLASSHDRDIR)/java_awt_Menu.h $(CLASSHDRDIR)/java_awt_MenuBar.h $(CLASSHDRDIR)/java_awt_MenuComponent.h $(CLASSHDRDIR)/java_awt_MenuItem.h $(CLASSHDRDIR)/java_awt_peer_MenuComponentPeer.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WFramePeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuBarPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuItemPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuPeer.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_Frame.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_Menu.h ../../../src/windows/native/sun/windows/awt_MenuBar.h ../../../src/windows/native/sun/windows/awt_MenuItem.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
@@ -122,15 +122,15 @@ $(OBJDIR)/awt_Rectangle.obj:: ../../../src/share/javavm/export/jni.h ../../../sr
$(OBJDIR)/awt_Robot.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_InputEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WRobotPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Robot.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
-$(OBJDIR)/awt_Scrollbar.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_Scrollbar.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WScrollbarPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_KeyboardFocusManager.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Scrollbar.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
+$(OBJDIR)/awt_Scrollbar.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_Scrollbar.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WScrollbarPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Scrollbar.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
$(OBJDIR)/awt_ScrollPane.obj:: $(CLASSHDRDIR)/java_awt_Adjustable.h $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_AdjustmentEvent.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_Insets.h $(CLASSHDRDIR)/java_awt_Scrollbar.h $(CLASSHDRDIR)/java_awt_ScrollPane.h $(CLASSHDRDIR)/java_awt_ScrollPaneAdjustable.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WScrollbarPeer.h $(CLASSHDRDIR)/sun_awt_windows_WScrollPanePeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Container.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_Insets.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Panel.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_Scrollbar.h ../../../src/windows/native/sun/windows/awt_ScrollPane.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
-$(OBJDIR)/awt_TextArea.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dialog.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_FileDialog.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_FontMetrics.h $(CLASSHDRDIR)/java_awt_Frame.h $(CLASSHDRDIR)/java_awt_Menu.h $(CLASSHDRDIR)/java_awt_MenuBar.h $(CLASSHDRDIR)/java_awt_MenuComponent.h $(CLASSHDRDIR)/java_awt_MenuItem.h $(CLASSHDRDIR)/java_awt_peer_MenuComponentPeer.h $(CLASSHDRDIR)/java_awt_TextArea.h $(CLASSHDRDIR)/java_awt_TextComponent.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WDialogPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFileDialogPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WFramePeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuBarPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuItemPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuPeer.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WTextAreaPeer.h $(CLASSHDRDIR)/sun_awt_windows_WTextComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Dialog.h ../../../src/windows/native/sun/windows/awt_FileDialog.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_Frame.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_KeyboardFocusManager.h ../../../src/windows/native/sun/windows/awt_Menu.h ../../../src/windows/native/sun/windows/awt_MenuBar.h ../../../src/windows/native/sun/windows/awt_MenuItem.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_PrintDialog.h ../../../src/windows/native/sun/windows/awt_TextArea.h ../../../src/windows/native/sun/windows/awt_TextComponent.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
+$(OBJDIR)/awt_TextArea.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dialog.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_FileDialog.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_FontMetrics.h $(CLASSHDRDIR)/java_awt_Frame.h $(CLASSHDRDIR)/java_awt_Menu.h $(CLASSHDRDIR)/java_awt_MenuBar.h $(CLASSHDRDIR)/java_awt_MenuComponent.h $(CLASSHDRDIR)/java_awt_MenuItem.h $(CLASSHDRDIR)/java_awt_peer_MenuComponentPeer.h $(CLASSHDRDIR)/java_awt_TextArea.h $(CLASSHDRDIR)/java_awt_TextComponent.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WDialogPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFileDialogPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WFramePeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuBarPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuItemPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuPeer.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WTextAreaPeer.h $(CLASSHDRDIR)/sun_awt_windows_WTextComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Dialog.h ../../../src/windows/native/sun/windows/awt_FileDialog.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_Frame.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_Menu.h ../../../src/windows/native/sun/windows/awt_MenuBar.h ../../../src/windows/native/sun/windows/awt_MenuItem.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_PrintDialog.h ../../../src/windows/native/sun/windows/awt_TextArea.h ../../../src/windows/native/sun/windows/awt_TextComponent.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
-$(OBJDIR)/awt_TextComponent.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_TextComponent.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WTextComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_KeyboardFocusManager.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_TextComponent.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
+$(OBJDIR)/awt_TextComponent.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_TextComponent.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WTextComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_TextComponent.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
-$(OBJDIR)/awt_TextField.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dialog.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_FileDialog.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_FontMetrics.h $(CLASSHDRDIR)/java_awt_Frame.h $(CLASSHDRDIR)/java_awt_Menu.h $(CLASSHDRDIR)/java_awt_MenuBar.h $(CLASSHDRDIR)/java_awt_MenuComponent.h $(CLASSHDRDIR)/java_awt_MenuItem.h $(CLASSHDRDIR)/java_awt_peer_MenuComponentPeer.h $(CLASSHDRDIR)/java_awt_TextComponent.h $(CLASSHDRDIR)/java_awt_TextField.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WDialogPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFileDialogPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WFramePeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuBarPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuItemPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuPeer.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WTextComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WTextFieldPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Dialog.h ../../../src/windows/native/sun/windows/awt_FileDialog.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_Frame.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_KeyboardFocusManager.h ../../../src/windows/native/sun/windows/awt_Menu.h ../../../src/windows/native/sun/windows/awt_MenuBar.h ../../../src/windows/native/sun/windows/awt_MenuItem.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_PrintDialog.h ../../../src/windows/native/sun/windows/awt_TextComponent.h ../../../src/windows/native/sun/windows/awt_TextField.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
+$(OBJDIR)/awt_TextField.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dialog.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_FileDialog.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_FontMetrics.h $(CLASSHDRDIR)/java_awt_Frame.h $(CLASSHDRDIR)/java_awt_Menu.h $(CLASSHDRDIR)/java_awt_MenuBar.h $(CLASSHDRDIR)/java_awt_MenuComponent.h $(CLASSHDRDIR)/java_awt_MenuItem.h $(CLASSHDRDIR)/java_awt_peer_MenuComponentPeer.h $(CLASSHDRDIR)/java_awt_TextComponent.h $(CLASSHDRDIR)/java_awt_TextField.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WDialogPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFileDialogPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WFramePeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuBarPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuItemPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuPeer.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WTextComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WTextFieldPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_Dialog.h ../../../src/windows/native/sun/windows/awt_FileDialog.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_Frame.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_Menu.h ../../../src/windows/native/sun/windows/awt_MenuBar.h ../../../src/windows/native/sun/windows/awt_MenuItem.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_PrintDialog.h ../../../src/windows/native/sun/windows/awt_TextComponent.h ../../../src/windows/native/sun/windows/awt_TextField.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
$(OBJDIR)/awt_Toolkit.obj:: $(CLASSHDRDIR)/java_awt_AWTEvent.h $(CLASSHDRDIR)/java_awt_Component.h $(CLASSHDRDIR)/java_awt_Dialog.h $(CLASSHDRDIR)/java_awt_Dimension.h $(CLASSHDRDIR)/java_awt_Event.h $(CLASSHDRDIR)/java_awt_event_FocusEvent.h $(CLASSHDRDIR)/java_awt_event_InputMethodEvent.h $(CLASSHDRDIR)/java_awt_event_KeyEvent.h $(CLASSHDRDIR)/java_awt_event_MouseEvent.h $(CLASSHDRDIR)/java_awt_event_WindowEvent.h $(CLASSHDRDIR)/java_awt_FileDialog.h $(CLASSHDRDIR)/java_awt_Font.h $(CLASSHDRDIR)/java_awt_FontMetrics.h $(CLASSHDRDIR)/java_awt_Frame.h $(CLASSHDRDIR)/java_awt_image_AffineTransformOp.h $(CLASSHDRDIR)/java_awt_List.h $(CLASSHDRDIR)/java_awt_Menu.h $(CLASSHDRDIR)/java_awt_MenuBar.h $(CLASSHDRDIR)/java_awt_MenuComponent.h $(CLASSHDRDIR)/java_awt_MenuItem.h $(CLASSHDRDIR)/java_awt_peer_ComponentPeer.h $(CLASSHDRDIR)/java_awt_peer_MenuComponentPeer.h $(CLASSHDRDIR)/java_awt_PopupMenu.h $(CLASSHDRDIR)/java_awt_Toolkit.h $(CLASSHDRDIR)/java_awt_Transparency.h $(CLASSHDRDIR)/java_awt_Window.h $(CLASSHDRDIR)/sun_awt_FontDescriptor.h $(CLASSHDRDIR)/sun_awt_PlatformFont.h $(CLASSHDRDIR)/sun_awt_windows_WCanvasPeer.h $(CLASSHDRDIR)/sun_awt_windows_WComponentPeer.h $(CLASSHDRDIR)/sun_awt_windows_WDialogPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFileDialogPeer.h $(CLASSHDRDIR)/sun_awt_windows_WFontMetrics.h $(CLASSHDRDIR)/sun_awt_windows_WFramePeer.h $(CLASSHDRDIR)/sun_awt_windows_WListPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuBarPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuItemPeer.h $(CLASSHDRDIR)/sun_awt_windows_WMenuPeer.h $(CLASSHDRDIR)/sun_awt_windows_WObjectPeer.h $(CLASSHDRDIR)/sun_awt_windows_WPopupMenuPeer.h $(CLASSHDRDIR)/sun_awt_windows_WToolkit.h $(CLASSHDRDIR)/sun_awt_windows_WWindowPeer.h $(CLASSHDRDIR)/sun_java2d_d3d_D3DContext.h $(CLASSHDRDIR)/sun_java2d_d3d_D3DSurfaceData.h $(CLASSHDRDIR)/sun_java2d_pipe_BufferedContext.h $(CLASSHDRDIR)/sun_java2d_pipe_hw_AccelDeviceEventNotifier.h $(CLASSHDRDIR)/sun_java2d_pipe_hw_AccelSurface.h ../../../src/share/javavm/export/jawt.h ../../../src/share/javavm/export/jni.h ../../../src/share/javavm/export/jvm.h ../../../src/share/native/common/gdefs.h ../../../src/share/native/common/jlong.h ../../../src/share/native/common/jni_util.h ../../../src/share/native/sun/awt/debug/debug_assert.h ../../../src/share/native/sun/awt/debug/debug_mem.h ../../../src/share/native/sun/awt/debug/debug_trace.h ../../../src/share/native/sun/awt/debug/debug_util.h ../../../src/share/native/sun/awt/image/cvutils/img_globals.h ../../../src/share/native/sun/java2d/ShaderList.h ../../../src/share/native/sun/java2d/SurfaceData.h ../../../src/share/native/sun/java2d/Trace.h ../../../src/windows/javavm/export/jawt_md.h ../../../src/windows/javavm/export/jni_md.h ../../../src/windows/javavm/export/jvm_md.h ../../../src/windows/native/common/gdefs_md.h ../../../src/windows/native/common/jlong_md.h ../../../src/windows/native/sun/java2d/d3d/D3DContext.h ../../../src/windows/native/sun/java2d/d3d/D3DMaskCache.h ../../../src/windows/native/sun/java2d/d3d/D3DPipeline.h ../../../src/windows/native/sun/java2d/d3d/D3DPipelineManager.h ../../../src/windows/native/sun/java2d/d3d/D3DResourceManager.h ../../../src/windows/native/sun/java2d/d3d/D3DSurfaceData.h ../../../src/windows/native/sun/java2d/d3d/D3DVertexCacher.h ../../../src/windows/native/sun/java2d/j2d_md.h ../../../src/windows/native/sun/java2d/windows/GDIWindowSurfaceData.h ../../../src/windows/native/sun/windows/alloc.h ../../../src/windows/native/sun/windows/awt.h ../../../src/windows/native/sun/windows/awtmsg.h ../../../src/windows/native/sun/windows/awt_AWTEvent.h ../../../src/windows/native/sun/windows/awt_Brush.h ../../../src/windows/native/sun/windows/awt_Canvas.h ../../../src/windows/native/sun/windows/awt_Clipboard.h ../../../src/windows/native/sun/windows/awt_Component.h ../../../src/windows/native/sun/windows/awt_Cursor.h ../../../src/windows/native/sun/windows/awt_Debug.h ../../../src/windows/native/sun/windows/awt_DesktopProperties.h ../../../src/windows/native/sun/windows/awt_Dialog.h ../../../src/windows/native/sun/windows/awt_DnDDS.h ../../../src/windows/native/sun/windows/awt_DnDDT.h ../../../src/windows/native/sun/windows/awt_DrawingSurface.h ../../../src/windows/native/sun/windows/awt_FileDialog.h ../../../src/windows/native/sun/windows/awt_Font.h ../../../src/windows/native/sun/windows/awt_Frame.h ../../../src/windows/native/sun/windows/awt_GDIObject.h ../../../src/windows/native/sun/windows/awt_InputEvent.h ../../../src/windows/native/sun/windows/awt_KeyEvent.h ../../../src/windows/native/sun/windows/awt_List.h ../../../src/windows/native/sun/windows/awt_Menu.h ../../../src/windows/native/sun/windows/awt_MenuBar.h ../../../src/windows/native/sun/windows/awt_MenuItem.h ../../../src/windows/native/sun/windows/awt_new.h ../../../src/windows/native/sun/windows/awt_Object.h ../../../src/windows/native/sun/windows/awt_Palette.h ../../../src/windows/native/sun/windows/awt_Pen.h ../../../src/windows/native/sun/windows/awt_PopupMenu.h ../../../src/windows/native/sun/windows/awt_Toolkit.h ../../../src/windows/native/sun/windows/awt_Win32GraphicsDevice.h ../../../src/windows/native/sun/windows/awt_Window.h ../../../src/windows/native/sun/windows/CmdIDList.h ../../../src/windows/native/sun/windows/colordata.h ../../../src/windows/native/sun/windows/ComCtl32Util.h ../../../src/windows/native/sun/windows/Devices.h ../../../src/windows/native/sun/windows/GDIHashtable.h ../../../src/windows/native/sun/windows/Hashtable.h ../../../src/windows/native/sun/windows/ObjectList.h ../../../src/windows/native/sun/windows/stdhdrs.h
diff --git a/jdk/src/share/classes/java/awt/Component.java b/jdk/src/share/classes/java/awt/Component.java
index 26cfc9ef6f2..fe52ba2ed7f 100644
--- a/jdk/src/share/classes/java/awt/Component.java
+++ b/jdk/src/share/classes/java/awt/Component.java
@@ -851,6 +851,12 @@ public abstract class Component implements ImageObserver, MenuContainer,
{
comp.setGraphicsConfiguration(gc);
}
+ public boolean requestFocus(Component comp, CausedFocusEvent.Cause cause) {
+ return comp.requestFocus(cause);
+ }
+ public boolean canBeFocusOwner(Component comp) {
+ return comp.canBeFocusOwner();
+ }
});
}
@@ -7147,8 +7153,8 @@ public abstract class Component implements ImageObserver, MenuContainer,
requestFocusHelper(false, true);
}
- void requestFocus(CausedFocusEvent.Cause cause) {
- requestFocusHelper(false, true, cause);
+ boolean requestFocus(CausedFocusEvent.Cause cause) {
+ return requestFocusHelper(false, true, cause);
}
/**
diff --git a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java
index 268eba915be..521c70403ae 100644
--- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java
+++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java
@@ -61,6 +61,7 @@ import sun.awt.HeadlessToolkit;
import sun.awt.SunToolkit;
import sun.awt.CausedFocusEvent;
import sun.awt.KeyboardFocusManagerPeerProvider;
+import sun.awt.AWTAccessor;
/**
* The KeyboardFocusManager is responsible for managing the active and focused
@@ -118,6 +119,32 @@ public abstract class KeyboardFocusManager
if (!GraphicsEnvironment.isHeadless()) {
initIDs();
}
+ AWTAccessor.setKeyboardFocusManagerAccessor(
+ new AWTAccessor.KeyboardFocusManagerAccessor() {
+ public int shouldNativelyFocusHeavyweight(Component heavyweight,
+ Component descendant,
+ boolean temporary,
+ boolean focusedWindowChangeAllowed,
+ long time,
+ CausedFocusEvent.Cause cause)
+ {
+ return KeyboardFocusManager.shouldNativelyFocusHeavyweight(
+ heavyweight, descendant, temporary, focusedWindowChangeAllowed, time, cause);
+ }
+ public boolean processSynchronousLightweightTransfer(Component heavyweight,
+ Component descendant,
+ boolean temporary,
+ boolean focusedWindowChangeAllowed,
+ long time)
+ {
+ return KeyboardFocusManager.processSynchronousLightweightTransfer(
+ heavyweight, descendant, temporary, focusedWindowChangeAllowed, time);
+ }
+ public void removeLastFocusRequest(Component heavyweight) {
+ KeyboardFocusManager.removeLastFocusRequest(heavyweight);
+ }
+ }
+ );
}
transient KeyboardFocusManagerPeer peer;
@@ -2443,79 +2470,7 @@ public abstract class KeyboardFocusManager
}
}
}
- static void heavyweightButtonDown(Component heavyweight, long time) {
- heavyweightButtonDown(heavyweight, time, false);
- }
- static void heavyweightButtonDown(Component heavyweight, long time, boolean acceptDuplicates) {
- if (log.isLoggable(Level.FINE)) {
- if (heavyweight == null) {
- log.log(Level.FINE, "Assertion (heavyweight != null) failed");
- }
- if (time == 0) {
- log.log(Level.FINE, "Assertion (time != 0) failed");
- }
- }
- KeyboardFocusManager manager = getCurrentKeyboardFocusManager(SunToolkit.targetToAppContext(heavyweight));
- synchronized (heavyweightRequests) {
- HeavyweightFocusRequest hwFocusRequest = getLastHWRequest();
- Component currentNativeFocusOwner = (hwFocusRequest == null)
- ? manager.getNativeFocusOwner()
- : hwFocusRequest.heavyweight;
-
- // Behavior for all use cases:
- // 1. Heavyweight leaf Components (e.g., Button, Checkbox, Choice,
- // List, TextComponent, Canvas) that respond to button down.
- //
- // Native platform will generate a FOCUS_GAINED if and only if
- // the Component is not the focus owner (or, will not be the
- // focus owner when all outstanding focus requests are
- // processed).
- //
- // 2. Panel with no descendants.
- //
- // Same as (1).
- //
- // 3. Panel with at least one heavyweight descendant.
- //
- // This function should NOT be called for this case!
- //
- // 4. Panel with only lightweight descendants.
- //
- // Native platform will generate a FOCUS_GAINED if and only if
- // neither the Panel, nor any of its recursive, lightweight
- // descendants, is the focus owner. However, we want a
- // requestFocus() for any lightweight descendant to win out over
- // the focus request for the Panel. To accomplish this, we
- // differ from the algorithm for shouldNativelyFocusHeavyweight
- // as follows:
- // a. If the requestFocus() for a lightweight descendant has
- // been fully handled by the time this function is invoked,
- // then 'hwFocusRequest' will be null and 'heavyweight'
- // will be the native focus owner. Do *not* synthesize a
- // focus transfer to the Panel.
- // b. If the requestFocus() for a lightweight descendant has
- // been recorded, but not handled, then 'hwFocusRequest'
- // will be non-null and 'hwFocusRequest.heavyweight' will
- // equal 'heavyweight'. Do *not* append 'heavyweight' to
- // hwFocusRequest.lightweightRequests.
- // c. If the requestFocus() for a lightweight descendant is
- // yet to be made, then post a new HeavyweightFocusRequest.
- // If no lightweight descendant ever requests focus, then
- // the Panel will get focus. If some descendant does, then
- // the descendant will get focus by either a synthetic
- // focus transfer, or a lightweightRequests focus transfer.
-
- if (acceptDuplicates || heavyweight != currentNativeFocusOwner) {
- getCurrentKeyboardFocusManager
- (SunToolkit.targetToAppContext(heavyweight)).
- enqueueKeyEvents(time, heavyweight);
- heavyweightRequests.add
- (new HeavyweightFocusRequest(heavyweight, heavyweight,
- false, CausedFocusEvent.Cause.MOUSE_EVENT));
- }
- }
- }
/**
* Returns the Window which will be active after processing this request,
* or null if this is a duplicate request. The active Window is useful
diff --git a/jdk/src/share/classes/sun/awt/AWTAccessor.java b/jdk/src/share/classes/sun/awt/AWTAccessor.java
index 767b4147778..41b9a37dd0d 100644
--- a/jdk/src/share/classes/sun/awt/AWTAccessor.java
+++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java
@@ -31,7 +31,8 @@ import java.awt.image.BufferedImage;
import sun.misc.Unsafe;
-/** The AWTAccessor utility class.
+/**
+ * The AWTAccessor utility class.
* The main purpose of this class is to enable accessing
* private and package-private fields of classes from
* different classes/packages. See sun.misc.SharedSecretes
@@ -83,6 +84,14 @@ public final class AWTAccessor {
* Sets GraphicsConfiguration value for the component.
*/
void setGraphicsConfiguration(Component comp, GraphicsConfiguration gc);
+ /*
+ * Requests focus to the component.
+ */
+ boolean requestFocus(Component comp, CausedFocusEvent.Cause cause);
+ /*
+ * Determines if the component can gain focus.
+ */
+ boolean canBeFocusOwner(Component comp);
}
/*
@@ -151,6 +160,35 @@ public final class AWTAccessor {
int getExtendedState(Frame frame);
}
+ /*
+ * An interface of accessor for the java.awt.Component class.
+ */
+ public interface KeyboardFocusManagerAccessor {
+ /*
+ * Indicates whether the native implementation should
+ * proceed with a pending focus request for the heavyweight.
+ */
+ int shouldNativelyFocusHeavyweight(Component heavyweight,
+ Component descendant,
+ boolean temporary,
+ boolean focusedWindowChangeAllowed,
+ long time,
+ CausedFocusEvent.Cause cause);
+ /*
+ * Delivers focus for the lightweight descendant of the heavyweight
+ * synchronously.
+ */
+ boolean processSynchronousLightweightTransfer(Component heavyweight,
+ Component descendant,
+ boolean temporary,
+ boolean focusedWindowChangeAllowed,
+ long time);
+ /*
+ * Removes the last focus request for the heavyweight from the queue.
+ */
+ void removeLastFocusRequest(Component heavyweight);
+ }
+
/*
* The java.awt.Component class accessor object.
*/
@@ -171,6 +209,11 @@ public final class AWTAccessor {
*/
private static FrameAccessor frameAccessor;
+ /*
+ * The java.awt.KeyboardFocusManager class accessor object.
+ */
+ private static KeyboardFocusManagerAccessor kfmAccessor;
+
/*
* Set an accessor object for the java.awt.Component class.
*/
@@ -236,4 +279,21 @@ public final class AWTAccessor {
}
return frameAccessor;
}
+
+ /*
+ * Set an accessor object for the java.awt.KeyboardFocusManager class.
+ */
+ public static void setKeyboardFocusManagerAccessor(KeyboardFocusManagerAccessor kfma) {
+ kfmAccessor = kfma;
+ }
+
+ /*
+ * Retrieve the accessor object for the java.awt.KeyboardFocusManager class.
+ */
+ public static KeyboardFocusManagerAccessor getKeyboardFocusManagerAccessor() {
+ if (kfmAccessor == null) {
+ unsafe.ensureClassInitialized(KeyboardFocusManager.class);
+ }
+ return kfmAccessor;
+ }
}
diff --git a/jdk/src/share/classes/sun/awt/HeadlessToolkit.java b/jdk/src/share/classes/sun/awt/HeadlessToolkit.java
index 18ccc446be5..cfc5a47a357 100644
--- a/jdk/src/share/classes/sun/awt/HeadlessToolkit.java
+++ b/jdk/src/share/classes/sun/awt/HeadlessToolkit.java
@@ -179,9 +179,9 @@ public class HeadlessToolkit extends Toolkit
throw new HeadlessException();
}
- public KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager) throws HeadlessException {
- KeyboardFocusManagerPeerImpl peer = new KeyboardFocusManagerPeerImpl(manager);
- return peer;
+ public KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager)
+ throws HeadlessException {
+ throw new HeadlessException();
}
public TrayIconPeer createTrayIcon(TrayIcon target)
diff --git a/jdk/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java b/jdk/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java
index 0d47a3fd286..6a8708a2abe 100644
--- a/jdk/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java
+++ b/jdk/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2003-2007 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
@@ -27,47 +27,150 @@ package sun.awt;
import java.awt.Component;
import java.awt.KeyboardFocusManager;
import java.awt.Window;
+import java.awt.Canvas;
+import java.awt.Scrollbar;
+import java.awt.Panel;
+
+import java.awt.event.FocusEvent;
import java.awt.peer.KeyboardFocusManagerPeer;
+import java.awt.peer.ComponentPeer;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.util.logging.Level;
+import java.util.logging.Logger;
-public class KeyboardFocusManagerPeerImpl implements KeyboardFocusManagerPeer {
- static native Window getNativeFocusedWindow();
- static native Component getNativeFocusOwner();
- static native void clearNativeGlobalFocusOwner(Window activeWindow);
+public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManagerPeer {
- KeyboardFocusManagerPeerImpl(KeyboardFocusManager manager) {
+ private static final Logger focusLog = Logger.getLogger("sun.awt.focus.KeyboardFocusManagerPeerImpl");
+
+ private static AWTAccessor.KeyboardFocusManagerAccessor kfmAccessor =
+ AWTAccessor.getKeyboardFocusManagerAccessor();
+
+ // The constants are copied from java.awt.KeyboardFocusManager
+ public static final int SNFH_FAILURE = 0;
+ public static final int SNFH_SUCCESS_HANDLED = 1;
+ public static final int SNFH_SUCCESS_PROCEED = 2;
+
+ protected KeyboardFocusManager manager;
+
+ public KeyboardFocusManagerPeerImpl(KeyboardFocusManager manager) {
+ this.manager = manager;
}
- public Window getCurrentFocusedWindow() {
- return getNativeFocusedWindow();
- }
-
- public void setCurrentFocusOwner(Component comp) {
- }
-
- public Component getCurrentFocusOwner() {
- return getNativeFocusOwner();
- }
+ @Override
public void clearGlobalFocusOwner(Window activeWindow) {
- clearNativeGlobalFocusOwner(activeWindow);
- }
-
- static Method m_removeLastFocusRequest = null;
- public static void removeLastFocusRequest(Component heavyweight) {
- try {
- if (m_removeLastFocusRequest == null) {
- m_removeLastFocusRequest = SunToolkit.getMethod(KeyboardFocusManager.class, "removeLastFocusRequest",
- new Class[] {Component.class});
+ if (activeWindow != null) {
+ Component focusOwner = activeWindow.getFocusOwner();
+ if (focusLog.isLoggable(Level.FINE)) focusLog.fine("Clearing global focus owner " + focusOwner);
+ if (focusOwner != null) {
+ FocusEvent fl = new CausedFocusEvent(focusOwner, FocusEvent.FOCUS_LOST, false, null,
+ CausedFocusEvent.Cause.CLEAR_GLOBAL_FOCUS_OWNER);
+ SunToolkit.postPriorityEvent(fl);
}
- m_removeLastFocusRequest.invoke(null, new Object[]{heavyweight});
- } catch (InvocationTargetException ite) {
- ite.printStackTrace();
- } catch (IllegalAccessException ex) {
- ex.printStackTrace();
}
}
+
+ /*
+ * WARNING: Don't call it on the Toolkit thread.
+ *
+ * Checks if the component:
+ * 1) accepts focus on click (in general)
+ * 2) may be a focus owner (in particular)
+ */
+ public static boolean shouldFocusOnClick(Component component) {
+ boolean acceptFocusOnClick = false;
+
+ // A component is generally allowed to accept focus on click
+ // if its peer is focusable. There're some exceptions though.
+
+
+ // CANVAS & SCROLLBAR accept focus on click
+ if (component instanceof Canvas ||
+ component instanceof Scrollbar)
+ {
+ acceptFocusOnClick = true;
+
+ // PANEL, empty only, accepts focus on click
+ } else if (component instanceof Panel) {
+ acceptFocusOnClick = (((Panel)component).getComponentCount() == 0);
+
+
+ // Other components
+ } else {
+ ComponentPeer peer = (component != null ? component.getPeer() : null);
+ acceptFocusOnClick = (peer != null ? peer.isFocusable() : false);
+ }
+ return acceptFocusOnClick &&
+ AWTAccessor.getComponentAccessor().canBeFocusOwner(component);
+ }
+
+ /*
+ * Posts proper lost/gain focus events to the event queue.
+ */
+ public static boolean deliverFocus(Component lightweightChild,
+ Component target,
+ boolean temporary,
+ boolean focusedWindowChangeAllowed,
+ long time,
+ CausedFocusEvent.Cause cause,
+ Component currentFocusOwner) // provided by the descendant peers
+ {
+ if (lightweightChild == null) {
+ lightweightChild = (Component)target;
+ }
+
+ Component currentOwner = currentFocusOwner;
+ if (currentOwner != null && currentOwner.getPeer() == null) {
+ currentOwner = null;
+ }
+ if (currentOwner != null) {
+ FocusEvent fl = new CausedFocusEvent(currentOwner, FocusEvent.FOCUS_LOST,
+ false, lightweightChild, cause);
+
+ if (focusLog.isLoggable(Level.FINER)) focusLog.finer("Posting focus event: " + fl);
+ SunToolkit.postPriorityEvent(fl);
+ }
+
+ FocusEvent fg = new CausedFocusEvent(lightweightChild, FocusEvent.FOCUS_GAINED,
+ false, currentOwner, cause);
+
+ if (focusLog.isLoggable(Level.FINER)) focusLog.finer("Posting focus event: " + fg);
+ SunToolkit.postPriorityEvent(fg);
+ return true;
+ }
+
+ // WARNING: Don't call it on the Toolkit thread.
+ public static boolean requestFocusFor(Component target, CausedFocusEvent.Cause cause) {
+ return AWTAccessor.getComponentAccessor().requestFocus(target, cause);
+ }
+
+ // WARNING: Don't call it on the Toolkit thread.
+ public static int shouldNativelyFocusHeavyweight(Component heavyweight,
+ Component descendant,
+ boolean temporary,
+ boolean focusedWindowChangeAllowed,
+ long time,
+ CausedFocusEvent.Cause cause)
+ {
+ return kfmAccessor.shouldNativelyFocusHeavyweight(
+ heavyweight, descendant, temporary, focusedWindowChangeAllowed, time, cause);
+ }
+
+ public static void removeLastFocusRequest(Component heavyweight) {
+ kfmAccessor.removeLastFocusRequest(heavyweight);
+ }
+
+ // WARNING: Don't call it on the Toolkit thread.
+ public static boolean processSynchronousLightweightTransfer(Component heavyweight,
+ Component descendant,
+ boolean temporary,
+ boolean focusedWindowChangeAllowed,
+ long time)
+ {
+ return kfmAccessor.processSynchronousLightweightTransfer(
+ heavyweight, descendant, temporary, focusedWindowChangeAllowed, time);
+ }
}
diff --git a/jdk/src/share/classes/sun/awt/SunToolkit.java b/jdk/src/share/classes/sun/awt/SunToolkit.java
index ac375d836fd..ac99f4bab5a 100644
--- a/jdk/src/share/classes/sun/awt/SunToolkit.java
+++ b/jdk/src/share/classes/sun/awt/SunToolkit.java
@@ -220,10 +220,8 @@ public abstract class SunToolkit extends Toolkit
public abstract RobotPeer createRobot(Robot target, GraphicsDevice screen)
throws AWTException;
- public KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager) throws HeadlessException {
- KeyboardFocusManagerPeerImpl peer = new KeyboardFocusManagerPeerImpl(manager);
- return peer;
- }
+ public abstract KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager)
+ throws HeadlessException;
/**
* The AWT lock is typically only used on Unix platforms to synchronize
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
index 75b0b6ca308..26db17c72a4 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java
@@ -77,11 +77,6 @@ import sun.java2d.pipe.Region;
public class XComponentPeer extends XWindow implements ComponentPeer, DropTargetPeer,
BackBufferCapsProvider
{
- /* FIX ME: these constants copied from java.awt.KeyboardFocusManager */
- static final int SNFH_FAILURE = 0;
- static final int SNFH_SUCCESS_HANDLED = 1;
- static final int SNFH_SUCCESS_PROCEED = 2;
-
private static final Logger log = Logger.getLogger("sun.awt.X11.XComponentPeer");
private static final Logger buffersLog = Logger.getLogger("sun.awt.X11.XComponentPeer.multibuffer");
private static final Logger focusLog = Logger.getLogger("sun.awt.X11.focus.XComponentPeer");
@@ -315,113 +310,27 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
return null;
}
- /**
- * Returns whether or not this component should be given focus on mouse click.
- * Default implementation return whether or not this peer is "focusable"
- * Descendants might want to override it to extend/restrict conditions at which this
- * component should be focused by click (see MCanvasPeer and MPanelPeer)
- */
- protected boolean shouldFocusOnClick() {
- return isFocusable();
- }
-
- /**
- * Checks whether or not this component would be focused by native system if it would be allowed to do so.
- * Currently it checks that it displayable, visible, enabled and focusable.
- */
- static boolean canBeFocusedByClick(Component component) {
- if (component == null) {
- return false;
- } else {
- return component.isDisplayable() && component.isVisible() && component.isEnabled() && component.isFocusable();
- }
- }
-
- static Window getContainingWindow(Component comp) {
- while (comp != null && !(comp instanceof Window)) {
- comp = comp.getParent();
- }
-
- return (Window)comp;
- }
-
- static Method processSynchronousLightweightTransferMethod;
- static boolean processSynchronousLightweightTransfer(Component heavyweight, Component descendant,
- boolean temporary, boolean focusedWindowChangeAllowed,
- long time)
- {
- try {
- if (processSynchronousLightweightTransferMethod == null) {
- processSynchronousLightweightTransferMethod =
- (Method)AccessController.doPrivileged(
- new PrivilegedExceptionAction() {
- public Object run() throws IllegalAccessException, NoSuchMethodException
- {
- Method m = KeyboardFocusManager.class.
- getDeclaredMethod("processSynchronousLightweightTransfer",
- new Class[] {Component.class, Component.class,
- Boolean.TYPE, Boolean.TYPE,
- Long.TYPE});
- m.setAccessible(true);
- return m;
- }
- });
- }
- Object[] params = new Object[] {
- heavyweight,
- descendant,
- Boolean.valueOf(temporary),
- Boolean.valueOf(focusedWindowChangeAllowed),
- Long.valueOf(time)
- };
- return ((Boolean)processSynchronousLightweightTransferMethod.invoke(null, params)).booleanValue();
- } catch (PrivilegedActionException pae) {
- pae.printStackTrace();
- return false;
- } catch (IllegalAccessException iae) {
- iae.printStackTrace();
- return false;
- } catch (IllegalArgumentException iaee) {
- iaee.printStackTrace();
- return false;
- } catch (InvocationTargetException ite) {
- ite.printStackTrace();
- return false;
- }
- }
-
- static Method requestFocusWithCause;
-
- static void callRequestFocus(Component target, CausedFocusEvent.Cause cause) {
- if (requestFocusWithCause == null) {
- requestFocusWithCause = SunToolkit.getMethod(Component.class, "requestFocus", new Class[] {CausedFocusEvent.Cause.class});
- }
- if (requestFocusWithCause != null) {
- try {
- requestFocusWithCause.invoke(target, new Object[] {cause});
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- }
-
+ // TODO: consider moving it to KeyboardFocusManagerPeerImpl
final public boolean requestFocus(Component lightweightChild, boolean temporary,
- boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause)
+ boolean focusedWindowChangeAllowed, long time,
+ CausedFocusEvent.Cause cause)
{
- if (processSynchronousLightweightTransfer(target, lightweightChild, temporary,
+ if (XKeyboardFocusManagerPeer.
+ processSynchronousLightweightTransfer(target, lightweightChild, temporary,
focusedWindowChangeAllowed, time))
{
return true;
}
- int result = XKeyboardFocusManagerPeer
- .shouldNativelyFocusHeavyweight(target, lightweightChild,
- temporary, focusedWindowChangeAllowed, time, cause);
+ int result = XKeyboardFocusManagerPeer.
+ shouldNativelyFocusHeavyweight(target, lightweightChild,
+ temporary, focusedWindowChangeAllowed,
+ time, cause);
switch (result) {
- case SNFH_FAILURE:
+ case XKeyboardFocusManagerPeer.SNFH_FAILURE:
return false;
- case SNFH_SUCCESS_PROCEED:
+ case XKeyboardFocusManagerPeer.SNFH_SUCCESS_PROCEED:
// Currently we just generate focus events like we deal with lightweight instead of calling
// XSetInputFocus on native window
if (focusLog.isLoggable(Level.FINER)) focusLog.finer("Proceeding with request to " +
@@ -434,7 +343,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
* focus owner which had focus before WLF. So, we should not add request record for such requests
* but store this component in mostRecent - and return true as before for compatibility.
*/
- Window parentWindow = getContainingWindow(target);
+ Window parentWindow = SunToolkit.getContainingWindow(target);
if (parentWindow == null) {
return rejectFocusRequestHelper("WARNING: Parent window is null");
}
@@ -455,14 +364,13 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
if (!(res && parentWindow.isFocused())) {
return rejectFocusRequestHelper("Waiting for asynchronous processing of the request");
}
-
- // NOTE: We simulate heavyweight behavior of Motif - component receives focus right
- // after request, not after event. Normally, we should better listen for event
- // by listeners.
- return XKeyboardFocusManagerPeer.simulateMotifRequestFocus(lightweightChild, target, temporary,
- focusedWindowChangeAllowed, time, cause);
+ return XKeyboardFocusManagerPeer.deliverFocus(lightweightChild,
+ (Component)target,
+ temporary,
+ focusedWindowChangeAllowed,
+ time, cause);
// Motif compatibility code
- case SNFH_SUCCESS_HANDLED:
+ case XKeyboardFocusManagerPeer.SNFH_SUCCESS_HANDLED:
// Either lightweight or excessive request - all events are generated.
return true;
}
@@ -471,7 +379,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
private boolean rejectFocusRequestHelper(String logMsg) {
if (focusLog.isLoggable(Level.FINER)) focusLog.finer(logMsg);
- KeyboardFocusManagerPeerImpl.removeLastFocusRequest(target);
+ XKeyboardFocusManagerPeer.removeLastFocusRequest(target);
return false;
}
@@ -615,8 +523,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
void handleJavaMouseEvent(MouseEvent e) {
switch (e.getID()) {
case MouseEvent.MOUSE_PRESSED:
- if (target == e.getSource() && shouldFocusOnClick()
- && !target.isFocusOwner() && canBeFocusedByClick(target))
+ if (target == e.getSource() &&
+ !target.isFocusOwner() &&
+ XKeyboardFocusManagerPeer.shouldFocusOnClick(target))
{
XWindowPeer parentXWindow = getParentTopLevel();
Window parentWindow = ((Window)parentXWindow.getTarget());
@@ -630,7 +539,7 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
// WindowEvent wfg = new WindowEvent(parentWindow, WindowEvent.WINDOW_GAINED_FOCUS);
// parentWindow.dispatchEvent(wfg);
// }
- callRequestFocus(target, CausedFocusEvent.Cause.MOUSE_EVENT);
+ XKeyboardFocusManagerPeer.requestFocusFor(target, CausedFocusEvent.Cause.MOUSE_EVENT);
}
break;
}
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java
index 8b44a7293ac..b3474ffdb8e 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbedChildProxyPeer.java
@@ -184,6 +184,7 @@ public class XEmbedChildProxyPeer implements ComponentPeer, XEventDispatcher{
fl = new FocusEvent(currentOwner, FocusEvent.FOCUS_LOST, false, lightweightChild);
}
+ // TODO: do we need to wrap in sequenced?
if (fl != null) {
postEvent(XComponentPeer.wrapInSequenced(fl));
}
@@ -203,9 +204,9 @@ public class XEmbedChildProxyPeer implements ComponentPeer, XEventDispatcher{
temporary, false, time, cause);
switch (result) {
- case XComponentPeer.SNFH_FAILURE:
+ case XKeyboardFocusManagerPeer.SNFH_FAILURE:
return false;
- case XComponentPeer.SNFH_SUCCESS_PROCEED:
+ case XKeyboardFocusManagerPeer.SNFH_SUCCESS_PROCEED:
// Currently we just generate focus events like we deal with lightweight instead of calling
// XSetInputFocus on native window
@@ -235,9 +236,11 @@ public class XEmbedChildProxyPeer implements ComponentPeer, XEventDispatcher{
// NOTE: We simulate heavyweight behavior of Motif - component receives focus right
// after request, not after event. Normally, we should better listen for event
// by listeners.
+
+ // TODO: consider replacing with XKeyboardFocusManagerPeer.deliverFocus
return simulateMotifRequestFocus(lightweightChild, temporary, focusedWindowChangeAllowed, time);
// Motif compatibility code
- case XComponentPeer.SNFH_SUCCESS_HANDLED:
+ case XKeyboardFocusManagerPeer.SNFH_SUCCESS_HANDLED:
// Either lightweight or excessive requiest - all events are generated.
return true;
}
diff --git a/jdk/src/solaris/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java
index c4a10be59fd..434de63ab2b 100644
--- a/jdk/src/solaris/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java
+++ b/jdk/src/solaris/classes/sun/awt/X11/XKeyboardFocusManagerPeer.java
@@ -31,6 +31,7 @@ import java.awt.Window;
import java.awt.event.FocusEvent;
import java.awt.peer.KeyboardFocusManagerPeer;
+import java.awt.peer.ComponentPeer;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -40,136 +41,73 @@ import java.util.logging.Logger;
import sun.awt.CausedFocusEvent;
import sun.awt.SunToolkit;
+import sun.awt.KeyboardFocusManagerPeerImpl;
-public class XKeyboardFocusManagerPeer implements KeyboardFocusManagerPeer {
+public class XKeyboardFocusManagerPeer extends KeyboardFocusManagerPeerImpl {
private static final Logger focusLog = Logger.getLogger("sun.awt.X11.focus.XKeyboardFocusManagerPeer");
- KeyboardFocusManager manager;
-
- XKeyboardFocusManagerPeer(KeyboardFocusManager manager) {
- this.manager = manager;
- }
private static Object lock = new Object() {};
private static Component currentFocusOwner;
private static Window currentFocusedWindow;
- static void setCurrentNativeFocusOwner(Component comp) {
- if (focusLog.isLoggable(Level.FINER)) focusLog.finer("Setting current native focus owner " + comp);
- synchronized(lock) {
+ XKeyboardFocusManagerPeer(KeyboardFocusManager manager) {
+ super(manager);
+ }
+
+ @Override
+ public void setCurrentFocusOwner(Component comp) {
+ setCurrentNativeFocusOwner(comp);
+ }
+
+ @Override
+ public Component getCurrentFocusOwner() {
+ return getCurrentNativeFocusOwner();
+ }
+
+ @Override
+ public Window getCurrentFocusedWindow() {
+ return getCurrentNativeFocusedWindow();
+ }
+
+ public static void setCurrentNativeFocusOwner(Component comp) {
+ synchronized (lock) {
currentFocusOwner = comp;
}
}
- static void setCurrentNativeFocusedWindow(Window win) {
+ public static Component getCurrentNativeFocusOwner() {
+ synchronized(lock) {
+ return currentFocusOwner;
+ }
+ }
+
+ public static void setCurrentNativeFocusedWindow(Window win) {
if (focusLog.isLoggable(Level.FINER)) focusLog.finer("Setting current native focused window " + win);
synchronized(lock) {
currentFocusedWindow = win;
}
}
- static Component getCurrentNativeFocusOwner() {
- synchronized(lock) {
- return currentFocusOwner;
- }
- }
-
- static Window getCurrentNativeFocusedWindow() {
+ public static Window getCurrentNativeFocusedWindow() {
synchronized(lock) {
return currentFocusedWindow;
}
}
- public Window getCurrentFocusedWindow() {
- return getCurrentNativeFocusedWindow();
- }
-
- public void setCurrentFocusOwner(Component comp) {
- setCurrentNativeFocusOwner(comp);
- }
-
- public Component getCurrentFocusOwner() {
- return getCurrentNativeFocusOwner();
- }
-
- public void clearGlobalFocusOwner(Window activeWindow) {
- if (activeWindow != null) {
- Component focusOwner = activeWindow.getFocusOwner();
- if (focusLog.isLoggable(Level.FINE)) focusLog.fine("Clearing global focus owner " + focusOwner);
- if (focusOwner != null) {
-// XComponentPeer nativePeer = XComponentPeer.getNativeContainer(focusOwner);
-// if (nativePeer != null) {
- FocusEvent fl = new CausedFocusEvent(focusOwner, FocusEvent.FOCUS_LOST, false, null,
- CausedFocusEvent.Cause.CLEAR_GLOBAL_FOCUS_OWNER);
- XWindow.sendEvent(fl);
-// }
- }
- }
- }
-
- static boolean simulateMotifRequestFocus(Component lightweightChild, Component target, boolean temporary,
- boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause)
+ // TODO: do something to eliminate this forwarding
+ public static boolean deliverFocus(Component lightweightChild,
+ Component target,
+ boolean temporary,
+ boolean focusedWindowChangeAllowed,
+ long time,
+ CausedFocusEvent.Cause cause)
{
- if (lightweightChild == null) {
- lightweightChild = (Component)target;
- }
- Component currentOwner = XKeyboardFocusManagerPeer.getCurrentNativeFocusOwner();
- if (currentOwner != null && currentOwner.getPeer() == null) {
- currentOwner = null;
- }
- if (focusLog.isLoggable(Level.FINER)) focusLog.finer("Simulating transfer from " + currentOwner + " to " + lightweightChild);
- FocusEvent fg = new CausedFocusEvent(lightweightChild, FocusEvent.FOCUS_GAINED, false, currentOwner, cause);
- FocusEvent fl = null;
- if (currentOwner != null) {
- fl = new CausedFocusEvent(currentOwner, FocusEvent.FOCUS_LOST, false, lightweightChild, cause);
- }
-
- if (fl != null) {
- XWindow.sendEvent(fl);
- }
- XWindow.sendEvent(fg);
- return true;
- }
-
- static Method shouldNativelyFocusHeavyweightMethod;
-
- static int shouldNativelyFocusHeavyweight(Component heavyweight,
- Component descendant, boolean temporary,
- boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause)
- {
- if (shouldNativelyFocusHeavyweightMethod == null) {
- Class[] arg_types =
- new Class[] { Component.class,
- Component.class,
- Boolean.TYPE,
- Boolean.TYPE,
- Long.TYPE,
- CausedFocusEvent.Cause.class
- };
-
- shouldNativelyFocusHeavyweightMethod =
- SunToolkit.getMethod(KeyboardFocusManager.class,
- "shouldNativelyFocusHeavyweight",
- arg_types);
- }
- Object[] args = new Object[] { heavyweight,
- descendant,
- Boolean.valueOf(temporary),
- Boolean.valueOf(focusedWindowChangeAllowed),
- Long.valueOf(time), cause};
-
- int result = XComponentPeer.SNFH_FAILURE;
- if (shouldNativelyFocusHeavyweightMethod != null) {
- try {
- result = ((Integer) shouldNativelyFocusHeavyweightMethod.invoke(null, args)).intValue();
- }
- catch (IllegalAccessException e) {
- assert false;
- }
- catch (InvocationTargetException e) {
- assert false;
- }
- }
-
- return result;
+ return KeyboardFocusManagerPeerImpl.deliverFocus(lightweightChild,
+ target,
+ temporary,
+ focusedWindowChangeAllowed,
+ time,
+ cause,
+ getCurrentNativeFocusOwner());
}
}
diff --git a/jdk/src/windows/classes/sun/awt/windows/WChoicePeer.java b/jdk/src/windows/classes/sun/awt/windows/WChoicePeer.java
index 20ab610ff36..b72e6f741ab 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WChoicePeer.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WChoicePeer.java
@@ -27,6 +27,10 @@ package sun.awt.windows;
import java.awt.*;
import java.awt.peer.*;
import java.awt.event.ItemEvent;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowListener;
+import java.awt.event.WindowAdapter;
+import sun.awt.SunToolkit;
class WChoicePeer extends WComponentPeer implements ChoicePeer {
@@ -70,6 +74,8 @@ class WChoicePeer extends WComponentPeer implements ChoicePeer {
public synchronized native void reshape(int x, int y, int width, int height);
+ private WindowListener windowListener;
+
// Toolkit & peer internals
WChoicePeer(Choice target) {
@@ -91,9 +97,38 @@ class WChoicePeer extends WComponentPeer implements ChoicePeer {
select(opt.getSelectedIndex());
}
}
+
+ Window parentWindow = SunToolkit.getContainingWindow((Component)target);
+ if (parentWindow != null) {
+ WWindowPeer wpeer = (WWindowPeer)parentWindow.getPeer();
+ if (wpeer != null) {
+ windowListener = new WindowAdapter() {
+ public void windowIconified(WindowEvent e) {
+ closeList();
+ }
+ public void windowClosing(WindowEvent e) {
+ closeList();
+ }
+ };
+ wpeer.addWindowListener(windowListener);
+ }
+ }
super.initialize();
}
+ protected void disposeImpl() {
+ // TODO: we should somehow reset the listener when the choice
+ // is moved to another toplevel without destroying its peer.
+ Window parentWindow = SunToolkit.getContainingWindow((Component)target);
+ if (parentWindow != null) {
+ WWindowPeer wpeer = (WWindowPeer)parentWindow.getPeer();
+ if (wpeer != null) {
+ wpeer.removeWindowListener(windowListener);
+ }
+ }
+ super.disposeImpl();
+ }
+
// native callbacks
void handleAction(final int index) {
@@ -121,4 +156,5 @@ class WChoicePeer extends WComponentPeer implements ChoicePeer {
return getMinimumSize();
}
+ native void closeList();
}
diff --git a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java
index 6f2837739f8..2f895640ccb 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java
@@ -38,6 +38,10 @@ import java.awt.image.ColorModel;
import java.awt.event.PaintEvent;
import java.awt.event.InvocationEvent;
import java.awt.event.KeyEvent;
+import java.awt.event.FocusEvent;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseWheelEvent;
+import java.awt.event.InputEvent;
import sun.awt.Win32GraphicsConfig;
import sun.awt.Win32GraphicsEnvironment;
import sun.java2d.InvalidPipeException;
@@ -68,6 +72,7 @@ public abstract class WComponentPeer extends WObjectPeer
private static final Logger log = Logger.getLogger("sun.awt.windows.WComponentPeer");
private static final Logger shapeLog = Logger.getLogger("sun.awt.windows.shape.WComponentPeer");
+ private static final Logger focusLog = Logger.getLogger("sun.awt.windows.focus.WComponentPeer");
// ComponentPeer implementation
SurfaceData surfaceData;
@@ -296,14 +301,35 @@ public abstract class WComponentPeer extends WObjectPeer
// on handling '\n' to prevent it from being passed to native code
public boolean handleJavaKeyEvent(KeyEvent e) { return false; }
+ public void handleJavaMouseEvent(MouseEvent e) {
+ switch (e.getID()) {
+ case MouseEvent.MOUSE_PRESSED:
+ // Note that Swing requests focus in its own mouse event handler.
+ if (target == e.getSource() &&
+ !((Component)target).isFocusOwner() &&
+ WKeyboardFocusManagerPeer.shouldFocusOnClick((Component)target))
+ {
+ WKeyboardFocusManagerPeer.requestFocusFor((Component)target,
+ CausedFocusEvent.Cause.MOUSE_EVENT);
+ }
+ break;
+ }
+ }
+
native void nativeHandleEvent(AWTEvent e);
public void handleEvent(AWTEvent e) {
int id = e.getID();
- if (((Component)target).isEnabled() && (e instanceof KeyEvent) && !((KeyEvent)e).isConsumed()) {
- if (handleJavaKeyEvent((KeyEvent)e)) {
- return;
+ if ((e instanceof InputEvent) && !((InputEvent)e).isConsumed() &&
+ ((Component)target).isEnabled())
+ {
+ if (e instanceof MouseEvent && !(e instanceof MouseWheelEvent)) {
+ handleJavaMouseEvent((MouseEvent) e);
+ } else if (e instanceof KeyEvent) {
+ if (handleJavaKeyEvent((KeyEvent)e)) {
+ return;
+ }
}
}
@@ -319,6 +345,9 @@ public abstract class WComponentPeer extends WObjectPeer
paintArea.paint(target,shouldClearRectBeforePaint());
}
return;
+ case FocusEvent.FOCUS_LOST:
+ case FocusEvent.FOCUS_GAINED:
+ handleJavaFocusEvent((FocusEvent)e);
default:
break;
}
@@ -327,6 +356,13 @@ public abstract class WComponentPeer extends WObjectPeer
nativeHandleEvent(e);
}
+ void handleJavaFocusEvent(FocusEvent fe) {
+ if (focusLog.isLoggable(Level.FINER)) focusLog.finer(fe.toString());
+ setFocus(fe.getID() == FocusEvent.FOCUS_GAINED);
+ }
+
+ native void setFocus(boolean doSetFocus);
+
public Dimension getMinimumSize() {
return ((Component)target).getSize();
}
@@ -572,22 +608,64 @@ public abstract class WComponentPeer extends WObjectPeer
WGlobalCursorManager.getCursorManager().updateCursorImmediately();
}
- native static boolean processSynchronousLightweightTransfer(Component heavyweight, Component descendant,
- boolean temporary, boolean focusedWindowChangeAllowed,
- long time);
- public boolean requestFocus
- (Component lightweightChild, boolean temporary,
- boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause) {
- if (processSynchronousLightweightTransfer((Component)target, lightweightChild, temporary,
- focusedWindowChangeAllowed, time)) {
+ // TODO: consider moving it to KeyboardFocusManagerPeerImpl
+ public boolean requestFocus(Component lightweightChild, boolean temporary,
+ boolean focusedWindowChangeAllowed, long time,
+ CausedFocusEvent.Cause cause)
+ {
+ if (WKeyboardFocusManagerPeer.
+ processSynchronousLightweightTransfer((Component)target, lightweightChild, temporary,
+ focusedWindowChangeAllowed, time))
+ {
return true;
- } else {
- return _requestFocus(lightweightChild, temporary, focusedWindowChangeAllowed, time, cause);
}
+
+ int result = WKeyboardFocusManagerPeer
+ .shouldNativelyFocusHeavyweight((Component)target, lightweightChild,
+ temporary, focusedWindowChangeAllowed,
+ time, cause);
+
+ switch (result) {
+ case WKeyboardFocusManagerPeer.SNFH_FAILURE:
+ return false;
+ case WKeyboardFocusManagerPeer.SNFH_SUCCESS_PROCEED:
+ if (focusLog.isLoggable(Level.FINER)) {
+ focusLog.finer("Proceeding with request to " + lightweightChild + " in " + target);
+ }
+ Window parentWindow = SunToolkit.getContainingWindow((Component)target);
+ if (parentWindow == null) {
+ return rejectFocusRequestHelper("WARNING: Parent window is null");
+ }
+ WWindowPeer wpeer = (WWindowPeer)parentWindow.getPeer();
+ if (wpeer == null) {
+ return rejectFocusRequestHelper("WARNING: Parent window's peer is null");
+ }
+ boolean res = wpeer.requestWindowFocus(cause);
+
+ if (focusLog.isLoggable(Level.FINER)) focusLog.finer("Requested window focus: " + res);
+ // If parent window can be made focused and has been made focused(synchronously)
+ // then we can proceed with children, otherwise we retreat.
+ if (!(res && parentWindow.isFocused())) {
+ return rejectFocusRequestHelper("Waiting for asynchronous processing of the request");
+ }
+ return WKeyboardFocusManagerPeer.deliverFocus(lightweightChild,
+ (Component)target,
+ temporary,
+ focusedWindowChangeAllowed,
+ time, cause);
+
+ case WKeyboardFocusManagerPeer.SNFH_SUCCESS_HANDLED:
+ // Either lightweight or excessive request - all events are generated.
+ return true;
+ }
+ return false;
+ }
+
+ private boolean rejectFocusRequestHelper(String logMsg) {
+ if (focusLog.isLoggable(Level.FINER)) focusLog.finer(logMsg);
+ WKeyboardFocusManagerPeer.removeLastFocusRequest((Component)target);
+ return false;
}
- public native boolean _requestFocus
- (Component lightweightChild, boolean temporary,
- boolean focusedWindowChangeAllowed, long time, CausedFocusEvent.Cause cause);
public Image createImage(ImageProducer producer) {
return new ToolkitImage(producer);
@@ -718,9 +796,12 @@ public abstract class WComponentPeer extends WObjectPeer
* Post an event. Queue it for execution by the callback thread.
*/
void postEvent(AWTEvent event) {
+ preprocessPostEvent(event);
WToolkit.postEvent(WToolkit.targetToAppContext(target), event);
}
+ void preprocessPostEvent(AWTEvent event) {}
+
// Routines to support deferred window positioning.
public void beginLayout() {
// Skip all painting till endLayout
diff --git a/jdk/src/windows/classes/sun/awt/windows/WKeyboardFocusManagerPeer.java b/jdk/src/windows/classes/sun/awt/windows/WKeyboardFocusManagerPeer.java
new file mode 100644
index 00000000000..89289960316
--- /dev/null
+++ b/jdk/src/windows/classes/sun/awt/windows/WKeyboardFocusManagerPeer.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+package sun.awt.windows;
+
+import java.awt.KeyboardFocusManager;
+import java.awt.Window;
+import java.awt.Component;
+import java.awt.peer.ComponentPeer;
+import sun.awt.KeyboardFocusManagerPeerImpl;
+import sun.awt.CausedFocusEvent;
+
+class WKeyboardFocusManagerPeer extends KeyboardFocusManagerPeerImpl {
+ static native void setNativeFocusOwner(ComponentPeer peer);
+ static native Component getNativeFocusOwner();
+ static native Window getNativeFocusedWindow();
+
+ WKeyboardFocusManagerPeer(KeyboardFocusManager manager) {
+ super(manager);
+ }
+
+ @Override
+ public void setCurrentFocusOwner(Component comp) {
+ setNativeFocusOwner(comp != null ? comp.getPeer() : null);
+ }
+
+ @Override
+ public Component getCurrentFocusOwner() {
+ return getNativeFocusOwner();
+ }
+
+ @Override
+ public Window getCurrentFocusedWindow() {
+ return getNativeFocusedWindow();
+ }
+
+ public static boolean deliverFocus(Component lightweightChild,
+ Component target,
+ boolean temporary,
+ boolean focusedWindowChangeAllowed,
+ long time,
+ CausedFocusEvent.Cause cause)
+ {
+ // TODO: do something to eliminate this forwarding
+ return KeyboardFocusManagerPeerImpl.deliverFocus(lightweightChild,
+ target,
+ temporary,
+ focusedWindowChangeAllowed,
+ time,
+ cause,
+ getNativeFocusOwner());
+ }
+}
diff --git a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java
index 5376e8ff720..62011b9b85c 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WToolkit.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WToolkit.java
@@ -494,6 +494,12 @@ public class WToolkit extends SunToolkit implements Runnable {
return true;
}
+ public KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager)
+ throws HeadlessException
+ {
+ return new WKeyboardFocusManagerPeer(manager);
+ }
+
protected native void setDynamicLayoutNative(boolean b);
public void setDynamicLayout(boolean b) {
diff --git a/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java b/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java
index 73f9e3f811f..b60cbd2f1ff 100644
--- a/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java
+++ b/jdk/src/windows/classes/sun/awt/windows/WWindowPeer.java
@@ -77,6 +77,12 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
private final static PropertyChangeListener guiDisposedListener =
new GuiDisposedListener();
+ /*
+ * Called (on the Toolkit thread) before the appropriate
+ * WindowStateEvent is posted to the EventQueue.
+ */
+ private WindowListener windowListener;
+
/**
* Initialize JNI field IDs
*/
@@ -232,27 +238,64 @@ public class WWindowPeer extends WPanelPeer implements WindowPeer,
int[] smallIconRaster, int smw, int smh);
synchronized native void reshapeFrame(int x, int y, int width, int height);
- public boolean requestWindowFocus() {
- // Win32 window doesn't need this
- return false;
+
+ public boolean requestWindowFocus(CausedFocusEvent.Cause cause) {
+ if (!focusAllowedFor()) {
+ return false;
+ }
+ return requestWindowFocus(cause == CausedFocusEvent.Cause.MOUSE_EVENT);
}
+ public native boolean requestWindowFocus(boolean isMouseEventCause);
public boolean focusAllowedFor() {
- Window target = (Window)this.target;
- if (!target.isVisible() ||
- !target.isEnabled() ||
- !target.isFocusable())
+ Window window = (Window)this.target;
+ if (!window.isVisible() ||
+ !window.isEnabled() ||
+ !window.isFocusableWindow())
{
return false;
}
-
if (isModalBlocked()) {
return false;
}
-
return true;
}
+ public void hide() {
+ WindowListener listener = windowListener;
+ if (listener != null) {
+ // We're not getting WINDOW_CLOSING from the native code when hiding
+ // the window programmatically. So, create it and notify the listener.
+ listener.windowClosing(new WindowEvent((Window)target, WindowEvent.WINDOW_CLOSING));
+ }
+ super.hide();
+ }
+
+ // WARNING: it's called on the Toolkit thread!
+ void preprocessPostEvent(AWTEvent event) {
+ if (event instanceof WindowEvent) {
+ WindowListener listener = windowListener;
+ if (listener != null) {
+ switch(event.getID()) {
+ case WindowEvent.WINDOW_CLOSING:
+ listener.windowClosing((WindowEvent)event);
+ break;
+ case WindowEvent.WINDOW_ICONIFIED:
+ listener.windowIconified((WindowEvent)event);
+ break;
+ }
+ }
+ }
+ }
+
+ synchronized void addWindowListener(WindowListener l) {
+ windowListener = AWTEventMulticaster.add(windowListener, l);
+ }
+
+ synchronized void removeWindowListener(WindowListener l) {
+ windowListener = AWTEventMulticaster.remove(windowListener, l);
+ }
+
public void updateMinimumSize() {
Dimension minimumSize = null;
if (((Component)target).isMinimumSizeSet()) {
diff --git a/jdk/src/windows/native/sun/windows/awt_Button.cpp b/jdk/src/windows/native/sun/windows/awt_Button.cpp
index 3764655cba4..2fb620fcd14 100644
--- a/jdk/src/windows/native/sun/windows/awt_Button.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Button.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -30,7 +30,6 @@
#include "awt_Button.h"
#include "awt_Canvas.h"
#include "awt_Window.h"
-#include "awt_KeyboardFocusManager.h"
/* IMPORTANT! Read the README.JNI file for notes on JNI converted AWT code.
*/
@@ -143,19 +142,6 @@ done:
return c;
}
-BOOL AwtButton::ActMouseMessage(MSG * pMsg) {
- if (!IsFocusingMessage(pMsg->message)) {
- return FALSE;
- }
-
- if (pMsg->message == WM_LBUTTONDOWN) {
- SendMessage(BM_SETSTATE, TRUE, 0);
- } else if (pMsg->message == WM_LBUTTONUP) {
- SendMessage(BM_SETSTATE, FALSE, 0);
- }
- return TRUE;
-}
-
MsgRouting
AwtButton::WmMouseDown(UINT flags, int x, int y, int button)
{
@@ -204,23 +190,6 @@ AwtButton::NotifyListeners()
(jint)AwtComponent::GetJavaModifiers());
}
-/* 4531849 fix. Previous to 1.4, mouse clicks and typing space bar on a
- * Button would notify ActionListeners via WM_COMMAND/WmNotify(). In 1.4, mouse
- * grabs are done for all presses in order to correctly send drag and release
- * events. However, WM_COMMAND message aren't sent when the mouse is grabbed,
- * so ActionListeners for mouse clicks are sent via WmMouseUp/WmNotify().
- * For some reason, if the right mouse button is held down when left-clicking
- * on a Button, WM_COMMAND _IS_ sent. This resulted in two ActionEvents being
- * sent in this case. To fix the problem, we handle typing space bar similar to
- * left clicks - in WmKeyUp(), and do nothing for WM_COMMAND. -bchristi
- */
-MsgRouting
-AwtButton::WmKeyUp(UINT wkey, UINT repCnt, UINT flags, BOOL system)
-{
- MsgRouting mrResult = AwtComponent::WmKeyUp(wkey, repCnt, flags, system);
- return mrResult;
-}
-
MsgRouting
AwtButton::OwnerDrawItem(UINT /*ctrlId*/, DRAWITEMSTRUCT& drawInfo)
{
@@ -293,18 +262,26 @@ MsgRouting AwtButton::WmPaint(HDC)
return mrDoDefault;
}
+BOOL AwtButton::IsFocusingMouseMessage(MSG *pMsg) {
+ return pMsg->message == WM_LBUTTONDOWN || pMsg->message == WM_LBUTTONUP;
+}
+
+BOOL AwtButton::IsFocusingKeyMessage(MSG *pMsg) {
+ return (pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP) &&
+ pMsg->wParam == VK_SPACE;
+}
+
MsgRouting AwtButton::HandleEvent(MSG *msg, BOOL synthetic)
{
- if (AwtComponent::sm_focusOwner != GetHWnd() &&
- (msg->message == WM_LBUTTONDOWN || msg->message == WM_LBUTTONDBLCLK))
- {
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- jobject target = GetTarget(env);
- env->CallStaticVoidMethod
- (AwtKeyboardFocusManager::keyboardFocusManagerCls,
- AwtKeyboardFocusManager::heavyweightButtonDownMID,
- target, ((jlong)msg->time) & 0xFFFFFFFF);
- env->DeleteLocalRef(target);
+ if (IsFocusingMouseMessage(msg)) {
+ SendMessage(BM_SETSTATE, msg->message == WM_LBUTTONDOWN ? TRUE : FALSE, 0);
+ delete msg;
+ return mrConsume;
+ }
+ if (IsFocusingKeyMessage(msg)) {
+ SendMessage(BM_SETSTATE, msg->message == WM_KEYDOWN ? TRUE : FALSE, 0);
+ delete msg;
+ return mrConsume;
}
return AwtComponent::HandleEvent(msg, synthetic);
}
diff --git a/jdk/src/windows/native/sun/windows/awt_Button.h b/jdk/src/windows/native/sun/windows/awt_Button.h
index 795fbf9b5de..5e6d2754aea 100644
--- a/jdk/src/windows/native/sun/windows/awt_Button.h
+++ b/jdk/src/windows/native/sun/windows/awt_Button.h
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2004 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -50,13 +50,13 @@ public:
/* Windows message handler functions */
MsgRouting WmMouseDown(UINT flags, int x, int y, int button);
MsgRouting WmMouseUp(UINT flags, int x, int y, int button);
- MsgRouting WmKeyUp(UINT vkey, UINT repCnt, UINT flags, BOOL system);
MsgRouting OwnerDrawItem(UINT ctrlId, DRAWITEMSTRUCT& drawInfo);
MsgRouting WmPaint(HDC hDC);
MsgRouting HandleEvent(MSG *msg, BOOL synthetic);
- BOOL ActMouseMessage(MSG * pMsg);
+ BOOL IsFocusingMouseMessage(MSG *pMsg);
+ BOOL IsFocusingKeyMessage(MSG *pMsg);
// called on Toolkit thread from JNI
static void _SetLabel(void *param);
diff --git a/jdk/src/windows/native/sun/windows/awt_Canvas.cpp b/jdk/src/windows/native/sun/windows/awt_Canvas.cpp
index 4988152b8dd..b03a79817ce 100644
--- a/jdk/src/windows/native/sun/windows/awt_Canvas.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Canvas.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -26,7 +26,6 @@
#include "awt_Toolkit.h"
#include "awt_Canvas.h"
#include "awt_Win32GraphicsConfig.h"
-#include "awt_KeyboardFocusManager.h"
#include "awt_Window.h"
/* IMPORTANT! Read the README.JNI file for notes on JNI converted AWT code.
@@ -176,27 +175,9 @@ MsgRouting AwtCanvas::WmPaint(HDC)
MsgRouting AwtCanvas::HandleEvent(MSG *msg, BOOL synthetic)
{
- if (msg->message == WM_LBUTTONDOWN || msg->message == WM_LBUTTONDBLCLK) {
- /*
- * Fix for BugTraq ID 4041703: keyDown not being invoked.
- * Give the focus to a Canvas or Panel if it doesn't have heavyweight
- * subcomponents so that they will behave the same way as on Solaris
- * providing a possibility of giving keyboard focus to an empty Applet.
- * Since ScrollPane doesn't receive focus on mouse press on Solaris,
- * HandleEvent() is overriden there to do nothing with focus.
- */
- if (AwtComponent::sm_focusOwner != GetHWnd() &&
- ::GetWindow(GetHWnd(), GW_CHILD) == NULL)
- {
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- jobject target = GetTarget(env);
- env->CallStaticVoidMethod
- (AwtKeyboardFocusManager::keyboardFocusManagerCls,
- AwtKeyboardFocusManager::heavyweightButtonDownMID,
- target, ((jlong)msg->time) & 0xFFFFFFFF);
- env->DeleteLocalRef(target);
- AwtSetFocus();
- }
+ if (IsFocusingMouseMessage(msg)) {
+ delete msg;
+ return mrConsume;
}
return AwtComponent::HandleEvent(msg, synthetic);
}
diff --git a/jdk/src/windows/native/sun/windows/awt_Checkbox.cpp b/jdk/src/windows/native/sun/windows/awt_Checkbox.cpp
index 2e8cf9923db..2830e56813b 100644
--- a/jdk/src/windows/native/sun/windows/awt_Checkbox.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Checkbox.cpp
@@ -26,7 +26,6 @@
#include "awt.h"
#include "awt_Toolkit.h"
#include "awt_Checkbox.h"
-#include "awt_KeyboardFocusManager.h"
#include "awt_Canvas.h"
#include "awt_Window.h"
@@ -143,17 +142,6 @@ done:
return checkbox;
}
-BOOL AwtCheckbox::ActMouseMessage(MSG* pMsg) {
- if (!IsFocusingMessage(pMsg->message)) {
- return FALSE;
- }
-
- if (pMsg->message == WM_LBUTTONDOWN) {
- SendMessage(BM_SETSTATE, ~SendMessage(BM_GETSTATE, 0, 0), 0);
- }
- return TRUE;
-}
-
MsgRouting
AwtCheckbox::WmMouseUp(UINT flags, int x, int y, int button)
{
@@ -329,18 +317,32 @@ MsgRouting AwtCheckbox::WmPaint(HDC)
return mrDoDefault;
}
+BOOL AwtCheckbox::IsFocusingMouseMessage(MSG *pMsg) {
+ return pMsg->message == WM_LBUTTONDOWN || pMsg->message == WM_LBUTTONUP;
+}
+
+BOOL AwtCheckbox::IsFocusingKeyMessage(MSG *pMsg) {
+ return (pMsg->message == WM_KEYDOWN || pMsg->message == WM_KEYUP) &&
+ pMsg->wParam == VK_SPACE;
+}
+
MsgRouting AwtCheckbox::HandleEvent(MSG *msg, BOOL synthetic)
{
- if (IsFocusable() && AwtComponent::sm_focusOwner != GetHWnd() &&
- (msg->message == WM_LBUTTONDOWN || msg->message == WM_LBUTTONDBLCLK))
- {
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- jobject target = GetTarget(env);
- env->CallStaticVoidMethod
- (AwtKeyboardFocusManager::keyboardFocusManagerCls,
- AwtKeyboardFocusManager::heavyweightButtonDownMID,
- target, ((jlong)msg->time) & 0xFFFFFFFF);
- env->DeleteLocalRef(target);
+ if (IsFocusingMouseMessage(msg)) {
+ SendMessage(BM_SETSTATE, (WPARAM)(msg->message == WM_LBUTTONDOWN ? TRUE : FALSE));
+ delete msg;
+ return mrConsume;
+ }
+ if (IsFocusingKeyMessage(msg)) {
+ SendMessage(BM_SETSTATE, (WPARAM)(msg->message == WM_KEYDOWN ? TRUE : FALSE));
+ if (msg->message == WM_KEYDOWN) {
+ m_fLButtonDowned = TRUE;
+ } else if (m_fLButtonDowned == TRUE) {
+ WmNotify(BN_CLICKED);
+ m_fLButtonDowned = TRUE;
+ }
+ delete msg;
+ return mrConsume;
}
return AwtComponent::HandleEvent(msg, synthetic);
}
diff --git a/jdk/src/windows/native/sun/windows/awt_Checkbox.h b/jdk/src/windows/native/sun/windows/awt_Checkbox.h
index 581afcd6505..4d913da00fb 100644
--- a/jdk/src/windows/native/sun/windows/awt_Checkbox.h
+++ b/jdk/src/windows/native/sun/windows/awt_Checkbox.h
@@ -69,7 +69,8 @@ public:
MsgRouting HandleEvent(MSG *msg, BOOL synthetic);
- BOOL ActMouseMessage(MSG* pMsg);
+ BOOL IsFocusingMouseMessage(MSG *pMsg);
+ BOOL IsFocusingKeyMessage(MSG *pMsg);
// called on Toolkit thread from JNI
static void _SetLabel(void *param);
diff --git a/jdk/src/windows/native/sun/windows/awt_Choice.cpp b/jdk/src/windows/native/sun/windows/awt_Choice.cpp
index ca7adb0ed6e..cfbf2b863ad 100644
--- a/jdk/src/windows/native/sun/windows/awt_Choice.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Choice.cpp
@@ -23,14 +23,17 @@
* have any questions.
*/
+#include
+
#include "awt_Toolkit.h"
#include "awt_Choice.h"
-#include "awt_KeyboardFocusManager.h"
#include "awt_Canvas.h"
#include "awt_Dimension.h"
#include "awt_Container.h"
+#include "ComCtl32Util.h"
+
#include
#include
#include
@@ -71,18 +74,29 @@ BOOL AwtChoice::mouseCapture = FALSE;
/* Bug #4338368: consume the spurious MouseUp when the choice loses focus */
BOOL AwtChoice::skipNextMouseUp = FALSE;
+
+BOOL AwtChoice::sm_isMouseMoveInList = FALSE;
+
/*************************************************************************
* AwtChoice class methods
*/
AwtChoice::AwtChoice() {
- killFocusRouting = mrPassAlong;
+ m_hList = NULL;
+ m_listDefWindowProc = NULL;
}
LPCTSTR AwtChoice::GetClassName() {
return TEXT("COMBOBOX"); /* System provided combobox class */
}
+void AwtChoice::Dispose() {
+ if (m_hList != NULL && m_listDefWindowProc != NULL) {
+ ComCtl32Util::GetInstance().UnsubclassHWND(m_hList, ListWindowProc, m_listDefWindowProc);
+ }
+ AwtComponent::Dispose();
+}
+
AwtChoice* AwtChoice::Create(jobject peer, jobject parent) {
@@ -175,17 +189,6 @@ done:
return c;
}
-BOOL AwtChoice::ActMouseMessage(MSG* pMsg) {
- if (!IsFocusingMessage(pMsg->message)) {
- return FALSE;
- }
-
- if (pMsg->message == WM_LBUTTONDOWN) {
- SendMessage(CB_SHOWDROPDOWN, ~SendMessage(CB_GETDROPPEDSTATE, 0, 0), 0);
- }
- return TRUE;
-}
-
// calculate height of drop-down list part of the combobox
// to show all the items up to a maximum of eight
int AwtChoice::GetDropDownHeight()
@@ -253,6 +256,7 @@ void AwtChoice::SetDragCapture(UINT flags)
}
return;
}
+
// don't want to interfere with other controls
if (::GetCapture() == NULL) {
::SetCapture(GetHWnd());
@@ -370,6 +374,58 @@ void AwtChoice::SetFont(AwtFont* font)
env->DeleteLocalRef(target);
}
+static int lastClickX = -1;
+static int lastClickY = -1;
+
+LRESULT CALLBACK AwtChoice::ListWindowProc(HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam)
+{
+ /*
+ * We don't pass the choice WM_LBUTTONDOWN message. As the result the choice's list
+ * doesn't forward mouse messages it captures. Below we do forward what we need.
+ */
+
+ TRY;
+
+ DASSERT(::IsWindow(hwnd));
+
+ switch (message) {
+ case WM_LBUTTONDOWN: {
+ DWORD curPos = ::GetMessagePos();
+ lastClickX = GET_X_LPARAM(curPos);
+ lastClickY = GET_Y_LPARAM(curPos);
+ break;
+ }
+ case WM_MOUSEMOVE: {
+ RECT rect;
+ ::GetClientRect(hwnd, &rect);
+
+ POINT pt = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
+ if (::PtInRect(&rect, pt)) {
+ sm_isMouseMoveInList = TRUE;
+ }
+
+ POINT lastPt = {lastClickX, lastClickY};
+ ::ScreenToClient(hwnd, &lastPt);
+ if (::PtInRect(&rect, lastPt)) {
+ break; // ignore when dragging inside the list
+ }
+ }
+ case WM_LBUTTONUP: {
+ lastClickX = -1;
+ lastClickY = -1;
+
+ AwtChoice *c = (AwtChoice *)::GetWindowLongPtr(hwnd, GWLP_USERDATA);
+ if (c != NULL) {
+ // forward the msg to the choice
+ c->WindowProc(message, wParam, lParam);
+ }
+ }
+ }
+ return ComCtl32Util::GetInstance().DefWindowProc(NULL, hwnd, message, wParam, lParam);
+
+ CATCH_BAD_ALLOC_RET(0);
+}
MsgRouting AwtChoice::WmNotify(UINT notifyCode)
@@ -379,15 +435,24 @@ MsgRouting AwtChoice::WmNotify(UINT notifyCode)
if (itemSelect != CB_ERR){
DoCallback("handleAction", "(I)V", itemSelect);
}
- } else if (notifyCode == CBN_DROPDOWN && !IsFocusable()) {
- // While non-focusable Choice is shown all WM_KILLFOCUS messages should be consumed.
- killFocusRouting = mrConsume;
- } else if (notifyCode == CBN_CLOSEUP && !IsFocusable()) {
- // When non-focusable Choice is about to close, send it synthetic WM_KILLFOCUS
- // message that should be processed by the native widget only. This will allow
- // the native widget to properly process WM_KILLFOCUS that was earlier consumed.
- killFocusRouting = mrDoDefault;
- ::PostMessage(GetHWnd(), WM_KILLFOCUS, (LPARAM)sm_focusOwner, 0);
+ } else if (notifyCode == CBN_DROPDOWN) {
+
+ if (m_hList == NULL) {
+ COMBOBOXINFO cbi;
+ cbi.cbSize = sizeof(COMBOBOXINFO);
+ ::GetComboBoxInfo(GetHWnd(), &cbi);
+ m_hList = cbi.hwndList;
+ m_listDefWindowProc = ComCtl32Util::GetInstance().SubclassHWND(m_hList, ListWindowProc);
+ DASSERT(::GetWindowLongPtr(m_hList, GWLP_USERDATA) == NULL);
+ ::SetWindowLongPtr(m_hList, GWLP_USERDATA, (LONG_PTR)this);
+ }
+ sm_isMouseMoveInList = FALSE;
+
+ // Clicking in the dropdown list steals focus from the proxy.
+ // So, set the focus-restore flag up.
+ SetRestoreFocus(TRUE);
+ } else if (notifyCode == CBN_CLOSEUP) {
+ SetRestoreFocus(FALSE);
}
return mrDoDefault;
}
@@ -414,19 +479,7 @@ MsgRouting
AwtChoice::WmKillFocus(HWND hWndGotFocus)
{
skipNextMouseUp = TRUE;
-
- switch (killFocusRouting) {
- case mrConsume:
- return mrConsume;
- case mrDoDefault:
- killFocusRouting = mrPassAlong;
- return mrDoDefault;
- case mrPassAlong:
- return AwtComponent::WmKillFocus(hWndGotFocus);
- }
-
- DASSERT(false); // must never reach here
- return mrDoDefault;
+ return AwtComponent::WmKillFocus(hWndGotFocus);
}
MsgRouting
@@ -441,27 +494,17 @@ AwtChoice::WmMouseUp(UINT flags, int x, int y, int button)
MsgRouting AwtChoice::HandleEvent(MSG *msg, BOOL synthetic)
{
- /*
- * 6366006
- * Note: the event can be sent in two cases:
- * 1) The Choice is closed and user clicks on it to drop it down.
- * 2) The Choice is non-focusable, it's droped down, user
- * clicks on it (or outside) to close it.
- * So, if the Choice is in droped down state, we shouldn't call
- * heavyweightButtonDown() method. Otherwise it will set a typeahead marker
- * that won't be removed, because no focus events will be generated.
- */
- if (AwtComponent::sm_focusOwner != GetHWnd() &&
- (msg->message == WM_LBUTTONDOWN || msg->message == WM_LBUTTONDBLCLK) &&
- !IsChoiceOpened())
+ if (IsFocusingMouseMessage(msg)) {
+ SendMessage(CB_SHOWDROPDOWN, ~SendMessage(CB_GETDROPPEDSTATE, 0, 0), 0);
+ delete msg;
+ return mrConsume;
+ }
+ // To simulate the native behavior, we close the list on WM_LBUTTONUP if
+ // WM_MOUSEMOVE has been dedected on the list since it has been dropped down.
+ if (msg->message == WM_LBUTTONUP && SendMessage(CB_GETDROPPEDSTATE, 0, 0) &&
+ sm_isMouseMoveInList)
{
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- jobject target = GetTarget(env);
- env->CallStaticVoidMethod
- (AwtKeyboardFocusManager::keyboardFocusManagerCls,
- AwtKeyboardFocusManager::heavyweightButtonDownMID,
- target, ((jlong)msg->time) & 0xFFFFFFFF);
- env->DeleteLocalRef(target);
+ SendMessage(CB_SHOWDROPDOWN, FALSE, 0);
}
return AwtComponent::HandleEvent(msg, synthetic);
}
@@ -618,6 +661,26 @@ done:
env->DeleteGlobalRef(choice);
}
+void AwtChoice::_CloseList(void *param)
+{
+ JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
+
+ jobject choice = (jobject)param;
+
+ AwtChoice *c = NULL;
+
+ PDATA pData;
+ JNI_CHECK_PEER_GOTO(choice, done);
+
+ c = (AwtChoice *)pData;
+ if (::IsWindow(c->GetHWnd()) && c->SendMessage(CB_GETDROPPEDSTATE, 0, 0)) {
+ c->SendMessage(CB_SHOWDROPDOWN, FALSE, 0);
+ }
+
+done:
+ env->DeleteGlobalRef(choice);
+}
+
/************************************************************************
* WChoicePeer native methods
*/
@@ -752,6 +815,23 @@ Java_sun_awt_windows_WChoicePeer_create(JNIEnv *env, jobject self,
CATCH_BAD_ALLOC;
}
+/*
+ * Class: sun_awt_windows_WChoicePeer
+ * Method: closeList
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL
+Java_sun_awt_windows_WChoicePeer_closeList(JNIEnv *env, jobject self)
+{
+ TRY;
+
+ jobject selfGlobalRef = env->NewGlobalRef(self);
+
+ AwtToolkit::GetInstance().SyncCall(AwtChoice::_CloseList, (void *)selfGlobalRef);
+ // global ref is deleted in _CloseList
+
+ CATCH_BAD_ALLOC;
+}
} /* extern "C" */
diff --git a/jdk/src/windows/native/sun/windows/awt_Choice.h b/jdk/src/windows/native/sun/windows/awt_Choice.h
index 075cb0c5ed9..35e9174745e 100644
--- a/jdk/src/windows/native/sun/windows/awt_Choice.h
+++ b/jdk/src/windows/native/sun/windows/awt_Choice.h
@@ -43,6 +43,8 @@ public:
virtual LPCTSTR GetClassName();
static AwtChoice* Create(jobject peer, jobject hParent);
+ virtual void Dispose();
+
virtual void Reshape(int x, int y, int w, int h);
void ResetDropDownHeight();
int GetDropDownHeight();
@@ -75,9 +77,6 @@ public:
virtual void SetDragCapture(UINT flags);
virtual void ReleaseDragCapture(UINT flags);
- BOOL ActMouseMessage(MSG * pMsg);
- INLINE BOOL AwtChoice::IsChoiceOpened() {return SendMessage(CB_GETDROPPEDSTATE, 0, 0);}
-
static BOOL mouseCapture;
static BOOL skipNextMouseUp;
@@ -87,11 +86,16 @@ public:
static void _AddItems(void *param);
static void _Remove(void *param);
static void _RemoveAll(void *param);
+ static void _CloseList(void *param);
private:
int GetFieldHeight();
int GetTotalHeight();
- MsgRouting killFocusRouting;
+ static BOOL sm_isMouseMoveInList;
+ HWND m_hList;
+ WNDPROC m_listDefWindowProc;
+ static LRESULT CALLBACK ListWindowProc(HWND hwnd, UINT message,
+ WPARAM wParam, LPARAM lParam);
};
#endif /* AWT_CHOICE_H */
diff --git a/jdk/src/windows/native/sun/windows/awt_Component.cpp b/jdk/src/windows/native/sun/windows/awt_Component.cpp
index e2eaf995123..959998d9ec1 100644
--- a/jdk/src/windows/native/sun/windows/awt_Component.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Component.cpp
@@ -38,7 +38,6 @@
#include "awt_InputTextInfor.h"
#include "awt_Insets.h"
#include "awt_KeyEvent.h"
-#include "awt_KeyboardFocusManager.h"
#include "awt_MenuItem.h"
#include "awt_MouseEvent.h"
#include "awt_Palette.h"
@@ -58,7 +57,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -94,12 +92,13 @@ extern "C" {
BOOL g_bUserHasChangedInputLang = FALSE;
}
-BOOL AwtComponent::sm_suppressFocusAndActivation;
-HWND AwtComponent::sm_focusOwner;
-HWND AwtComponent::sm_focusedWindow;
-HWND AwtComponent::sm_realFocusOpposite;
+BOOL AwtComponent::sm_suppressFocusAndActivation = FALSE;
+BOOL AwtComponent::sm_restoreFocusAndActivation = FALSE;
+HWND AwtComponent::sm_focusOwner = NULL;
+HWND AwtComponent::sm_focusedWindow = NULL;
BOOL AwtComponent::sm_bMenuLoop = FALSE;
AwtComponent* AwtComponent::sm_getComponentCache = NULL;
+BOOL AwtComponent::sm_inSynthesizeFocus = FALSE;
/************************************************************************/
// Struct for _Reshape() and ReshapeNoCheck() methods
@@ -123,15 +122,6 @@ struct SetFontStruct {
jobject component;
jobject font;
};
-// Struct for _RequestFocus() method
-struct RequestFocusStruct {
- jobject component;
- jobject lightweightChild;
- jboolean temporary;
- jboolean focusedWindowChangeAllowed;
- jlong time;
- jobject cause;
-};
// Struct for _CreatePrintedPixels() method
struct CreatePrintedPixelsStruct {
jobject component;
@@ -154,6 +144,11 @@ struct SetZOrderStruct {
jobject component;
jlong above;
};
+// Struct for _SetFocus function
+struct SetFocusStruct {
+ jobject component;
+ jboolean doSetFocus;
+};
/************************************************************************/
//////////////////////////////////////////////////////////////////////////
@@ -239,7 +234,6 @@ AwtComponent::AwtComponent()
m_InputMethod = NULL;
m_useNativeCompWindow = TRUE;
m_PendingLeadByte = 0;
- m_skipNextSetFocus = FALSE;
m_bitsCandType = 0;
windowMoveLockPosX = 0;
@@ -277,15 +271,8 @@ AwtComponent::~AwtComponent()
void AwtComponent::Dispose()
{
- if (sm_focusOwner == GetHWnd()) {
- ::SetFocus(NULL);
- }
- if (sm_focusedWindow == GetHWnd()) {
- sm_focusedWindow = NULL;
- }
- if (sm_realFocusOpposite == GetHWnd()) {
- sm_realFocusOpposite = NULL;
- }
+ // NOTE: in case the component/toplevel was focused, Java should
+ // have already taken care of proper transfering it or clearing.
if (m_hdwp != NULL) {
// end any deferred window positioning, regardless
@@ -890,27 +877,8 @@ void AwtComponent::Show()
void AwtComponent::Hide()
{
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- jobject peer = GetPeer(env);
- BOOL oldValue = sm_suppressFocusAndActivation;
m_visible = false;
-
- // On disposal the focus owner actually loses focus at the moment of hiding.
- // So, focus change suppression (if requested) should be made here.
- if (GetHWnd() == sm_focusOwner &&
- !JNU_CallMethodByName(env, NULL, peer, "isAutoFocusTransferOnDisposal", "()Z").z)
- {
- sm_suppressFocusAndActivation = TRUE;
- // The native system may autotransfer focus on hiding to the parent
- // of the component. Nevertheless this focus change won't be posted
- // to the Java level, we're better to avoid this. Anyway, after
- // the disposal focus should be requested to the right component.
- ::SetFocus(NULL);
- sm_focusOwner = NULL;
- }
::ShowWindow(GetHWnd(), SW_HIDE);
-
- sm_suppressFocusAndActivation = oldValue;
}
BOOL
@@ -1254,6 +1222,7 @@ void SpyWinMessage(HWND hwnd, UINT message, LPCTSTR szComment) {
WIN_MSG(WM_AWT_COMPONENT_SHOW)
WIN_MSG(WM_AWT_COMPONENT_HIDE)
WIN_MSG(WM_AWT_COMPONENT_SETFOCUS)
+ WIN_MSG(WM_AWT_WINDOW_SETACTIVE)
WIN_MSG(WM_AWT_LIST_SETMULTISELECT)
WIN_MSG(WM_AWT_HANDLE_EVENT)
WIN_MSG(WM_AWT_PRINT_COMPONENT)
@@ -1505,67 +1474,54 @@ LRESULT AwtComponent::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
sm_bMenuLoop = FALSE;
break;
+ // We don't expect any focus messages on non-proxy component,
+ // except those that came from Java.
case WM_SETFOCUS:
- mr = (!sm_suppressFocusAndActivation && !m_skipNextSetFocus)
- ? WmSetFocus((HWND)wParam) : mrConsume;
- m_skipNextSetFocus = FALSE;
+ if (sm_inSynthesizeFocus) {
+ mr = WmSetFocus((HWND)wParam);
+ } else {
+ mr = mrConsume;
+ }
break;
case WM_KILLFOCUS:
- mr = (!sm_suppressFocusAndActivation)
- ? WmKillFocus((HWND)wParam) : mrConsume;
+ if (sm_inSynthesizeFocus) {
+ mr = WmKillFocus((HWND)wParam);
+ } else {
+ mr = mrConsume;
+ }
break;
- case WM_ACTIVATE:
- {
+ case WM_ACTIVATE: {
UINT nState = LOWORD(wParam);
BOOL fMinimized = (BOOL)HIWORD(wParam);
+ mr = mrConsume;
+
if (!sm_suppressFocusAndActivation &&
(!fMinimized || (nState == WA_INACTIVE)))
{
mr = WmActivate(nState, fMinimized, (HWND)lParam);
- m_skipNextSetFocus = FALSE;
+
// When the window is deactivated, send WM_IME_ENDCOMPOSITION
// message to deactivate the composition window so that
// it won't receive keyboard input focus.
if (ImmGetContext() != NULL) {
DefWindowProc(WM_IME_ENDCOMPOSITION, 0, 0);
}
- } else {
- if (!sm_suppressFocusAndActivation
- && fMinimized && (nState != WA_INACTIVE))
- {
- m_skipNextSetFocus = TRUE;
- }
- mr = mrConsume;
}
+ break;
+ }
+ case WM_MOUSEACTIVATE: {
+ AwtWindow *window = GetContainer();
+ if (window && window->IsFocusableWindow()) {
+ // AWT/Swing will later request focus to a proper component
+ // on handling the Java mouse event. Anyway, we have to
+ // activate the window here as it works both for AWT & Swing.
+ // Do it in our own fassion,
+ window->AwtSetActiveWindow(TRUE, LOWORD(lParam)/*hittest*/);
+ }
+ mr = mrConsume;
+ retValue = MA_NOACTIVATE;
+ break;
}
- break;
- case WM_MOUSEACTIVATE: {
- AwtWindow * window = (AwtWindow*)GetComponent((HWND)wParam);
- if (window != NULL) {
- if (!window->IsFocusableWindow()) {
- // if it is non-focusable window we can return
- // MA_NOACTIVATExxx and it will not be activated. We
- // return NOACTIVATE for a client part of the window so we
- // receive mouse event responsible for activation. We
- // return NOACTIVEA for Frame's non-client so user be able
- // to resize and move frames by title and borders. We
- // return NOACTIVATEANDEAT for Window non-client area as
- // there is noone to listen for this event.
- mr = mrConsume;
- if ((window == this) && LOWORD(lParam) != HTCLIENT ) {
- if (window->IsSimpleWindow()) {
- retValue = MA_NOACTIVATEANDEAT;
- } else {
- retValue = MA_NOACTIVATE;
- }
- } else {
- retValue = MA_NOACTIVATE;
- }
- }
- }
- break;
- }
-
case WM_CTLCOLORMSGBOX:
case WM_CTLCOLOREDIT:
case WM_CTLCOLORLISTBOX:
@@ -1922,7 +1878,15 @@ LRESULT AwtComponent::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
break;
case WM_AWT_COMPONENT_SETFOCUS:
- retValue = (LRESULT)WmComponentSetFocus((WmComponentSetFocusData *)wParam);
+ if ((BOOL)wParam) {
+ retValue = SynthesizeWmSetFocus(GetHWnd(), NULL);
+ } else {
+ retValue = SynthesizeWmKillFocus(GetHWnd(), NULL);
+ }
+ mr = mrConsume;
+ break;
+ case WM_AWT_WINDOW_SETACTIVE:
+ retValue = (LRESULT)((AwtWindow*)this)->AwtSetActiveWindow((BOOL)wParam);
mr = mrConsume;
break;
@@ -2050,188 +2014,16 @@ MsgRouting AwtComponent::WmShowWindow(BOOL show, UINT status)
MsgRouting AwtComponent::WmSetFocus(HWND hWndLostFocus)
{
- if (sm_focusOwner == GetHWnd()) {
- sm_realFocusOpposite = NULL;
- return mrConsume;
- }
-
- HWND toplevelHWnd = AwtComponent::GetTopLevelParentForWindow(GetHWnd());
- AwtComponent *comp = AwtComponent::GetComponent(toplevelHWnd);
-
- if (comp && comp->IsEmbeddedFrame() &&
- !((AwtFrame*)comp)->activateEmbeddedFrameOnSetFocus(hWndLostFocus))
- {
- // Fix for 6562716.
- // In order that AwtSetFocus() returns FALSE.
- sm_suppressFocusAndActivation = TRUE;
- ::SetFocus(NULL);
- sm_suppressFocusAndActivation = FALSE;
-
- return mrConsume;
- }
-
- sm_focusOwner = GetHWnd();
- sm_focusedWindow = toplevelHWnd;
-
- if (sm_realFocusOpposite != NULL) {
- hWndLostFocus = sm_realFocusOpposite;
- sm_realFocusOpposite = NULL;
- }
-
sm_wheelRotationAmount = 0;
-
- SendFocusEvent(java_awt_event_FocusEvent_FOCUS_GAINED, hWndLostFocus);
-
return mrDoDefault;
}
MsgRouting AwtComponent::WmKillFocus(HWND hWndGotFocus)
{
- if (sm_focusOwner != NULL && sm_focusOwner == hWndGotFocus) {
- return mrConsume;
- }
-
- if (sm_focusOwner != GetHWnd()) {
- if (sm_focusOwner != NULL) {
- if (hWndGotFocus != NULL &&
- AwtComponent::GetComponent(hWndGotFocus) != NULL)
- {
- sm_realFocusOpposite = sm_focusOwner;
- }
- ::SendMessage(sm_focusOwner, WM_KILLFOCUS, (WPARAM)hWndGotFocus,
- 0);
- }
- return mrConsume;
- }
-
- AwtComponent *comp = AwtComponent::GetComponent(sm_focusedWindow);
-
- if (comp && comp->IsEmbeddedFrame()) {
- ((AwtFrame*)comp)->deactivateEmbeddedFrameOnKillFocus(hWndGotFocus);
- }
-
- sm_focusOwner = NULL;
sm_wheelRotationAmount = 0;
-
- SendFocusEvent(java_awt_event_FocusEvent_FOCUS_LOST, hWndGotFocus);
return mrDoDefault;
}
-jboolean
-AwtComponent::WmComponentSetFocus(WmComponentSetFocusData *data)
-{
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- if (env->EnsureLocalCapacity(1) < 0) {
- env->DeleteGlobalRef(data->lightweightChild);
- delete data;
- return JNI_FALSE;
- }
-
- jboolean result = JNI_FALSE;
-
- BOOL setSuppressFocusAndActivation = FALSE;
-
- /*
- * This is a fix for 4628933.
- * If sm_suppressFocusAndActivation is TRUE here then
- * this means that we dispatch WM_COMPONENT_SET_FOCUS inside
- * dispatching bounce activation, this unlikely but possible.
- * So we reset sm_suppressFocusAndActivation to give a chance
- * to dispatch focus events which will generate due this focus
- * request to Java.
- *
- * son@sparc.spb.su
- */
- if (sm_suppressFocusAndActivation) {
- sm_suppressFocusAndActivation = FALSE;
- setSuppressFocusAndActivation = TRUE;
- }
-
- jobject heavyweight = GetTarget(env);
- jint retval = env->CallStaticIntMethod
- (AwtKeyboardFocusManager::keyboardFocusManagerCls,
- AwtKeyboardFocusManager::shouldNativelyFocusHeavyweightMID,
- heavyweight, data->lightweightChild, data->temporary,
- data->focusedWindowChangeAllowed, data->time, data->cause);
-
- if (retval == java_awt_KeyboardFocusManager_SNFH_SUCCESS_HANDLED) {
- result = JNI_TRUE;
- } else if (retval == java_awt_KeyboardFocusManager_SNFH_SUCCESS_PROCEED) {
- result = (AwtSetFocus()) ? JNI_TRUE : JNI_FALSE;
- if (result == JNI_FALSE) {
- env->CallStaticVoidMethod
- (AwtKeyboardFocusManager::keyboardFocusManagerCls,
- AwtKeyboardFocusManager::removeLastFocusRequestMID,
- heavyweight);
- }
- } else {
- DASSERT(retval == java_awt_KeyboardFocusManager_SNFH_FAILURE);
- result = JNI_FALSE;
- }
- env->DeleteLocalRef(heavyweight);
-
- /*
- * Set sm_suppressFocusAndActivation back to TRUE if needed.
- * Fix for 4628933 (son@sparc.spb.su)
- */
- if (setSuppressFocusAndActivation) {
- sm_suppressFocusAndActivation = TRUE;
- }
-
- env->DeleteGlobalRef(data->lightweightChild);
- delete data;
- return result;
-}
-
-BOOL
-AwtComponent::AwtSetFocus()
-{
- HWND hwnd = GetHWnd();
-
- if (sm_focusOwner == hwnd) {
- return TRUE;
- }
-
- HWND fgWindow = ::GetForegroundWindow();
- if (NULL != fgWindow) {
- DWORD fgProcessID;
- ::GetWindowThreadProcessId(fgWindow, &fgProcessID);
-
- if (fgProcessID != ::GetCurrentProcessId()
- && !AwtToolkit::GetInstance().IsEmbedderProcessId(fgProcessID))
- {
- // fix for 6458497. we shouldn't request focus if it is out of both
- // our and embedder process.
- return FALSE;
- }
- }
-
- AwtWindow *pCont = GetContainer();
- AwtFrame *owner = pCont ? pCont->GetOwningFrameOrDialog() : NULL;
-
- if (owner == NULL) {
- ::SetFocus(hwnd);
- if (::GetFocus() != hwnd) {
- return FALSE;
- }
- } else {
- HWND oldFocusOwner = sm_focusOwner;
- if (oldFocusOwner != NULL) {
- ::SendMessage(oldFocusOwner, WM_KILLFOCUS, (WPARAM)hwnd, 0);
- }
-
- sm_suppressFocusAndActivation = TRUE;
- ::SetActiveWindow(owner->GetHWnd());
- ::SetFocus(owner->GetProxyFocusOwner());
- sm_suppressFocusAndActivation = FALSE;
-
- sm_focusedWindow = GetTopLevelParentForWindow(GetHWnd());
- ::SendMessage(hwnd, WM_SETFOCUS, (WPARAM)oldFocusOwner, 0);
- }
-
- return TRUE;
-}
-
MsgRouting AwtComponent::WmCtlColor(HDC hDC, HWND hCtrl,
UINT ctlColor, HBRUSH& retBrush)
{
@@ -2526,7 +2318,6 @@ MsgRouting AwtComponent::WmMouseDown(UINT flags, int x, int y, int button)
AwtWindow::GetGrabbedWindow()->Ungrab();
}
}
-
return mrConsume;
}
@@ -4035,14 +3826,15 @@ HIMC AwtComponent::ImmAssociateContext(HIMC himc)
HWND AwtComponent::GetProxyFocusOwner()
{
- AwtWindow * window = GetContainer();
+ AwtWindow *window = GetContainer();
if (window != 0) {
- AwtFrame * owner = window->GetOwningFrameOrDialog();
+ AwtFrame *owner = window->GetOwningFrameOrDialog();
if (owner != 0) {
return owner->GetProxyFocusOwner();
+ } else if (!window->IsSimpleWindow()) { // isn't an owned simple window
+ return ((AwtFrame*)window)->GetProxyFocusOwner();
}
}
-
return (HWND)NULL;
}
@@ -4640,25 +4432,52 @@ jintArray AwtComponent::CreatePrintedPixels(SIZE &loc, SIZE &size) {
return pixelArray;
}
-void *
-AwtComponent::GetNativeFocusOwner() {
+void* AwtComponent::SetNativeFocusOwner(void *self) {
+ if (self == NULL) {
+ // It means that the KFM wants to set focus to null
+ sm_focusOwner = NULL;
+ return NULL;
+ }
+
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- AwtComponent *comp =
- AwtComponent::GetComponent(AwtComponent::sm_focusOwner);
- return (comp != NULL) ? comp->GetTargetAsGlobalRef(env) : NULL;
+
+ AwtComponent *c = NULL;
+ jobject peer = (jobject)self;
+
+ PDATA pData;
+ JNI_CHECK_NULL_GOTO(peer, "peer", ret);
+ pData = JNI_GET_PDATA(peer);
+ if (pData == NULL) {
+ goto ret;
+ }
+ c = (AwtComponent *)pData;
+
+ret:
+ if (c && ::IsWindow(c->GetHWnd())) {
+ sm_focusOwner = c->GetHWnd();
+ AwtFrame *owner = (AwtFrame*)GetComponent(c->GetProxyToplevelContainer());
+ if (owner) {
+ owner->SetLastProxiedFocusOwner(sm_focusOwner);
+ }
+ } else {
+ sm_focusOwner = NULL;
+ }
+ env->DeleteGlobalRef(peer);
+ return NULL;
}
-void *
-AwtComponent::GetNativeFocusedWindow() {
+
+void* AwtComponent::GetNativeFocusedWindow() {
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
AwtComponent *comp =
AwtComponent::GetComponent(AwtComponent::sm_focusedWindow);
return (comp != NULL) ? comp->GetTargetAsGlobalRef(env) : NULL;
}
-void
-AwtComponent::ClearGlobalFocusOwner() {
- if (AwtComponent::sm_focusOwner != NULL) {
- ::SetFocus(NULL);
- }
+
+void* AwtComponent::GetNativeFocusOwner() {
+ JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
+ AwtComponent *comp =
+ AwtComponent::GetComponent(AwtComponent::sm_focusOwner);
+ return (comp != NULL) ? comp->GetTargetAsGlobalRef(env) : NULL;
}
AwtComponent* AwtComponent::SearchChild(UINT id) {
@@ -5179,14 +4998,7 @@ void AwtComponent::SynthesizeMouseMessage(JNIEnv *env, jobject mouseEvent)
jint x = (env)->GetIntField(mouseEvent, AwtMouseEvent::xID);
jint y = (env)->GetIntField(mouseEvent, AwtMouseEvent::yID);
MSG* msg = CreateMessage(message, wParam, MAKELPARAM(x, y), x, y);
- // If the window is not focusable but if this is a focusing
- // message we should skip it then and perform our own actions.
- AwtWindow *pCont = GetContainer();
- if ((pCont && pCont->IsFocusableWindow()) || !ActMouseMessage(msg)) {
- PostHandleEventMessage(msg, TRUE);
- } else {
- delete msg;
- }
+ PostHandleEventMessage(msg, TRUE);
}
BOOL AwtComponent::InheritsNativeMouseWheelBehavior() {return false;}
@@ -5272,15 +5084,14 @@ void AwtComponent::UnlinkObjects()
void AwtComponent::Enable(BOOL bEnable)
{
- sm_suppressFocusAndActivation = TRUE;
-
if (bEnable && IsTopLevel()) {
// we should not enable blocked toplevels
bEnable = !::IsWindow(AwtWindow::GetModalBlocker(GetHWnd()));
}
+ // Shouldn't trigger native focus change
+ // (only the proxy may be the native focus owner).
::EnableWindow(GetHWnd(), bEnable);
- sm_suppressFocusAndActivation = FALSE;
CriticalSection::Lock l(GetLock());
VerifyState();
}
@@ -5307,23 +5118,12 @@ void AwtComponent::DestroyDropTarget() {
}
}
-/**
- * Special procedure responsible for performing the actions which
- * usually happen with component when mouse buttons are being
- * pressed. It is required in case of non-focusable components - we
- * don't pass mouse messages directly to the windows because otherwise
- * it will try to focus component first which we don't want. This
- * function receives MSG and should return TRUE if it processed the
- * message and no furhter processing is allowed, FALSE otherwise.
- * Default implementation returns TRUE it is the message on which
- * Windows try to focus the component. Descendant components write
- * their own implementation of this procedure.
- */
-BOOL AwtComponent::ActMouseMessage(MSG * pMsg) {
- if (IsFocusingMessage(pMsg->message)) {
- return TRUE;
- }
- return FALSE;
+BOOL AwtComponent::IsFocusingMouseMessage(MSG *pMsg) {
+ return pMsg->message == WM_LBUTTONDOWN || pMsg->message == WM_LBUTTONDBLCLK;
+}
+
+BOOL AwtComponent::IsFocusingKeyMessage(MSG *pMsg) {
+ return pMsg->message == WM_KEYDOWN && pMsg->wParam == VK_SPACE;
}
void AwtComponent::_Show(void *param)
@@ -5661,22 +5461,12 @@ void AwtComponent::_NativeHandleEvent(void *param)
return;
}
- /* Post the message directly to the subclassed component. */
- if (self && (pData = JNI_GET_PDATA(self))) {
- AwtComponent* p = (AwtComponent*)pData;
- // If the window is not focusable but if this is a focusing
- // message we should skip it then and perform our own actions.
- AwtWindow *pCont = (AwtWindow*)(p->GetContainer());
- if ((pCont && pCont->IsFocusableWindow()) ||
- !p->ActMouseMessage(&msg))
- {
- // Create copy for local msg
- MSG* pCopiedMsg = new MSG;
- memmove(pCopiedMsg, &msg, sizeof(MSG));
- // Event handler deletes msg
- p->PostHandleEventMessage(pCopiedMsg, FALSE);
- }
- }
+ // Create copy for local msg
+ MSG* pCopiedMsg = new MSG;
+ memmove(pCopiedMsg, &msg, sizeof(MSG));
+ // Event handler deletes msg
+ p->PostHandleEventMessage(pCopiedMsg, FALSE);
+
env->DeleteGlobalRef(self);
env->DeleteGlobalRef(event);
delete nhes;
@@ -5798,19 +5588,15 @@ ret:
delete sfs;
}
-jboolean AwtComponent::_RequestFocus(void *param)
+// Sets or kills focus for a component.
+void AwtComponent::_SetFocus(void *param)
{
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- RequestFocusStruct *rfs = (RequestFocusStruct *)param;
- jobject self = rfs->component;
- jobject lightweightChild = rfs->lightweightChild;
- jboolean temporary = rfs->temporary;
- jboolean focusedWindowChangeAllowed = rfs->focusedWindowChangeAllowed;
- jlong time = rfs->time;
- jobject cause = rfs->cause;
+ SetFocusStruct *sfs = (SetFocusStruct *)param;
+ jobject self = sfs->component;
+ jboolean doSetFocus = sfs->doSetFocus;
- jboolean result = JNI_FALSE;
AwtComponent *c = NULL;
PDATA pData;
@@ -5822,25 +5608,13 @@ jboolean AwtComponent::_RequestFocus(void *param)
}
c = (AwtComponent *)pData;
- if (::IsWindow(c->GetHWnd()))
- {
- WmComponentSetFocusData *data = new WmComponentSetFocusData;
- data->lightweightChild = env->NewGlobalRef(lightweightChild);
- data->temporary = temporary;
- data->focusedWindowChangeAllowed = focusedWindowChangeAllowed;
- data->time = time;
- data->cause = cause;
- result = (jboolean)c->SendMessage(WM_AWT_COMPONENT_SETFOCUS, (WPARAM)data, 0);
- // data and global ref in it are deleted in WmComponentSetFocus
+ if (::IsWindow(c->GetHWnd())) {
+ c->SendMessage(WM_AWT_COMPONENT_SETFOCUS, (WPARAM)doSetFocus, 0);
}
ret:
env->DeleteGlobalRef(self);
- env->DeleteGlobalRef(lightweightChild);
- env->DeleteGlobalRef(cause);
- delete rfs;
-
- return result;
+ delete sfs;
}
void AwtComponent::_Start(void *param)
@@ -6103,9 +5877,9 @@ void AwtComponent::SetParent(void * param) {
HWND selfWnd = comps[0]->GetHWnd();
HWND parentWnd = comps[1]->GetHWnd();
if (::IsWindow(selfWnd) && ::IsWindow(parentWnd)) {
- sm_suppressFocusAndActivation = TRUE;
+ // Shouldn't trigger native focus change
+ // (only the proxy may be the native focus owner).
::SetParent(selfWnd, parentWnd);
- sm_suppressFocusAndActivation = FALSE;
}
}
delete[] comps;
@@ -6632,31 +6406,25 @@ Java_sun_awt_windows_WComponentPeer__1setFont(JNIEnv *env, jobject self,
/*
* Class: sun_awt_windows_WComponentPeer
- * Method: requestFocus
- * Signature: (Ljava/awt/Component;ZZJ)Z
+ * Method: focusGained
+ * Signature: (Z)
*/
-JNIEXPORT jboolean JNICALL Java_sun_awt_windows_WComponentPeer__1requestFocus
- (JNIEnv *env, jobject self, jobject lightweightChild, jboolean temporary,
- jboolean focusedWindowChangeAllowed, jlong time, jobject cause)
+JNIEXPORT void JNICALL Java_sun_awt_windows_WComponentPeer_setFocus
+ (JNIEnv *env, jobject self, jboolean doSetFocus)
{
TRY;
jobject selfGlobalRef = env->NewGlobalRef(self);
- jobject lightweightChildGlobalRef = env->NewGlobalRef(lightweightChild);
- RequestFocusStruct *rfs = new RequestFocusStruct;
- rfs->component = selfGlobalRef;
- rfs->lightweightChild = lightweightChildGlobalRef;
- rfs->temporary = temporary;
- rfs->focusedWindowChangeAllowed = focusedWindowChangeAllowed;
- rfs->time = time;
- rfs->cause = env->NewGlobalRef(cause);
+ SetFocusStruct *sfs = new SetFocusStruct;
+ sfs->component = selfGlobalRef;
+ sfs->doSetFocus = doSetFocus;
- return (jboolean)AwtToolkit::GetInstance().SyncCall(
- (void*(*)(void*))AwtComponent::_RequestFocus, rfs);
- // global refs and rfs are deleted in _RequestFocus
+ AwtToolkit::GetInstance().SyncCall(
+ (void*(*)(void*))AwtComponent::_SetFocus, sfs);
+ // global refs and self are deleted in _SetFocus
- CATCH_BAD_ALLOC_RET(JNI_FALSE);
+ CATCH_BAD_ALLOC;
}
/*
@@ -6868,25 +6636,6 @@ Java_sun_awt_windows_WComponentPeer_isObscured(JNIEnv* env,
CATCH_BAD_ALLOC_RET(NULL);
}
-JNIEXPORT jboolean JNICALL
-Java_sun_awt_windows_WComponentPeer_processSynchronousLightweightTransfer(JNIEnv *env, jclass cls,
- jobject heavyweight,
- jobject descendant,
- jboolean temporary,
- jboolean focusedWindowChangeAllowed,
- jlong time)
-{
- TRY;
-
- return env->CallStaticBooleanMethod(AwtKeyboardFocusManager::keyboardFocusManagerCls,
- AwtKeyboardFocusManager::processSynchronousTransfer,
- heavyweight, descendant, temporary,
- focusedWindowChangeAllowed,
- time);
-
- CATCH_BAD_ALLOC_RET(JNI_TRUE);
-}
-
JNIEXPORT void JNICALL
Java_sun_awt_windows_WComponentPeer_pSetParent(JNIEnv* env, jobject self, jobject parent) {
TRY;
diff --git a/jdk/src/windows/native/sun/windows/awt_Component.h b/jdk/src/windows/native/sun/windows/awt_Component.h
index 31e8be2c879..148bdcfc005 100644
--- a/jdk/src/windows/native/sun/windows/awt_Component.h
+++ b/jdk/src/windows/native/sun/windows/awt_Component.h
@@ -78,8 +78,6 @@ class AwtPopupMenu;
class AwtDropTarget;
-struct WmComponentSetFocusData;
-
/*
* Message routing codes
*/
@@ -221,17 +219,10 @@ public:
virtual BOOL IsContainer() { return FALSE;} // Plain components can't
/**
- * Perform some actions which by default are being performed by Default Window procedure of
- * this window class
- * For detailed comments see implementation in awt_Component.cpp
+ * Returns TRUE if this message will trigger native focus change, FALSE otherwise.
*/
- virtual BOOL ActMouseMessage(MSG * pMsg);
- /**
- * Returns TRUE if this message will this component to become focused. Returns FALSE otherwise.
- */
- inline BOOL IsFocusingMessage(UINT message) {
- return message == WM_LBUTTONDOWN || message == WM_LBUTTONUP || message == WM_LBUTTONDBLCLK;
- }
+ virtual BOOL IsFocusingKeyMessage(MSG *pMsg);
+ virtual BOOL IsFocusingMouseMessage(MSG *pMsg);
BOOL IsFocusable();
@@ -477,6 +468,12 @@ public:
HIMC ImmGetContext();
HIMC ImmAssociateContext(HIMC himc);
HWND GetProxyFocusOwner();
+
+ INLINE HWND GetProxyToplevelContainer() {
+ HWND proxyHWnd = GetProxyFocusOwner();
+ return ::GetAncestor(proxyHWnd, GA_ROOT); // a browser in case of EmbeddedFrame
+ }
+
void CallProxyDefWindowProc(UINT message,
WPARAM wParam,
LPARAM lParam,
@@ -514,11 +511,6 @@ public:
virtual MsgRouting WmShowWindow(BOOL show, UINT status);
virtual MsgRouting WmSetFocus(HWND hWndLost);
virtual MsgRouting WmKillFocus(HWND hWndGot);
- jboolean WmComponentSetFocus(WmComponentSetFocusData *data);
- // Use instead of ::SetFocus to maintain special focusing semantics for
- // Windows which are not Frames/Dialogs.
- BOOL AwtSetFocus();
-
virtual MsgRouting WmCtlColor(HDC hDC, HWND hCtrl,
UINT ctlColor, HBRUSH& retBrush);
virtual MsgRouting WmHScroll(UINT scrollCode, UINT pos, HWND hScrollBar);
@@ -608,10 +600,6 @@ public:
jintArray CreatePrintedPixels(SIZE &loc, SIZE &size);
- static void * GetNativeFocusOwner();
- static void * GetNativeFocusedWindow();
- static void ClearGlobalFocusOwner();
-
/*
* HWND, AwtComponent and Java Peer interaction
*
@@ -670,7 +658,6 @@ public:
static void _SetForeground(void *param);
static void _SetBackground(void *param);
static void _SetFont(void *param);
- static jboolean _RequestFocus(void *param);
static void _Start(void *param);
static void _BeginValidate(void *param);
static void _EndValidate(void *param);
@@ -685,6 +672,29 @@ public:
static HWND sm_focusOwner;
static HWND sm_focusedWindow;
+ static void _SetFocus(void *param);
+
+ static void *SetNativeFocusOwner(void *self);
+ static void *GetNativeFocusedWindow();
+ static void *GetNativeFocusOwner();
+
+ static BOOL sm_inSynthesizeFocus;
+
+ // Execute on Toolkit only.
+ INLINE static LRESULT SynthesizeWmSetFocus(HWND targetHWnd, HWND oppositeHWnd) {
+ sm_inSynthesizeFocus = TRUE;
+ LRESULT res = ::SendMessage(targetHWnd, WM_SETFOCUS, (WPARAM)oppositeHWnd, 0);
+ sm_inSynthesizeFocus = FALSE;
+ return res;
+ }
+ // Execute on Toolkit only.
+ INLINE static LRESULT SynthesizeWmKillFocus(HWND targetHWnd, HWND oppositeHWnd) {
+ sm_inSynthesizeFocus = TRUE;
+ LRESULT res = ::SendMessage(targetHWnd, WM_KILLFOCUS, (WPARAM)oppositeHWnd, 0);
+ sm_inSynthesizeFocus = FALSE;
+ return res;
+ }
+
static BOOL sm_bMenuLoop;
static INLINE BOOL isMenuLoopActive() {
return sm_bMenuLoop;
@@ -708,7 +718,18 @@ protected:
BOOL m_visible; /* copy of Component.visible */
static BOOL sm_suppressFocusAndActivation;
- static HWND sm_realFocusOpposite;
+ static BOOL sm_restoreFocusAndActivation;
+
+ /*
+ * The function sets the focus-restore flag ON/OFF.
+ * When the flag is ON, focus is restored immidiately after the proxy loses it.
+ * All focus messages are suppressed. It's also assumed that sm_focusedWindow and
+ * sm_focusOwner don't change after the flag is set ON and before it's set OFF.
+ */
+ static INLINE void SetRestoreFocus(BOOL doSet) {
+ sm_suppressFocusAndActivation = doSet;
+ sm_restoreFocusAndActivation = doSet;
+ }
virtual void SetDragCapture(UINT flags);
virtual void ReleaseDragCapture(UINT flags);
@@ -778,8 +799,6 @@ private:
static BOOL m_QueryNewPaletteCalled;
- BOOL m_skipNextSetFocus;
-
static AwtComponent* sm_getComponentCache; // a cache for the GetComponent(..) method.
int windowMoveLockPosX;
@@ -874,14 +893,6 @@ public:
void RealizePalettes(int screen);
};
-struct WmComponentSetFocusData {
- jobject lightweightChild;
- jboolean temporary;
- jboolean focusedWindowChangeAllowed;
- jlong time;
- jobject cause;
-};
-
void ReleaseDCList(HWND hwnd, DCList &list);
void MoveDCToPassiveList(HDC hDC);
diff --git a/jdk/src/windows/native/sun/windows/awt_Frame.cpp b/jdk/src/windows/native/sun/windows/awt_Frame.cpp
index 94bb0050c9e..217b93cacc6 100644
--- a/jdk/src/windows/native/sun/windows/awt_Frame.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Frame.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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,8 +39,6 @@
#include
-BOOL isAppActive = FALSE;
-
/* IMPORTANT! Read the README.JNI file for notes on JNI converted AWT code.
*/
@@ -112,6 +110,7 @@ AwtFrame::AwtFrame() {
m_isInputMethodWindow = FALSE;
m_isUndecorated = FALSE;
m_proxyFocusOwner = NULL;
+ m_lastProxiedFocusOwner = NULL;
m_actualFocusedWindow = NULL;
m_iconic = FALSE;
m_zoomed = FALSE;
@@ -287,7 +286,6 @@ AwtFrame* AwtFrame::Create(jobject self, jobject parent)
::GetSysColor(COLOR_WINDOWTEXT),
::GetSysColor(COLOR_WINDOWFRAME),
self);
-
/*
* Reshape here instead of during create, so that a
* WM_NCCALCSIZE is sent.
@@ -327,7 +325,7 @@ LRESULT CALLBACK AwtFrame::ProxyWindowProc(HWND hwnd, UINT message,
return ComCtl32Util::GetInstance().DefWindowProc(NULL, hwnd, message, wParam, lParam);
}
- AwtComponent *p = NULL;
+ AwtComponent *focusOwner = NULL;
// IME and input language related messages need to be sent to a window
// which has the Java input focus
switch (message) {
@@ -345,16 +343,37 @@ LRESULT CALLBACK AwtFrame::ProxyWindowProc(HWND hwnd, UINT message,
case WM_IME_KEYUP:
case WM_INPUTLANGCHANGEREQUEST:
case WM_INPUTLANGCHANGE:
- p = AwtComponent::GetComponent(sm_focusOwner);
- if (p != NULL) {
- return p->WindowProc(message, wParam, lParam);
+ // TODO: when a Choice's list is dropped down and we're scrolling in
+ // the list WM_MOUSEWHEEL messages come to the poxy, not to the list. Why?
+ case WM_MOUSEWHEEL:
+ focusOwner = AwtComponent::GetComponent(parent->GetLastProxiedFocusOwner());
+ if (focusOwner != NULL) {
+ return focusOwner->WindowProc(message, wParam, lParam);
}
break;
+ case WM_SETFOCUS:
+ if (!sm_suppressFocusAndActivation && parent->IsEmbeddedFrame()) {
+ parent->AwtSetActiveWindow();
+ }
+ return 0;
+ case WM_KILLFOCUS:
+ if (!sm_suppressFocusAndActivation && parent->IsEmbeddedFrame()) {
+ AwtWindow::SynthesizeWmActivate(FALSE, parent->GetHWnd(), NULL);
+
+ } else if (sm_restoreFocusAndActivation) {
+ if (sm_focusedWindow != NULL) {
+ AwtWindow *focusedWindow = (AwtWindow*)GetComponent(sm_focusedWindow);
+ if (focusedWindow != NULL) {
+ // Will just silently restore native focus & activation.
+ focusedWindow->AwtSetActiveWindow();
+ }
+ }
+ }
+ return 0;
case 0x0127: // WM_CHANGEUISTATE
case 0x0128: // WM_UPDATEUISTATE
return 0;
}
-
return parent->WindowProc(message, wParam, lParam);
CATCH_BAD_ALLOC_RET(0);
@@ -557,7 +576,6 @@ MsgRouting AwtFrame::WmNcMouseDown(WPARAM hitTest, int x, int y, int button) {
if (m_grabbedWindow != NULL/* && !m_grabbedWindow->IsOneOfOwnersOf(this)*/) {
m_grabbedWindow->Ungrab();
}
-
if (!IsFocusableWindow() && (button & LEFT_BUTTON)) {
switch (hitTest) {
case HTTOP:
@@ -915,33 +933,16 @@ MsgRouting AwtFrame::WmSize(UINT type, int w, int h)
MsgRouting AwtFrame::WmActivate(UINT nState, BOOL fMinimized, HWND opposite)
{
jint type;
- BOOL doActivateFrame = TRUE;
if (nState != WA_INACTIVE) {
- if (!::IsWindow(AwtWindow::GetModalBlocker(GetHWnd()))) {
- ::SetFocus(NULL); // The KeyboardFocusManager will set focus later
- type = java_awt_event_WindowEvent_WINDOW_GAINED_FOCUS;
- isAppActive = TRUE;
- sm_focusedWindow = GetHWnd();
-
- /*
- * Fix for 4823903.
- * If the window to be focused is actually not this Frame
- * and it's visible then send it WM_ACTIVATE.
- */
- if (m_actualFocusedWindow != NULL) {
- HWND hwnd = m_actualFocusedWindow->GetHWnd();
-
- if (hwnd != NULL && ::IsWindowVisible(hwnd)) {
-
- ::SendMessage(hwnd, WM_ACTIVATE, MAKEWPARAM(nState, fMinimized), (LPARAM)opposite);
- doActivateFrame = FALSE;
- }
- m_actualFocusedWindow = NULL;
- }
- } else {
- doActivateFrame = FALSE;
+ if (::IsWindow(AwtWindow::GetModalBlocker(GetHWnd())) ||
+ CheckActivateActualFocusedWindow(opposite))
+ {
+ return mrConsume;
}
+ type = java_awt_event_WindowEvent_WINDOW_GAINED_FOCUS;
+ sm_focusedWindow = GetHWnd();
+
} else {
if (!::IsWindow(AwtWindow::GetModalBlocker(opposite))) {
// If deactivation happens because of press on grabbing
@@ -963,39 +964,65 @@ MsgRouting AwtFrame::WmActivate(UINT nState, BOOL fMinimized, HWND opposite)
}
}
}
-
- // If actual focused window is not this Frame
- if (sm_focusedWindow != GetHWnd()) {
-
- // Check that the Frame is going to be really inactive (i.e. the opposite is not its owned window)
- if (opposite != NULL) {
- AwtWindow *wOpposite = (AwtWindow *)AwtComponent::GetComponent(opposite);
-
- if (wOpposite != NULL &&
- wOpposite->GetOwningFrameOrDialog() != this)
- {
- AwtWindow *window = (AwtWindow *)AwtComponent::GetComponent(sm_focusedWindow);
-
- // If actual focused window is one of Frame's owned windows
- if (window != NULL && window->GetOwningFrameOrDialog() == this) {
- m_actualFocusedWindow = window;
- }
- }
- }
- }
+ CheckRetainActualFocusedWindow(opposite);
type = java_awt_event_WindowEvent_WINDOW_LOST_FOCUS;
- isAppActive = FALSE;
sm_focusedWindow = NULL;
+ sm_focusOwner = NULL;
}
}
- if (doActivateFrame) {
- SendWindowEvent(type, opposite);
- }
+ SendWindowEvent(type, opposite);
return mrConsume;
}
+BOOL AwtFrame::CheckActivateActualFocusedWindow(HWND deactivatedOpositeHWnd)
+{
+ if (m_actualFocusedWindow != NULL) {
+ HWND hwnd = m_actualFocusedWindow->GetHWnd();
+ if (hwnd != NULL && ::IsWindowVisible(hwnd)) {
+ SynthesizeWmActivate(TRUE, hwnd, deactivatedOpositeHWnd);
+ return TRUE;
+ }
+ m_actualFocusedWindow = NULL;
+ }
+ return FALSE;
+}
+
+void AwtFrame::CheckRetainActualFocusedWindow(HWND activatedOpositeHWnd)
+{
+ // If actual focused window is not this Frame
+ if (sm_focusedWindow != GetHWnd()) {
+ // Make sure the actual focused window is an owned window of this frame
+ AwtWindow *focusedWindow = (AwtWindow *)AwtComponent::GetComponent(sm_focusedWindow);
+ if (focusedWindow != NULL && focusedWindow->GetOwningFrameOrDialog() == this) {
+
+ // Check that the opposite window is not this frame, nor an owned window of this frame
+ if (activatedOpositeHWnd != NULL) {
+ AwtWindow *oppositeWindow = (AwtWindow *)AwtComponent::GetComponent(activatedOpositeHWnd);
+ if (oppositeWindow && oppositeWindow != this &&
+ oppositeWindow->GetOwningFrameOrDialog() != this)
+ {
+ m_actualFocusedWindow = focusedWindow;
+ }
+ } else {
+ m_actualFocusedWindow = focusedWindow;
+ }
+ }
+ }
+}
+
+BOOL AwtFrame::AwtSetActiveWindow(BOOL isMouseEventCause, UINT hittest)
+{
+ if (hittest == HTCLIENT) {
+ // Don't let the actualFocusedWindow to steal focus if:
+ // a) the frame is clicked in its client area;
+ // b) focus is requested to some of the frame's child.
+ m_actualFocusedWindow = NULL;
+ }
+ return AwtWindow::AwtSetActiveWindow(isMouseEventCause);
+}
+
MsgRouting AwtFrame::WmEnterMenuLoop(BOOL isTrackPopupMenu)
{
if ( !isTrackPopupMenu ) {
@@ -1169,60 +1196,6 @@ LRESULT AwtFrame::WinThreadExecProc(ExecuteArgs * args)
return 0L;
}
-/*
- * hWndLostFocus - the opposite component
- * Returns TRUE if WM_SETFOCUS may be processed further, otherwise FALSE.
- */
-BOOL AwtFrame::activateEmbeddedFrameOnSetFocus(HWND hWndLostFocus) {
-
- // If the EmbeddedFrame is not yet active, then this is either:
- // - requesting focus on smth in the EmbeddedFrame, or
- // - Alt hitting in IE while its menu is active (see 6374321).
- // In both these cases we get WM_SETFOCUS without WM_ACTIVATE
- // on the EmbeddedFrame.
- if (sm_focusedWindow != GetHWnd()) {
- HWND oppositeToplevelHWnd = AwtComponent::GetTopLevelParentForWindow(hWndLostFocus);
-
- // As we get WM_SETFOCUS from the native system we expect
- // the native toplevel be set to the active window.
- HWND activeWindowHWnd = ::GetActiveWindow();
- DASSERT(activeWindowHWnd == ::GetAncestor(GetHWnd(), GA_ROOT));
-
- // See 6538154.
- ::BringWindowToTop(activeWindowHWnd);
- ::SetForegroundWindow(activeWindowHWnd);
-
- SynthesizeWmActivate(TRUE, oppositeToplevelHWnd);
-
- return FALSE;
- }
- // If the EmbeddedFrame is already active, then this is a mouse click
- // or activation (by Alt-Tab, start etc).
- return TRUE;
-}
-
-/*
- * hWndGotFocus - the opposite component
- * Returns TRUE if WM_KILLFOCUS may be processed further, otherwise FALSE.
- */
-BOOL AwtFrame::deactivateEmbeddedFrameOnKillFocus(HWND hWndGotFocus) {
- HWND oppositeToplevelHWnd = AwtComponent::GetTopLevelParentForWindow(hWndGotFocus);
-
- if (oppositeToplevelHWnd != sm_focusedWindow) {
- SynthesizeWmActivate(FALSE, oppositeToplevelHWnd);
- }
- return TRUE;
-}
-
-/*
- * Execute on Toolkit only.
- */
-void AwtFrame::SynthesizeWmActivate(BOOL doActivate, HWND opposite) {
- if (::IsWindowVisible(GetHWnd())) {
- ::SendMessage(GetHWnd(), WM_ACTIVATE, MAKEWPARAM(doActivate ? WA_ACTIVE : WA_INACTIVE, FALSE), (LPARAM) opposite);
- }
-}
-
void AwtFrame::_SynthesizeWmActivate(void *param)
{
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
@@ -1237,7 +1210,7 @@ void AwtFrame::_SynthesizeWmActivate(void *param)
JNI_CHECK_PEER_GOTO(self, ret);
frame = (AwtFrame *)pData;
- frame->SynthesizeWmActivate(doActivate, NULL);
+ SynthesizeWmActivate(doActivate, frame->GetHWnd(), NULL);
ret:
env->DeleteGlobalRef(self);
diff --git a/jdk/src/windows/native/sun/windows/awt_Frame.h b/jdk/src/windows/native/sun/windows/awt_Frame.h
index 65a21655a03..8c99dabc3a6 100644
--- a/jdk/src/windows/native/sun/windows/awt_Frame.h
+++ b/jdk/src/windows/native/sun/windows/awt_Frame.h
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2007 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -133,11 +133,6 @@ public:
// adjusts the IME candidate window position if needed
void AdjustCandidateWindowPos();
- void SynthesizeWmActivate(BOOL doActivate, HWND opposite);
-
- BOOL activateEmbeddedFrameOnSetFocus(HWND hWndLostFocus);
- BOOL deactivateEmbeddedFrameOnKillFocus(HWND hWndGotFocus);
-
// invoked on Toolkit thread
static jobject _GetBoundsPrivate(void *param);
@@ -153,6 +148,14 @@ public:
virtual void Reshape(int x, int y, int width, int height);
+ virtual BOOL AwtSetActiveWindow(BOOL isMouseEventCause = FALSE, UINT hittest = HTCLIENT);
+
+ void CheckRetainActualFocusedWindow(HWND activatedOpositeHWnd);
+ BOOL CheckActivateActualFocusedWindow(HWND deactivatedOpositeHWnd);
+
+ INLINE HWND GetLastProxiedFocusOwner() { return m_lastProxiedFocusOwner; }
+ INLINE void SetLastProxiedFocusOwner(HWND hwnd) { m_lastProxiedFocusOwner = hwnd; }
+
protected:
/* The frame is undecorated. */
BOOL m_isUndecorated;
@@ -189,6 +192,10 @@ private:
or an AwtDialog (or one of its children) has the logical input focus. */
HWND m_proxyFocusOwner;
+ /* Retains the last/current sm_focusOwner proxied. Actually, it should be
+ * a component of an owned window last/currently active. */
+ HWND m_lastProxiedFocusOwner;
+
/*
* Fix for 4823903.
* Retains a focus proxied window to set the focus correctly
diff --git a/jdk/src/windows/native/sun/windows/awt_KeyboardFocusManager.cpp b/jdk/src/windows/native/sun/windows/awt_KeyboardFocusManager.cpp
index 907f0a303c5..146dd0398ec 100644
--- a/jdk/src/windows/native/sun/windows/awt_KeyboardFocusManager.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_KeyboardFocusManager.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2004 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 2000-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
@@ -24,30 +24,20 @@
*/
#include "awt.h"
-#include "awt_KeyboardFocusManager.h"
#include "awt_Component.h"
#include "awt_Toolkit.h"
#include
-
-jclass AwtKeyboardFocusManager::keyboardFocusManagerCls;
-jmethodID AwtKeyboardFocusManager::shouldNativelyFocusHeavyweightMID;
-jmethodID AwtKeyboardFocusManager::heavyweightButtonDownMID;
-jmethodID AwtKeyboardFocusManager::markClearGlobalFocusOwnerMID;
-jmethodID AwtKeyboardFocusManager::removeLastFocusRequestMID;
-jfieldID AwtKeyboardFocusManager::isProxyActive;
-jmethodID AwtKeyboardFocusManager::processSynchronousTransfer;
+#include
static jobject getNativeFocusState(JNIEnv *env, void*(*ftn)()) {
- jobject lFocusState = NULL;
+ jobject gFocusState = (jobject)AwtToolkit::GetInstance().SyncCall(ftn);
- jobject gFocusState = reinterpret_cast(AwtToolkit::GetInstance().
- InvokeFunction(ftn));
if (gFocusState != NULL) {
- lFocusState = env->NewLocalRef(gFocusState);
+ jobject lFocusState = env->NewLocalRef(gFocusState);
env->DeleteGlobalRef(gFocusState);
+ return lFocusState;
}
-
- return lFocusState;
+ return NULL;
}
extern "C" {
@@ -60,54 +50,36 @@ extern "C" {
JNIEXPORT void JNICALL
Java_java_awt_KeyboardFocusManager_initIDs
(JNIEnv *env, jclass cls)
+{
+}
+
+/*
+ * Class: sun_awt_windows_WKeyboardFocusManagerPeer
+ * Method: setNativeFocusOwner
+ * Signature: (Lsun/awt/windows/WComponentPeer)
+ */
+JNIEXPORT void JNICALL
+Java_sun_awt_windows_WKeyboardFocusManagerPeer_setNativeFocusOwner
+ (JNIEnv *env, jclass cls, jobject compPeer)
{
TRY;
- AwtKeyboardFocusManager::keyboardFocusManagerCls = (jclass)
- env->NewGlobalRef(cls);
- AwtKeyboardFocusManager::shouldNativelyFocusHeavyweightMID =
- env->GetStaticMethodID(cls, "shouldNativelyFocusHeavyweight",
- "(Ljava/awt/Component;Ljava/awt/Component;ZZJLsun/awt/CausedFocusEvent$Cause;)I");
- AwtKeyboardFocusManager::heavyweightButtonDownMID =
- env->GetStaticMethodID(cls, "heavyweightButtonDown",
- "(Ljava/awt/Component;J)V");
- AwtKeyboardFocusManager::markClearGlobalFocusOwnerMID =
- env->GetStaticMethodID(cls, "markClearGlobalFocusOwner",
- "()Ljava/awt/Window;");
- AwtKeyboardFocusManager::removeLastFocusRequestMID =
- env->GetStaticMethodID(cls, "removeLastFocusRequest",
- "(Ljava/awt/Component;)V");
+ jobject peerGlobalRef = env->NewGlobalRef(compPeer);
- AwtKeyboardFocusManager::processSynchronousTransfer =
- env->GetStaticMethodID(cls, "processSynchronousLightweightTransfer",
- "(Ljava/awt/Component;Ljava/awt/Component;ZZJ)Z");
+ AwtToolkit::GetInstance().SyncCall(AwtComponent::SetNativeFocusOwner,
+ (void*)peerGlobalRef);
+ // peerGlobalRef is deleted in SetNativeFocusOwner
- jclass keyclass = env->FindClass("java/awt/event/KeyEvent");
- DASSERT (keyclass != NULL);
-
- AwtKeyboardFocusManager::isProxyActive =
- env->GetFieldID(keyclass, "isProxyActive", "Z");
-
- env->DeleteLocalRef(keyclass);
-
- DASSERT(AwtKeyboardFocusManager::keyboardFocusManagerCls != NULL);
- DASSERT(AwtKeyboardFocusManager::shouldNativelyFocusHeavyweightMID !=
- NULL);
- DASSERT(AwtKeyboardFocusManager::heavyweightButtonDownMID != NULL);
- DASSERT(AwtKeyboardFocusManager::markClearGlobalFocusOwnerMID != NULL);
- DASSERT(AwtKeyboardFocusManager::removeLastFocusRequestMID != NULL);
- DASSERT(AwtKeyboardFocusManager::processSynchronousTransfer != NULL);
CATCH_BAD_ALLOC;
}
-
/*
- * Class: sun_awt_KeyboardFocusManagerPeerImpl
+ * Class: sun_awt_windows_WKeyboardFocusManagerPeer
* Method: getNativeFocusOwner
- * Signature: ()Ljava/awt/Component;
+ * Signature: (Lsun/awt/windows/WComponentPeer)
*/
JNIEXPORT jobject JNICALL
-Java_sun_awt_KeyboardFocusManagerPeerImpl_getNativeFocusOwner
+Java_sun_awt_windows_WKeyboardFocusManagerPeer_getNativeFocusOwner
(JNIEnv *env, jclass cls)
{
TRY;
@@ -118,12 +90,12 @@ Java_sun_awt_KeyboardFocusManagerPeerImpl_getNativeFocusOwner
}
/*
- * Class: sun_awt_KeyboardFocusManagerPeerImpl
+ * Class: sun_awt_windows_WKeyboardFocusManagerPeer
* Method: getNativeFocusedWindow
* Signature: ()Ljava/awt/Window;
*/
JNIEXPORT jobject JNICALL
-Java_sun_awt_KeyboardFocusManagerPeerImpl_getNativeFocusedWindow
+Java_sun_awt_windows_WKeyboardFocusManagerPeer_getNativeFocusedWindow
(JNIEnv *env, jclass cls)
{
TRY;
@@ -132,21 +104,4 @@ Java_sun_awt_KeyboardFocusManagerPeerImpl_getNativeFocusedWindow
CATCH_BAD_ALLOC_RET(NULL);
}
-
-/*
- * Class: sun_awt_KeyboardFocusManagerPeerImpl
- * Method: clearNativeGlobalFocusOwner
- * Signature: (Ljava/awt/Window;)V
- */
-JNIEXPORT void JNICALL
-Java_sun_awt_KeyboardFocusManagerPeerImpl_clearNativeGlobalFocusOwner
- (JNIEnv *env, jobject self, jobject activeWindow)
-{
- TRY;
-
- AwtToolkit::GetInstance().InvokeFunction
- ((void*(*)(void))AwtComponent::ClearGlobalFocusOwner);
-
- CATCH_BAD_ALLOC;
-}
}
diff --git a/jdk/src/windows/native/sun/windows/awt_KeyboardFocusManager.h b/jdk/src/windows/native/sun/windows/awt_KeyboardFocusManager.h
deleted file mode 100644
index 26087c21a3c..00000000000
--- a/jdk/src/windows/native/sun/windows/awt_KeyboardFocusManager.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2001-2002 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
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation. Sun designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Sun in the LICENSE file that accompanied this code.
- *
- * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
- */
-
-#ifndef AWT_KEYBOARDFOCUSMANAGER_H
-#define AWT_KEYBOARDFOCUSMANAGER_H
-
-#include
-
-class AwtKeyboardFocusManager {
-public:
-
- static jclass keyboardFocusManagerCls;
- static jmethodID shouldNativelyFocusHeavyweightMID;
- static jmethodID heavyweightButtonDownMID;
- static jmethodID markClearGlobalFocusOwnerMID;
- static jmethodID removeLastFocusRequestMID;
- static jfieldID isProxyActive;
- static jmethodID processSynchronousTransfer;
-};
-
-#endif // AWT_KEYBOARDFOCUSMANAGER_H
diff --git a/jdk/src/windows/native/sun/windows/awt_List.cpp b/jdk/src/windows/native/sun/windows/awt_List.cpp
index 20844de7875..453025ec98b 100644
--- a/jdk/src/windows/native/sun/windows/awt_List.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_List.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -24,7 +24,6 @@
*/
#include "awt_List.h"
-#include "awt_KeyboardFocusManager.h"
#include "awt_Canvas.h"
#include "awt_Dimension.h"
#include "awt_Toolkit.h"
@@ -154,28 +153,6 @@ done:
return c;
}
-BOOL AwtList::ActMouseMessage(MSG * pMsg) {
- if (!IsFocusingMessage(pMsg->message)) {
- return FALSE;
- }
-
- if (pMsg->message == WM_LBUTTONDOWN) {
- LONG item = static_cast(SendListMessage(LB_ITEMFROMPOINT, 0, pMsg->lParam));
- if (item != LB_ERR) {
- if (isMultiSelect) {
- if (IsItemSelected(item)) {
- Deselect(item);
- } else {
- Select(item);
- }
- } else {
- Select(item);
- }
- }
- }
- return TRUE;
-}
-
void AwtList::SetDragCapture(UINT flags)
{
// don't want to interfere with other controls
@@ -473,17 +450,11 @@ AwtList::WmMouseDown(UINT flags, int x, int y, int button)
}
/*
- * Fix for 6240202. List being inside a non-focusable Window (or non-focusable List
- * being a single component inside a focusable Window) won't trigger ActionEvent by
- * double click. All focus events will be filtered (in the AWT focus hook) for such
- * a Window containing the List. In such a case OS Windows won't generate WM_COMMAND
- * (and no WmNotify() will be called for the List). Here we call WmCommand()
- * synthetically.
+ * As we consume WM_LBUTONDOWN the list won't trigger ActionEvent by double click.
+ * We trigger it ourselves. (see also 6240202)
*/
int clickCount = GetClickCount();
- if (button == LEFT_BUTTON && clickCount >= 2 && clickCount % 2 == 0 &&
- !GetContainer()->IsFocusableWindow())
- {
+ if (button == LEFT_BUTTON && clickCount >= 2 && clickCount % 2 == 0) {
WmCommand(0, GetListHandle(), LBN_DBLCLK);
}
return mrResult;
@@ -500,67 +471,32 @@ AwtList::WmCtlColor(HDC hDC, HWND hCtrl, UINT ctlColor, HBRUSH& retBrush)
return mrConsume;
}
-// Override WmSetFocus and WmKillFocus so that they operate on the List handle
-// instead of the wrapper handle. Otherwise, the methods are the same as their
-// AwtComponent counterparts.
-
-MsgRouting AwtList::WmSetFocus(HWND hWndLostFocus) {
- if (sm_focusOwner == GetListHandle()) {
- sm_realFocusOpposite = NULL;
- return mrConsume;
- }
-
- sm_focusOwner = GetListHandle();
-
- if (sm_realFocusOpposite != NULL) {
- hWndLostFocus = sm_realFocusOpposite;
- sm_realFocusOpposite = NULL;
- }
-
- SendFocusEvent(java_awt_event_FocusEvent_FOCUS_GAINED, hWndLostFocus);
-
- return mrDoDefault;
-}
-
-MsgRouting AwtList::WmKillFocus(HWND hWndGotFocus) {
- if (sm_focusOwner != NULL && sm_focusOwner == hWndGotFocus) {
- return mrConsume;
- }
-
- if (sm_focusOwner != GetListHandle()) {
- if (sm_focusOwner != NULL) {
- if (hWndGotFocus != NULL &&
- AwtComponent::GetComponent(hWndGotFocus) != NULL)
- {
- sm_realFocusOpposite = sm_focusOwner;
- }
- ::SendMessage(sm_focusOwner, WM_KILLFOCUS, (WPARAM)hWndGotFocus,
- 0);
- }
- return mrConsume;
- }
-
- sm_focusOwner = NULL;
-
- SendFocusEvent(java_awt_event_FocusEvent_FOCUS_LOST, hWndGotFocus);
-
- return mrDoDefault;
+BOOL AwtList::IsFocusingMouseMessage(MSG *pMsg)
+{
+ return pMsg->message == WM_LBUTTONDOWN || pMsg->message == WM_LBUTTONDBLCLK;
}
MsgRouting AwtList::HandleEvent(MSG *msg, BOOL synthetic)
{
- if (AwtComponent::sm_focusOwner != GetListHandle() &&
- (msg->message == WM_LBUTTONDOWN || msg->message == WM_LBUTTONDBLCLK))
- {
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- jobject target = GetTarget(env);
- env->CallStaticVoidMethod
- (AwtKeyboardFocusManager::keyboardFocusManagerCls,
- AwtKeyboardFocusManager::heavyweightButtonDownMID,
- target, ((jlong)msg->time) & 0xFFFFFFFF);
- env->DeleteLocalRef(target);
+ if (IsFocusingMouseMessage(msg)) {
+ LONG item = static_cast(SendListMessage(LB_ITEMFROMPOINT, 0, msg->lParam));
+ if (item != LB_ERR) {
+ if (isMultiSelect) {
+ if (IsItemSelected(item)) {
+ Deselect(item);
+ } else {
+ Select(item);
+ }
+ } else {
+ Select(item);
+ }
+ }
+ delete msg;
+ return mrConsume;
+ }
+ if (msg->message == WM_KEYDOWN && msg->wParam == VK_RETURN) {
+ WmNotify(LBN_DBLCLK);
}
-
return AwtComponent::HandleEvent(msg, synthetic);
}
@@ -607,15 +543,6 @@ AwtList::WmNotify(UINT notifyCode)
return mrDoDefault;
}
-MsgRouting
-AwtList::WmKeyDown(UINT wkey, UINT repCnt, UINT flags, BOOL system)
-{
- if (wkey == VK_RETURN) {
- WmNotify(LBN_DBLCLK);
- }
- return AwtComponent::WmKeyDown(wkey, repCnt, flags, system);
-}
-
BOOL AwtList::InheritsNativeMouseWheelBehavior() {return true;}
jint AwtList::_GetMaxWidth(void *param)
diff --git a/jdk/src/windows/native/sun/windows/awt_List.h b/jdk/src/windows/native/sun/windows/awt_List.h
index 832e41c2c3d..5389c63349b 100644
--- a/jdk/src/windows/native/sun/windows/awt_List.h
+++ b/jdk/src/windows/native/sun/windows/awt_List.h
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -97,8 +97,6 @@ public:
}
}
- BOOL ActMouseMessage(MSG* pMsg);
-
// Netscape : Change the font on the list and redraw the
// items nicely.
virtual void SetFont(AwtFont *pFont);
@@ -116,7 +114,6 @@ public:
MsgRouting WmMouseDown(UINT flags, int x, int y, int button);
MsgRouting WmMouseUp(UINT flags, int x, int y, int button);
MsgRouting WmNotify(UINT notifyCode);
- MsgRouting WmKeyDown(UINT vkey, UINT repCnt, UINT flags, BOOL system);
/* for multifont list */
MsgRouting OwnerDrawItem(UINT ctrlId, DRAWITEMSTRUCT& drawInfo);
@@ -127,8 +124,6 @@ public:
MsgRouting WmCtlColor(HDC hDC, HWND hCtrl, UINT ctlColor,
HBRUSH& retBrush);
- MsgRouting WmSetFocus(HWND hWndLostFocus);
- MsgRouting WmKillFocus(HWND hWndGotFocus);
MsgRouting HandleEvent(MSG *msg, BOOL synthetic);
@@ -170,6 +165,8 @@ public:
virtual BOOL InheritsNativeMouseWheelBehavior();
+ virtual BOOL IsFocusingMouseMessage(MSG *pMsg);
+
// some methods called on Toolkit thread
static jint _GetMaxWidth(void *param);
static void _UpdateMaxItemWidth(void *param);
diff --git a/jdk/src/windows/native/sun/windows/awt_PrintDialog.cpp b/jdk/src/windows/native/sun/windows/awt_PrintDialog.cpp
index 12b208b9493..14c7750cb92 100644
--- a/jdk/src/windows/native/sun/windows/awt_PrintDialog.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_PrintDialog.cpp
@@ -88,7 +88,7 @@ PrintDialogHookProc(HWND hdlg, UINT uiMsg, WPARAM wParam, LPARAM lParam)
DWORD style = ::GetClassLong(hdlg, GCL_STYLE);
::SetClassLong(hdlg,GCL_STYLE, style & ~CS_SAVEBITS);
- ::SetFocus(hdlg);
+ ::SetFocus(hdlg); // will not break synthetic focus as hdlg is a native toplevel
// set appropriate icon for parentless dialogs
jobject awtParent = env->GetObjectField(peer, AwtPrintDialog::parentID);
diff --git a/jdk/src/windows/native/sun/windows/awt_ScrollPane.cpp b/jdk/src/windows/native/sun/windows/awt_ScrollPane.cpp
index 4d41e0b0cbe..bf11ecca3c0 100644
--- a/jdk/src/windows/native/sun/windows/awt_ScrollPane.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_ScrollPane.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -361,13 +361,6 @@ void AwtScrollPane::PostScrollEvent(int orient, int scrollCode, int pos) {
DASSERT(!safe_ExceptionOccurred(env));
}
-BOOL AwtScrollPane::ActMouseMessage(MSG* pMsg) {
- if (!IsFocusingMessage(pMsg->message)) {
- return FALSE;
- }
- return TRUE;
-}
-
MsgRouting
AwtScrollPane::WmNcHitTest(UINT x, UINT y, LRESULT& retVal)
{
@@ -412,13 +405,10 @@ MsgRouting AwtScrollPane::WmHScroll(UINT scrollCode, UINT pos, HWND hScrollPane)
return mrConsume;
}
-/*
- * Fix for BugTraq ID 4041703: keyDown not being invoked.
- * This method overrides AwtCanvas::HandleEvent() since we
- * don't want ScrollPanel to receive focus on mouse press.
- */
MsgRouting AwtScrollPane::HandleEvent(MSG *msg, BOOL synthetic)
{
+ // SunAwtScrollPane control doesn't cause activation on mouse/key events,
+ // so we can safely (for synthetic focus) pass them to the system proc.
return AwtComponent::HandleEvent(msg, synthetic);
}
diff --git a/jdk/src/windows/native/sun/windows/awt_ScrollPane.h b/jdk/src/windows/native/sun/windows/awt_ScrollPane.h
index c583639693a..326e7fa75c7 100644
--- a/jdk/src/windows/native/sun/windows/awt_ScrollPane.h
+++ b/jdk/src/windows/native/sun/windows/awt_ScrollPane.h
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -65,7 +65,6 @@ public:
virtual void Reshape(int x, int y, int w, int h);
virtual void BeginValidate() {}
virtual void EndValidate() {}
- BOOL ActMouseMessage(MSG* pMsg);
/*
* Fix for bug 4046446
diff --git a/jdk/src/windows/native/sun/windows/awt_Scrollbar.cpp b/jdk/src/windows/native/sun/windows/awt_Scrollbar.cpp
index 879c1847fa8..27b1b5ddbc9 100644
--- a/jdk/src/windows/native/sun/windows/awt_Scrollbar.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Scrollbar.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -27,7 +27,6 @@
#include "awt_Scrollbar.h"
#include "awt_Canvas.h"
#include "awt_Window.h"
-#include "awt_KeyboardFocusManager.h"
/* IMPORTANT! Read the README.JNI file for notes on JNI converted AWT code.
*/
@@ -61,7 +60,6 @@ AwtScrollbar::AwtScrollbar() {
m_orientation = SB_HORZ;
m_lineIncr = 0;
m_pageIncr = 0;
- m_ignoreFocusEvents = FALSE;
m_prevCallback = NULL;
m_prevCallbackPos = 0;
ms_instanceCounter++;
@@ -221,7 +219,6 @@ AwtScrollbar::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
return retValue;
}
-
MsgRouting
AwtScrollbar::WmNcHitTest(UINT x, UINT y, LRESULT& retVal)
{
@@ -265,17 +262,10 @@ AwtScrollbar::WmMouseDown(UINT flags, int x, int y, int button)
MsgRouting
AwtScrollbar::HandleEvent(MSG *msg, BOOL synthetic)
{
- if (msg->message == WM_LBUTTONDOWN || msg->message == WM_LBUTTONDBLCLK) {
- if (IsFocusable() && AwtComponent::sm_focusOwner != GetHWnd()) {
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- jobject target = GetTarget(env);
- env->CallStaticVoidMethod
- (AwtKeyboardFocusManager::keyboardFocusManagerCls,
- AwtKeyboardFocusManager::heavyweightButtonDownMID,
- target, ((jlong)msg->time) & 0xFFFFFFFF);
- env->DeleteLocalRef(target);
- AwtSetFocus();
- }
+ // SCROLLBAR control doesn't cause activation on mouse/key events,
+ // so we can safely (for synthetic focus) pass them to the system proc.
+
+ if (IsFocusingMouseMessage(msg)) {
// Left button press was already routed to default window
// procedure in the WmMouseDown above. Propagating synthetic
// press seems like a bad idea as internal message loop
@@ -283,54 +273,19 @@ AwtScrollbar::HandleEvent(MSG *msg, BOOL synthetic)
delete msg;
return mrConsume;
}
- else {
- return AwtComponent::HandleEvent(msg, synthetic);
- }
+ return AwtComponent::HandleEvent(msg, synthetic);
}
-
// Work around a windows bug descrbed in KB article Q73839. Reset
// focus on scrollbars to update focus indicator. The article advises
-// to disable/enable the scrollbar, but simply resetting the focus is
-// sufficient.
+// to disable/enable the scrollbar.
void
AwtScrollbar::UpdateFocusIndicator()
{
if (IsFocusable()) {
- m_ignoreFocusEvents = TRUE;
- ::SetFocus(NULL);
- AwtSetFocus();
- m_ignoreFocusEvents = FALSE;
- }
-}
-
-MsgRouting
-AwtScrollbar::WmKillFocus(HWND hWndGot)
-{
- if (m_ignoreFocusEvents) {
- // We are voluntary giving up focus and will get it back
- // immediately. This is necessary to force windows to update
- // the focus indicator.
- sm_focusOwner = NULL;
- return mrDoDefault;
- }
- else {
- return AwtComponent::WmKillFocus(hWndGot);
- }
-}
-
-MsgRouting
-AwtScrollbar::WmSetFocus(HWND hWndLost)
-{
- if (m_ignoreFocusEvents) {
- // We have voluntary gave up focus and are getting it back
- // now. This is necessary to force windows to update the
- // focus indicator.
- sm_focusOwner = GetHWnd();
- return mrDoDefault;
- }
- else {
- return AwtComponent::WmSetFocus(hWndLost);
+ // todo: doesn't work
+ SendMessage((WPARAM)ESB_DISABLE_BOTH);
+ SendMessage((WPARAM)ESB_ENABLE_BOTH);
}
}
diff --git a/jdk/src/windows/native/sun/windows/awt_Scrollbar.h b/jdk/src/windows/native/sun/windows/awt_Scrollbar.h
index 4fcac523c81..44763cd23a4 100644
--- a/jdk/src/windows/native/sun/windows/awt_Scrollbar.h
+++ b/jdk/src/windows/native/sun/windows/awt_Scrollbar.h
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2006 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -69,10 +69,6 @@ public:
virtual MsgRouting WmHScroll(UINT scrollCode, UINT pos, HWND hScrollBar);
virtual MsgRouting WmVScroll(UINT scrollCode, UINT pos, HWND hScrollBar);
- // Work around KB Q73839 bug.
- virtual MsgRouting WmSetFocus(HWND hWndLost);
- virtual MsgRouting WmKillFocus(HWND hWndGot);
-
// Prevent KB Q102552 race.
virtual MsgRouting WmMouseDown(UINT flags, int x, int y, int button);
virtual MsgRouting WmNcHitTest(UINT x, UINT y, LRESULT& retVal);
@@ -91,7 +87,6 @@ private:
int m_pageIncr;
// Work around KB Q73839 bug.
- BOOL m_ignoreFocusEvents;
void UpdateFocusIndicator();
// Don't do redundant callbacks.
diff --git a/jdk/src/windows/native/sun/windows/awt_TextArea.cpp b/jdk/src/windows/native/sun/windows/awt_TextArea.cpp
index e0d4c6158c2..b99de8d2301 100644
--- a/jdk/src/windows/native/sun/windows/awt_TextArea.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_TextArea.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -26,9 +26,9 @@
#include "awt_Toolkit.h"
#include "awt_TextArea.h"
#include "awt_TextComponent.h"
-#include "awt_KeyboardFocusManager.h"
#include "awt_Canvas.h"
#include "awt_Window.h"
+#include "awt_Frame.h"
/* IMPORTANT! Read the README.JNI file for notes on JNI converted AWT code.
*/
@@ -362,13 +362,6 @@ AwtTextArea::EditProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
DASSERT(::IsWindow(::GetParent(hWnd)));
switch (message) {
- case WM_SETFOCUS:
- ::SendMessage(::GetParent(hWnd), EM_HIDESELECTION, FALSE, 0);
- break;
- case WM_KILLFOCUS:
- ::SendMessage(::GetParent(hWnd), EM_HIDESELECTION, TRUE, 0);
- break;
-
case WM_UNDO:
case WM_CUT:
case WM_COPY:
@@ -400,7 +393,6 @@ AwtTextArea::EditProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) {
MsgRouting
AwtTextArea::WmContextMenu(HWND hCtrl, UINT xPos, UINT yPos) {
-
/* Use the system provided edit control class to generate context menu. */
if (m_hEditCtrl == NULL) {
DWORD dwStyle = WS_CHILD;
@@ -494,22 +486,11 @@ AwtTextArea::WmContextMenu(HWND hCtrl, UINT xPos, UINT yPos) {
VERIFY(::ClientToScreen(GetHWnd(), &p));
}
- ::SendMessage(m_hEditCtrl, WM_CONTEXTMENU, (WPARAM)m_hEditCtrl,
- MAKELPARAM(p.x, p.y));
- /*
- * After the context menu is dismissed focus is owned by the edit contol.
- * Return focus to parent.
- */
- if (IsFocusable() && AwtComponent::sm_focusOwner != GetHWnd()) {
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- jobject target = GetTarget(env);
- env->CallStaticVoidMethod
- (AwtKeyboardFocusManager::keyboardFocusManagerCls,
- AwtKeyboardFocusManager::heavyweightButtonDownMID,
- target, TimeHelper::getMessageTimeUTC());
- env->DeleteLocalRef(target);
- AwtSetFocus();
- }
+ // The context menu steals focus from the proxy.
+ // So, set the focus-restore flag up.
+ SetRestoreFocus(TRUE);
+ ::SendMessage(m_hEditCtrl, WM_CONTEXTMENU, (WPARAM)m_hEditCtrl, MAKELPARAM(p.x, p.y));
+ SetRestoreFocus(FALSE);
return mrConsume;
}
@@ -558,20 +539,11 @@ AwtTextArea::HandleEvent(MSG *msg, BOOL synthetic)
* By consuming WM_MOUSEMOVE messages we also don't give
* the RichEdit control a chance to recognize a drag gesture
* and initiate its own drag-n-drop operation.
+ *
+ * The workaround also allows us to implement synthetic focus mechanism.
+ *
*/
- if (msg->message == WM_LBUTTONDOWN || msg->message == WM_LBUTTONDBLCLK) {
-
- if (IsFocusable() && AwtComponent::sm_focusOwner != GetHWnd()) {
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- jobject target = GetTarget(env);
- env->CallStaticVoidMethod
- (AwtKeyboardFocusManager::keyboardFocusManagerCls,
- AwtKeyboardFocusManager::heavyweightButtonDownMID,
- target, ((jlong)msg->time) & 0xFFFFFFFF);
- env->DeleteLocalRef(target);
- AwtSetFocus();
- }
-
+ if (IsFocusingMouseMessage(msg)) {
CHARRANGE cr;
LONG lCurPos = EditGetCharFromPos(msg->pt);
@@ -717,6 +689,7 @@ AwtTextArea::HandleEvent(MSG *msg, BOOL synthetic)
p.x = -1;
p.y = -1;
}
+
if (!::PostMessage(GetHWnd(), WM_CONTEXTMENU, (WPARAM)GetHWnd(),
MAKELPARAM(p.x, p.y))) {
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
@@ -724,6 +697,8 @@ AwtTextArea::HandleEvent(MSG *msg, BOOL synthetic)
env->ExceptionDescribe();
env->ExceptionClear();
}
+ delete msg;
+ return mrConsume;
} else if (msg->message == WM_MOUSEWHEEL) {
// 4417236: If there is an old version of RichEd32.dll which
// does not provide the mouse wheel scrolling we have to
diff --git a/jdk/src/windows/native/sun/windows/awt_TextComponent.cpp b/jdk/src/windows/native/sun/windows/awt_TextComponent.cpp
index 9920b925254..e0a7af74da1 100644
--- a/jdk/src/windows/native/sun/windows/awt_TextComponent.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_TextComponent.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -25,7 +25,6 @@
#include "awt_Toolkit.h"
#include "awt_TextComponent.h"
-#include "awt_KeyboardFocusManager.h"
#include "awt_Canvas.h"
#include "jni.h"
@@ -62,9 +61,9 @@ jfieldID AwtTextComponent::canAccessClipboardID;
AwtTextComponent::AwtTextComponent() {
m_synthetic = FALSE;
- m_lStartPos = -1;
- m_lEndPos = -1;
- m_lLastPos = -1;
+ m_lStartPos = -1;
+ m_lEndPos = -1;
+ m_lLastPos = -1;
m_isLFonly = FALSE;
m_EOLchecked = FALSE;
// javaEventsMask = 0; // accessibility support
@@ -74,10 +73,6 @@ LPCTSTR AwtTextComponent::GetClassName() {
return TEXT("EDIT"); /* System provided edit control class */
}
-BOOL AwtTextComponent::ActMouseMessage(MSG* pMsg) {
- return FALSE;
-}
-
/* Set a suitable font to IME against the component font. */
void AwtTextComponent::SetFont(AwtFont* font)
{
@@ -143,23 +138,16 @@ AwtTextComponent::WmNotify(UINT notifyCode)
return mrDoDefault;
}
+BOOL AwtTextComponent::IsFocusingMouseMessage(MSG *pMsg)
+{
+ return pMsg->message == WM_LBUTTONDOWN || pMsg->message == WM_LBUTTONDBLCLK;
+}
+
MsgRouting
AwtTextComponent::HandleEvent(MSG *msg, BOOL synthetic)
{
MsgRouting returnVal;
- if (AwtComponent::sm_focusOwner != GetHWnd() && IsFocusable() &&
- (msg->message == WM_LBUTTONDOWN || msg->message == WM_LBUTTONDBLCLK))
- {
- JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
- jobject target = GetTarget(env);
- env->CallStaticVoidMethod
- (AwtKeyboardFocusManager::keyboardFocusManagerCls,
- AwtKeyboardFocusManager::heavyweightButtonDownMID,
- target, ((jlong)msg->time) & 0xFFFFFFFF);
- env->DeleteLocalRef(target);
- }
-
/*
* Store the 'synthetic' parameter so that the WM_PASTE security check
* happens only for synthetic events.
diff --git a/jdk/src/windows/native/sun/windows/awt_TextComponent.h b/jdk/src/windows/native/sun/windows/awt_TextComponent.h
index 32a430baf38..c6068b5238c 100644
--- a/jdk/src/windows/native/sun/windows/awt_TextComponent.h
+++ b/jdk/src/windows/native/sun/windows/awt_TextComponent.h
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -69,8 +69,6 @@ public:
// called on Toolkit thread from JNI
static jstring _GetText(void *param);
- BOOL ActMouseMessage(MSG* pMsg);
-
void SetFont(AwtFont* font);
/*
@@ -80,6 +78,8 @@ public:
MsgRouting HandleEvent(MSG *msg, BOOL synthetic);
MsgRouting WmPaste();
+ virtual BOOL IsFocusingMouseMessage(MSG *pMsg);
+
/* To be fully implemented in a future release
MsgRouting WmKeyDown(UINT wkey, UINT repCnt,
@@ -125,7 +125,6 @@ private:
LONG m_lEndPos;
LONG m_lLastPos;
-
HFONT m_hFont;
//im --- end
diff --git a/jdk/src/windows/native/sun/windows/awt_TextField.cpp b/jdk/src/windows/native/sun/windows/awt_TextField.cpp
index 975fd20bc0b..49095d3e3ac 100644
--- a/jdk/src/windows/native/sun/windows/awt_TextField.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_TextField.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -26,7 +26,6 @@
#include "awt_Toolkit.h"
#include "awt_TextField.h"
#include "awt_TextComponent.h"
-#include "awt_KeyboardFocusManager.h"
#include "awt_Canvas.h"
/* IMPORTANT! Read the README.JNI file for notes on JNI converted AWT code.
@@ -150,135 +149,130 @@ AwtTextField::HandleEvent(MSG *msg, BOOL synthetic)
* By consuming WM_MOUSEMOVE messages we also don't give
* the RichEdit control a chance to recognize a drag gesture
* and initiate its own drag-n-drop operation.
+ *
+ * The workaround also allows us to implement synthetic focus mechanism.
*/
- /**
- * In non-focusable mode we don't pass mouse messages to native window thus making user unable
- * to select the text. Below is the code from awt_TextArea.cpp which implements selection
- * functionality. For safety this code is only being executed in non-focusable mode.
- */
- if (!IsFocusable()) {
- if (msg->message == WM_LBUTTONDOWN || msg->message == WM_LBUTTONDBLCLK) {
+ if (IsFocusingMouseMessage(msg)) {
+ CHARRANGE cr;
+
+ LONG lCurPos = EditGetCharFromPos(msg->pt);
+
+ EditGetSel(cr);
+ /*
+ * NOTE: Plain EDIT control always clears selection on mouse
+ * button press. We are clearing the current selection only if
+ * the mouse pointer is not over the selected region.
+ * In this case we sacrifice backward compatibility
+ * to allow dnd of the current selection.
+ */
+ if (msg->message == WM_LBUTTONDBLCLK) {
+ SetStartSelectionPos(static_cast(SendMessage(
+ EM_FINDWORDBREAK, WB_MOVEWORDLEFT, lCurPos)));
+ SetEndSelectionPos(static_cast(SendMessage(
+ EM_FINDWORDBREAK, WB_MOVEWORDRIGHT, lCurPos)));
+ } else {
+ SetStartSelectionPos(lCurPos);
+ SetEndSelectionPos(lCurPos);
+ }
+ cr.cpMin = GetStartSelectionPos();
+ cr.cpMax = GetEndSelectionPos();
+ EditSetSel(cr);
+
+ delete msg;
+ return mrConsume;
+ } else if (msg->message == WM_LBUTTONUP) {
+
+ /*
+ * If the left mouse button is pressed on the selected region
+ * we don't clear the current selection. We clear it on button
+ * release instead. This is to allow dnd of the current selection.
+ */
+ if (GetStartSelectionPos() == -1 && GetEndSelectionPos() == -1) {
CHARRANGE cr;
LONG lCurPos = EditGetCharFromPos(msg->pt);
- EditGetSel(cr);
- /*
- * NOTE: Plain EDIT control always clears selection on mouse
- * button press. We are clearing the current selection only if
- * the mouse pointer is not over the selected region.
- * In this case we sacrifice backward compatibility
- * to allow dnd of the current selection.
- */
- if (msg->message == WM_LBUTTONDBLCLK) {
- SetStartSelectionPos(static_cast(SendMessage(
- EM_FINDWORDBREAK, WB_MOVEWORDLEFT, lCurPos)));
- SetEndSelectionPos(static_cast(SendMessage(
- EM_FINDWORDBREAK, WB_MOVEWORDRIGHT, lCurPos)));
- } else {
- SetStartSelectionPos(lCurPos);
- SetEndSelectionPos(lCurPos);
- }
- cr.cpMin = GetStartSelectionPos();
- cr.cpMax = GetEndSelectionPos();
+ cr.cpMin = lCurPos;
+ cr.cpMax = lCurPos;
EditSetSel(cr);
-
- delete msg;
- return mrConsume;
- } else if (msg->message == WM_LBUTTONUP) {
-
- /*
- * If the left mouse button is pressed on the selected region
- * we don't clear the current selection. We clear it on button
- * release instead. This is to allow dnd of the current selection.
- */
- if (GetStartSelectionPos() == -1 && GetEndSelectionPos() == -1) {
- CHARRANGE cr;
-
- LONG lCurPos = EditGetCharFromPos(msg->pt);
-
- cr.cpMin = lCurPos;
- cr.cpMax = lCurPos;
- EditSetSel(cr);
- }
-
- /*
- * Cleanup the state variables when left mouse button is released.
- * These state variables are designed to reflect the selection state
- * while the left mouse button is pressed and be set to -1 otherwise.
- */
- SetStartSelectionPos(-1);
- SetEndSelectionPos(-1);
- SetLastSelectionPos(-1);
-
- delete msg;
- return mrConsume;
- } else if (msg->message == WM_MOUSEMOVE && (msg->wParam & MK_LBUTTON)) {
-
- /*
- * We consume WM_MOUSEMOVE while the left mouse button is pressed,
- * so we have to simulate autoscrolling when mouse is moved outside
- * of the client area.
- */
- POINT p;
- RECT r;
- BOOL bScrollLeft = FALSE;
- BOOL bScrollRight = FALSE;
- BOOL bScrollUp = FALSE;
- BOOL bScrollDown = FALSE;
-
- p.x = msg->pt.x;
- p.y = msg->pt.y;
- VERIFY(::GetClientRect(GetHWnd(), &r));
-
- if (p.x < 0) {
- bScrollLeft = TRUE;
- p.x = 0;
- } else if (p.x > r.right) {
- bScrollRight = TRUE;
- p.x = r.right - 1;
- }
- LONG lCurPos = EditGetCharFromPos(p);
-
- if (GetStartSelectionPos() != -1 &&
- GetEndSelectionPos() != -1 &&
- lCurPos != GetLastSelectionPos()) {
-
- CHARRANGE cr;
-
- SetLastSelectionPos(lCurPos);
-
- cr.cpMin = GetStartSelectionPos();
- cr.cpMax = GetLastSelectionPos();
-
- EditSetSel(cr);
- }
-
- if (bScrollLeft == TRUE || bScrollRight == TRUE) {
- SCROLLINFO si;
- memset(&si, 0, sizeof(si));
- si.cbSize = sizeof(si);
- si.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
-
- VERIFY(::GetScrollInfo(GetHWnd(), SB_HORZ, &si));
- if (bScrollLeft == TRUE) {
- si.nPos = si.nPos - si.nPage / 2;
- si.nPos = max(si.nMin, si.nPos);
- } else if (bScrollRight == TRUE) {
- si.nPos = si.nPos + si.nPage / 2;
- si.nPos = min(si.nPos, si.nMax);
- }
- /*
- * Okay to use 16-bit position since RichEdit control adjusts
- * its scrollbars so that their range is always 16-bit.
- */
- DASSERT(abs(si.nPos) < 0x8000);
- SendMessage(WM_HSCROLL,
- MAKEWPARAM(SB_THUMBPOSITION, LOWORD(si.nPos)));
- }
- delete msg;
- return mrConsume;
}
+
+ /*
+ * Cleanup the state variables when left mouse button is released.
+ * These state variables are designed to reflect the selection state
+ * while the left mouse button is pressed and be set to -1 otherwise.
+ */
+ SetStartSelectionPos(-1);
+ SetEndSelectionPos(-1);
+ SetLastSelectionPos(-1);
+
+ delete msg;
+ return mrConsume;
+ } else if (msg->message == WM_MOUSEMOVE && (msg->wParam & MK_LBUTTON)) {
+
+ /*
+ * We consume WM_MOUSEMOVE while the left mouse button is pressed,
+ * so we have to simulate autoscrolling when mouse is moved outside
+ * of the client area.
+ */
+ POINT p;
+ RECT r;
+ BOOL bScrollLeft = FALSE;
+ BOOL bScrollRight = FALSE;
+ BOOL bScrollUp = FALSE;
+ BOOL bScrollDown = FALSE;
+
+ p.x = msg->pt.x;
+ p.y = msg->pt.y;
+ VERIFY(::GetClientRect(GetHWnd(), &r));
+
+ if (p.x < 0) {
+ bScrollLeft = TRUE;
+ p.x = 0;
+ } else if (p.x > r.right) {
+ bScrollRight = TRUE;
+ p.x = r.right - 1;
+ }
+ LONG lCurPos = EditGetCharFromPos(p);
+
+ if (GetStartSelectionPos() != -1 &&
+ GetEndSelectionPos() != -1 &&
+ lCurPos != GetLastSelectionPos()) {
+
+ CHARRANGE cr;
+
+ SetLastSelectionPos(lCurPos);
+
+ cr.cpMin = GetStartSelectionPos();
+ cr.cpMax = GetLastSelectionPos();
+
+ EditSetSel(cr);
+ }
+
+ if (bScrollLeft == TRUE || bScrollRight == TRUE) {
+ SCROLLINFO si;
+ memset(&si, 0, sizeof(si));
+ si.cbSize = sizeof(si);
+ si.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
+
+ VERIFY(::GetScrollInfo(GetHWnd(), SB_HORZ, &si));
+ if (bScrollLeft == TRUE) {
+ si.nPos = si.nPos - si.nPage / 2;
+ si.nPos = max(si.nMin, si.nPos);
+ } else if (bScrollRight == TRUE) {
+ si.nPos = si.nPos + si.nPage / 2;
+ si.nPos = min(si.nPos, si.nMax);
+ }
+ /*
+ * Okay to use 16-bit position since RichEdit control adjusts
+ * its scrollbars so that their range is always 16-bit.
+ */
+ DASSERT(abs(si.nPos) < 0x8000);
+ SendMessage(WM_HSCROLL,
+ MAKEWPARAM(SB_THUMBPOSITION, LOWORD(si.nPos)));
+ }
+ delete msg;
+ return mrConsume;
}
/*
* Store the 'synthetic' parameter so that the WM_PASTE security check
diff --git a/jdk/src/windows/native/sun/windows/awt_Window.cpp b/jdk/src/windows/native/sun/windows/awt_Window.cpp
index 8d635b5d00d..0e9f0378313 100644
--- a/jdk/src/windows/native/sun/windows/awt_Window.cpp
+++ b/jdk/src/windows/native/sun/windows/awt_Window.cpp
@@ -131,6 +131,11 @@ struct UpdateWindowStruct {
HBITMAP hBitmap;
jint width, height;
};
+// Struct for _RequestWindowFocus() method
+struct RequestWindowFocusStruct {
+ jobject component;
+ jboolean isMouseEventCause;
+};
/************************************************************************
* AwtWindow fields
@@ -395,7 +400,7 @@ AwtWindow* AwtWindow::Create(jobject self, jobject parent)
window->m_isRetainingHierarchyZOrder = TRUE;
}
DWORD style = WS_CLIPCHILDREN | WS_POPUP;
- DWORD exStyle = 0;
+ DWORD exStyle = WS_EX_NOACTIVATE;
if (GetRTL()) {
exStyle |= WS_EX_RIGHT | WS_EX_LEFTSCROLLBAR;
if (GetRTLReadingOrder())
@@ -886,45 +891,92 @@ void AwtWindow::SendWindowEvent(jint id, HWND opposite,
env->DeleteLocalRef(event);
}
+BOOL AwtWindow::AwtSetActiveWindow(BOOL isMouseEventCause, UINT hittest)
+{
+ // Fix for 6458497.
+ // Retreat if current foreground window is out of both our and embedder process.
+ // The exception is when activation is requested due to a mouse event.
+ if (!isMouseEventCause) {
+ HWND fgWindow = ::GetForegroundWindow();
+ if (NULL != fgWindow) {
+ DWORD fgProcessID;
+ ::GetWindowThreadProcessId(fgWindow, &fgProcessID);
+ if (fgProcessID != ::GetCurrentProcessId()
+ && !AwtToolkit::GetInstance().IsEmbedderProcessId(fgProcessID))
+ {
+ return FALSE;
+ }
+ }
+ }
+
+ HWND proxyContainerHWnd = GetProxyToplevelContainer();
+ HWND proxyHWnd = GetProxyFocusOwner();
+
+ if (proxyContainerHWnd == NULL || proxyHWnd == NULL) {
+ return FALSE;
+ }
+
+ // Activate the proxy toplevel container
+ if (::GetActiveWindow() != proxyContainerHWnd) {
+ sm_suppressFocusAndActivation = TRUE;
+ ::BringWindowToTop(proxyContainerHWnd);
+ ::SetForegroundWindow(proxyContainerHWnd);
+ sm_suppressFocusAndActivation = FALSE;
+
+ if (::GetActiveWindow() != proxyContainerHWnd) {
+ return FALSE; // activation has been rejected
+ }
+ }
+
+ // Focus the proxy itself
+ if (::GetFocus() != proxyHWnd) {
+ sm_suppressFocusAndActivation = TRUE;
+ ::SetFocus(proxyHWnd);
+ sm_suppressFocusAndActivation = FALSE;
+
+ if (::GetFocus() != proxyHWnd) {
+ return FALSE; // focus has been rejected (that is unlikely)
+ }
+ }
+
+ if (sm_focusedWindow != GetHWnd()) {
+ if (sm_focusedWindow != NULL) {
+ // Deactivate the old focused window
+ AwtWindow::SynthesizeWmActivate(FALSE, sm_focusedWindow, GetHWnd());
+ }
+ // Activate the new focused window.
+ AwtWindow::SynthesizeWmActivate(TRUE, GetHWnd(), sm_focusedWindow);
+ }
+ return TRUE;
+}
+
MsgRouting AwtWindow::WmActivate(UINT nState, BOOL fMinimized, HWND opposite)
{
jint type;
if (nState != WA_INACTIVE) {
- ::SetFocus((sm_focusOwner == NULL ||
- AwtComponent::GetTopLevelParentForWindow(sm_focusOwner) !=
- GetHWnd()) ? NULL : sm_focusOwner);
type = java_awt_event_WindowEvent_WINDOW_GAINED_FOCUS;
- AwtToolkit::GetInstance().
- InvokeFunctionLater(BounceActivation, this);
sm_focusedWindow = GetHWnd();
} else {
+ // The owner is not necassarily getting WM_ACTIVATE(WA_INACTIVE).
+ // So, initiate retaining the actualFocusedWindow.
+ AwtFrame *owner = GetOwningFrameOrDialog();
+ if (owner) {
+ owner->CheckRetainActualFocusedWindow(opposite);
+ }
+
if (m_grabbedWindow != NULL && !m_grabbedWindow->IsOneOfOwnersOf(this)) {
m_grabbedWindow->Ungrab();
}
type = java_awt_event_WindowEvent_WINDOW_LOST_FOCUS;
sm_focusedWindow = NULL;
+ sm_focusOwner = NULL;
}
SendWindowEvent(type, opposite);
return mrConsume;
}
-void AwtWindow::BounceActivation(void *self) {
- AwtWindow *wSelf = (AwtWindow *)self;
-
- if (::GetActiveWindow() == wSelf->GetHWnd()) {
- AwtFrame *owner = wSelf->GetOwningFrameOrDialog();
-
- if (owner != NULL) {
- sm_suppressFocusAndActivation = TRUE;
- ::SetActiveWindow(owner->GetHWnd());
- ::SetFocus(owner->GetProxyFocusOwner());
- sm_suppressFocusAndActivation = FALSE;
- }
- }
-}
-
MsgRouting AwtWindow::WmCreate()
{
return mrDoDefault;
@@ -948,17 +1000,20 @@ MsgRouting AwtWindow::WmShowWindow(BOOL show, UINT status)
{
/*
* Original fix for 4810575. Modified for 6386592.
- * If an owned window (not frame/dialog) gets disposed we should synthesize
+ * If a simple window gets disposed we should synthesize
* WM_ACTIVATE for its nearest owner. This is not performed by default because
* the owner frame/dialog is natively active.
*/
HWND hwndSelf = GetHWnd();
- HWND hwndParent = ::GetParent(hwndSelf);
+ HWND hwndOwner = ::GetParent(hwndSelf);
if (!show && IsSimpleWindow() && hwndSelf == sm_focusedWindow &&
- hwndParent != NULL && ::IsWindowVisible(hwndParent))
+ hwndOwner != NULL && ::IsWindowVisible(hwndOwner))
{
- ::PostMessage(hwndParent, WM_ACTIVATE, (WPARAM)WA_ACTIVE, (LPARAM)hwndSelf);
+ AwtFrame *owner = (AwtFrame*)AwtComponent::GetComponent(hwndOwner);
+ if (owner != NULL) {
+ owner->AwtSetActiveWindow();
+ }
}
//Fixed 4842599: REGRESSION: JPopupMenu not Hidden Properly After Iconified and Deiconified
@@ -1453,6 +1508,38 @@ void AwtWindow::FlashWindowEx(HWND hWnd, UINT count, DWORD timeout, DWORD flags)
::FlashWindowEx(&fi);
}
+jboolean
+AwtWindow::_RequestWindowFocus(void *param)
+{
+ JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
+
+ RequestWindowFocusStruct *rfs = (RequestWindowFocusStruct *)param;
+ jobject self = rfs->component;
+ jboolean isMouseEventCause = rfs->isMouseEventCause;
+
+ jboolean result = JNI_FALSE;
+ AwtWindow *window = NULL;
+
+ PDATA pData;
+ JNI_CHECK_NULL_GOTO(self, "peer", ret);
+ pData = JNI_GET_PDATA(self);
+ if (pData == NULL) {
+ // do nothing just return false
+ goto ret;
+ }
+
+ window = (AwtWindow *)pData;
+ if (::IsWindow(window->GetHWnd())) {
+ result = (jboolean)window->SendMessage(WM_AWT_WINDOW_SETACTIVE, (WPARAM)isMouseEventCause, 0);
+ }
+ret:
+ env->DeleteGlobalRef(self);
+
+ delete rfs;
+
+ return result;
+}
+
void AwtWindow::_ToFront(void *param)
{
JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
@@ -2173,11 +2260,14 @@ void AwtWindow::_SetFocusableWindow(void *param)
window->m_isFocusableWindow = isFocusableWindow;
- if (!window->m_isFocusableWindow) {
- LONG isPopup = window->GetStyle() & WS_POPUP;
- window->SetStyleEx(window->GetStyleEx() | (isPopup ? 0 : WS_EX_APPWINDOW) | AWT_WS_EX_NOACTIVATE);
- } else {
- window->SetStyleEx(window->GetStyleEx() & ~WS_EX_APPWINDOW & ~AWT_WS_EX_NOACTIVATE);
+ // A simple window is permanently set to WS_EX_NOACTIVATE
+ if (!window->IsSimpleWindow()) {
+ if (!window->m_isFocusableWindow) {
+ LONG isPopup = window->GetStyle() & WS_POPUP;
+ window->SetStyleEx(window->GetStyleEx() | (isPopup ? 0 : WS_EX_APPWINDOW) | WS_EX_NOACTIVATE);
+ } else {
+ window->SetStyleEx(window->GetStyleEx() & ~WS_EX_APPWINDOW & ~WS_EX_NOACTIVATE);
+ }
}
ret:
@@ -2843,4 +2933,27 @@ void AwtWindow_UpdateWindow(JNIEnv *env, jobject peer,
CATCH_BAD_ALLOC;
}
+/*
+ * Class: sun_awt_windows_WComponentPeer
+ * Method: requestFocus
+ * Signature: (Z)Z
+ */
+JNIEXPORT jboolean JNICALL Java_sun_awt_windows_WWindowPeer_requestWindowFocus
+ (JNIEnv *env, jobject self, jboolean isMouseEventCause)
+{
+ TRY;
+
+ jobject selfGlobalRef = env->NewGlobalRef(self);
+
+ RequestWindowFocusStruct *rfs = new RequestWindowFocusStruct;
+ rfs->component = selfGlobalRef;
+ rfs->isMouseEventCause = isMouseEventCause;
+
+ return (jboolean)AwtToolkit::GetInstance().SyncCall(
+ (void*(*)(void*))AwtWindow::_RequestWindowFocus, rfs);
+ // global refs and rfs are deleted in _RequestWindowFocus
+
+ CATCH_BAD_ALLOC_RET(JNI_FALSE);
+}
+
} /* extern "C" */
diff --git a/jdk/src/windows/native/sun/windows/awt_Window.h b/jdk/src/windows/native/sun/windows/awt_Window.h
index 17f05ec164a..339080c55f0 100644
--- a/jdk/src/windows/native/sun/windows/awt_Window.h
+++ b/jdk/src/windows/native/sun/windows/awt_Window.h
@@ -40,9 +40,6 @@ static LPCTSTR NativeDialogWndProcProp = TEXT("SunAwtNativeDialogWndProcProp");
#define WH_MOUSE_LL 14
#endif
-// WS_EX_NOACTIVATE is not defined in the headers we build with
-#define AWT_WS_EX_NOACTIVATE 0x08000000L
-
class AwtFrame;
/************************************************************************
@@ -157,7 +154,6 @@ public:
* Windows message handler functions
*/
virtual MsgRouting WmActivate(UINT nState, BOOL fMinimized, HWND opposite);
- static void BounceActivation(void *self); // used by WmActivate
virtual MsgRouting WmCreate();
virtual MsgRouting WmClose();
virtual MsgRouting WmDestroy();
@@ -181,6 +177,20 @@ public:
virtual MsgRouting HandleEvent(MSG *msg, BOOL synthetic);
virtual void WindowResized();
+ static jboolean _RequestWindowFocus(void *param);
+
+ virtual BOOL AwtSetActiveWindow(BOOL isMouseEventCause = FALSE, UINT hittest = HTCLIENT);
+
+ // Execute on Toolkit only.
+ INLINE static LRESULT SynthesizeWmActivate(BOOL doActivate, HWND targetHWnd, HWND oppositeHWnd) {
+ if (::IsWindowVisible(targetHWnd)) {
+ return ::SendMessage(targetHWnd, WM_ACTIVATE,
+ MAKEWPARAM(doActivate ? WA_ACTIVE : WA_INACTIVE, FALSE),
+ (LPARAM) oppositeHWnd);
+ }
+ return 1; // if not processed
+ }
+
void moveToDefaultLocation(); /* moves Window to X,Y specified by Window Manger */
void UpdateWindow(JNIEnv* env, jintArray data, int width, int height,
diff --git a/jdk/src/windows/native/sun/windows/awtmsg.h b/jdk/src/windows/native/sun/windows/awtmsg.h
index 35e436b53e7..8c080621907 100644
--- a/jdk/src/windows/native/sun/windows/awtmsg.h
+++ b/jdk/src/windows/native/sun/windows/awtmsg.h
@@ -1,5 +1,5 @@
/*
- * Copyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved.
+ * Copyright 1996-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
@@ -194,6 +194,7 @@ enum {
WM_AWT_COMPONENT_SHOW,
WM_AWT_COMPONENT_HIDE,
WM_AWT_COMPONENT_SETFOCUS,
+ WM_AWT_WINDOW_SETACTIVE,
WM_AWT_LIST_SETMULTISELECT,
WM_AWT_HANDLE_EVENT,
WM_AWT_PRINT_COMPONENT,
diff --git a/jdk/test/java/awt/Focus/ClearGlobalFocusOwnerTest/ClearGlobalFocusOwnerTest.java b/jdk/test/java/awt/Focus/ClearGlobalFocusOwnerTest/ClearGlobalFocusOwnerTest.java
new file mode 100644
index 00000000000..1ea53f52a2f
--- /dev/null
+++ b/jdk/test/java/awt/Focus/ClearGlobalFocusOwnerTest/ClearGlobalFocusOwnerTest.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 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
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ @test
+ @bug 4390555
+ @summary Synopsis: clearGlobalFocusOwner() is not trigerring permanent FOCUS_LOST event
+ @author son@sparc.spb.su, anton.tarasov: area=awt.focus
+ @library ../../regtesthelpers
+ @build Util
+ @run main ClearGlobalFocusOwnerTest
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import test.java.awt.regtesthelpers.Util;
+
+public class ClearGlobalFocusOwnerTest {
+ static volatile boolean isFocusLost = false;
+ static Frame frame = new Frame("Test frame");
+ static Button button = new Button("Test button");
+
+ public static void main(String[] args) {
+ button.addFocusListener(new FocusAdapter() {
+ public void focusLost(FocusEvent fe) {
+ if (fe.isTemporary()) {
+ throw new TestFailedException("the FocusLost event is temporary: " + fe);
+ }
+ isFocusLost = true;
+ }
+ });
+
+ frame.add(button);
+ frame.pack();
+ frame.setVisible(true);
+
+ Util.waitForIdle(null);
+
+ if (!button.hasFocus()) {
+ button.requestFocus();
+ Util.waitForIdle(null);
+ if (!button.hasFocus()) {
+ throw new TestErrorException("couldn't focus " + button);
+ }
+ }
+
+ KeyboardFocusManager.getCurrentKeyboardFocusManager().clearGlobalFocusOwner();
+
+ Util.waitForIdle(null);
+
+ if (!isFocusLost) {
+ throw new TestFailedException("no FocusLost event happened on clearGlobalFocusOwner");
+ }
+
+ System.out.println("Test passed.");
+ }
+}
+
+/**
+ * Thrown when the behavior being verified is found wrong.
+ */
+class TestFailedException extends RuntimeException {
+ TestFailedException(String msg) {
+ super("Test failed: " + msg);
+ }
+}
+
+/**
+ * Thrown when an error not related to the behavior being verified is encountered.
+ */
+class TestErrorException extends RuntimeException {
+ TestErrorException(String msg) {
+ super("Unexpected error: " + msg);
+ }
+}
diff --git a/jdk/test/java/awt/Focus/IconifiedFrameFocusChangeTest/IconifiedFrameFocusChangeTest.java b/jdk/test/java/awt/Focus/IconifiedFrameFocusChangeTest/IconifiedFrameFocusChangeTest.java
index 409ce351f34..8ab82bdb689 100644
--- a/jdk/test/java/awt/Focus/IconifiedFrameFocusChangeTest/IconifiedFrameFocusChangeTest.java
+++ b/jdk/test/java/awt/Focus/IconifiedFrameFocusChangeTest/IconifiedFrameFocusChangeTest.java
@@ -71,8 +71,14 @@ public class IconifiedFrameFocusChangeTest extends Applet {
testFrame.setVisible(true);
Util.waitForIdle(robot);
+ robot.delay(1000); // additional delay is required
+
if (!testButton.hasFocus()) {
- throw new TestErrorException("wrong initial focus");
+ testButton.requestFocus();
+ Util.waitForIdle(robot);
+ if (!testButton.hasFocus()) {
+ throw new TestErrorException("couldn't focus " + testButton);
+ }
}
/*
diff --git a/jdk/test/java/awt/Focus/RemoveAfterRequest/RemoveAfterRequest.java b/jdk/test/java/awt/Focus/RemoveAfterRequest/RemoveAfterRequest.java
new file mode 100644
index 00000000000..728b48a0bdd
--- /dev/null
+++ b/jdk/test/java/awt/Focus/RemoveAfterRequest/RemoveAfterRequest.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright 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
+ * 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ @test
+ @bug 6411406
+ @summary Components automatically transfer focus on removal, even if developer requests focus elsewhere first
+ @author oleg.sukhodolsky, anton.tarasov: area=awt.focus
+ @library ../../regtesthelpers
+ @build Util
+ @run main RemoveAfterRequest
+*/
+
+/**
+ * RemoveAfterRequest.java
+ *
+ * summary: Components automatically transfer focus on removal, even if developer requests focus elsewhere first
+ */
+
+import java.awt.*;
+import java.awt.event.*;
+import test.java.awt.regtesthelpers.Util;
+
+public class RemoveAfterRequest {
+ final static Frame frame = new Frame("test frame");
+ final static Button btn1 = new Button("btn1");
+ final static Button btn2 = new Button("btn2");
+ final static Button btn3 = new Button("btn3");
+
+ public static void main(String[] args) {
+ frame.setLayout(new GridLayout(3, 1));
+ frame.add(btn1);
+ frame.add(btn2);
+ frame.add(btn3);
+ frame.pack();
+ frame.setVisible(true);
+
+ Util.waitForIdle(null);
+
+ if (!btn1.hasFocus()) {
+ btn1.requestFocus();
+ Util.waitForIdle(null);
+ if (!btn1.hasFocus()) {
+ throw new TestErrorException("couldn't focus " + btn1);
+ }
+ }
+
+ if (!Util.trackFocusGained(btn3, new Runnable() {
+ public void run() {
+ btn3.requestFocus();
+ frame.remove(btn1);
+ frame.invalidate();
+ frame.validate();
+ frame.repaint();
+ }
+ }, 2000, true))
+ {
+ throw new TestFailedException("focus request on removal failed");
+ }
+
+ System.out.println("Test passed.");
+ }
+}
+
+/**
+ * Thrown when the behavior being verified is found wrong.
+ */
+class TestFailedException extends RuntimeException {
+ TestFailedException(String msg) {
+ super("Test failed: " + msg);
+ }
+}
+
+/**
+ * Thrown when an error not related to the behavior being verified is encountered.
+ */
+class TestErrorException extends RuntimeException {
+ TestErrorException(String msg) {
+ super("Unexpected error: " + msg);
+ }
+}
+
From 97942f9872e22388c4c99ca17502d023b8d119f1 Mon Sep 17 00:00:00 2001
From: Anton Tarasov
Date: Wed, 11 Mar 2009 16:11:31 +0300
Subject: [PATCH 21/80] 6815946: regression: failed to build MToolkit
Reviewed-by: anthony
---
jdk/src/share/classes/sun/awt/AWTAccessor.java | 2 +-
jdk/src/solaris/classes/sun/awt/motif/MToolkit.java | 4 ++++
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/jdk/src/share/classes/sun/awt/AWTAccessor.java b/jdk/src/share/classes/sun/awt/AWTAccessor.java
index 41b9a37dd0d..8a3275e4b9b 100644
--- a/jdk/src/share/classes/sun/awt/AWTAccessor.java
+++ b/jdk/src/share/classes/sun/awt/AWTAccessor.java
@@ -161,7 +161,7 @@ public final class AWTAccessor {
}
/*
- * An interface of accessor for the java.awt.Component class.
+ * An interface of accessor for the java.awt.KeyboardFocusManager class.
*/
public interface KeyboardFocusManagerAccessor {
/*
diff --git a/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java b/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java
index 717990da2f7..672e6e2bcce 100644
--- a/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java
+++ b/jdk/src/solaris/classes/sun/awt/motif/MToolkit.java
@@ -336,6 +336,10 @@ public class MToolkit extends UNIXToolkit implements Runnable {
return null;
}
+ public KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager manager) {
+ return null;
+ }
+
//public MEmbeddedFramePeer createEmbeddedFrame(MEmbeddedFrame target)
//{
//MEmbeddedFramePeer peer = new MEmbeddedFramePeer(target);
From 93c4a7033c7ad17a7a3d225f465fcd2c50dc5782 Mon Sep 17 00:00:00 2001
From: Pavel Porvatov
Date: Thu, 12 Mar 2009 14:00:26 +0300
Subject: [PATCH 22/80] 6491795: COM should be initialized for Shell API calls
in ShellFolder2.cpp
Reviewed-by: peterz, loneid
---
.../swing/plaf/basic/BasicDirectoryModel.java | 173 ++---
.../classes/sun/awt/shell/ShellFolder.java | 30 +
.../sun/awt/shell/ShellFolderManager.java | 17 +-
jdk/src/share/classes/sun/swing/FilePane.java | 11 +
.../sun/awt/shell/Win32ShellFolder2.java | 650 +++++++++++-------
.../awt/shell/Win32ShellFolderManager2.java | 101 +++
.../native/sun/windows/ShellFolder2.cpp | 153 ++---
.../JFileChooser/6570445/bug6570445.java | 20 +
8 files changed, 712 insertions(+), 443 deletions(-)
create mode 100644 jdk/test/javax/swing/JFileChooser/6570445/bug6570445.java
diff --git a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java
index 8cff0a3e7cb..b823553b627 100644
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicDirectoryModel.java
@@ -27,6 +27,7 @@ package javax.swing.plaf.basic;
import java.io.File;
import java.util.*;
+import java.util.concurrent.Callable;
import javax.swing.*;
import javax.swing.filechooser.*;
import javax.swing.event.*;
@@ -223,113 +224,115 @@ public class BasicDirectoryModel extends AbstractListModel implements PropertyCh
this.fid = fid;
}
- private void invokeLater(DoChangeContents runnable) {
- runnables.addElement(runnable);
- SwingUtilities.invokeLater(runnable);
- }
-
public void run() {
run0();
setBusy(false, fid);
}
public void run0() {
- FileSystemView fileSystem = filechooser.getFileSystemView();
+ DoChangeContents doChangeContents = ShellFolder.getInvoker().invoke(new Callable() {
+ public DoChangeContents call() throws Exception {
+ FileSystemView fileSystem = filechooser.getFileSystemView();
- File[] list = fileSystem.getFiles(currentDirectory, filechooser.isFileHidingEnabled());
+ File[] list = fileSystem.getFiles(currentDirectory, filechooser.isFileHidingEnabled());
- Vector acceptsList = new Vector();
+ Vector acceptsList = new Vector();
- if (isInterrupted()) {
- return;
- }
+ if (isInterrupted()) {
+ return null;
+ }
- // run through the file list, add directories and selectable files to fileCache
- for (File file : list) {
- if (filechooser.accept(file)) {
- acceptsList.addElement(file);
- }
- }
+ // run through the file list, add directories and selectable files to fileCache
+ for (File file : list) {
+ if (filechooser.accept(file)) {
+ acceptsList.addElement(file);
+ }
+ }
- if (isInterrupted()) {
- return;
- }
+ if (isInterrupted()) {
+ return null;
+ }
- // First sort alphabetically by filename
- sort(acceptsList);
+ // First sort alphabetically by filename
+ sort(acceptsList);
- Vector newDirectories = new Vector(50);
- Vector newFiles = new Vector();
- // run through list grabbing directories in chunks of ten
- for(int i = 0; i < acceptsList.size(); i++) {
- File f = acceptsList.elementAt(i);
- boolean isTraversable = filechooser.isTraversable(f);
- if (isTraversable) {
- newDirectories.addElement(f);
- } else if (!isTraversable && filechooser.isFileSelectionEnabled()) {
- newFiles.addElement(f);
- }
- if(isInterrupted()) {
- return;
- }
- }
+ Vector newDirectories = new Vector(50);
+ Vector newFiles = new Vector();
+ // run through list grabbing directories in chunks of ten
+ for (int i = 0; i < acceptsList.size(); i++) {
+ File f = acceptsList.elementAt(i);
+ boolean isTraversable = filechooser.isTraversable(f);
+ if (isTraversable) {
+ newDirectories.addElement(f);
+ } else if (!isTraversable && filechooser.isFileSelectionEnabled()) {
+ newFiles.addElement(f);
+ }
+ if (isInterrupted()) {
+ return null;
+ }
+ }
- Vector newFileCache = new Vector(newDirectories);
- newFileCache.addAll(newFiles);
+ Vector newFileCache = new Vector(newDirectories);
+ newFileCache.addAll(newFiles);
- int newSize = newFileCache.size();
- int oldSize = fileCache.size();
+ int newSize = newFileCache.size();
+ int oldSize = fileCache.size();
- if (newSize > oldSize) {
- //see if interval is added
- int start = oldSize;
- int end = newSize;
- for (int i = 0; i < oldSize; i++) {
- if (!newFileCache.get(i).equals(fileCache.get(i))) {
- start = i;
- for (int j = i; j < newSize; j++) {
- if (newFileCache.get(j).equals(fileCache.get(i))) {
- end = j;
+ if (newSize > oldSize) {
+ //see if interval is added
+ int start = oldSize;
+ int end = newSize;
+ for (int i = 0; i < oldSize; i++) {
+ if (!newFileCache.get(i).equals(fileCache.get(i))) {
+ start = i;
+ for (int j = i; j < newSize; j++) {
+ if (newFileCache.get(j).equals(fileCache.get(i))) {
+ end = j;
+ break;
+ }
+ }
break;
}
}
- break;
+ if (start >= 0 && end > start
+ && newFileCache.subList(end, newSize).equals(fileCache.subList(start, oldSize))) {
+ if (isInterrupted()) {
+ return null;
+ }
+ return new DoChangeContents(newFileCache.subList(start, end), start, null, 0, fid);
+ }
+ } else if (newSize < oldSize) {
+ //see if interval is removed
+ int start = -1;
+ int end = -1;
+ for (int i = 0; i < newSize; i++) {
+ if (!newFileCache.get(i).equals(fileCache.get(i))) {
+ start = i;
+ end = i + oldSize - newSize;
+ break;
+ }
+ }
+ if (start >= 0 && end > start
+ && fileCache.subList(end, oldSize).equals(newFileCache.subList(start, newSize))) {
+ if (isInterrupted()) {
+ return null;
+ }
+ return new DoChangeContents(null, 0, new Vector(fileCache.subList(start, end)), start, fid);
+ }
}
- }
- if (start >= 0 && end > start
- && newFileCache.subList(end, newSize).equals(fileCache.subList(start, oldSize))) {
- if(isInterrupted()) {
- return;
+ if (!fileCache.equals(newFileCache)) {
+ if (isInterrupted()) {
+ cancelRunnables(runnables);
+ }
+ return new DoChangeContents(newFileCache, 0, fileCache, 0, fid);
}
- invokeLater(new DoChangeContents(newFileCache.subList(start, end), start, null, 0, fid));
- newFileCache = null;
+ return null;
}
- } else if (newSize < oldSize) {
- //see if interval is removed
- int start = -1;
- int end = -1;
- for (int i = 0; i < newSize; i++) {
- if (!newFileCache.get(i).equals(fileCache.get(i))) {
- start = i;
- end = i + oldSize - newSize;
- break;
- }
- }
- if (start >= 0 && end > start
- && fileCache.subList(end, oldSize).equals(newFileCache.subList(start, newSize))) {
- if(isInterrupted()) {
- return;
- }
- invokeLater(new DoChangeContents(null, 0, new Vector(fileCache.subList(start, end)),
- start, fid));
- newFileCache = null;
- }
- }
- if (newFileCache != null && !fileCache.equals(newFileCache)) {
- if (isInterrupted()) {
- cancelRunnables(runnables);
- }
- invokeLater(new DoChangeContents(newFileCache, 0, fileCache, 0, fid));
+ });
+
+ if (doChangeContents != null) {
+ runnables.addElement(doChangeContents);
+ SwingUtilities.invokeLater(doChangeContents);
}
}
diff --git a/jdk/src/share/classes/sun/awt/shell/ShellFolder.java b/jdk/src/share/classes/sun/awt/shell/ShellFolder.java
index 16c1b12cb80..0e75ac183dc 100644
--- a/jdk/src/share/classes/sun/awt/shell/ShellFolder.java
+++ b/jdk/src/share/classes/sun/awt/shell/ShellFolder.java
@@ -31,6 +31,7 @@ import java.awt.Toolkit;
import java.io.*;
import java.io.FileNotFoundException;
import java.util.*;
+import java.util.concurrent.Callable;
/**
* @author Michael Martak
@@ -461,6 +462,35 @@ public abstract class ShellFolder extends File {
return null;
}
+ private static Invoker invoker;
+
+ /**
+ * Provides the single access point to the {@link Invoker}. It is guaranteed that the value
+ * returned by this method will be always the same.
+ *
+ * @return the singleton instance of {@link Invoker}
+ */
+ public static Invoker getInvoker() {
+ if (invoker == null) {
+ invoker = shellFolderManager.createInvoker();
+ }
+ return invoker;
+ }
+
+ /**
+ * Interface allowing to invoke tasks in different environments on different platforms.
+ */
+ public static interface Invoker {
+ /**
+ * Invokes a callable task. If the {@code task} throws a checked exception,
+ * it will be wrapped into a {@link RuntimeException}
+ *
+ * @param task a task to invoke
+ * @return the result of {@code task}'s invokation
+ */
+ T invoke(Callable task);
+ }
+
/**
* Provides a default comparator for the default column set
*/
diff --git a/jdk/src/share/classes/sun/awt/shell/ShellFolderManager.java b/jdk/src/share/classes/sun/awt/shell/ShellFolderManager.java
index 8fb15bf0cf8..dc8901f7bc5 100644
--- a/jdk/src/share/classes/sun/awt/shell/ShellFolderManager.java
+++ b/jdk/src/share/classes/sun/awt/shell/ShellFolderManager.java
@@ -27,6 +27,7 @@ package sun.awt.shell;
import java.io.File;
import java.io.FileNotFoundException;
+import java.util.concurrent.Callable;
/**
* @author Michael Martak
@@ -96,9 +97,23 @@ class ShellFolderManager {
}
public boolean isFileSystemRoot(File dir) {
- if (dir instanceof ShellFolder && !((ShellFolder)dir).isFileSystem()) {
+ if (dir instanceof ShellFolder && !((ShellFolder) dir).isFileSystem()) {
return false;
}
return (dir.getParentFile() == null);
}
+
+ protected ShellFolder.Invoker createInvoker() {
+ return new DirectInvoker();
+ }
+
+ private static class DirectInvoker implements ShellFolder.Invoker {
+ public T invoke(Callable task) {
+ try {
+ return task.call();
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+ }
}
diff --git a/jdk/src/share/classes/sun/swing/FilePane.java b/jdk/src/share/classes/sun/swing/FilePane.java
index de5ad7c4831..71112b319d8 100644
--- a/jdk/src/share/classes/sun/swing/FilePane.java
+++ b/jdk/src/share/classes/sun/swing/FilePane.java
@@ -34,6 +34,7 @@ import java.text.DateFormat;
import java.text.MessageFormat;
import java.util.*;
import java.util.List;
+import java.util.concurrent.Callable;
import javax.swing.*;
import javax.swing.border.*;
@@ -900,6 +901,16 @@ public class FilePane extends JPanel implements PropertyChangeListener {
}
}
+ @Override
+ public void sort() {
+ ShellFolder.getInvoker().invoke(new Callable() {
+ public Void call() throws Exception {
+ DetailsTableRowSorter.super.sort();
+ return null;
+ }
+ });
+ }
+
public void modelStructureChanged() {
super.modelStructureChanged();
updateComparators(detailsTableModel.getColumns());
diff --git a/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java b/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java
index 418dc8f59db..bc81b80e793 100644
--- a/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java
+++ b/jdk/src/windows/classes/sun/awt/shell/Win32ShellFolder2.java
@@ -32,6 +32,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.*;
+import java.util.concurrent.*;
import javax.swing.SwingConstants;
// NOTE: This class supersedes Win32ShellFolder, which was removed from
@@ -184,15 +185,20 @@ final class Win32ShellFolder2 extends ShellFolder {
boolean disposed;
public void dispose() {
if (disposed) return;
- if (relativePIDL != 0) {
- releasePIDL(relativePIDL);
- }
- if (absolutePIDL != 0) {
- releasePIDL(absolutePIDL);
- }
- if (pIShellFolder != 0) {
- releaseIShellFolder(pIShellFolder);
- }
+ ShellFolder.getInvoker().invoke(new Callable() {
+ public Void call() throws Exception {
+ if (relativePIDL != 0) {
+ releasePIDL(relativePIDL);
+ }
+ if (absolutePIDL != 0) {
+ releasePIDL(absolutePIDL);
+ }
+ if (pIShellFolder != 0) {
+ releaseIShellFolder(pIShellFolder);
+ }
+ return null;
+ }
+ });
disposed = true;
}
}
@@ -218,50 +224,59 @@ final class Win32ShellFolder2 extends ShellFolder {
*/
private boolean isPersonal;
+ private static String composePathForCsidl(int csidl) throws IOException {
+ String path = getFileSystemPath(csidl);
+ return path == null
+ ? ("ShellFolder: 0x" + Integer.toHexString(csidl))
+ : path;
+ }
/**
* Create a system special shell folder, such as the
* desktop or Network Neighborhood.
*/
- Win32ShellFolder2(int csidl) throws IOException {
+ Win32ShellFolder2(final int csidl) throws IOException {
// Desktop is parent of DRIVES and NETWORK, not necessarily
// other special shell folders.
- super(null,
- (getFileSystemPath(csidl) == null)
- ? ("ShellFolder: 0x"+Integer.toHexString(csidl)) : getFileSystemPath(csidl));
- if (csidl == DESKTOP) {
- initDesktop();
- } else {
- initSpecial(getDesktop().getIShellFolder(), csidl);
- // At this point, the native method initSpecial() has set our relativePIDL
- // relative to the Desktop, which may not be our immediate parent. We need
- // to traverse this ID list and break it into a chain of shell folders from
- // the top, with each one having an immediate parent and a relativePIDL
- // relative to that parent.
- long pIDL = disposer.relativePIDL;
- parent = getDesktop();
- while (pIDL != 0) {
- // Get a child pidl relative to 'parent'
- long childPIDL = copyFirstPIDLEntry(pIDL);
- if (childPIDL != 0) {
- // Get a handle to the the rest of the ID list
- // i,e, parent's grandchilren and down
- pIDL = getNextPIDLEntry(pIDL);
- if (pIDL != 0) {
- // Now we know that parent isn't immediate to 'this' because it
- // has a continued ID list. Create a shell folder for this child
- // pidl and make it the new 'parent'.
- parent = new Win32ShellFolder2((Win32ShellFolder2)parent, childPIDL);
- } else {
- // No grandchildren means we have arrived at the parent of 'this',
- // and childPIDL is directly relative to parent.
- disposer.relativePIDL = childPIDL;
- }
+ super(null, composePathForCsidl(csidl));
+ ShellFolder.getInvoker().invoke(new Callable() {
+ public Void call() throws Exception {
+ if (csidl == DESKTOP) {
+ initDesktop();
} else {
- break;
+ initSpecial(getDesktop().getIShellFolder(), csidl);
+ // At this point, the native method initSpecial() has set our relativePIDL
+ // relative to the Desktop, which may not be our immediate parent. We need
+ // to traverse this ID list and break it into a chain of shell folders from
+ // the top, with each one having an immediate parent and a relativePIDL
+ // relative to that parent.
+ long pIDL = disposer.relativePIDL;
+ parent = getDesktop();
+ while (pIDL != 0) {
+ // Get a child pidl relative to 'parent'
+ long childPIDL = copyFirstPIDLEntry(pIDL);
+ if (childPIDL != 0) {
+ // Get a handle to the the rest of the ID list
+ // i,e, parent's grandchilren and down
+ pIDL = getNextPIDLEntry(pIDL);
+ if (pIDL != 0) {
+ // Now we know that parent isn't immediate to 'this' because it
+ // has a continued ID list. Create a shell folder for this child
+ // pidl and make it the new 'parent'.
+ parent = new Win32ShellFolder2((Win32ShellFolder2) parent, childPIDL);
+ } else {
+ // No grandchildren means we have arrived at the parent of 'this',
+ // and childPIDL is directly relative to parent.
+ disposer.relativePIDL = childPIDL;
+ }
+ } else {
+ break;
+ }
+ }
}
+ return null;
}
- }
+ });
sun.java2d.Disposer.addRecord(this, disposer);
}
@@ -281,17 +296,26 @@ final class Win32ShellFolder2 extends ShellFolder {
/**
* Creates a shell folder with a parent and relative PIDL
*/
- Win32ShellFolder2(Win32ShellFolder2 parent, long relativePIDL) {
- super(parent, getFileSystemPath(parent.getIShellFolder(), relativePIDL));
+ Win32ShellFolder2(final Win32ShellFolder2 parent, final long relativePIDL) {
+ super(parent,
+ ShellFolder.getInvoker().invoke(new Callable() {
+ public String call() throws Exception {
+ return getFileSystemPath(parent.getIShellFolder(), relativePIDL);
+ }
+ })
+ );
this.disposer.relativePIDL = relativePIDL;
getAbsolutePath();
sun.java2d.Disposer.addRecord(this, disposer);
}
// Initializes the desktop shell folder
+ // NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details
private native void initDesktop();
+
// Initializes a special, non-file system shell folder
// from one of the above constants
+ // NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details
private native void initSpecial(long desktopIShellFolder, int csidl);
/** Marks this folder as being the My Documents (Personal) folder */
@@ -311,26 +335,30 @@ final class Win32ShellFolder2 extends ShellFolder {
* drive (normally "C:\").
*/
protected Object writeReplace() throws java.io.ObjectStreamException {
- if (isFileSystem()) {
- return new File(getPath());
- } else {
- Win32ShellFolder2 drives = Win32ShellFolderManager2.getDrives();
- if (drives != null) {
- File[] driveRoots = drives.listFiles();
- if (driveRoots != null) {
- for (int i = 0; i < driveRoots.length; i++) {
- if (driveRoots[i] instanceof Win32ShellFolder2) {
- Win32ShellFolder2 sf = (Win32ShellFolder2)driveRoots[i];
- if (sf.isFileSystem() && !sf.hasAttribute(ATTRIB_REMOVABLE)) {
- return new File(sf.getPath());
+ return ShellFolder.getInvoker().invoke(new Callable() {
+ public File call() throws Exception {
+ if (isFileSystem()) {
+ return new File(getPath());
+ } else {
+ Win32ShellFolder2 drives = Win32ShellFolderManager2.getDrives();
+ if (drives != null) {
+ File[] driveRoots = drives.listFiles();
+ if (driveRoots != null) {
+ for (int i = 0; i < driveRoots.length; i++) {
+ if (driveRoots[i] instanceof Win32ShellFolder2) {
+ Win32ShellFolder2 sf = (Win32ShellFolder2) driveRoots[i];
+ if (sf.isFileSystem() && !sf.hasAttribute(ATTRIB_REMOVABLE)) {
+ return new File(sf.getPath());
+ }
+ }
}
}
}
+ // Ouch, we have no hard drives. Return something "valid" anyway.
+ return new File("C:\\");
}
}
- // Ouch, we have no hard drives. Return something "valid" anyway.
- return new File("C:\\");
- }
+ });
}
@@ -364,6 +392,7 @@ final class Win32ShellFolder2 extends ShellFolder {
static native void releasePIDL(long pIDL);
// Release an IShellFolder object
+ // NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details
private static native void releaseIShellFolder(long pIShellFolder);
/**
@@ -371,18 +400,28 @@ final class Win32ShellFolder2 extends ShellFolder {
*/
public long getIShellFolder() {
if (disposer.pIShellFolder == 0) {
- assert(isDirectory());
- assert(parent != null);
- long parentIShellFolder = getParentIShellFolder();
- if (parentIShellFolder == 0) {
- throw new InternalError("Parent IShellFolder was null for " + getAbsolutePath());
- }
- // We are a directory with a parent and a relative PIDL.
- // We want to bind to the parent so we get an IShellFolder instance associated with us.
- disposer.pIShellFolder = bindToObject(parentIShellFolder, disposer.relativePIDL);
- if (disposer.pIShellFolder == 0) {
- throw new InternalError("Unable to bind " + getAbsolutePath() + " to parent");
- }
+ disposer.pIShellFolder =
+ ShellFolder.getInvoker().invoke(new Callable() {
+ public Long call() throws Exception {
+ assert(isDirectory());
+ assert(parent != null);
+ long parentIShellFolder = getParentIShellFolder();
+ if (parentIShellFolder == 0) {
+ throw new InternalError("Parent IShellFolder was null for "
+ + getAbsolutePath());
+ }
+ // We are a directory with a parent and a relative PIDL.
+ // We want to bind to the parent so we get an
+ // IShellFolder instance associated with us.
+ long pIShellFolder = bindToObject(parentIShellFolder,
+ disposer.relativePIDL);
+ if (pIShellFolder == 0) {
+ throw new InternalError("Unable to bind "
+ + getAbsolutePath() + " to parent");
+ }
+ return pIShellFolder;
+ }
+ });
}
return disposer.pIShellFolder;
}
@@ -472,24 +511,42 @@ final class Win32ShellFolder2 extends ShellFolder {
return false;
}
- private static boolean pidlsEqual(long pIShellFolder, long pidl1, long pidl2) {
- return (compareIDs(pIShellFolder, pidl1, pidl2) == 0);
+ private static boolean pidlsEqual(final long pIShellFolder, final long pidl1, final long pidl2) {
+ return ShellFolder.getInvoker().invoke(new Callable() {
+ public Boolean call() throws Exception {
+ return (compareIDs(pIShellFolder, pidl1, pidl2) == 0);
+ }
+ });
}
+
+ // NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details
private static native int compareIDs(long pParentIShellFolder, long pidl1, long pidl2);
+ private Boolean cachedIsFileSystem;
+
/**
* @return Whether this is a file system shell folder
*/
- public boolean isFileSystem() {
- return hasAttribute(ATTRIB_FILESYSTEM);
+ public synchronized boolean isFileSystem() {
+ if (cachedIsFileSystem == null) {
+ cachedIsFileSystem = hasAttribute(ATTRIB_FILESYSTEM);
+ }
+
+ return cachedIsFileSystem;
}
/**
* Return whether the given attribute flag is set for this object
*/
- public boolean hasAttribute(int attribute) {
- // Caching at this point doesn't seem to be cost efficient
- return (getAttributes0(getParentIShellFolder(), getRelativePIDL(), attribute) & attribute) != 0;
+ public boolean hasAttribute(final int attribute) {
+ return ShellFolder.getInvoker().invoke(new Callable() {
+ public Boolean call() throws Exception {
+ // Caching at this point doesn't seem to be cost efficient
+ return (getAttributes0(getParentIShellFolder(),
+ getRelativePIDL(), attribute)
+ & attribute) != 0;
+ }
+ });
}
/**
@@ -498,26 +555,42 @@ final class Win32ShellFolder2 extends ShellFolder {
* Could plausibly be used for attribute caching but have to be
* very careful not to touch network drives and file system roots
* with a full attrsMask
+ * NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details
*/
+
private static native int getAttributes0(long pParentIShellFolder, long pIDL, int attrsMask);
// Return the path to the underlying file system object
- private static String getFileSystemPath(long parentIShellFolder, long relativePIDL) {
- int linkedFolder = ATTRIB_LINK | ATTRIB_FOLDER;
- if (parentIShellFolder == Win32ShellFolderManager2.getNetwork().getIShellFolder() &&
- getAttributes0(parentIShellFolder, relativePIDL, linkedFolder) == linkedFolder) {
+ private static String getFileSystemPath(final long parentIShellFolder, final long relativePIDL) {
+ return ShellFolder.getInvoker().invoke(new Callable() {
+ public String call() throws Exception {
+ int linkedFolder = ATTRIB_LINK | ATTRIB_FOLDER;
+ if (parentIShellFolder == Win32ShellFolderManager2.getNetwork().getIShellFolder() &&
+ getAttributes0(parentIShellFolder, relativePIDL, linkedFolder) == linkedFolder) {
- String s =
- getFileSystemPath(Win32ShellFolderManager2.getDesktop().getIShellFolder(),
- getLinkLocation(parentIShellFolder, relativePIDL, false));
- if (s != null && s.startsWith("\\\\")) {
- return s;
+ String s =
+ getFileSystemPath(Win32ShellFolderManager2.getDesktop().getIShellFolder(),
+ getLinkLocation(parentIShellFolder, relativePIDL, false));
+ if (s != null && s.startsWith("\\\\")) {
+ return s;
+ }
+ }
+ return getDisplayNameOf(parentIShellFolder, relativePIDL, SHGDN_FORPARSING);
}
- }
- return getDisplayNameOf(parentIShellFolder, relativePIDL, SHGDN_NORMAL | SHGDN_FORPARSING);
+ });
}
+
// Needs to be accessible to Win32ShellFolderManager2
- static native String getFileSystemPath(int csidl) throws IOException;
+ static String getFileSystemPath(final int csidl) throws IOException {
+ return ShellFolder.getInvoker().invoke(new Callable() {
+ public String call() throws Exception {
+ return getFileSystemPath0(csidl);
+ }
+ });
+ }
+
+ // NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details
+ private static native String getFileSystemPath0(int csidl) throws IOException;
// Return whether the path is a network root.
// Path is assumed to be non-null
@@ -557,24 +630,33 @@ final class Win32ShellFolder2 extends ShellFolder {
*/
// Returns an IEnumIDList interface for an IShellFolder. The value
// returned must be released using releaseEnumObjects().
- private long getEnumObjects(long pIShellFolder, boolean includeHiddenFiles) {
- boolean isDesktop = (disposer.pIShellFolder == getDesktopIShellFolder());
- return getEnumObjects(disposer.pIShellFolder, isDesktop, includeHiddenFiles);
+ private long getEnumObjects(long pIShellFolder, final boolean includeHiddenFiles) {
+ final boolean isDesktop = (disposer.pIShellFolder == getDesktopIShellFolder());
+ return ShellFolder.getInvoker().invoke(new Callable() {
+ public Long call() throws Exception {
+ return getEnumObjects(disposer.pIShellFolder, isDesktop, includeHiddenFiles);
+ }
+ });
}
+
// Returns an IEnumIDList interface for an IShellFolder. The value
// returned must be released using releaseEnumObjects().
+ // NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details
private native long getEnumObjects(long pIShellFolder, boolean isDesktop,
boolean includeHiddenFiles);
// Returns the next sequential child as a relative PIDL
// from an IEnumIDList interface. The value returned must
// be released using releasePIDL().
+ // NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details
private native long getNextChild(long pEnumObjects);
// Releases the IEnumIDList interface
+ // NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details
private native void releaseEnumObjects(long pEnumObjects);
// Returns the IShellFolder of a child from a parent IShellFolder
// and a relative PIDL. The value returned must be released
// using releaseIShellFolder().
+ // NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details
private static native long bindToObject(long parentIShellFolder, long pIDL);
/**
@@ -582,60 +664,64 @@ final class Win32ShellFolder2 extends ShellFolder {
* object. The array will be empty if the folder is empty. Returns
* null if this shellfolder does not denote a directory.
*/
- public File[] listFiles(boolean includeHiddenFiles) {
+ public File[] listFiles(final boolean includeHiddenFiles) {
SecurityManager security = System.getSecurityManager();
if (security != null) {
security.checkRead(getPath());
}
- if (!isDirectory()) {
- return null;
- }
- // Links to directories are not directories and cannot be parents.
- // This does not apply to folders in My Network Places (NetHood)
- // because they are both links and real directories!
- if (isLink() && !hasAttribute(ATTRIB_FOLDER)) {
- return new File[0];
- }
- Win32ShellFolder2 desktop = Win32ShellFolderManager2.getDesktop();
- Win32ShellFolder2 personal = Win32ShellFolderManager2.getPersonal();
-
- // If we are a directory, we have a parent and (at least) a
- // relative PIDL. We must first ensure we are bound to the
- // parent so we have an IShellFolder to query.
- long pIShellFolder = getIShellFolder();
- // Now we can enumerate the objects in this folder.
- ArrayList list = new ArrayList();
- long pEnumObjects = getEnumObjects(pIShellFolder, includeHiddenFiles);
- if (pEnumObjects != 0) {
- long childPIDL;
- int testedAttrs = ATTRIB_FILESYSTEM | ATTRIB_FILESYSANCESTOR;
- do {
- if (Thread.currentThread().isInterrupted()) {
+ return ShellFolder.getInvoker().invoke(new Callable() {
+ public File[] call() throws Exception {
+ if (!isDirectory()) {
+ return null;
+ }
+ // Links to directories are not directories and cannot be parents.
+ // This does not apply to folders in My Network Places (NetHood)
+ // because they are both links and real directories!
+ if (isLink() && !hasAttribute(ATTRIB_FOLDER)) {
return new File[0];
}
- childPIDL = getNextChild(pEnumObjects);
- boolean releasePIDL = true;
- if (childPIDL != 0 &&
- (getAttributes0(pIShellFolder, childPIDL, testedAttrs) & testedAttrs) != 0) {
- Win32ShellFolder2 childFolder = null;
- if (this.equals(desktop)
- && personal != null
- && pidlsEqual(pIShellFolder, childPIDL, personal.disposer.relativePIDL)) {
- childFolder = personal;
- } else {
- childFolder = new Win32ShellFolder2(this, childPIDL);
- releasePIDL = false;
- }
- list.add(childFolder);
+
+ Win32ShellFolder2 desktop = Win32ShellFolderManager2.getDesktop();
+ Win32ShellFolder2 personal = Win32ShellFolderManager2.getPersonal();
+
+ // If we are a directory, we have a parent and (at least) a
+ // relative PIDL. We must first ensure we are bound to the
+ // parent so we have an IShellFolder to query.
+ long pIShellFolder = getIShellFolder();
+ // Now we can enumerate the objects in this folder.
+ ArrayList list = new ArrayList();
+ long pEnumObjects = getEnumObjects(pIShellFolder, includeHiddenFiles);
+ if (pEnumObjects != 0) {
+ long childPIDL;
+ int testedAttrs = ATTRIB_FILESYSTEM | ATTRIB_FILESYSANCESTOR;
+ do {
+ childPIDL = getNextChild(pEnumObjects);
+ boolean releasePIDL = true;
+ if (childPIDL != 0 &&
+ (getAttributes0(pIShellFolder, childPIDL, testedAttrs) & testedAttrs) != 0) {
+ Win32ShellFolder2 childFolder;
+ if (Win32ShellFolder2.this.equals(desktop)
+ && personal != null
+ && pidlsEqual(pIShellFolder, childPIDL, personal.disposer.relativePIDL)) {
+ childFolder = personal;
+ } else {
+ childFolder = new Win32ShellFolder2(Win32ShellFolder2.this, childPIDL);
+ releasePIDL = false;
+ }
+ list.add(childFolder);
+ }
+ if (releasePIDL) {
+ releasePIDL(childPIDL);
+ }
+ } while (childPIDL != 0 && !Thread.currentThread().isInterrupted());
+ releaseEnumObjects(pEnumObjects);
}
- if (releasePIDL) {
- releasePIDL(childPIDL);
- }
- } while (childPIDL != 0);
- releaseEnumObjects(pEnumObjects);
- }
- return list.toArray(new ShellFolder[list.size()]);
+ return Thread.currentThread().isInterrupted()
+ ? new File[0]
+ : list.toArray(new ShellFolder[list.size()]);
+ }
+ });
}
@@ -644,33 +730,43 @@ final class Win32ShellFolder2 extends ShellFolder {
*
* @return The child shellfolder, or null if not found.
*/
- Win32ShellFolder2 getChildByPath(String filePath) {
- long pIShellFolder = getIShellFolder();
- long pEnumObjects = getEnumObjects(pIShellFolder, true);
- Win32ShellFolder2 child = null;
- long childPIDL;
+ Win32ShellFolder2 getChildByPath(final String filePath) {
+ return ShellFolder.getInvoker().invoke(new Callable() {
+ public Win32ShellFolder2 call() throws Exception {
+ long pIShellFolder = getIShellFolder();
+ long pEnumObjects = getEnumObjects(pIShellFolder, true);
+ Win32ShellFolder2 child = null;
+ long childPIDL = 0;
- while ((childPIDL = getNextChild(pEnumObjects)) != 0) {
- if (getAttributes0(pIShellFolder, childPIDL, ATTRIB_FILESYSTEM) != 0) {
- String path = getFileSystemPath(pIShellFolder, childPIDL);
- if (path != null && path.equalsIgnoreCase(filePath)) {
- long childIShellFolder = bindToObject(pIShellFolder, childPIDL);
- child = new Win32ShellFolder2(this, childIShellFolder, childPIDL, path);
- break;
+ while ((childPIDL = getNextChild(pEnumObjects)) != 0) {
+ if (getAttributes0(pIShellFolder, childPIDL, ATTRIB_FILESYSTEM) != 0) {
+ String path = getFileSystemPath(pIShellFolder, childPIDL);
+ if (path != null && path.equalsIgnoreCase(filePath)) {
+ long childIShellFolder = bindToObject(pIShellFolder, childPIDL);
+ child = new Win32ShellFolder2(Win32ShellFolder2.this,
+ childIShellFolder, childPIDL, path);
+ break;
+ }
+ }
+ releasePIDL(childPIDL);
}
+ releaseEnumObjects(pEnumObjects);
+ return child;
}
- releasePIDL(childPIDL);
- }
- releaseEnumObjects(pEnumObjects);
- return child;
+ });
}
+ private Boolean cachedIsLink;
/**
* @return Whether this shell folder is a link
*/
- public boolean isLink() {
- return hasAttribute(ATTRIB_LINK);
+ public synchronized boolean isLink() {
+ if (cachedIsLink == null) {
+ cachedIsLink = hasAttribute(ATTRIB_LINK);
+ }
+
+ return cachedIsLink;
}
/**
@@ -682,6 +778,7 @@ final class Win32ShellFolder2 extends ShellFolder {
// Return the link location of a shell folder
+ // NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details
private static native long getLinkLocation(long parentIShellFolder,
long relativePIDL, boolean resolve);
@@ -693,38 +790,52 @@ final class Win32ShellFolder2 extends ShellFolder {
return getLinkLocation(true);
}
- private ShellFolder getLinkLocation(boolean resolve) {
- if (!isLink()) {
- return null;
- }
+ private ShellFolder getLinkLocation(final boolean resolve) {
+ return ShellFolder.getInvoker().invoke(new Callable() {
+ public ShellFolder call() throws Exception {
+ if (!isLink()) {
+ return null;
+ }
- ShellFolder location = null;
- long linkLocationPIDL = getLinkLocation(getParentIShellFolder(),
- getRelativePIDL(), resolve);
- if (linkLocationPIDL != 0) {
- try {
- location =
- Win32ShellFolderManager2.createShellFolderFromRelativePIDL(getDesktop(),
- linkLocationPIDL);
- } catch (InternalError e) {
- // Could be a link to a non-bindable object, such as a network connection
- // TODO: getIShellFolder() should throw FileNotFoundException instead
+ ShellFolder location = null;
+ long linkLocationPIDL = getLinkLocation(getParentIShellFolder(),
+ getRelativePIDL(), resolve);
+ if (linkLocationPIDL != 0) {
+ try {
+ location =
+ Win32ShellFolderManager2.createShellFolderFromRelativePIDL(getDesktop(),
+ linkLocationPIDL);
+ } catch (InternalError e) {
+ // Could be a link to a non-bindable object, such as a network connection
+ // TODO: getIShellFolder() should throw FileNotFoundException instead
+ }
+ }
+ return location;
}
- }
- return location;
+ });
}
// Parse a display name into a PIDL relative to the current IShellFolder.
- long parseDisplayName(String name) throws FileNotFoundException {
+ long parseDisplayName(final String name) throws FileNotFoundException {
try {
- return parseDisplayName0(getIShellFolder(), name);
- } catch (IOException e) {
- throw new FileNotFoundException("Could not find file " + name);
+ return ShellFolder.getInvoker().invoke(new Callable() {
+ public Long call() throws Exception {
+ return parseDisplayName0(getIShellFolder(), name);
+ }
+ });
+ } catch (RuntimeException e) {
+ if (e.getCause() instanceof IOException) {
+ throw new FileNotFoundException("Could not find file " + name);
+ }
+ throw e;
}
}
+
+ // NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details
private static native long parseDisplayName0(long pIShellFolder, String name) throws IOException;
// Return the display name of a shell folder
+ // NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details
private static native String getDisplayNameOf(long parentIShellFolder,
long relativePIDL,
int attrs);
@@ -734,12 +845,19 @@ final class Win32ShellFolder2 extends ShellFolder {
*/
public String getDisplayName() {
if (displayName == null) {
- displayName = getDisplayNameOf(getParentIShellFolder(), getRelativePIDL(), SHGDN_NORMAL);
+ displayName =
+ ShellFolder.getInvoker().invoke(new Callable() {
+ public String call() throws Exception {
+ return getDisplayNameOf(getParentIShellFolder(),
+ getRelativePIDL(), SHGDN_NORMAL);
+ }
+ });
}
return displayName;
}
// Return the folder type of a shell folder
+ // NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details
private static native String getFolderType(long pIDL);
/**
@@ -747,7 +865,13 @@ final class Win32ShellFolder2 extends ShellFolder {
*/
public String getFolderType() {
if (folderType == null) {
- folderType = getFolderType(getAbsolutePIDL());
+ final long absolutePIDL = getAbsolutePIDL();
+ folderType =
+ ShellFolder.getInvoker().invoke(new Callable() {
+ public String call() throws Exception {
+ return getFolderType(absolutePIDL);
+ }
+ });
}
return folderType;
}
@@ -774,11 +898,16 @@ final class Win32ShellFolder2 extends ShellFolder {
private static Map smallLinkedSystemImages = new HashMap();
private static Map largeLinkedSystemImages = new HashMap();
+ // NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details
private static native long getIShellIcon(long pIShellFolder);
+
+ // NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details
private static native int getIconIndex(long parentIShellIcon, long relativePIDL);
// Return the icon of a file system shell folder in the form of an HICON
private static native long getIcon(String absolutePath, boolean getLargeIcon);
+
+ // NOTE: this method uses COM and must be called on the 'COM thread'. See ComInvoker for the details
private static native long extractIcon(long parentIShellFolder, long relativePIDL,
boolean getLargeIcon);
@@ -799,7 +928,12 @@ final class Win32ShellFolder2 extends ShellFolder {
private long getIShellIcon() {
if (pIShellIcon == -1L) {
- pIShellIcon = getIShellIcon(getIShellFolder());
+ pIShellIcon =
+ ShellFolder.getInvoker().invoke(new Callable() {
+ public Long call() throws Exception {
+ return getIShellIcon(getIShellFolder());
+ }
+ });
}
return pIShellIcon;
}
@@ -850,50 +984,60 @@ final class Win32ShellFolder2 extends ShellFolder {
/**
* @return The icon image used to display this shell folder
*/
- public Image getIcon(boolean getLargeIcon) {
+ public Image getIcon(final boolean getLargeIcon) {
Image icon = getLargeIcon ? largeIcon : smallIcon;
if (icon == null) {
- long parentIShellIcon = (parent != null) ? ((Win32ShellFolder2)parent).getIShellIcon() : 0L;
- long relativePIDL = getRelativePIDL();
+ icon =
+ ShellFolder.getInvoker().invoke(new Callable() {
+ public Image call() throws Exception {
+ Image newIcon = null;
+ if (isFileSystem()) {
+ long parentIShellIcon = (parent != null)
+ ? ((Win32ShellFolder2) parent).getIShellIcon()
+ : 0L;
+ long relativePIDL = getRelativePIDL();
- if (isFileSystem()) {
- // These are cached per type (using the index in the system image list)
- int index = getIconIndex(parentIShellIcon, relativePIDL);
- if (index > 0) {
- Map imageCache;
- if (isLink()) {
- imageCache = getLargeIcon ? largeLinkedSystemImages : smallLinkedSystemImages;
- } else {
- imageCache = getLargeIcon ? largeSystemImages : smallSystemImages;
- }
- icon = (Image)imageCache.get(Integer.valueOf(index));
- if (icon == null) {
- long hIcon = getIcon(getAbsolutePath(), getLargeIcon);
- icon = makeIcon(hIcon, getLargeIcon);
- disposeIcon(hIcon);
- if (icon != null) {
- imageCache.put(Integer.valueOf(index), icon);
+ // These are cached per type (using the index in the system image list)
+ int index = getIconIndex(parentIShellIcon, relativePIDL);
+ if (index > 0) {
+ Map imageCache;
+ if (isLink()) {
+ imageCache = getLargeIcon ? largeLinkedSystemImages : smallLinkedSystemImages;
+ } else {
+ imageCache = getLargeIcon ? largeSystemImages : smallSystemImages;
+ }
+ newIcon = (Image) imageCache.get(Integer.valueOf(index));
+ if (newIcon == null) {
+ long hIcon = getIcon(getAbsolutePath(), getLargeIcon);
+ newIcon = makeIcon(hIcon, getLargeIcon);
+ disposeIcon(hIcon);
+ if (newIcon != null) {
+ imageCache.put(Integer.valueOf(index), newIcon);
+ }
+ }
+ }
}
+
+ if (newIcon == null) {
+ // These are only cached per object
+ long hIcon = extractIcon(getParentIShellFolder(),
+ getRelativePIDL(), getLargeIcon);
+ newIcon = makeIcon(hIcon, getLargeIcon);
+ disposeIcon(hIcon);
+ }
+
+ if (newIcon == null) {
+ newIcon = Win32ShellFolder2.super.getIcon(getLargeIcon);
+ }
+ return newIcon;
}
- }
- }
-
- if (icon == null) {
- // These are only cached per object
- long hIcon = extractIcon(getParentIShellFolder(), getRelativePIDL(), getLargeIcon);
- icon = makeIcon(hIcon, getLargeIcon);
- disposeIcon(hIcon);
- }
-
+ });
if (getLargeIcon) {
largeIcon = icon;
} else {
smallIcon = icon;
}
}
- if (icon == null) {
- icon = super.getIcon(getLargeIcon);
- }
return icon;
}
@@ -969,39 +1113,50 @@ final class Win32ShellFolder2 extends ShellFolder {
private static final int LVCFMT_CENTER = 2;
public ShellFolderColumnInfo[] getFolderColumns() {
- ShellFolderColumnInfo[] columns = doGetColumnInfo(getIShellFolder());
+ return ShellFolder.getInvoker().invoke(new Callable() {
+ public ShellFolderColumnInfo[] call() throws Exception {
+ ShellFolderColumnInfo[] columns = doGetColumnInfo(getIShellFolder());
- if (columns != null) {
- List notNullColumns =
- new ArrayList();
- for (int i = 0; i < columns.length; i++) {
- ShellFolderColumnInfo column = columns[i];
- if (column != null) {
- column.setAlignment(column.getAlignment() == LVCFMT_RIGHT
- ? SwingConstants.RIGHT
- : column.getAlignment() == LVCFMT_CENTER
- ? SwingConstants.CENTER
- : SwingConstants.LEADING);
+ if (columns != null) {
+ List notNullColumns =
+ new ArrayList();
+ for (int i = 0; i < columns.length; i++) {
+ ShellFolderColumnInfo column = columns[i];
+ if (column != null) {
+ column.setAlignment(column.getAlignment() == LVCFMT_RIGHT
+ ? SwingConstants.RIGHT
+ : column.getAlignment() == LVCFMT_CENTER
+ ? SwingConstants.CENTER
+ : SwingConstants.LEADING);
- column.setComparator(new ColumnComparator(getIShellFolder(), i));
+ column.setComparator(new ColumnComparator(getIShellFolder(), i));
- notNullColumns.add(column);
+ notNullColumns.add(column);
+ }
+ }
+ columns = new ShellFolderColumnInfo[notNullColumns.size()];
+ notNullColumns.toArray(columns);
}
+ return columns;
}
- columns = new ShellFolderColumnInfo[notNullColumns.size()];
- notNullColumns.toArray(columns);
- }
- return columns;
+ });
}
- public Object getFolderColumnValue(int column) {
- return doGetColumnValue(getParentIShellFolder(), getRelativePIDL(), column);
+ public Object getFolderColumnValue(final int column) {
+ return ShellFolder.getInvoker().invoke(new Callable
*
* @param remote
* The remote address to which this channel is to be connected
@@ -356,7 +359,10 @@ public abstract class DatagramChannel
*
This method may be invoked at any time. If another thread has
* already initiated a read operation upon this channel, however, then an
* invocation of this method will block until the first operation is
- * complete.
+ * complete. If this channel's socket is not bound then this method will
+ * first cause the socket to be bound to an address that is assigned
+ * automatically, as if invoking the {@link #bind bind} method with a
+ * parameter of {@code null}.
*
* @param dst
* The buffer into which the datagram is to be transferred
@@ -413,7 +419,10 @@ public abstract class DatagramChannel
*
This method may be invoked at any time. If another thread has
* already initiated a write operation upon this channel, however, then an
* invocation of this method will block until the first operation is
- * complete.
+ * complete. If this channel's socket is not bound then this method will
+ * first cause the socket to be bound to an address that is assigned
+ * automatically, as if by invoking the {@link #bind bind) method with a
+ * parameter of {@code null}.
*
* @param src
* The buffer containing the datagram to be sent
diff --git a/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java b/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
index e5ec5e0632d..57b35c9bc20 100644
--- a/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
+++ b/jdk/src/share/classes/sun/nio/ch/DatagramChannelImpl.java
@@ -313,11 +313,9 @@ class DatagramChannelImpl
throw new NullPointerException();
synchronized (readLock) {
ensureOpen();
- // If socket is not bound then behave as if nothing received
- // Will be fixed by 6621699
- if (localAddress() == null) {
- return null;
- }
+ // Socket was not bound before attempting receive
+ if (localAddress() == null)
+ bind(null);
int n = 0;
ByteBuffer bb = null;
try {
diff --git a/jdk/test/java/nio/channels/DatagramChannel/NotBound.java b/jdk/test/java/nio/channels/DatagramChannel/NotBound.java
index 9a58fe64d18..d9fbd7b5efa 100644
--- a/jdk/test/java/nio/channels/DatagramChannel/NotBound.java
+++ b/jdk/test/java/nio/channels/DatagramChannel/NotBound.java
@@ -22,27 +22,110 @@
*/
/* @test
- * @bug 4512723
- * @summary Unit test for datagram-socket-channel adaptors
+ * @bug 4512723 6621689
+ * @summary Test that connect/send/receive with unbound DatagramChannel causes
+ * the channel's socket to be bound to a local address
*/
import java.net.*;
-import java.nio.*;
-import java.nio.channels.*;
+import java.nio.ByteBuffer;
+import java.nio.channels.DatagramChannel;
+import java.io.IOException;
-class NotBound {
- public static void main(String[] args) throws Exception {
- test1(false);
- test1(true);
+public class NotBound {
+
+ static void checkBound(DatagramChannel dc) throws IOException {
+ if (dc.getLocalAddress() == null)
+ throw new RuntimeException("Not bound??");
}
- static void test1(boolean blocking) throws Exception {
- ByteBuffer bb = ByteBuffer.allocateDirect(256);
- DatagramChannel dc1 = DatagramChannel.open();
- dc1.configureBlocking(false);
- SocketAddress isa = dc1.receive(bb);
- if (isa != null)
- throw new Exception("Unbound dc returned non-null");
- dc1.close();
+ // starts a thread to send a datagram to the given channel once the channel
+ // is bound to a local address
+ static void wakeupWhenBound(final DatagramChannel dc) {
+ Runnable wakeupTask = new Runnable() {
+ public void run() {
+ try {
+ // poll for local address
+ InetSocketAddress local;
+ do {
+ Thread.sleep(50);
+ local = (InetSocketAddress)dc.getLocalAddress();
+ } while (local == null);
+
+ // send message to channel to wakeup receiver
+ DatagramChannel sender = DatagramChannel.open();
+ try {
+ ByteBuffer bb = ByteBuffer.wrap("hello".getBytes());
+ InetAddress lh = InetAddress.getLocalHost();
+ SocketAddress target =
+ new InetSocketAddress(lh, local.getPort());
+ sender.send(bb, target);
+ } finally {
+ sender.close();
+ }
+
+ } catch (Exception x) {
+ x.printStackTrace();
+ }
+ }};
+ new Thread(wakeupTask).start();
+ }
+
+ public static void main(String[] args) throws IOException {
+ DatagramChannel dc;
+
+ // connect
+ dc = DatagramChannel.open();
+ try {
+ DatagramChannel peer = DatagramChannel.open()
+ .bind(new InetSocketAddress(0));
+ int peerPort = ((InetSocketAddress)(peer.getLocalAddress())).getPort();
+ try {
+ dc.connect(new InetSocketAddress(InetAddress.getLocalHost(), peerPort));
+ checkBound(dc);
+ } finally {
+ peer.close();
+ }
+ } finally {
+ dc.close();
+ }
+
+ // send
+ dc = DatagramChannel.open();
+ try {
+ ByteBuffer bb = ByteBuffer.wrap("ignore this".getBytes());
+ SocketAddress target =
+ new InetSocketAddress(InetAddress.getLocalHost(), 5000);
+ dc.send(bb, target);
+ checkBound(dc);
+ } finally {
+ dc.close();
+ }
+
+ // receive (blocking)
+ dc = DatagramChannel.open();
+ try {
+ ByteBuffer bb = ByteBuffer.allocateDirect(128);
+ wakeupWhenBound(dc);
+ SocketAddress sender = dc.receive(bb);
+ if (sender == null)
+ throw new RuntimeException("Sender should not be null");
+ checkBound(dc);
+ } finally {
+ dc.close();
+ }
+
+ // receive (non-blocking)
+ dc = DatagramChannel.open();
+ try {
+ dc.configureBlocking(false);
+ ByteBuffer bb = ByteBuffer.allocateDirect(128);
+ SocketAddress sender = dc.receive(bb);
+ if (sender != null)
+ throw new RuntimeException("Sender should be null");
+ checkBound(dc);
+ } finally {
+ dc.close();
+ }
}
}
From 1a0a9da57001bf3e49e7941f34cc2ed8e2fd2584 Mon Sep 17 00:00:00 2001
From: Roman Kennke
Date: Tue, 24 Mar 2009 21:57:50 +0100
Subject: [PATCH 35/80] 6809233: Modal dialog blocks calling thread after it is
hidden and disposed
Send WakingRunnable to toolkit to prevent early cleanup.
Reviewed-by: art, son
---
jdk/src/share/classes/java/awt/Dialog.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/jdk/src/share/classes/java/awt/Dialog.java b/jdk/src/share/classes/java/awt/Dialog.java
index 310e52350e1..a67d94a32ae 100644
--- a/jdk/src/share/classes/java/awt/Dialog.java
+++ b/jdk/src/share/classes/java/awt/Dialog.java
@@ -1226,7 +1226,7 @@ public class Dialog extends Window {
synchronized (getTreeLock()) {
if (keepBlockingEDT) {
keepBlockingEDT = false;
- PeerEvent wakingEvent = new PeerEvent(this, new WakingRunnable(), PeerEvent.PRIORITY_EVENT);
+ PeerEvent wakingEvent = new PeerEvent(getToolkit(), new WakingRunnable(), PeerEvent.PRIORITY_EVENT);
AppContext curAppContext = AppContext.getAppContext();
if (showAppContext != curAppContext) {
// Wake up event dispatch thread on which the dialog was
From 01a36018d3056abd0b12ffdff20827cf5a1e352d Mon Sep 17 00:00:00 2001
From: Doug Lea
+ * WARNING: This class is an implementation detail and only meant
+ * for limited use outside of the core platform. This API may change
+ * drastically between update release, and it may even be
+ * removed or be moved to some other packages or classes.
+ */
+public final class SecurityWarning {
+
+ /**
+ * The SecurityWarning class should not be instantiated
+ */
+ private SecurityWarning() {
+ }
+
+ /**
+ * Gets the size of the security warning.
+ *
+ * The returned value is not valid until the peer has been created. Before
+ * invoking this method a developer must call the {@link Window#pack()},
+ * {@link Window#setVisible()}, or some other method that creates the peer.
+ *
+ * @param window the window to get the security warning size for
+ *
+ * @throws NullPointerException if the window argument is null
+ * @throws IllegalArgumentException if the window is trusted (i.e.
+ * the {@code getWarningString()} returns null)
+ */
+ public static Dimension getSize(Window window) {
+ if (window == null) {
+ throw new NullPointerException(
+ "The window argument should not be null.");
+ }
+ if (window.getWarningString() == null) {
+ throw new IllegalArgumentException(
+ "The window must have a non-null warning string.");
+ }
+ // We don't check for a non-null peer since it may be destroyed
+ // after assigning a valid value to the security warning size.
+
+ return AWTAccessor.getWindowAccessor().getSecurityWarningSize(window);
+ }
+
+ /**
+ * Sets the position of the security warning.
+ *
+ * The {@code alignmentX} and {@code alignmentY} arguments specify the
+ * origin of the coordinate system used to calculate the position of the
+ * security warning. The values must be in the range [0.0f...1.0f]. The
+ * {@code 0.0f} value represents the left (top) edge of the rectangular
+ * bounds of the window. The {@code 1.0f} value represents the right
+ * (bottom) edge of the bounds. Whenever the size of the window changes,
+ * the origin of the coordinate system gets relocated accordingly. For
+ * convenience a developer may use the {@code Component.*_ALIGNMENT}
+ * constants to pass predefined values for these arguments.
+ *
+ * The {@code point} argument specifies the location of the security
+ * warning in the coordinate system described above. If both {@code x} and
+ * {@code y} coordinates of the point are equal to zero, the warning will
+ * be located right in the origin of the coordinate system. On the other
+ * hand, if both {@code alignmentX} and {@code alignmentY} are equal to
+ * zero (i.e. the origin of the coordinate system is placed at the top-left
+ * corner of the window), then the {@code point} argument represents the
+ * absolute location of the security warning relative to the location of
+ * the window. The "absolute" in this case means that the position of the
+ * security warning is not effected by resizing of the window.
+ *
+ * Note that the security warning managment code guarantees that:
+ *
+ *
The security warning cannot be located farther than two pixels from
+ * the rectangular bounds of the window (see {@link Window#getBounds}), and
+ *
The security warning is always visible on the screen.
+ *
+ * If either of the conditions is violated, the calculated position of the
+ * security warning is adjusted by the system to meet both these
+ * conditions.
+ *
+ * The default position of the security warning is in the upper-right
+ * corner of the window, two pixels to the right from the right edge. This
+ * corresponds to the following arguments passed to this method:
+ *