Deprecate AWTUtilitiesWrapper and use Java 1.7 API for translucency

GitOrigin-RevId: dcf3a966f6e7ad62ffd945354a94b9eaa4d69303
This commit is contained in:
Konstantin Bulenkov
2019-07-30 20:05:38 +03:00
committed by intellij-monorepo-bot
parent 92001a67bc
commit 019edb2e14
2 changed files with 21 additions and 4 deletions
@@ -15,10 +15,17 @@
*/
package com.intellij.openapi.wm.impl;
import org.jetbrains.annotations.ApiStatus;
import java.awt.*;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
/**
* @deprecated use Java 1.7 API
*/
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2019.3")
public class AWTUtilitiesWrapper {
private static Class<?> awtUtilitiesClass;
@@ -256,8 +256,8 @@ public final class WindowManagerImpl extends WindowManagerEx implements Persiste
((JFrame)window).getRootPane().putClientProperty("Window.alpha", 1.0f - ratio);
}
}
else if (AWTUtilitiesWrapper.isTranslucencySupported(AWTUtilitiesWrapper.TRANSLUCENT)) {
AWTUtilitiesWrapper.setWindowOpacity(window, 1.0f - ratio);
else if (isTranslucencySupported()) {
window.setOpacity(1.0f - ratio);
}
else {
WindowUtils.setWindowAlpha(window, 1.0f - ratio);
@@ -271,8 +271,8 @@ public final class WindowManagerImpl extends WindowManagerEx implements Persiste
@Override
public void setWindowMask(final Window window, @Nullable final Shape mask) {
try {
if (AWTUtilitiesWrapper.isTranslucencySupported(AWTUtilitiesWrapper.PERPIXEL_TRANSPARENT)) {
AWTUtilitiesWrapper.setWindowShape(window, mask);
if (isPerPixelTransparencySupported()) {
window.setShape(mask);
}
else {
WindowUtils.setWindowMask(window, mask);
@@ -752,6 +752,16 @@ public final class WindowManagerImpl extends WindowManagerEx implements Persiste
return !SystemInfo.isMac && getInstance().isFullScreenSupportedInCurrentOS();
}
static boolean isTranslucencySupported() {
GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
return device.isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency.TRANSLUCENT);
}
static boolean isPerPixelTransparencySupported() {
GraphicsDevice device = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
return device.isWindowTranslucencySupported(GraphicsDevice.WindowTranslucency.PERPIXEL_TRANSPARENT);
}
/**
* Converts the frame bounds b/w the user space (JRE-managed HiDPI mode) and the device space (IDE-managed HiDPI mode).
* See {@link JreHiDpiUtil#isJreHiDPIEnabled()}