diff --git a/macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSDecorationsUtil.java b/macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSDecorationsUtil.java index 5df4600e6..91c7b8225 100644 --- a/macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSDecorationsUtil.java +++ b/macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSDecorationsUtil.java @@ -78,14 +78,18 @@ private static void setFullSizeContent(final long windowHandle, final boolean en } } - static void uninstallDecorations(final DecorationInformation information) { + static void uninstallDecorations(final Window window, final DecorationInformation information) { if (information == null || information.windowHandle == 0) { return; } if (information.useColoredTitleBar) { + // As for the case when removing decorations, adding them back will cause the window to + // change it's size. + Rectangle bounds = window.getBounds(); JNIDecorationsMacOS.uninstallDecorations(information.windowHandle, information.fullWindowContentEnabled, information.transparentTitleBarEnabled); + window.setBounds(bounds); } JNIDecorationsMacOS.setTitleEnabled(information.windowHandle, true); JNIDecorationsMacOS.releaseWindow(information.windowHandle); diff --git a/macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSTitlePane.java b/macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSTitlePane.java index 939dd7070..280565a4a 100644 --- a/macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSTitlePane.java +++ b/macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSTitlePane.java @@ -159,7 +159,7 @@ public void uninstall(final boolean removeDecorations) { uninstallListeners(); if (decorationInformation != null) { if (removeDecorations || decorationInformation.useColoredTitleBar != isUseColoredTitleBar(getRootPane())) { - MacOSDecorationsUtil.uninstallDecorations(decorationInformation); + MacOSDecorationsUtil.uninstallDecorations(window, decorationInformation); decorationInformation = null; } }