Skip to content

Commit

Permalink
Restore window bounds after uninstalling decorations
Browse files Browse the repository at this point in the history
  • Loading branch information
weisJ committed Mar 30, 2022
1 parent f8e01d1 commit af82ec0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit af82ec0

Please sign in to comment.