diff --git a/app/src/processing/app/RunnerListenerEdtAdapter.java b/app/src/processing/app/RunnerListenerEdtAdapter.java index a436eefbc..2984cf9bf 100644 --- a/app/src/processing/app/RunnerListenerEdtAdapter.java +++ b/app/src/processing/app/RunnerListenerEdtAdapter.java @@ -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)); diff --git a/java/src/processing/mode/java/runner/Runner.java b/java/src/processing/mode/java/runner/Runner.java index 04897afa4..df53a3fa0 100644 --- a/java/src/processing/mode/java/runner/Runner.java +++ b/java/src/processing/mode/java/runner/Runner.java @@ -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; } diff --git a/todo.txt b/todo.txt index 0a2290356..9979e9cc8 100755 --- a/todo.txt +++ b/todo.txt @@ -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