-
-
Notifications
You must be signed in to change notification settings - Fork 285
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
Improve on Window resizing #866
Comments
This is a characteristic behavior of Swing, I have always observed this in Swing applications, from the most basic to the most complex layouts. Applications written with JavaFX, this does not happen, the graphical capabilities have been improved. Do this same test on your videos with a JavaFX application and you will see that nothing like this happens. 👍 |
Hello. On linux, this problem is partially solved by enabling hardware acceleration in the JVM: |
Hello. Thanks for the suggestion. Kind of unfortunate, because I thought I would use flatlaf despite java fx being an alternative. flatlaf does offer some advantages, like styling the window title bars according to the theme out of the box.
I think on Windows it is not as annoying, as the flickering on Linux. But that might just be personal preference. Maybe this issue can not be addressed by flatlaf. Then I would need to hope for a newer java version to fix the flickering. |
@CodingFuchs thanks for the report and the details. The resize behavior is not controlled/implemented by FlatLaf. On Windows, window resizing is fixed since FlatLaf 3.5.2, On macOS, window resizing is super fast. On Linux, I don't see your problems. On Ubuntu 24.10 (Java 8 and 21; VirtualBox) it resizes smooth and fast. No text jittering or temporary black/white areas on resizsed edges. Also works fine on KDE neon. ubuntu-24.10.mp4On older Ubuntu 22.04, sometimes the drop shadow seems not to follow fast enough when making a window smaller: The behavior on your Ubuntu system is very strange. Screenshot taken from your video. Left is before resizing. Right is during resizing. Don't know why this happens on your Ubuntu. Do you have other Linux distros or other PCs? Do they show same behavior? |
@DevCharly Thanks for you reply.
Yes, that sound like an accurate description of what is happening. I am not sure, if I am onto something: I attached a video showing what I just described. Ubuntu24_10.mp4Here is my theory: So my suspicion would be that customizing the TitlePane has something to do with the problem. But it may just be a coincidence. I am curious on your opinion on this discovery. Unfortunately I have no other linux distributions in my dual-boot setup. But the next Ubuntu release is not that far away. Is there a way to keep the native window decorations, when initializing flatlaf on startup? That would help to prove or discard the theory. |
Interesting that the behavior is different when using native window decorations 😕 Does the behavior (with FlatLaf decorations) change if you start with disabled OpenGL? E.g.:
I don't think this is a problem in Ubuntu. Looks more like a Java issue... What Java distro do you use? Have you tried another Java version.
Sure, do not enable it in your app 😉 |
…dow decorations are enabled (issue #866) also made drag border slightly wider (from 5 to 6 pixels) and changed drag corner width from 16 to 32 to match native windows
I thought I would share some more feedback concerning this issue. All videos below have been recorded with Java 22, but I also tried it with the latest oracle jdk 23, which did not make a positive difference. Video 1 - FlatLaf Demo but only Native Window Decorations: WindowWithoutLafDecoration.mp4With native window decorations, resizing is smooth. However, there still seems to be some pixel edge at the very border of the resizing area, which I cannot notice in your video. No idea, how your virtual machine manages to be even better at that. But this behavior can be ignored, because the overall result is still really good. Video 2 - FlatLaf Demo without OpenGL: WindowDecoratedNoOpenGL.mp4Turning off OpenGL is the worst resizing I have seen. You would not believe, that I have a RTX 3080 in my rig... Video 3 - FlatLaf Demo with Decorated Windows: WindowDecorated.mp4This video is for reference to compare it, with you latest changes concerning X11. Video 4 - FlatLaf with your latest X11 Commit checked out: WindowWithX11_changes.mp4With your latest commit, resizing seems more stable. The random frame flickers seem to be gone. But there still seems to be some lagging Bitmap Scaling going on. It seems like its painting the content to late, when the size does not match. I wonder, whether double-buffering has something to do with that? Having buffer content with a size, that does not match the size of the JFrame anymore, thus resulting in the effect we can see in the video. That's all I got at the moment. I am interested, if you think tackling the bitmap resizing paint lag would be possible or not. |
Hello,
I really like this Look and Feel!
One area, which might could be improved upon, is the resizing behavior of windows.
Let's first sum up the observations, that can be made:
This leads to following questions:
On Ubuntu the resizing has no "delay". While on Windows (10 at least) it seems, that the mouse needs to stop moving, before the contents inside will be resized.
Resizing on Windows:
https://github.com/JFormDesigner/FlatLaf/assets/84087666/b6285d91-cc29-4f2d-9fed-ad59325478ea
Note how the resizing takes place only after finishing the mouse movements.
Resizing on Ubuntu (FlatDark Theme)
https://github.com/JFormDesigner/FlatLaf/assets/84087666/08bf7d54-337b-4a8d-b740-1d98ca2b4e4a
Resizing on Ubuntu (FlatLight Theme)
https://github.com/JFormDesigner/FlatLaf/assets/84087666/bfa15a01-edcb-4aaa-8ad9-a501a2ea16d1
Note:
Resizing on Ubuntu (Metal)
https://github.com/JFormDesigner/FlatLaf/assets/84087666/1c071690-9a43-40c0-a3a3-28597e55913b
I also looked at the resizing behavior with good old metal look, which is even more laggy. So maybe it is a combination of Java + Operating System which cannot be addressed by the Look and Feel?
The text was updated successfully, but these errors were encountered: