JFormDesigner / FlatLaf

FlatLaf - Swing Look and Feel (with Darcula/IntelliJ themes support)
https://www.formdev.com/flatlaf/
Apache License 2.0
3.42k stars 272 forks source link

macOS unified title bar affordance is too narrow #562

Closed ctipper closed 2 years ago

ctipper commented 2 years ago

I suspect this is to do with JDK implementation of apple.awt.fullWindowContent but the affordance using FlatLaf at top of the frame is smaller than other native apps. I am putting this here in the hope that the issue gains some traction. I show a screenshot of my own private app and macOS Safari (macOS 12). When a user attempts to drag using the title bar the target is very narrow, though not insurmountable.

Screenshot 2022-07-02 at 15.41.50.png Screenshot 2022-07-02 at 15.42.34.png

openjdk version "11.0.15" 2022-04-19 OpenJDK Runtime Environment Temurin-11.0.15+10 (build 11.0.15+10) OpenJDK 64-Bit Server VM Temurin-11.0.15+10 (build 11.0.15+10, mixed mode) macOS 12 (Monterey) iMac 4K Core i7 16GB 512GB

ctipper commented 2 years ago

So I've found a workaround with a javax.swing.border.EmptyBorder I guess that will get me most of the way there, but achieving the native padding effect seems impossible using existing Java APIs.

DevCharly commented 2 years ago

So I've found a workaround with a EmptyBorder...

What do you mean? Could you move the three round system buttons?

There is a comment on JDK-8211301 that suggests adding an empty NSToolbar, which would move the three round system buttons.

Here is an example how to do this with Swift: https://github.com/lukakerr/NSWindowStyles#12-transparent-toolbar-without-seperator

For Java, there seems to be no solution at the moment...

ctipper commented 2 years ago

I think you have confirmed what I thought and really it would be too much to expect native controls in Java. The property to set a transparent title bar means that the title bar is still available, I only confirmed that after I posted this issue. So I will close this issue.

remcopoelstra commented 2 years ago

Issue is already closed, but you might have a look at the property "apple.awt.windowTransparentTitleBarHeight" that's available when you run your application with a recent Jetbrains Runtime:

https://github.com/JetBrains/JetBrainsRuntime/blob/main/src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java

As a test I was able to move the traffic lights: windowTransparentTitleBarHeight

I'm not using it because It's not yet perfect I think, the buttons sometimes get highlighted when hovering the mouse over the original location (and I'm also having some font issues when using Jetbrains Runtime on MacOS). Also make sure to pass a float to this property (integer won't work).

DevCharly commented 2 years ago

Thanks for the info. That's very interesting 👍