8153512: Taskbar support reported for Xfce4.
authorazvegint
Wed, 13 Jul 2016 12:24:24 +0300
changeset 39857 6178820cadaf
parent 39856 96d7761b869a
child 39858 882e63569349
8153512: Taskbar support reported for Xfce4. Reviewed-by: alexsch, ssadetsky
jdk/src/java.desktop/unix/classes/sun/awt/X11/XTaskbarPeer.java
--- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTaskbarPeer.java	Wed Jul 13 10:50:58 2016 +0300
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XTaskbarPeer.java	Wed Jul 13 12:24:24 2016 +0300
@@ -32,6 +32,7 @@
 
 import sun.awt.UNIXToolkit;
 import java.security.AccessController;
+import java.security.PrivilegedAction;
 import sun.security.action.GetPropertyAction;
 
 final class XTaskbarPeer implements TaskbarPeer {
@@ -40,6 +41,14 @@
     private static boolean initExecuted = false;
 
     private PopupMenu menu = null;
+    private static boolean isUnity;
+
+    static {
+        String de = AccessController.doPrivileged(
+                        (PrivilegedAction<String>) ()
+                                -> System.getenv("XDG_CURRENT_DESKTOP"));
+        isUnity = de != null && de.equals("Unity");
+    }
 
     private static void initWithLock() {
         XToolkit.awtLock();
@@ -68,6 +77,9 @@
     }
 
     static boolean isTaskbarSupported() {
+        if (!isUnity) {
+            return false;
+        }
         initWithLock();
         return nativeLibraryLoaded;
     }