Revision: 5151
          http://sourceforge.net/p/tigervnc/code/5151
Author:   bphinz
Date:     2014-01-04 17:28:20 +0000 (Sat, 04 Jan 2014)
Log Message:
-----------
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

Modified Paths:
--------------
    trunk/java/com/tigervnc/vncviewer/Viewport.java

Modified: trunk/java/com/tigervnc/vncviewer/Viewport.java
===================================================================
--- trunk/java/com/tigervnc/vncviewer/Viewport.java     2014-01-02 20:35:52 UTC 
(rev 5150)
+++ trunk/java/com/tigervnc/vncviewer/Viewport.java     2014-01-04 17:28:20 UTC 
(rev 5151)
@@ -27,6 +27,7 @@
 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 @@
     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 @@
     } catch (Exception e) {
       vlog.debug("Could not enable OS X 10.7+ full-screen mode: " +
                  e.getMessage());
-      
     }
   }
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Tigervnc-commits mailing list
Tigervnc-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tigervnc-commits

Reply via email to