提交 42910ea5 编写于 作者: L lana

Merge

...@@ -1857,7 +1857,7 @@ public abstract class Toolkit { ...@@ -1857,7 +1857,7 @@ public abstract class Toolkit {
/** /**
* Adds the specified property change listener for the named desktop * 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. * its property name is ignored, and the wrapped listener is added.
* If {@code name} is {@code null} or {@code pcl} is {@code null}, * If {@code name} is {@code null} or {@code pcl} is {@code null},
* no exception is thrown and no action is performed. * no exception is thrown and no action is performed.
...@@ -1874,7 +1874,7 @@ public abstract class Toolkit { ...@@ -1874,7 +1874,7 @@ public abstract class Toolkit {
/** /**
* Removes the specified property change listener for the named * 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 * is removed, its property name is ignored, and
* the wrapped listener is removed. * the wrapped listener is removed.
* If {@code name} is {@code null} or {@code pcl} is {@code null}, * If {@code name} is {@code null} or {@code pcl} is {@code null},
...@@ -1893,11 +1893,11 @@ public abstract class Toolkit { ...@@ -1893,11 +1893,11 @@ public abstract class Toolkit {
/** /**
* Returns an array of all the property change listeners * Returns an array of all the property change listeners
* registered on this toolkit. The returned array * 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. * that associate listeners with the names of desktop properties.
* *
* @return all of this toolkit's {@ code PropertyChangeListener} * @return all of this toolkit's {@link PropertyChangeListener}
* objects wrapped in {@code PropertyChangeListenerProxy} objects * objects wrapped in {@code java.beans.PropertyChangeListenerProxy} objects
* or an empty array if no listeners are added * or an empty array if no listeners are added
* *
* @see PropertyChangeSupport#getPropertyChangeListeners() * @see PropertyChangeSupport#getPropertyChangeListeners()
......
...@@ -29,8 +29,6 @@ import java.awt.FileDialog; ...@@ -29,8 +29,6 @@ import java.awt.FileDialog;
import java.awt.peer.FileDialogPeer; import java.awt.peer.FileDialogPeer;
import java.io.File; import java.io.File;
import java.io.FilenameFilter; import java.io.FilenameFilter;
import javax.swing.SwingUtilities;
import javax.swing.SwingWorker;
import sun.awt.AWTAccessor; import sun.awt.AWTAccessor;
/** /**
...@@ -107,9 +105,7 @@ class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer { ...@@ -107,9 +105,7 @@ class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer {
if (b) { if (b) {
Thread t = new Thread() { Thread t = new Thread() {
public void run() { public void run() {
GtkFileDialogPeer.this.run(fd.getTitle(), fd.getMode(), showNativeDialog();
fd.getDirectory(), fd.getFile(), fd.getFilenameFilter(), fd.isMultipleMode(),
fd.getX(), fd.getY());
fd.setVisible(false); fd.setVisible(false);
} }
}; };
...@@ -146,4 +142,30 @@ class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer { ...@@ -146,4 +142,30 @@ class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer {
// We do not implement this method because we // We do not implement this method because we
// have delegated to FileDialog#setFilenameFilter // 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());
}
} }
...@@ -3715,7 +3715,10 @@ void AwtComponent::OpenCandidateWindow(int x, int y) ...@@ -3715,7 +3715,10 @@ void AwtComponent::OpenCandidateWindow(int x, int y)
SetCandidateWindow(iCandType, x-rc.left, y-rc.top); SetCandidateWindow(iCandType, x-rc.left, y-rc.top);
} }
if (m_bitsCandType != 0) { 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);
} }
} }
......
...@@ -69,9 +69,12 @@ void AwtObject::_Dispose(jobject self) ...@@ -69,9 +69,12 @@ void AwtObject::_Dispose(jobject self)
CriticalSection::Lock l(AwtToolkit::GetInstance().GetSyncCS()); 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 // value 0 of lParam means that we should not attempt to enter the
// SyncCall critical section, as it was entered someshere earlier // 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; CATCH_BAD_ALLOC;
} }
......
...@@ -741,7 +741,9 @@ LRESULT CALLBACK AwtToolkit::WndProc(HWND hWnd, UINT message, ...@@ -741,7 +741,9 @@ LRESULT CALLBACK AwtToolkit::WndProc(HWND hWnd, UINT message,
} }
if (canDispose) { if (canDispose) {
if(wParam != NULL) { 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)) { if(o != NULL && theAwtObjectList.Remove(o)) {
o->Dispose(); o->Dispose();
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册