trying to debug window focus issue

This commit is contained in:
benfry
2012-03-27 14:27:58 +00:00
parent 30319befb6
commit 6eea3ec46e
4 changed files with 38 additions and 29 deletions
+7 -3
View File
@@ -265,9 +265,13 @@ public abstract class Editor extends JFrame implements RunnerListener {
// May not be necessary, but helps avoid random situations with
// the editor not being able to request its own focus.
addWindowFocusListener(new WindowAdapter() {
public void windowGainedFocus(WindowEvent e) {
textarea.requestFocusInWindow();
}
public void windowGainedFocus(WindowEvent e) {
textarea.requestFocusInWindow();
}
// public void windowLostFocus(WindowEvent e) {
// System.out.println("lost focus, should we tell the text area?");
// }
});
// Open the document that was passed in
+19 -18
View File
@@ -709,7 +709,9 @@ public class Sketch {
String newParentDir = null;
String newName = null;
/*
if (false) {
// The Swing file chooser has some upside (i.e. fixes an OS X focus
// traversal bug) bug is super ugly and not OS native.
JFileChooser fc = new JFileChooser();
fc.setDialogTitle("Save sketch folder as...");
if (isReadOnly() || isUntitled()) {
@@ -727,25 +729,24 @@ public class Sketch {
newParentDir = selection.getParent();
newName = selection.getName();
}
*/
// get new name for folder
FileDialog fd = new FileDialog(editor,
"Save sketch folder as...",
FileDialog.SAVE);
if (isReadOnly() || isUntitled()) {
// default to the sketchbook folder
fd.setDirectory(Preferences.get("sketchbook.path"));
} else {
// default to the parent folder of where this was
fd.setDirectory(folder.getParent());
// get new name for folder
FileDialog fd = new FileDialog(editor,
"Save sketch folder as...",
FileDialog.SAVE);
if (isReadOnly() || isUntitled()) {
// default to the sketchbook folder
fd.setDirectory(Preferences.get("sketchbook.path"));
} else {
// default to the parent folder of where this was
fd.setDirectory(folder.getParent());
}
String oldName = folder.getName();
fd.setFile(oldName);
fd.setVisible(true);
newParentDir = fd.getDirectory();
newName = fd.getFile();
}
String oldName = folder.getName();
fd.setFile(oldName);
fd.setVisible(true);
newParentDir = fd.getDirectory();
newName = fd.getFile();
// user canceled selection
if (newName == null) return false;
@@ -176,13 +176,13 @@ public class JEditTextArea extends JComponent
}
/**
* Returns if this component can be traversed by pressing
* the Tab key. This returns false.
*/
// public final boolean isManagingFocus() {
// return true;
// }
// /**
// * Returns if this component can be traversed by pressing
// * the Tab key. This returns false. (removing b/c superclass returns false)
// */
// public final boolean isManagingFocus() {
// return false;
// }
/**
* Returns the object responsible for painting this text area.
@@ -1822,7 +1822,7 @@ public class JEditTextArea extends JComponent
* Inserts the clipboard contents into the text.
*/
public void paste() {
System.out.println("focus owner is: " + isFocusOwner());
// System.out.println("focus owner is: " + isFocusOwner());
if (editable) {
Clipboard clipboard = getToolkit().getSystemClipboard();
try {
+4
View File
@@ -1542,6 +1542,10 @@ _ http://dev.processing.org/bugs/show_bug.cgi?id=1567
DIST / Mac OS X
_ cut/copy/paste while saving a sketch on goes to the editor, not save dialog
_ http://code.google.com/p/processing/issues/detail?id=997
_ problem with focus traversal and native windows on OS X
_ using JFileChooser fixes the problem (but is ugly)
_ the word from apple on Info.plist setup
DO NOT USE "JVMArchs". It is deprecated, and manually overrides the natural architecture launching and ordering that LaunchServices does, including accommodating the 32-bit checkbox in the Get Info window.
_ instead of "show sketch folder" method, use: