<div dir="ltr">JetBrains Runtime has support for per-monitor scaling in X11 mode implemented a few months ago.<div><br><div>At first I tried to use the GTK library for reading the scales as suggested in <a href="https://bugs.openjdk.org/browse/JDK-8260270">https://bugs.openjdk.org/browse/JDK-8260270</a>, but in a multi-monitor environment it is always returning scale of the main display when running with X11 backend.</div><div>The final solution was to connect to Wayland just to read the scaling values and then do a huge refactoring to make AWT's X11-related code respect these individual scaling values.</div><div>For coordinate conversions I took the same approach that was used in Windows - <a href="https://github.com/openjdk/jdk/pull/375">https://github.com/openjdk/jdk/pull/375</a></div><div>There were some issues that I was unable to solve, like the window title bar is always scaled with the main monitor's scale no matter what monitor the window is on, the same with mouse cursor when it's over the window, but overall it seems to work.</div><div><br></div><div>I can try porting this into OpenJDK and create a PR if needed.<br></div><div><br></div><div>JBR issue: <a href="https://youtrack.jetbrains.com/issue/JBR-5208">https://youtrack.jetbrains.com/issue/JBR-5208</a></div><div>Code: <a href="https://github.com/JetBrains/JetBrainsRuntime/commit/bf073b92b8803fb45c5934127b8f4a9f58e508a1">https://github.com/JetBrains/JetBrainsRuntime/commit/bf073b92b8803fb45c5934127b8f4a9f58e508a1</a></div></div></div>