andrewauclair / ModernDocking

Modern docking framework for Java Swing
https://andrewauclair.github.io/modern-docking/starter-topic.html
MIT License
94 stars 22 forks source link

Bad Flicking on Linux with Integrated Graphics #218

Open andrewauclair opened 5 months ago

andrewauclair commented 5 months ago

Looks like the overlays flicker on and off really bad when dragging a window in Gnome on Arch.

andrewauclair commented 5 months ago

Played around with this for a while and reducing the number of repaint helps. I'm wondering if it's because I'm on an old laptop with integrated graphics. I'm sure that doesn't help.

andrewauclair commented 5 months ago

This will be fixed with the overlay refactor and was finally achieved by using a BufferStrategy instead of manually repainting the JFrame.

This didn't work out in the end. Need to test on a archlinux machine with an actual graphics card.

Mino260806 commented 3 months ago

Same issue on Linux Mint 21.1 with integrated graphics. Laptop is fairly new though. The flickering causes a huge lag.

https://github.com/user-attachments/assets/f31c18aa-59b9-464b-9644-c7601354e2a8

Edit: After some unsuccessful tinkering with the source code, I figured out the root cause is renderPanel.setOpaque(false) inside FloatUtilsFrame. However, I was unable to fix it

This 11-year-old stackoverflow question describes the exact problem, but it has no answer

andrewauclair commented 3 months ago

Interesting. That is the exact behavior I've seen on Arch. Maybe integrated graphics is the common issue. I had found a fix for it, but it broke the windows side of Modern Docking. I'll look into some way that I can do Linux specific code.

Mino260806 commented 3 months ago

Maybe integrated graphics is the common issue.

Maybe it's an issue with Gnome rather than integrated graphics? The person in the SO question mentions having "nvidia drivers", so he most likely has dedicated graphics.

Did you confirm it works in a linux computer with dedicated graphics ?

I had found a fix for it, but it broke the windows side of Modern Docking

Why don't you put a check on the OS type and operate accordingly ?


There is something else to point out, the overlay thinks the window size is bigger than it originally is, so the right and bottom handles overflow the screen (see video again). Did you also find a fix for this ?

andrewauclair commented 3 months ago

Maybe it's an issue with Gnome rather than integrated graphics? The person in the SO question mentions having "nvidia drivers", so he most likely has dedicated graphics.

Did you confirm it works in a linux computer with dedicated graphics ?

Yes. I use this at work on Gnome on CentOS and haven't encountered this issue there.

I had found a fix for it, but it broke the windows side of Modern Docking

Why don't you put a check on the OS type and operate accordingly ?

That's likely what I'll try.


There is something else to point out, the overlay thinks the window size is bigger than it originally is, so the right and bottom handles overflow the screen (see video again). Did you also find a fix for this ?

That is intentional. The overlap frame is larger to account for drawing handles off the edge of the main frame.

andrewauclair commented 2 months ago

Maybe integrated graphics is the common issue.

Good news. I finally had the time and energy to fix this. I believe I have a working solution. The common issue appears to be integrated graphics not supporting multi-buffer. Wrote some code that will work one way for multi-buffer and another when it's not available and have tested that.

There is something else to point out, the overlay thinks the window size is bigger than it originally is, so the right and bottom handles overflow the screen (see video again). Did you also find a fix for this ?

Sorry, I just realized this is actually an issue. Looks to be specific to using the application in full screen mode. Looking into it now.