diff --git a/core/src/processing/awt/PSurfaceAWT.java b/core/src/processing/awt/PSurfaceAWT.java index 2ff5b2194..b1038dbe4 100644 --- a/core/src/processing/awt/PSurfaceAWT.java +++ b/core/src/processing/awt/PSurfaceAWT.java @@ -22,13 +22,30 @@ package processing.awt; -import java.awt.*; +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Image; +import java.awt.Insets; +import java.awt.Label; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Toolkit; import java.awt.event.*; import java.awt.geom.Rectangle2D; import java.awt.image.*; +import java.lang.management.ManagementFactory; import java.lang.reflect.Method; import java.net.URL; import java.util.ArrayList; +import java.util.List; import javax.swing.JFrame; @@ -565,9 +582,9 @@ public class PSurfaceAWT extends PSurfaceNone { } - static ArrayList iconImages; + List iconImages; - static protected void setProcessingIcon(Frame frame) { + protected void setProcessingIcon(Frame frame) { // On OS X, this only affects what shows up in the dock when minimized. // So replacing it is actually a step backwards. Brilliant. if (PApplet.platform != PConstants.MACOSX) { @@ -590,26 +607,45 @@ public class PSurfaceAWT extends PSurfaceNone { } catch (Exception e) { } // harmless; keep this to ourselves - } else { - // On OS X, set this for AWT surfaces, which handles the dock image - // as well as the cmd-tab image that's shown. Just one size, I guess. - URL url = PApplet.class.getResource("/icon/icon-512.png"); - // Seems dangerous to have this in code instead of using reflection, no? - //ThinkDifferent.setIconImage(Toolkit.getDefaultToolkit().getImage(url)); - try { - final String td = "processing.core.ThinkDifferent"; - Class thinkDifferent = - Thread.currentThread().getContextClassLoader().loadClass(td); - Method method = - thinkDifferent.getMethod("setIconImage", new Class[] { java.awt.Image.class }); - method.invoke(null, new Object[] { Toolkit.getDefaultToolkit().getImage(url) }); - } catch (Exception e) { - e.printStackTrace(); // That's unfortunate + } else { // handle OS X differently + if (!dockIconSpecified()) { // don't override existing -Xdock param + // On OS X, set this for AWT surfaces, which handles the dock image + // as well as the cmd-tab image that's shown. Just one size, I guess. + URL url = PApplet.class.getResource("/icon/icon-512.png"); + // Seems dangerous to have this in code instead of using reflection, no? + //ThinkDifferent.setIconImage(Toolkit.getDefaultToolkit().getImage(url)); + try { + final String td = "processing.core.ThinkDifferent"; + Class thinkDifferent = + Thread.currentThread().getContextClassLoader().loadClass(td); + Method method = + thinkDifferent.getMethod("setIconImage", new Class[] { java.awt.Image.class }); + method.invoke(null, new Object[] { Toolkit.getDefaultToolkit().getImage(url) }); + } catch (Exception e) { + e.printStackTrace(); // That's unfortunate + } } } } + /** + * @return true if -Xdock:icon was specified on the command line + */ + private boolean dockIconSpecified() { + // TODO This is incomplete... Haven't yet found a way to figure out if + // the app has an icns file specified already. Help? + List jvmArgs = + ManagementFactory.getRuntimeMXBean().getInputArguments(); + for (String arg : jvmArgs) { + if (arg.startsWith("-Xdock:icon")) { + return true; // dock image already set + } + } + return false; + } + + @Override public void setVisible(boolean visible) { frame.setVisible(visible); diff --git a/core/todo.txt b/core/todo.txt index 51c1614dd..5b745d5ab 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -271,6 +271,7 @@ _ need to change to iterate through display rectangles _ may be related to full-screen bug filed recently _ closing a sketch window manually (not hitting Stop) not killing sketch _ at least with the Java2D renderer +_ don't override the window icon w/ p5 logo if already set retina/hidpi diff --git a/todo.txt b/todo.txt index 44d494174..3f6415f52 100644 --- a/todo.txt +++ b/todo.txt @@ -36,6 +36,9 @@ X Internationalize MovieMaker.java X https://github.com/processing/processing/pull/3424 X Auto-completion does not seem to be working X https://github.com/processing/processing/issues/3111 +X Re-enable export to application with command line +X https://github.com/processing/processing/pull/3451 +X https://github.com/processing/processing/issues/2760 gsoc X Mode problems window wasn't doing line breaks @@ -57,6 +60,8 @@ X https://github.com/processing/processing/pull/3432 X Error during installation of any contribution X https://github.com/processing/processing/issues/3429 X https://github.com/processing/processing/pull/3438 +X CM with updated statusPanel and error popup +X https://github.com/processing/processing/pull/3452 cleaning o libraries in java tabs (separate .java files) are reported missing @@ -75,6 +80,9 @@ _ https://github.com/processing/processing/issues/2953 beta _ Tweak mode broken (re: new settings() function) _ https://github.com/processing/processing/issues/3435 +_ looks like 'class' def from tweak needs to go below setup +_ make modes load their parent class +_ https://github.com/processing/processing/issues/3443 _ add "welcome" or "what's new" window to explain features in 3 _ https://github.com/processing/processing/issues/3358 _ a summary of what's new, plus a link to GitHub wiki page with details