diff options
Diffstat (limited to 'platform/platform-impl/src/com/intellij/openapi/wm/impl/X11UiUtil.java')
-rw-r--r-- | platform/platform-impl/src/com/intellij/openapi/wm/impl/X11UiUtil.java | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/X11UiUtil.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/X11UiUtil.java index 6c6bcd137949..120579bcb809 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/X11UiUtil.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/X11UiUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,9 +16,11 @@ package com.intellij.openapi.wm.impl; import com.intellij.Patches; +import com.intellij.execution.util.ExecUtil; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.registry.Registry; +import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.wm.IdeFrame; import com.intellij.openapi.wm.WindowManager; import org.jetbrains.annotations.Nullable; @@ -29,6 +31,8 @@ import java.awt.*; import java.awt.peer.ComponentPeer; import java.lang.reflect.Field; import java.lang.reflect.Method; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import static com.intellij.util.ArrayUtil.newLongArray; import static com.intellij.util.containers.ContainerUtil.newHashSet; @@ -254,11 +258,17 @@ public class X11UiUtil { setWM("MARCO_WM", "METACITY_WM"); } else if ("awesome".equals(wmName)) { - setWM("SAWFISH_WM"); + String version = getAwesomeWMVersion(); + if (StringUtil.compareVersionNumbers(version, "3.5") >= 0) { + setWM("SAWFISH_WM"); + } + else if (version != null) { + setWM("OTHER_NONREPARENTING_WM", "LG3D_WM"); + } } } - catch (Throwable e) { - LOG.warn(e); + catch (Throwable t) { + LOG.warn(t); } } @@ -273,6 +283,7 @@ public class X11UiUtil { if (id != null) { field(xwmClass, "awt_wmgr").set(null, id); field(xwmClass, "WMID").set(xwm, id); + LOG.info("impersonated WM: " + wmConstant); break; } } @@ -281,6 +292,23 @@ public class X11UiUtil { } } + @Nullable + private static String getAwesomeWMVersion() { + try { + String version = ExecUtil.execAndReadLine("awesome", "--version"); + if (version != null) { + Matcher m = Pattern.compile("awesome v([0-9.]+)").matcher(version); + if (m.find()) { + return m.group(1); + } + } + } + catch (Throwable t) { + LOG.warn(t); + } + return null; + } + // full-screen support public static boolean isFullScreenSupported() { |