Browse Source

Add logging for macos title pane.

pull/235/head
weisj 4 years ago
parent
commit
b4b577e9e9
No known key found for this signature in database
GPG Key ID: 31124CB75461DA2A
  1. 4
      macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSDecorationsUtil.java
  2. 9
      macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSTitlePane.java

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

@ -60,7 +60,9 @@ public final class MacOSDecorationsUtil {
boolean isDarkTheme = UIManager.getBoolean("Theme.dark");
JNIDecorationsMacOS.setDarkTheme(windowHandle, isDarkTheme);
}
return new DecorationInformation(windowHandle, fullWindowContent, transparentTitleBar, useColoredTitleBar,
return new DecorationInformation(
windowHandle, fullWindowContent,
transparentTitleBar, useColoredTitleBar,
jniInstall, rootPane,
titleVisible, titleBarHeight, titleFontSize);
}

9
macos/src/main/java/com/github/weisj/darklaf/platform/macos/ui/MacOSTitlePane.java

@ -27,16 +27,20 @@ import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.logging.Logger;
import javax.swing.*;
import com.github.weisj.darklaf.platform.decorations.CustomTitlePane;
import com.github.weisj.darklaf.platform.macos.JNIDecorationsMacOS;
import com.github.weisj.darklaf.util.LogUtil;
import com.github.weisj.darklaf.util.PropertyKey;
import com.github.weisj.darklaf.util.PropertyUtil;
public class MacOSTitlePane extends CustomTitlePane {
private static final Logger LOGGER = LogUtil.getLogger(MacOSTitlePane.class);
private final JRootPane rootPane;
private final Window window;
private final boolean useColoredTitleBar;
@ -204,10 +208,13 @@ public class MacOSTitlePane extends CustomTitlePane {
if (decorationInformation == null) return new Dimension(0, 0);
int height = decorationInformation.titleBarHeight;
if (hideTitleBar()) {
LOGGER.finer("Title bar is hidden.");
height = 0;
} else if (useCustomTitle()) {
LOGGER.finer("Using custom title label.");
height = Math.max(height, titleLabel.getPreferredSize().height);
}
LOGGER.finer("Preferred height of title pane: " + height);
return new Dimension(0, height);
}
@ -233,7 +240,7 @@ public class MacOSTitlePane extends CustomTitlePane {
@Override
public void doLayout() {
boolean hide = hideTitleBar();
if (useCustomTitle() && !hide) {
if (!hide && useCustomTitle()) {
int width = getWidth();
int height = getHeight();
int labelWidth = titleLabel.getPreferredSize().width;

Loading…
Cancel
Save