summaryrefslogtreecommitdiffstats
path: root/java/com
diff options
context:
space:
mode:
authorBrian Hinz <bphinz@users.sourceforge.net>2014-01-04 17:28:20 +0000
committerBrian Hinz <bphinz@users.sourceforge.net>2014-01-04 17:28:20 +0000
commit857bed00f6ed1dea8a629b7b7d0129b26d485094 (patch)
tree64b3020b123f06a2a3488c6024ab4363ba2fa403 /java/com
parent3ddb148338c4d48ad8b40d044657169712669b6a (diff)
downloadtigervnc-857bed00f6ed1dea8a629b7b7d0129b26d485094.tar.gz
tigervnc-857bed00f6ed1dea8a629b7b7d0129b26d485094.zip
Set the dock icon on OS X. Not perfect as it still shows the standard Java logo for a second or two, but better than nothing
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5151 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'java/com')
-rw-r--r--java/com/tigervnc/vncviewer/Viewport.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/java/com/tigervnc/vncviewer/Viewport.java b/java/com/tigervnc/vncviewer/Viewport.java
index a6ce3554..e7d76a54 100644
--- a/java/com/tigervnc/vncviewer/Viewport.java
+++ b/java/com/tigervnc/vncviewer/Viewport.java
@@ -27,6 +27,7 @@ import java.awt.Event;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
+import java.awt.Image;
import java.awt.Window;
import java.lang.reflect.*;
import javax.swing.*;
@@ -41,7 +42,23 @@ public class Viewport extends JFrame
setTitle(name+" - TigerVNC");
setFocusable(false);
setFocusTraversalKeysEnabled(false);
- setIconImage(VncViewer.frameIcon);
+ if (VncViewer.os.startsWith("mac os x")) {
+ try {
+ Class appClass = Class.forName("com.apple.eawt.Application");
+ Method getApplication =
+ appClass.getMethod("getApplication", (Class[])null);
+ Object app = getApplication.invoke(appClass);
+ Class paramTypes[] = new Class[1];
+ paramTypes[0] = Image.class;
+ Method setDockIconImage =
+ appClass.getMethod("setDockIconImage", paramTypes);
+ setDockIconImage.invoke(app, VncViewer.logoImage);
+ } catch (Exception e) {
+ vlog.debug("Could not set OS X dock icon: " + e.getMessage());
+ }
+ } else {
+ setIconImage(VncViewer.frameIcon);
+ }
UIManager.getDefaults().put("ScrollPane.ancestorInputMap",
new UIDefaults.LazyInputMap(new Object[]{}));
sp = new JScrollPane();
@@ -133,7 +150,6 @@ public class Viewport extends JFrame
} catch (Exception e) {
vlog.debug("Could not enable OS X 10.7+ full-screen mode: " +
e.getMessage());
-
}
}