i have a problem with content rendering on secondary monitor with different windows scaling. This issue appeared when project migrated from Java 1.8 (no problems on this version) to Java 17.
JDK is OpenJDK 17.
JCEF Version = 88.2.9.281
CEF Version = 88.2.9
Chromium Version = 88.0.4324.182
Primary monitor - 1920x1080 with 125% scaling
Secondary monitor - 1680x1050 with 100% scaling
When application located on primary monitor, everything works as expected, but when i drag application to secondary monitor and create new CefBrowser (basically new tab), all content in this tab is moved right (in case if monitor is configured to be on right side), image is attached.
The main thing is when i manually change size of main application window, content is rerendered and displayed as expected.
I tried to set correct width, height, x, y programatically (took values from current JFrame) using
- Code: Select all
CefBrowserWr.getUIComponent()
After some time of debugging i came up that method stack goes to
- Code: Select all
CefBrowser_N.N_WasResized(int width, int height)
A this moment i came up with ugly solution to change width of the CefBrowserWr UIComponent twice - frist -1 px then +1px after browser is constructed. This allows to correctly position content on secondary monitor.
Also it's worth to mention that i debugged and figured out that it's not JPanel is broken (or JFRame) but the content inside of it.
As i came up to some native C++ code, i cannot continue investigation because of lack of technical background here. I'm really wondering if there're any callbacks to Java from C++ code when
- Code: Select all
CefBrowser_N.N_WasResized(int width, int height)
And of course i want to find clean solution for my problem.