more robust;
authorwenzelm
Fri, 10 Jan 2014 12:29:25 +0100
changeset 54965 a8af7a9c38d1
parent 54964 bbf2ef613b8c
child 54966 2a010ef82fd7
more robust;
src/Pure/GUI/gui.scala
--- a/src/Pure/GUI/gui.scala	Fri Jan 10 12:05:15 2014 +0100
+++ b/src/Pure/GUI/gui.scala	Fri Jan 10 12:29:25 2014 +0100
@@ -43,19 +43,21 @@
 
   def window_manager(): Option[String] =
   {
-    try {
-      val XWM = Class.forName("sun.awt.X11.XWM", true, ClassLoader.getSystemClassLoader)
-      val getWM = XWM.getDeclaredMethod("getWM")
-      getWM.setAccessible(true)
-      getWM.invoke(null) match {
-        case null => None
-        case wm => Some(wm.toString)
+    if (Platform.is_windows || Platform.is_macos) None
+    else
+      try {
+        val XWM = Class.forName("sun.awt.X11.XWM", true, ClassLoader.getSystemClassLoader)
+        val getWM = XWM.getDeclaredMethod("getWM")
+        getWM.setAccessible(true)
+        getWM.invoke(null) match {
+          case null => None
+          case wm => Some(wm.toString)
+        }
       }
-    }
-    catch {
-      case _: ClassNotFoundException => None
-      case _: NoSuchMethodException => None
-    }
+      catch {
+        case _: ClassNotFoundException => None
+        case _: NoSuchMethodException => None
+      }
   }