Cleanup (type-safe icon operations in Win7TaskBar)

This commit is contained in:
Roman Shevchenko
2019-03-19 15:54:28 +01:00
parent 6ecb78258e
commit 85f58bec6f
2 changed files with 10 additions and 10 deletions
@@ -16,6 +16,7 @@ import com.intellij.openapi.wm.WindowManager;
import com.intellij.util.IconUtil;
import com.intellij.util.ui.ImageUtil;
import com.intellij.util.ui.UIUtil;
import com.sun.jna.platform.win32.WinDef;
import org.apache.commons.imaging.common.BinaryOutputStream;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -518,7 +519,7 @@ public abstract class AppIcon {
return;
}
Object icon = null;
WinDef.HICON icon = null;
if (text != null) {
try {
@@ -564,7 +565,7 @@ public abstract class AppIcon {
}
}
private Object myOkIcon;
private WinDef.HICON myOkIcon;
@Override
public void _setOkBadge(IdeFrame frame, boolean visible) {
@@ -572,7 +573,7 @@ public abstract class AppIcon {
return;
}
Object icon = null;
WinDef.HICON icon = null;
if (visible) {
synchronized (Win7AppIcon.class) {
@@ -119,23 +119,21 @@ class Win7TaskBar {
mySetProgressState.invokeInt(new Object[]{myInterfacePointer, getHandle(frame), TBPF_NOPROGRESS});
}
static void setOverlayIcon(IdeFrame frame, Object icon, boolean dispose) {
static void setOverlayIcon(IdeFrame frame, WinDef.HICON icon, boolean dispose) {
if (!ourInitialized) {
return;
}
if (icon == null) {
icon = Pointer.NULL;
}
mySetOverlayIcon.invokeInt(new Object[]{myInterfacePointer, getHandle(frame), icon, Pointer.NULL});
if (dispose) {
User32.INSTANCE.DestroyIcon((WinDef.HICON)icon);
User32.INSTANCE.DestroyIcon(icon);
}
}
static Object createIcon(byte[] ico) {
static WinDef.HICON createIcon(byte[] ico) {
if (!ourInitialized) {
return new Object();
return null;
}
DisposableMemory memory = new DisposableMemory(ico.length);
@@ -148,6 +146,7 @@ class Win7TaskBar {
if (offset != 0) {
return User32Ex.INSTANCE.CreateIconFromResourceEx(memory.share(offset), DWORD_ZERO, true, ICO_VERSION, nSize, nSize, 0);
}
return null;
}
finally {