From 20926bd8a2aa8617e91cbec98b714f9cccdf9729 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Wed, 3 Jun 2015 17:03:49 -0500 Subject: [PATCH] set frame icon images for Java2D (dock and cmd-tab) --- core/src/processing/core/PSurfaceAWT.java | 6 ++++++ core/src/processing/core/ThinkDifferent.java | 7 +++++++ core/todo.txt | 1 + 3 files changed, 14 insertions(+) diff --git a/core/src/processing/core/PSurfaceAWT.java b/core/src/processing/core/PSurfaceAWT.java index fbeec944d..6ad6c8ac6 100644 --- a/core/src/processing/core/PSurfaceAWT.java +++ b/core/src/processing/core/PSurfaceAWT.java @@ -988,6 +988,12 @@ public class PSurfaceAWT extends PSurfaceNone { frame.setIconImages(iconImages); } 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"); + ThinkDifferent.setIconImage(Toolkit.getDefaultToolkit().getImage(url)); } } diff --git a/core/src/processing/core/ThinkDifferent.java b/core/src/processing/core/ThinkDifferent.java index ec17a67ca..c24db090e 100644 --- a/core/src/processing/core/ThinkDifferent.java +++ b/core/src/processing/core/ThinkDifferent.java @@ -22,6 +22,8 @@ package processing.core; +import java.awt.Image; + import com.apple.eawt.AppEvent.QuitEvent; import com.apple.eawt.Application; import com.apple.eawt.QuitHandler; @@ -118,4 +120,9 @@ public class ThinkDifferent { } */ } + + + static void setIconImage(Image image) { + application.setDockIconImage(image); + } } diff --git a/core/todo.txt b/core/todo.txt index 3a1498e1e..ce2338a24 100644 --- a/core/todo.txt +++ b/core/todo.txt @@ -1,5 +1,6 @@ 0237 (3.0a10) X retain original java.awt.Frame when it's in use +X set frame icon images for Java2D (dock and cmd-tab) fixed earlier/can no longer reproduce X strips when rendering spheres with lights and anti-aliasing