fix --external and window placement issues (fixes #158)

This commit is contained in:
Ben Fry
2021-06-14 18:46:57 -04:00
parent 3eeb196a79
commit fe5f7d568d
3 changed files with 25 additions and 13 deletions

View File

@@ -10,6 +10,11 @@ public class RunnerListenerEdtAdapter implements RunnerListener {
this.wrapped = wrapped;
}
/** Need the original object so we can see if it's a JavaEditor */
public RunnerListener getWrapped() {
return wrapped;
}
@Override
public void statusError(String message) {
EventQueue.invokeLater(() -> wrapped.statusError(message));

View File

@@ -85,16 +85,24 @@ public class Runner implements MessageConsumer {
public Runner(JavaBuild build, RunnerListener listener) throws SketchException {
this.listener = listener;
// this.sketch = sketch;
this.build = build;
checkLocalHost();
if (listener instanceof JavaEditor) {
this.editor = (JavaEditor) listener;
sketchErr = editor.getConsole().getErr();
sketchOut = editor.getConsole().getOut();
} else {
if (listener instanceof RunnerListenerEdtAdapter) {
// RunnerListener gets wrapped so that it behaves on the EDT.
// Need to extract the wrapped Object and see if it's a Java Editor,
// in which case we'll be passing additional parameters to the PApplet.
// https://github.com/processing/processing/issues/5843
RunnerListener wrapped = ((RunnerListenerEdtAdapter) listener).getWrapped();
if (wrapped instanceof JavaEditor) {
editor = (JavaEditor) wrapped;
sketchErr = editor.getConsole().getErr();
sketchOut = editor.getConsole().getOut();
}
}
// If it's not a JavaEditor, then we don't redirect to a console.
if (editor == null) {
sketchErr = System.err;
sketchOut = System.out;
}
@@ -466,10 +474,8 @@ public class Runner implements MessageConsumer {
}
params.append(PApplet.ARGS_EXTERNAL);
}
params.append(PApplet.ARGS_DISPLAY + "=" + runDisplay);
if (present) {
params.append(PApplet.ARGS_PRESENT);
// if (Preferences.getBoolean("run.present.exclusive")) {
@@ -495,6 +501,7 @@ public class Runner implements MessageConsumer {
if (args != null) {
params.append(args);
}
// Pass back the whole list
return params;
}

View File

@@ -23,6 +23,11 @@ X add PVector.setHeading() for parity with p5.js
X https://github.com/processing/processing4/issues/193
X automatically lock closed issues
X https://github.com/apps/lock
X Display Window doesn't remember its position
X https://github.com/processing/processing4/issues/158
_ seems that --external not getting passed
_ https://github.com/processing/processing/issues/5843
_ https://github.com/processing/processing/issues/5781
earlier
o further streamline the downloader
@@ -70,11 +75,6 @@ already fixed in 4.x? (confirm/close on release)
_ HDPI support GNOME desktop
_ https://github.com/processing/processing/issues/6059
_ Display Window doesn't remember its position
_ https://github.com/processing/processing4/issues/158
_ seems that --external not getting passed
_ https://github.com/processing/processing/issues/5843
_ https://github.com/processing/processing/issues/5781
_ remove the JRE Downloader
_ https://github.com/processing/processing4/issues/155
_ editor breakpoints out of the .pde files