-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
There is a problem with the display on macos #65
Comments
Unfortunately, I don't own a Mac and don't have access to one. I did recently rework how the sizes are chosen for the overlay and floating frame. Maybe that will fix the issue. I'm going to be publishing a 0.6.0 soon (possibly today). |
The new 0.0.6 code will still have this problem |
You may try jdk 19. I have seen a lot of issues in jdk 11 & 17 with swing for some reason, but jdk 19 seems to fix all but one that I have come across |
I'm now seeing a similar on JDK 17 with 4k displays, also the drop locations are not correct. I think this may be a java issue. I will test with JDK 19 on the same displays and see how it behaves. |
I do recall there being some dpi issues with an older version. I will see if I can reproduce the issue with some older versions and display settings. |
Wow, that is very strange. I'll see if I can get it to do that. So far, I have tried it out on Java 9 with 150% scaling and I see an issue there with the position when floating a dockable. The overlay has looked ok though. |
Wow, no. That's the dockable that's floating, not another frame. Forget what I said (It has been too long of a day). |
for (GraphicsDevice screenDevice : env.getScreenDevices()) {
System.out.println("scale for: " + screenDevice.getIDstring() + ": " + screenDevice.getDefaultConfiguration().getDefaultTransform().getScaleX() + ", " + screenDevice.getDefaultConfiguration().getDefaultTransform().getScaleY());
} @tlf30 Hey, could you tell me what this code outputs on your setup? I believe most of this boils down to me not using the scaling properly. Essentially that makes almost all the positioning wrong. Funny enough, the center docking handles are the only things I use the scale for. That's why they appear huge in the original screenshot in this issue. I did more testing on 150% and the drag position was way off. I scaled the mouse position using the above code and the position was fixed. However, that only works on the 150% monitor. I need to figure out how you tell which monitor you're on and using the scaling for that. This might take some time. |
Absolutely, here is the output
|
I tested it on macos jdk19 and found the same problem. When I try to drag, the component behind the background temporarily disappears. |
Hard to see, but it looks like the DockingUtilsFrame where the handles are drawn isn't being hidden. This frame is set as undecorated (this part looks to be working) and the background is set to |
@Richard-Tang It turns out that transparency works a little different on macOS. I have committed a change to use the client property "Window.alpha". Apparently you have to set that to 0.0f instead of using If you're able to try it out, that would be great. I am still investigating the other scaling issues. |
This time it is indeed transparent, but without ModernDocking layout display! The original layout component is no longer displayed. |
@Richard-Tang Interesting. We're learning something! I've been doing some research about translucency/transparency in Java Swing. I've added a new test class to basic-demo. Could you run For example, when I run it on my Windows 11 machine it outputs the following.
|
I suspect that macOS doesn't support the per-pixel translucency and that's what we're seeing here. Either way, this looks like something I need to consider and have a backup solution for when the transparency tricks won't work. |
|
Well, there goes that theory. I guess macOS supports it but it doesn't work the same. |
@Richard-Tang Undid the previous change and set the background color of the content pane to be transparent. I have my fingers crossed that does something, if you wouldn't mind trying. |
I made another change based on what was discovered in Issue #68 that might be related to this issue as well. I am publishing a 0.6.1 right now which should be available on maven central later this morning. |
#68 This solves the translucent issue on MacOS But in the latest code, try {
if (getContentPane() instanceof JComponent) {
((JComponent) getContentPane()).setOpaque(false);
}
}
catch (IllegalComponentStateException e) {
// TODO we need to handle platforms that don't support translucent display
// this exception indicates that the platform doesn't support changing the opacity
} ![]() It currently works on MacOS |
A Looks good. Something still seems a little off with the handles, but at least they're rendering with transparency. |
@Richard-Tang Could you try out the latest? I wrote issue #72 related to this issue. Turns out, the special RepaintManager that I use to check for EDT violations breaks the transparency on Linux and I suspect the same happens on MacOS. I modified the demo to have this off by default. This would also be a problem for apps derived from my example code if they kept the |
I'm a little confused. Is there a missing screenshot there with the detector off? |
Damn :( I really thought that was going to be it. |
Interesting that it has regressed. I am seeing some look and feel issue with the demo where the backgrounds always stay white. Not sure if it's related, but I do have a fix for it. |
@Richard-Tang Getting back to this again. What does it display with I noticed that before when it was working you were running my Edit: Sorry, that was supposed to say |
I came across this FlatLaf MacOS transparency issue last night (JFormDesigner/FlatLaf#705) that has a very similar issue. I will try the suggested workaround for 0.7.2. |
0.7.2 has the workaround in it now. |
Closing. I believe this has been resolved. |
The same jar package code, when displayed on MACOS, there will be a visual bug.
When I drag and drop on MACOS, it looks like this: the feature works, but it doesn't appear as complete as it does on Windows.
It is displayed normally on windows
The text was updated successfully, but these errors were encountered: