changeset 4439:b955226868af

Merge
author lana
date Thu, 02 Jun 2011 13:36:29 -0700
parents b351af09bfa3 (current diff) f05164caa490 (diff)
children 386516fdf40b
files
diffstat 5 files changed, 43 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/awt/Toolkit.java	Thu Jun 02 13:35:47 2011 -0700
+++ b/src/share/classes/java/awt/Toolkit.java	Thu Jun 02 13:36:29 2011 -0700
@@ -1857,7 +1857,7 @@
 
     /**
      * Adds the specified property change listener for the named desktop
-     * property. When a {@link PropertyChangeListenerProxy} object is added,
+     * property. When a {@link java.beans.PropertyChangeListenerProxy} object is added,
      * its property name is ignored, and the wrapped listener is added.
      * If {@code name} is {@code null} or {@code pcl} is {@code null},
      * no exception is thrown and no action is performed.
@@ -1874,7 +1874,7 @@
 
     /**
      * Removes the specified property change listener for the named
-     * desktop property. When a {@link PropertyChangeListenerProxy} object
+     * desktop property. When a {@link java.beans.PropertyChangeListenerProxy} object
      * is removed, its property name is ignored, and
      * the wrapped listener is removed.
      * If {@code name} is {@code null} or {@code pcl} is {@code null},
@@ -1893,11 +1893,11 @@
     /**
      * Returns an array of all the property change listeners
      * registered on this toolkit. The returned array
-     * contains {@code PropertyChangeListenerProxy} objects
+     * contains {@link java.beans.PropertyChangeListenerProxy} objects
      * that associate listeners with the names of desktop properties.
      *
-     * @return all of this toolkit's {@ code PropertyChangeListener}
-     *         objects wrapped in {@code PropertyChangeListenerProxy} objects
+     * @return all of this toolkit's {@link PropertyChangeListener}
+     *         objects wrapped in {@code java.beans.PropertyChangeListenerProxy} objects
      *         or an empty array  if no listeners are added
      *
      * @see PropertyChangeSupport#getPropertyChangeListeners()
--- a/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java	Thu Jun 02 13:35:47 2011 -0700
+++ b/src/solaris/classes/sun/awt/X11/GtkFileDialogPeer.java	Thu Jun 02 13:36:29 2011 -0700
@@ -29,8 +29,6 @@
 import java.awt.peer.FileDialogPeer;
 import java.io.File;
 import java.io.FilenameFilter;
-import javax.swing.SwingUtilities;
-import javax.swing.SwingWorker;
 import sun.awt.AWTAccessor;
 
 /**
@@ -107,9 +105,7 @@
             if (b) {
                 Thread t = new Thread() {
                     public void run() {
-                        GtkFileDialogPeer.this.run(fd.getTitle(), fd.getMode(),
-                                   fd.getDirectory(), fd.getFile(), fd.getFilenameFilter(), fd.isMultipleMode(),
-                                   fd.getX(), fd.getY());
+                        showNativeDialog();
                         fd.setVisible(false);
                     }
                 };
@@ -146,4 +142,30 @@
         // We do not implement this method because we
         // have delegated to FileDialog#setFilenameFilter
     }
+
+    private void showNativeDialog() {
+        String dirname = fd.getDirectory();
+        // File path has a priority against directory path.
+        String filename = fd.getFile();
+        if (filename != null) {
+            final File file = new File(filename);
+            if (fd.getMode() == FileDialog.LOAD
+                && dirname != null
+                && file.getParent() == null) {
+                // File path for gtk_file_chooser_set_filename.
+                filename = dirname + (dirname.endsWith(File.separator) ? "" :
+                                              File.separator) + filename;
+            }
+            if (fd.getMode() == FileDialog.SAVE && file.getParent() != null) {
+                // Filename for gtk_file_chooser_set_current_name.
+                filename = file.getName();
+                // Directory path for gtk_file_chooser_set_current_folder.
+                dirname = file.getParent();
+            }
+        }
+        GtkFileDialogPeer.this.run(fd.getTitle(), fd.getMode(), dirname,
+                                   filename, fd.getFilenameFilter(),
+                                   fd.isMultipleMode(), fd.getX(), fd.getY());
+    }
+
 }
--- a/src/windows/native/sun/windows/awt_Component.cpp	Thu Jun 02 13:35:47 2011 -0700
+++ b/src/windows/native/sun/windows/awt_Component.cpp	Thu Jun 02 13:36:29 2011 -0700
@@ -3715,7 +3715,10 @@
             SetCandidateWindow(iCandType, x-rc.left, y-rc.top);
     }
     if (m_bitsCandType != 0) {
-        ::DefWindowProc(GetHWnd(), WM_IME_NOTIFY, IMN_OPENCANDIDATE, m_bitsCandType);
+        HWND proxy = GetProxyFocusOwner();
+        // REMIND: is there any chance GetProxyFocusOwner() returns NULL here?
+        ::DefWindowProc((proxy != NULL) ? proxy : GetHWnd(),
+                        WM_IME_NOTIFY, IMN_OPENCANDIDATE, m_bitsCandType);
     }
 }
 
--- a/src/windows/native/sun/windows/awt_Object.cpp	Thu Jun 02 13:35:47 2011 -0700
+++ b/src/windows/native/sun/windows/awt_Object.cpp	Thu Jun 02 13:36:29 2011 -0700
@@ -69,9 +69,12 @@
 
     CriticalSection::Lock l(AwtToolkit::GetInstance().GetSyncCS());
 
+    JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2);
+    jobject selfGlobalRef = env->NewGlobalRef(self);
+
     // value 0 of lParam means that we should not attempt to enter the
     // SyncCall critical section, as it was entered someshere earlier
-    AwtToolkit::GetInstance().SendMessage(WM_AWT_DISPOSE, (WPARAM)self, (LPARAM)0);
+    AwtToolkit::GetInstance().SendMessage(WM_AWT_DISPOSE, (WPARAM)selfGlobalRef, (LPARAM)0);
 
     CATCH_BAD_ALLOC;
 }
--- a/src/windows/native/sun/windows/awt_Toolkit.cpp	Thu Jun 02 13:35:47 2011 -0700
+++ b/src/windows/native/sun/windows/awt_Toolkit.cpp	Thu Jun 02 13:36:29 2011 -0700
@@ -741,7 +741,9 @@
           }
           if (canDispose) {
               if(wParam != NULL) {
-                  AwtObject *o = (AwtObject *) JNI_GET_PDATA((jobject)wParam);
+                  jobject self = (jobject)wParam;
+                  AwtObject *o = (AwtObject *) JNI_GET_PDATA(self);
+                  env->DeleteGlobalRef(self);
                   if(o != NULL && theAwtObjectList.Remove(o)) {
                       o->Dispose();
                   }