Browse Source

RootPane: Added logging for size calculations.

[MacOS] TitlePane: Added logging for decorations installation.
pull/235/head
weisj 4 years ago
parent
commit
53ebf4e2ae
No known key found for this signature in database
GPG Key ID: 31124CB75461DA2A
  1. 4
      core/src/main/java/com/github/weisj/darklaf/ui/rootpane/DarkRootPaneUI.java
  2. 23
      core/src/main/java/com/github/weisj/darklaf/ui/rootpane/DarkSubstanceRootLayout.java
  3. 4
      macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSDecorationsUtil.java

4
core/src/main/java/com/github/weisj/darklaf/ui/rootpane/DarkRootPaneUI.java

@ -47,8 +47,8 @@ public class DarkRootPaneUI extends BasicRootPaneUI implements HierarchyListener
public static final String KEY_UNIFIED_MENUBAR = KEY_PREFIX + "unifiedMenuBar";
protected static final String[] borderKeys = new String[] {"RootPane.border", "RootPane.frameBorder",
"RootPane.plainDialogBorder", "RootPane.informationDialogBorder", "RootPane.errorDialogBorder",
"RootPane.colorChooserDialogBorder", "RootPane.fileChooserDialogBorder", "RootPane.questionDialogBorder",
"RootPane.warningDialogBorder"};
"RootPane.colorChooserDialogBorder", "RootPane.fileChooserDialogBorder",
"RootPane.questionDialogBorder", "RootPane.warningDialogBorder"};
private Window window;
private CustomTitlePane titlePane;

23
core/src/main/java/com/github/weisj/darklaf/ui/rootpane/DarkSubstanceRootLayout.java

@ -22,12 +22,14 @@
package com.github.weisj.darklaf.ui.rootpane;
import java.awt.*;
import java.util.logging.Logger;
import javax.swing.*;
import com.github.weisj.darklaf.platform.DecorationsHandler;
import com.github.weisj.darklaf.platform.decorations.CustomTitlePane;
import com.github.weisj.darklaf.util.DarkUIUtil;
import com.github.weisj.darklaf.util.LogUtil;
/**
* @author Konstantin Bulenkov
@ -35,6 +37,8 @@ import com.github.weisj.darklaf.util.DarkUIUtil;
*/
class DarkSubstanceRootLayout implements LayoutManager2 {
private static final Logger LOGGER = LogUtil.getLogger(DarkSubstanceRootLayout.class);
@Override
public void addLayoutComponent(final String name, final Component comp) {}
@ -62,6 +66,7 @@ class DarkSubstanceRootLayout implements LayoutManager2 {
} else {
cpd = root.getSize();
}
LOGGER.finer("[PrefSize] JRootPane content size: " + cpd);
if (cpd != null) {
cpWidth = cpd.width;
cpHeight = cpd.height;
@ -81,6 +86,7 @@ class DarkSubstanceRootLayout implements LayoutManager2 {
tpWidth = tpd.width;
tpHeight = tpd.height;
}
LOGGER.finer("[PrefSize] JRootPane titlePane size: " + tpd);
}
return new Dimension(Math.max(Math.max(cpWidth, mbWidth), tpWidth) + i.left + i.right,
@ -97,12 +103,14 @@ class DarkSubstanceRootLayout implements LayoutManager2 {
int tpHeight = 0;
Insets i = parent.getInsets();
JRootPane root = (JRootPane) parent;
CustomTitlePane titlePane = getTitlePane(root);
if (root.getContentPane() != null) {
cpd = root.getContentPane().getMinimumSize();
} else {
cpd = root.getSize();
}
LOGGER.finer("[MinSize] JRootPane content size: " + cpd);
if (cpd != null) {
cpWidth = cpd.width;
cpHeight = cpd.height;
@ -115,15 +123,14 @@ class DarkSubstanceRootLayout implements LayoutManager2 {
mbHeight = mbd.height;
}
}
if ((root.getWindowDecorationStyle() != JRootPane.NONE) && (root.getUI() instanceof DarkRootPaneUI)) {
JComponent titlePane = ((DarkRootPaneUI) root.getUI()).getTitlePane();
if (titlePane != null) {
tpd = titlePane.getMinimumSize();
if (tpd != null) {
tpWidth = tpd.width;
tpHeight = tpd.height;
}
if (titlePane != null) {
tpd = titlePane.getMinimumSize();
if (tpd != null) {
tpWidth = tpd.width;
tpHeight = tpd.height;
}
LOGGER.finer("[MinSize] JRootPane titlePane size: " + tpd);
}
return new Dimension(Math.max(Math.max(cpWidth, mbWidth), tpWidth) + i.left + i.right,

4
macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSDecorationsUtil.java

@ -22,15 +22,18 @@
package com.github.weisj.darklaf.platform.macos.ui;
import java.awt.*;
import java.util.logging.Logger;
import javax.swing.*;
import com.github.weisj.darklaf.platform.macos.JNIDecorationsMacOS;
import com.github.weisj.darklaf.util.LogUtil;
import com.github.weisj.darklaf.util.PropertyUtil;
import com.github.weisj.darklaf.util.SystemInfo;
public final class MacOSDecorationsUtil {
private static final Logger LOGGER = LogUtil.getLogger(MacOSDecorationsUtil.class);
private static final String FULL_WINDOW_CONTENT_KEY = "apple.awt.fullWindowContent";
private static final String TRANSPARENT_TITLE_BAR_KEY = "apple.awt.transparentTitleBar";
@ -42,6 +45,7 @@ public final class MacOSDecorationsUtil {
if (windowHandle == 0) {
return new DecorationInformation(0, false, false, false, false, rootPane, false, 0, 0);
}
LOGGER.fine("Installing decorations for window " + windowHandle);
JNIDecorationsMacOS.retainWindow(windowHandle);
boolean fullWindowContent = isFullWindowContentEnabled(rootPane);
boolean transparentTitleBar = isTransparentTitleBarEnabled(rootPane);

Loading…
Cancel
Save