Fixed image scaling query for Ubuntu 16.06, changed all debug logs to
'debug'. Added a separate menu entry size (independent of tray size)
This commit is contained in:
parent
49b0ec0ff2
commit
6a9b606e51
|
@ -97,6 +97,14 @@ class SystemTray {
|
||||||
*/
|
*/
|
||||||
public static int DEFAULT_LINUX_SIZE = 16;
|
public static int DEFAULT_LINUX_SIZE = 16;
|
||||||
|
|
||||||
|
@Property
|
||||||
|
/**
|
||||||
|
* Size of the menu entries, so that the icon can be properly scaled based on OS.
|
||||||
|
* <p>
|
||||||
|
* You will experience WEIRD graphical glitches if this is NOT a power of 2.
|
||||||
|
*/
|
||||||
|
public static int DEFAULT_MENU_SIZE = 16;
|
||||||
|
|
||||||
@Property
|
@Property
|
||||||
/** Forces the system tray to always choose GTK2 (even when GTK3 might be available). */
|
/** Forces the system tray to always choose GTK2 (even when GTK3 might be available). */
|
||||||
public static boolean FORCE_GTK2 = false;
|
public static boolean FORCE_GTK2 = false;
|
||||||
|
@ -120,7 +128,7 @@ class SystemTray {
|
||||||
/**
|
/**
|
||||||
* This property is provided for debugging any errors in the logic used to determine the system-tray type.
|
* This property is provided for debugging any errors in the logic used to determine the system-tray type.
|
||||||
*/
|
*/
|
||||||
public static boolean DEBUG = false;
|
public static boolean DEBUG = true;
|
||||||
|
|
||||||
|
|
||||||
private static volatile SystemTray systemTray = null;
|
private static volatile SystemTray systemTray = null;
|
||||||
|
@ -477,7 +485,7 @@ class SystemTray {
|
||||||
|
|
||||||
if (!output.isEmpty()) {
|
if (!output.isEmpty()) {
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
logger.info("Installing gnome-shell extension");
|
logger.debug("Installing gnome-shell extension");
|
||||||
}
|
}
|
||||||
|
|
||||||
GnomeShellExtension.install(output);
|
GnomeShellExtension.install(output);
|
||||||
|
@ -732,7 +740,7 @@ class SystemTray {
|
||||||
*/
|
*/
|
||||||
public
|
public
|
||||||
void setIcon(String imagePath) {
|
void setIcon(String imagePath) {
|
||||||
setIcon_(ImageUtils.resizeAndCache(ImageUtils.SIZE, imagePath));
|
setIcon_(ImageUtils.resizeAndCache(ImageUtils.TRAY_SIZE, imagePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -745,7 +753,7 @@ class SystemTray {
|
||||||
*/
|
*/
|
||||||
public
|
public
|
||||||
void setIcon(URL imageUrl) {
|
void setIcon(URL imageUrl) {
|
||||||
setIcon_(ImageUtils.resizeAndCache(ImageUtils.SIZE, imageUrl));
|
setIcon_(ImageUtils.resizeAndCache(ImageUtils.TRAY_SIZE, imageUrl));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -759,7 +767,7 @@ class SystemTray {
|
||||||
*/
|
*/
|
||||||
public
|
public
|
||||||
void setIcon(String cacheName, InputStream imageStream) {
|
void setIcon(String cacheName, InputStream imageStream) {
|
||||||
setIcon_(ImageUtils.resizeAndCache(ImageUtils.SIZE, cacheName, imageStream));
|
setIcon_(ImageUtils.resizeAndCache(ImageUtils.TRAY_SIZE, cacheName, imageStream));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -772,7 +780,7 @@ class SystemTray {
|
||||||
*/
|
*/
|
||||||
public
|
public
|
||||||
void setIcon(InputStream imageStream) {
|
void setIcon(InputStream imageStream) {
|
||||||
setIcon_(ImageUtils.resizeAndCache(ImageUtils.SIZE, imageStream));
|
setIcon_(ImageUtils.resizeAndCache(ImageUtils.TRAY_SIZE, imageStream));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -200,7 +200,9 @@ class GnomeShellExtension {
|
||||||
|
|
||||||
// should be ['background-logo@fedorahosted.org', 'zyx', 'abs'
|
// should be ['background-logo@fedorahosted.org', 'zyx', 'abs'
|
||||||
// or will be [ (if there is nothing)
|
// or will be [ (if there is nothing)
|
||||||
logger.info("Installed extensions (should have leading '[') are: {}", stringBuilder.toString());
|
if (SystemTray.DEBUG) {
|
||||||
|
logger.debug("Installed extensions (should have leading '[') are: {}", stringBuilder.toString());
|
||||||
|
}
|
||||||
|
|
||||||
// add our extension to the list
|
// add our extension to the list
|
||||||
if (stringBuilder.length() > 2) {
|
if (stringBuilder.length() > 2) {
|
||||||
|
@ -230,8 +232,9 @@ class GnomeShellExtension {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SystemTray.DEBUG) {
|
||||||
logger.info("Restarting gnome-shell so tray notification changes can be applied.");
|
logger.debug("Restarting gnome-shell so tray notification changes can be applied.");
|
||||||
|
}
|
||||||
|
|
||||||
// now we have to restart the gnome shell via bash
|
// now we have to restart the gnome shell via bash
|
||||||
final ShellProcessBuilder restartShell = new ShellProcessBuilder();
|
final ShellProcessBuilder restartShell = new ShellProcessBuilder();
|
||||||
|
|
|
@ -142,7 +142,7 @@ class GtkMenuEntry implements MenuEntry, GCallback {
|
||||||
setImage_(null);
|
setImage_(null);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setImage_(ImageUtils.resizeAndCache(ImageUtils.SIZE, imagePath));
|
setImage_(ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE, imagePath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ class GtkMenuEntry implements MenuEntry, GCallback {
|
||||||
setImage_(null);
|
setImage_(null);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setImage_(ImageUtils.resizeAndCache(ImageUtils.SIZE, imageUrl));
|
setImage_(ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE, imageUrl));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,7 +164,7 @@ class GtkMenuEntry implements MenuEntry, GCallback {
|
||||||
setImage_(null);
|
setImage_(null);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setImage_(ImageUtils.resizeAndCache(ImageUtils.SIZE, cacheName, imageStream));
|
setImage_(ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE, cacheName, imageStream));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ class GtkMenuEntry implements MenuEntry, GCallback {
|
||||||
setImage_(null);
|
setImage_(null);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setImage_(ImageUtils.resizeAndCache(ImageUtils.SIZE, imageStream));
|
setImage_(ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE, imageStream));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -295,7 +295,7 @@ class GtkTypeSystemTray extends SystemTray {
|
||||||
addMenuEntry_(menuText, null, callback);
|
addMenuEntry_(menuText, null, callback);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
addMenuEntry_(menuText, ImageUtils.resizeAndCache(ImageUtils.SIZE, imagePath), callback);
|
addMenuEntry_(menuText, ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE, imagePath), callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ class GtkTypeSystemTray extends SystemTray {
|
||||||
addMenuEntry_(menuText, null, callback);
|
addMenuEntry_(menuText, null, callback);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
addMenuEntry_(menuText, ImageUtils.resizeAndCache(ImageUtils.SIZE, imageUrl), callback);
|
addMenuEntry_(menuText, ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE, imageUrl), callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ class GtkTypeSystemTray extends SystemTray {
|
||||||
addMenuEntry_(menuText, null, callback);
|
addMenuEntry_(menuText, null, callback);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
addMenuEntry_(menuText, ImageUtils.resizeAndCache(ImageUtils.SIZE, cacheName, imageStream), callback);
|
addMenuEntry_(menuText, ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE, cacheName, imageStream), callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ class GtkTypeSystemTray extends SystemTray {
|
||||||
addMenuEntry_(menuText, null, callback);
|
addMenuEntry_(menuText, null, callback);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
addMenuEntry_(menuText, ImageUtils.resizeAndCache(ImageUtils.SIZE, imageStream), callback);
|
addMenuEntry_(menuText, ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE, imageStream), callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ class Gtk {
|
||||||
isLoaded = true;
|
isLoaded = true;
|
||||||
|
|
||||||
if (SystemTray.DEBUG) {
|
if (SystemTray.DEBUG) {
|
||||||
logger.info("GTK: {}", gtk2LibName);
|
logger.debug("GTK: {}", gtk2LibName);
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
if (SystemTray.DEBUG) {
|
if (SystemTray.DEBUG) {
|
||||||
|
@ -107,7 +107,7 @@ class Gtk {
|
||||||
isLoaded = true;
|
isLoaded = true;
|
||||||
|
|
||||||
if (SystemTray.DEBUG) {
|
if (SystemTray.DEBUG) {
|
||||||
logger.info("GTK: {}", gtk3LibName);
|
logger.debug("GTK: {}", gtk3LibName);
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
if (SystemTray.DEBUG) {
|
if (SystemTray.DEBUG) {
|
||||||
|
@ -129,7 +129,7 @@ class Gtk {
|
||||||
isLoaded = true;
|
isLoaded = true;
|
||||||
|
|
||||||
if (SystemTray.DEBUG) {
|
if (SystemTray.DEBUG) {
|
||||||
logger.info("GTK: {}", gtk2LibName);
|
logger.debug("GTK: {}", gtk2LibName);
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
if (SystemTray.DEBUG) {
|
if (SystemTray.DEBUG) {
|
||||||
|
@ -143,7 +143,7 @@ class Gtk {
|
||||||
alreadyRunningGTK |= SystemTray.isSwtLoaded;
|
alreadyRunningGTK |= SystemTray.isSwtLoaded;
|
||||||
|
|
||||||
if (SystemTray.DEBUG) {
|
if (SystemTray.DEBUG) {
|
||||||
logger.info("Is the system already running GTK? {}", alreadyRunningGTK);
|
logger.debug("Is the system already running GTK? {}", alreadyRunningGTK);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isLoaded) {
|
if (!isLoaded) {
|
||||||
|
|
|
@ -125,7 +125,7 @@ class SwingMenuEntry implements MenuEntry {
|
||||||
setImage_(null);
|
setImage_(null);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setImage_(ImageUtils.resizeAndCache(ImageUtils.SIZE, imagePath));
|
setImage_(ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE, imagePath));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ class SwingMenuEntry implements MenuEntry {
|
||||||
setImage_(null);
|
setImage_(null);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setImage_(ImageUtils.resizeAndCache(ImageUtils.SIZE, imageUrl));
|
setImage_(ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE, imageUrl));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ class SwingMenuEntry implements MenuEntry {
|
||||||
setImage_(null);
|
setImage_(null);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setImage_(ImageUtils.resizeAndCache(ImageUtils.SIZE, cacheName, imageStream));
|
setImage_(ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE, cacheName, imageStream));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ class SwingMenuEntry implements MenuEntry {
|
||||||
setImage_(null);
|
setImage_(null);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
setImage_(ImageUtils.resizeAndCache(ImageUtils.SIZE, imageStream));
|
setImage_(ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE, imageStream));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -259,7 +259,7 @@ class SwingSystemTray extends dorkbox.systemTray.SystemTray {
|
||||||
addMenuEntry_(menuText, null, callback);
|
addMenuEntry_(menuText, null, callback);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
addMenuEntry_(menuText, ImageUtils.resizeAndCache(ImageUtils.SIZE, imagePath), callback);
|
addMenuEntry_(menuText, ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE, imagePath), callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,7 +270,7 @@ class SwingSystemTray extends dorkbox.systemTray.SystemTray {
|
||||||
addMenuEntry_(menuText, null, callback);
|
addMenuEntry_(menuText, null, callback);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
addMenuEntry_(menuText, ImageUtils.resizeAndCache(ImageUtils.SIZE, imageUrl), callback);
|
addMenuEntry_(menuText, ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE, imageUrl), callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ class SwingSystemTray extends dorkbox.systemTray.SystemTray {
|
||||||
addMenuEntry_(menuText, null, callback);
|
addMenuEntry_(menuText, null, callback);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
addMenuEntry_(menuText, ImageUtils.resizeAndCache(ImageUtils.SIZE, cacheName, imageStream), callback);
|
addMenuEntry_(menuText, ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE, cacheName, imageStream), callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ class SwingSystemTray extends dorkbox.systemTray.SystemTray {
|
||||||
addMenuEntry_(menuText, null, callback);
|
addMenuEntry_(menuText, null, callback);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
addMenuEntry_(menuText, ImageUtils.resizeAndCache(ImageUtils.SIZE, imageStream), callback);
|
addMenuEntry_(menuText, ImageUtils.resizeAndCache(ImageUtils.ENTRY_SIZE, imageStream), callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,8 @@ class ImageUtils {
|
||||||
private static final File TEMP_DIR = new File(CacheUtil.TEMP_DIR, "ResizedImages");
|
private static final File TEMP_DIR = new File(CacheUtil.TEMP_DIR, "ResizedImages");
|
||||||
|
|
||||||
// tray/menu-entry size.
|
// tray/menu-entry size.
|
||||||
public static volatile int SIZE = 0;
|
public static volatile int TRAY_SIZE = 0;
|
||||||
|
public static volatile int ENTRY_SIZE = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param trayType
|
* @param trayType
|
||||||
|
@ -57,16 +58,21 @@ class ImageUtils {
|
||||||
*/
|
*/
|
||||||
public static
|
public static
|
||||||
void determineIconSize(int trayType) {
|
void determineIconSize(int trayType) {
|
||||||
|
int trayScale = 0;
|
||||||
|
int menuScale = 0;
|
||||||
|
|
||||||
if (SystemTray.AUTO_TRAY_SIZE) {
|
if (SystemTray.AUTO_TRAY_SIZE) {
|
||||||
if (OS.isWindows()) {
|
if (OS.isWindows()) {
|
||||||
// windows will automatically scale the tray size
|
// windows will automatically scale the tray size BUT NOT the menu entry icon size
|
||||||
SIZE = SystemTray.DEFAULT_WINDOWS_SIZE;
|
trayScale = SystemTray.DEFAULT_WINDOWS_SIZE;
|
||||||
|
menuScale = SystemTray.DEFAULT_MENU_SIZE;
|
||||||
} else {
|
} else {
|
||||||
// GtkStatusIcon will USUALLY automatically scale the icon
|
// GtkStatusIcon will USUALLY automatically scale the icon
|
||||||
// AppIndicator will NOT scale the icon
|
// AppIndicator will NOT scale the icon
|
||||||
if (trayType == SystemTray.TYPE_SWING || trayType == SystemTray.TYPE_GTK_STATUSICON) {
|
if (trayType == SystemTray.TYPE_SWING || trayType == SystemTray.TYPE_GTK_STATUSICON) {
|
||||||
// swing or GtkStatusIcon on linux/mac? use the default settings
|
// swing or GtkStatusIcon on linux/mac? use the default settings
|
||||||
SIZE = SystemTray.DEFAULT_LINUX_SIZE;
|
trayScale = SystemTray.DEFAULT_LINUX_SIZE;
|
||||||
|
menuScale = SystemTray.DEFAULT_MENU_SIZE;
|
||||||
} else {
|
} else {
|
||||||
int uiScalingFactor = 0;
|
int uiScalingFactor = 0;
|
||||||
|
|
||||||
|
@ -86,13 +92,13 @@ class ImageUtils {
|
||||||
|
|
||||||
if (!output.isEmpty()) {
|
if (!output.isEmpty()) {
|
||||||
if (SystemTray.DEBUG) {
|
if (SystemTray.DEBUG) {
|
||||||
SystemTray.logger.info("Checking scaling factor for GTK environment, should start with 'uint32', value: '{}'", output);
|
SystemTray.logger.debug("Checking scaling factor for GTK environment, should start with 'uint32', value: '{}'", output);
|
||||||
}
|
}
|
||||||
|
|
||||||
// DEFAULT icon size is 16. HiDpi changes this scale, so we should use it as well.
|
// DEFAULT icon size is 16. HiDpi changes this scale, so we should use it as well.
|
||||||
// should be: uint32 0 or something
|
// should be: uint32 0 or something
|
||||||
if (output.startsWith("uint32")) {
|
if (output.contains("uint32")) {
|
||||||
String value = output.substring(output.indexOf(" ")+1, output.length()-1);
|
String value = output.substring(output.indexOf("uint")+7, output.length()-1);
|
||||||
uiScalingFactor = Integer.parseInt(value);
|
uiScalingFactor = Integer.parseInt(value);
|
||||||
|
|
||||||
// 0 is disabled (no scaling)
|
// 0 is disabled (no scaling)
|
||||||
|
@ -115,23 +121,30 @@ class ImageUtils {
|
||||||
|
|
||||||
// the DEFAULT scale is 16
|
// the DEFAULT scale is 16
|
||||||
if (uiScalingFactor > 1) {
|
if (uiScalingFactor > 1) {
|
||||||
SIZE = SystemTray.DEFAULT_LINUX_SIZE * uiScalingFactor;
|
trayScale = SystemTray.DEFAULT_LINUX_SIZE * uiScalingFactor;
|
||||||
|
menuScale = SystemTray.DEFAULT_MENU_SIZE * uiScalingFactor;
|
||||||
} else {
|
} else {
|
||||||
SIZE = SystemTray.DEFAULT_LINUX_SIZE;
|
trayScale = SystemTray.DEFAULT_LINUX_SIZE;
|
||||||
|
menuScale = SystemTray.DEFAULT_MENU_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SystemTray.DEBUG) {
|
if (SystemTray.DEBUG) {
|
||||||
SystemTray.logger.info("uiScaling factor is '{}', auto tray size is '{}'.", uiScalingFactor, SIZE);
|
SystemTray.logger.debug("uiScaling factor is '{}', auto tray size is '{}'.", uiScalingFactor, trayScale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (OS.isWindows()) {
|
if (OS.isWindows()) {
|
||||||
SIZE = SystemTray.DEFAULT_WINDOWS_SIZE;
|
trayScale = SystemTray.DEFAULT_WINDOWS_SIZE;
|
||||||
|
menuScale = SystemTray.DEFAULT_MENU_SIZE;
|
||||||
} else {
|
} else {
|
||||||
SIZE = SystemTray.DEFAULT_LINUX_SIZE;
|
trayScale = SystemTray.DEFAULT_LINUX_SIZE;
|
||||||
|
menuScale = SystemTray.DEFAULT_MENU_SIZE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TRAY_SIZE = trayScale;
|
||||||
|
ENTRY_SIZE = menuScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -328,6 +341,10 @@ class ImageUtils {
|
||||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||||
private static
|
private static
|
||||||
File resizeFileNoCheck(final int size, final URL fileUrl) throws IOException {
|
File resizeFileNoCheck(final int size, final URL fileUrl) throws IOException {
|
||||||
|
if (SystemTray.DEBUG) {
|
||||||
|
SystemTray.logger.debug("Resizing URL to {}. '{}'", size, fileUrl.getPath());
|
||||||
|
}
|
||||||
|
|
||||||
InputStream inputStream = fileUrl.openStream();
|
InputStream inputStream = fileUrl.openStream();
|
||||||
|
|
||||||
// have to resize the file (and return the new path)
|
// have to resize the file (and return the new path)
|
||||||
|
|
|
@ -114,7 +114,7 @@ class WindowsSystemTraySwing {
|
||||||
trayClass.getConstructors()[0].setModifiers(trayClass.getConstructors()[0].getModifiers() & javassist.Modifier.PUBLIC);
|
trayClass.getConstructors()[0].setModifiers(trayClass.getConstructors()[0].getModifiers() & javassist.Modifier.PUBLIC);
|
||||||
CtMethod ctMethodGet = trayClass.getDeclaredMethod("getTrayIconSize");
|
CtMethod ctMethodGet = trayClass.getDeclaredMethod("getTrayIconSize");
|
||||||
ctMethodGet.setBody("{" +
|
ctMethodGet.setBody("{" +
|
||||||
"return new java.awt.Dimension(" + ImageUtils.SIZE + ", " + ImageUtils.SIZE + ");" +
|
"return new java.awt.Dimension(" + ImageUtils.TRAY_SIZE + ", " + ImageUtils.TRAY_SIZE + ");" +
|
||||||
"}");
|
"}");
|
||||||
|
|
||||||
trayBytes = trayClass.toBytecode();
|
trayBytes = trayClass.toBytecode();
|
||||||
|
@ -125,7 +125,7 @@ class WindowsSystemTraySwing {
|
||||||
CtMethod ctMethodCreate = trayIconClass.getDeclaredMethod("createNativeImage");
|
CtMethod ctMethodCreate = trayIconClass.getDeclaredMethod("createNativeImage");
|
||||||
CtMethod ctMethodUpdate = trayIconClass.getDeclaredMethod("updateNativeImage");
|
CtMethod ctMethodUpdate = trayIconClass.getDeclaredMethod("updateNativeImage");
|
||||||
|
|
||||||
int TRAY_MASK = (ImageUtils.SIZE * ImageUtils.SIZE) / 8;
|
int TRAY_MASK = (ImageUtils.TRAY_SIZE * ImageUtils.TRAY_SIZE) / 8;
|
||||||
ctMethodCreate.setBody("{" +
|
ctMethodCreate.setBody("{" +
|
||||||
"java.awt.image.BufferedImage bufferedImage = $1;\n" +
|
"java.awt.image.BufferedImage bufferedImage = $1;\n" +
|
||||||
|
|
||||||
|
@ -194,10 +194,10 @@ class WindowsSystemTraySwing {
|
||||||
BootStrapClassLoader.defineClass(trayIconBytes);
|
BootStrapClassLoader.defineClass(trayIconBytes);
|
||||||
|
|
||||||
if (SystemTray.DEBUG) {
|
if (SystemTray.DEBUG) {
|
||||||
logger.info("Successfully changed tray icon size to: {}", ImageUtils.SIZE);
|
logger.debug("Successfully changed tray icon size to: {}", ImageUtils.TRAY_SIZE);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("Error setting tray icon size to: {}", ImageUtils.SIZE, e);
|
logger.error("Error setting tray icon size to: {}", ImageUtils.TRAY_SIZE, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user