mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Wallpaper: do not eat cpu cycles if not configured
This commit is contained in:
@@ -57,11 +57,11 @@ public class IdeBackgroundUtil {
|
||||
}
|
||||
|
||||
public static void initEditorPainters(@NotNull PaintersHelper painters) {
|
||||
painters.addPainter(PaintersHelper.newWallpaperPainter("idea.wallpaper.editor"), null);
|
||||
PaintersHelper.initWallpaperPainter("idea.wallpaper.editor", painters);
|
||||
}
|
||||
|
||||
public static void initFramePainters(@NotNull PaintersHelper painters) {
|
||||
painters.addPainter(PaintersHelper.newWallpaperPainter("idea.wallpaper.ide"), null);
|
||||
PaintersHelper.initWallpaperPainter("idea.wallpaper.ide", painters);
|
||||
|
||||
ApplicationInfoEx appInfo = ApplicationInfoEx.getInstanceEx();
|
||||
String path = UIUtil.isUnderDarcula()? appInfo.getEditorBackgroundImageUrl() : null;
|
||||
|
||||
@@ -120,7 +120,17 @@ final class PaintersHelper implements Painter.Listener {
|
||||
TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT
|
||||
}
|
||||
|
||||
public static AbstractPainter newWallpaperPainter(final String propertyName) {
|
||||
public static void initWallpaperPainter(@NotNull String propertyName, @NotNull PaintersHelper painters) {
|
||||
String value = System.getProperty(propertyName);
|
||||
if (value == null && !new File(PathManager.getConfigPath(), propertyName + ".png").exists()) {
|
||||
// property not set & there's no default
|
||||
return;
|
||||
}
|
||||
ImagePainter painter = (ImagePainter)newWallpaperPainter(propertyName);
|
||||
painters.addPainter(painter, null);
|
||||
}
|
||||
|
||||
private static AbstractPainter newWallpaperPainter(@NotNull final String propertyName) {
|
||||
return new ImagePainter() {
|
||||
Image image;
|
||||
float alpha;
|
||||
|
||||
Reference in New Issue
Block a user