From ca35e6ca67174abb09035ea4c50d434e64963567 Mon Sep 17 00:00:00 2001 From: weisj <31143295+weisJ@users.noreply.github.com> Date: Sun, 22 Aug 2021 22:50:42 +0200 Subject: [PATCH] Decorations: Remove DecorationsProvider#adjustWindowInsets It was only used on Windows, where it is currently always an effective no-op as the insets were adjusted by zero values. In fact with non-zero adjustments the result was an incorrectly sized window. --- .../weisj/darklaf/platform/DecorationsHandler.java | 4 ---- .../platform/decorations/DecorationsProvider.java | 8 -------- .../platform/windows/WindowsDecorationsProvider.java | 12 ------------ 3 files changed, 24 deletions(-) diff --git a/core/src/main/java/com/github/weisj/darklaf/platform/DecorationsHandler.java b/core/src/main/java/com/github/weisj/darklaf/platform/DecorationsHandler.java index 471403b4..f58e20e6 100644 --- a/core/src/main/java/com/github/weisj/darklaf/platform/DecorationsHandler.java +++ b/core/src/main/java/com/github/weisj/darklaf/platform/DecorationsHandler.java @@ -110,8 +110,4 @@ public class DecorationsHandler { public void adjustContentArea(final JRootPane root, final Rectangle rect) { decorationsProvider.adjustContentArea(root, rect); } - - public void adjustWindowInsets(final Window window, final Insets i) { - decorationsProvider.adjustWindowInsets(window, i); - } } diff --git a/platform-base/src/main/java/com/github/weisj/darklaf/platform/decorations/DecorationsProvider.java b/platform-base/src/main/java/com/github/weisj/darklaf/platform/decorations/DecorationsProvider.java index e7506329..09b24699 100644 --- a/platform-base/src/main/java/com/github/weisj/darklaf/platform/decorations/DecorationsProvider.java +++ b/platform-base/src/main/java/com/github/weisj/darklaf/platform/decorations/DecorationsProvider.java @@ -70,12 +70,4 @@ public interface DecorationsProvider { * @param rect the proposed content area. */ default void adjustContentArea(final JRootPane root, final Rectangle rect) {} - - /** - * Adjust the window insets. - * - * @param window the corresponding window. - * @param i the insets to adjust. - */ - default void adjustWindowInsets(final Window window, final Insets i) {} } diff --git a/windows/src/main/java/com/github/weisj/darklaf/platform/windows/WindowsDecorationsProvider.java b/windows/src/main/java/com/github/weisj/darklaf/platform/windows/WindowsDecorationsProvider.java index bf1b0dcd..d7f3d2c1 100644 --- a/windows/src/main/java/com/github/weisj/darklaf/platform/windows/WindowsDecorationsProvider.java +++ b/windows/src/main/java/com/github/weisj/darklaf/platform/windows/WindowsDecorationsProvider.java @@ -98,18 +98,6 @@ public class WindowsDecorationsProvider implements DecorationsProvider { } } - @Override - public void adjustWindowInsets(final Window window, final Insets i) { - // Compensate for the insets of the native window peer that include the decorations. - if (window != null) { - Insets insets = window.getInsets(); - i.left -= insets.left; - i.right -= insets.right; - i.top -= insets.top; - i.bottom -= insets.bottom; - } - } - @Override public void loadDecorationProperties(final Properties properties, final UIDefaults currentDefaults) { IconLoader iconLoader = IconLoader.get(WindowsDecorationsProvider.class);