Browse Source

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.
pull/270/head
weisj 3 years ago
parent
commit
ca35e6ca67
No known key found for this signature in database
GPG Key ID: 31124CB75461DA2A
  1. 4
      core/src/main/java/com/github/weisj/darklaf/platform/DecorationsHandler.java
  2. 8
      platform-base/src/main/java/com/github/weisj/darklaf/platform/decorations/DecorationsProvider.java
  3. 12
      windows/src/main/java/com/github/weisj/darklaf/platform/windows/WindowsDecorationsProvider.java

4
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);
}
}

8
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) {}
}

12
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);

Loading…
Cancel
Save