mirror of
https://github.com/processing/processing4.git
synced 2026-02-13 18:35:37 +01:00
major changes, moving pgraphics stuff into papplet
This commit is contained in:
@@ -44,27 +44,33 @@ class PdeMessageSiphon implements Runnable {
|
||||
|
||||
|
||||
public void run() {
|
||||
while (Thread.currentThread() == thread) {
|
||||
//System.err.print("p");
|
||||
//System.err.println(streamReader);
|
||||
String currentLine;
|
||||
|
||||
String currentLine;
|
||||
try {
|
||||
// process data until we hit EOF; this may block
|
||||
//
|
||||
while ((currentLine = streamReader.readLine()) != null) {
|
||||
consumer.message(currentLine);
|
||||
//System.err.println("PMS: " + currentLine);
|
||||
}
|
||||
} catch (NullPointerException npe) {
|
||||
// ignore this guy, since it's prolly just shutting down
|
||||
//npe.printStackTrace();
|
||||
thread = null;
|
||||
|
||||
try {
|
||||
// process data until we hit EOF; this may block
|
||||
//
|
||||
while ((currentLine = streamReader.readLine()) != null) {
|
||||
consumer.message(currentLine);
|
||||
//System.err.println(currentLine);
|
||||
}
|
||||
} catch (NullPointerException npe) {
|
||||
// ignore this guy, since it's prolly just shutting down
|
||||
|
||||
} catch (Exception e) {
|
||||
// on linux, a "bad file descriptor" message comes up when
|
||||
// closing an applet that's being run externally.
|
||||
// use this to cause that to fail silently since not important
|
||||
if ((PdeBase.platform != PdeBase.LINUX) ||
|
||||
(e.getMessage().indexOf("Bad file descriptor") == -1)) {
|
||||
System.err.println("PdeMessageSiphon err " + e);
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
// on linux, a "bad file descriptor" message comes up when
|
||||
// closing an applet that's being run externally.
|
||||
// use this to cause that to fail silently since not important
|
||||
if ((PdeBase.platform != PdeBase.LINUX) ||
|
||||
(e.getMessage().indexOf("Bad file descriptor") == -1)) {
|
||||
System.err.println("PdeMessageSiphon err " + e);
|
||||
e.printStackTrace();
|
||||
thread = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
//System.err.println("siphon thread exiting");
|
||||
|
||||
@@ -82,10 +82,17 @@ public class PdeRuntime implements PdeMessageConsumer {
|
||||
// the sketch window. this will be passed to the PApplet runner
|
||||
// using something like --external=e30,20 where the e stands for
|
||||
// exact. otherwise --external=x,y for just the regular positioning.
|
||||
/*
|
||||
String location = (windowLocation != null) ?
|
||||
(PApplet.EXTERNAL_EXACT_LOCATION +
|
||||
windowLocation.x + "," + windowLocation.y) :
|
||||
(x1 + "," + y1);
|
||||
*/
|
||||
String location =
|
||||
(windowLocation != null) ?
|
||||
(PApplet.EXT_EXACT_LOCATION +
|
||||
windowLocation.x + "," + windowLocation.y) :
|
||||
(PApplet.EXT_LOCATION + x1 + "," + y1);
|
||||
|
||||
String command[] = new String[] {
|
||||
"java",
|
||||
@@ -93,13 +100,16 @@ public class PdeRuntime implements PdeMessageConsumer {
|
||||
"-cp",
|
||||
sketch.classPath,
|
||||
"processing.core.PApplet",
|
||||
PApplet.EXTERNAL_FLAG + location,
|
||||
//PApplet.EXTERNAL_FLAG + location,
|
||||
location,
|
||||
PApplet.EXT_SKETCH_FOLDER + sketch.folder.getAbsolutePath(),
|
||||
sketch.mainClassName
|
||||
};
|
||||
|
||||
//PApplet.println(command);
|
||||
process = Runtime.getRuntime().exec(command);
|
||||
new SystemOutSiphon(process.getInputStream());
|
||||
new PdeMessageSiphon(process.getErrorStream(), this);
|
||||
new SystemOutSiphon(process.getInputStream());
|
||||
processOutput = process.getOutputStream();
|
||||
|
||||
} else {
|
||||
@@ -109,6 +119,7 @@ public class PdeRuntime implements PdeMessageConsumer {
|
||||
|
||||
// replaces setRuntime with PApplet having leechErr [fry]
|
||||
applet.leechErr = leechErr;
|
||||
applet.folder = sketch.folder.getAbsolutePath();
|
||||
|
||||
// has to be before init
|
||||
//applet.serialProperties(PdePreferences.properties);
|
||||
|
||||
Reference in New Issue
Block a user