Skip to content

Commit

Permalink
Fix MacOS
Browse files Browse the repository at this point in the history
Add an icon for the installer.

Remove the systray as it hangs.

Remove useless library calls for dark mode borders.
  • Loading branch information
zapek committed Nov 14, 2023
1 parent 23d1c02 commit 5670e2a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ jpackage {
}
mac {
appVersion = "6.6.6" // MacOS sucks, it wants no more than 3 numbers and the first one != 0
icon = "${parent.rootDir}/icon.icns"
}
}

Expand Down
Binary file added icon.icns
Binary file not shown.
6 changes: 4 additions & 2 deletions ui/src/main/java/io/xeres/ui/support/tray/TrayService.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ public void addSystemTray()
return;
}

if (!SystemTray.isSupported() || SystemUtils.IS_OS_LINUX)
// Only works properly on Windows. On Linux it makes an ugly mess with weird UI and flickering and on
// MacOS it hangs on exit.
if (!SystemTray.isSupported() || SystemUtils.IS_OS_LINUX || SystemUtils.IS_OS_MAC)
{
log.error("System tray not supported");
log.error("System tray not supported on that platform");
return;
}

Expand Down
9 changes: 7 additions & 2 deletions ui/src/main/java/io/xeres/ui/support/window/UiBorders.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private WindowHandle(WinDef.HWND hwnd)

private interface DwmSupport extends Library
{
DwmSupport INSTANCE = Native.load("dwmapi", DwmSupport.class);
DwmSupport INSTANCE = Platform.getOSType() == Platform.WINDOWS ? Native.load("dwmapi", DwmSupport.class) : null;

WinNT.HRESULT DwmSetWindowAttribute(
WinDef.HWND hwnd,
Expand All @@ -74,7 +74,7 @@ WinNT.HRESULT DwmSetWindowAttribute(
);
}

public static void dwmSetBooleanValue(WindowHandle handle, DwmAttribute attribute, boolean value)
private static void dwmSetBooleanValue(WindowHandle handle, DwmAttribute attribute, boolean value)
{
if (handle != null)
{
Expand Down Expand Up @@ -112,6 +112,11 @@ private static Optional<WindowHandle> findOpeningWindowHandle()

private static List<WindowHandle> findAllWindowHandle()
{
if (Platform.getOSType() != Platform.WINDOWS)
{
return List.of();
}

return com.sun.glass.ui.Window.getWindows().stream()
.map(window -> new WindowHandle(new WinDef.HWND(new Pointer(window.getNativeWindow()))))
.toList();
Expand Down

0 comments on commit 5670e2a

Please sign in to comment.