mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup (type-safe icon operations in Win7TaskBar)
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user