diff --git a/core/PApplet.java b/core/PApplet.java index 2f340ce26..35a3e7a05 100644 --- a/core/PApplet.java +++ b/core/PApplet.java @@ -1424,6 +1424,12 @@ public class PApplet extends Applet keyTyped(); break; } + + // if someone else wants to intercept the key, they should + // set key to zero (or something besides the ESC). + if (key == KeyEvent.VK_ESCAPE) { + exit(); + } } @@ -1817,7 +1823,11 @@ public class PApplet extends Applet */ public void exit() { stop(); - // TODO if not running as an applet, do a System.exit() here + finished = true; + + if ((leechErr == null) && !online) { + System.exit(0); + } } @@ -5376,29 +5386,37 @@ v PApplet.this.stop(); (fullscreen.height - applet.height) / 2, applet.width, applet.height); - if (external) { - Label label = new Label("stop"); - label.setForeground(stopColor); - label.addMouseListener(new MouseAdapter() { - public void mousePressed(MouseEvent e) { + // doesn't help for gl, since it has its own canvas + /* + applet.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent e) { + System.out.println(e); + if (e.getKeyChar() == KeyEvent.VK_ESCAPE) { + //System.out.println("escape!"); System.exit(0); } - }); - frame.add(label); + } + }); + */ - /* - frame.addKeyListener(new KeyAdapter() { - public void keyPressed(KeyEvent e) { - System.out.println(e); - } - }); - */ + Label label = new Label("stop"); + label.setForeground(stopColor); + label.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent e) { + System.exit(0); + } + }); + frame.add(label); - Dimension labelSize = label.getPreferredSize(); - // sometimes shows up truncated on mac - labelSize = new Dimension(labelSize.width * 2, labelSize.height); - label.setSize(labelSize); - label.setLocation(20, fullscreen.height - labelSize.height - 20); + Dimension labelSize = label.getPreferredSize(); + // sometimes shows up truncated on mac + //System.out.println("label width is " + labelSize.width); + labelSize = new Dimension(100, labelSize.height); + label.setSize(labelSize); + label.setLocation(20, fullscreen.height - labelSize.height - 20); + + // not always running externally when in present mode + if (external) { applet.setupExternal(frame); } diff --git a/core/todo.txt b/core/todo.txt index b026af9ca..7935c3af0 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -8,11 +8,17 @@ o make the 1.4 code in PApplet load via reflection X doesn't appear necessary with 1.3 applets o or is some of the stuff usable in 1.3 but not all? o ie. the device config classes exist but not the set full screen method - -_ currently some bugs in the main() because it's not sizing applets -_ if running in present mode it works ok -_ but that also needs its display set.. argh -_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1115834600;start=0 +X currently some bugs in the main() because it's not sizing applets +X if running in present mode it works ok +X but that also needs its display set.. argh +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1115834600;start=0 +X add exit() function to actually explicitly quit +X scripts will just require that people include exit at the end +X esc should kill fullscreen mode (actually now it just quits anything) +X can a key handler be added to the window? not really +X add an escape listener to the applet tho.. but will it work with gl? +X how can this be shut off for presentations? +X http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1114027594;start=0 _ need to test/straighten out load/update pixels loadPixels() and updatePixels() only need to be used when @@ -94,10 +100,7 @@ _ should image i/o and sound i/o be moved into PImage and PSound? _ how to load external encoders/decoders _ placement of 100x100 items is odd _ happens with P3D and maybe also P2D? -_ scripting issues -_ how to make a long setup() sleep so that things don't lock way up -_ add exit() function to actually explicitly quit -_ scripts will just require that people include exit at the end +_ scripts: how to make a long setup() sleep so that things don't lock way up _ fileInput() and fileOutput() may not agree with draw() _ not yet verified _ can only be used inside of setup()? @@ -113,10 +116,6 @@ CORE / PApplet - main() _ present mode is flakey.. applet doesn't always come up _ seems like hitting stop helps shut it down? _ is full screen window not being taken down properly? -_ esc should kill fullscreen mode -_ can a key handler be added to the window? -_ how can this be shut off for presentations? -_ http://processing.org/discourse/yabb_beta/YaBB.cgi?board=SoftwareBugs;action=display;num=1114027594;start=0 _ implement full screen mode.. this takes over the screen as best it can _ size(screen.width, screen.height, OPENGL); _ if size is screen.width and screen.height, does its best diff --git a/opengl/PGraphicsGL.java b/opengl/PGraphicsGL.java index 641fbc89d..bd0483295 100644 --- a/opengl/PGraphicsGL.java +++ b/opengl/PGraphicsGL.java @@ -93,7 +93,6 @@ public class PGraphicsGL extends PGraphics3 { canvas.setBounds(0, 0, width, height); //System.out.println("creating PGraphicsGL 5"); - //System.out.println("adding canvas listeners"); canvas.addMouseListener(applet); canvas.addMouseMotionListener(applet);