<div dir="ltr"><div>It doesn't require Wayland in order to run as before,</div><div>but if Wayland is available at runtime (dlsym), it will use it to get per-monitor scaling.</div><div>AFAIU mainline currently mostly works with XWayland, right?</div><div>If so, probably this can even help the mainline, not only sandbox?</div><div><br></div><div><div>And yes, it still reports integer scales, I didn't find a way to get fractional scaling,</div><div>Wayland protocol itself has only integer wl_output::scale.</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 10, 2023 at 10:48 PM Philip Race <<a href="mailto:philip.race@oracle.com">philip.race@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">If it needs Wayland, then it might be something that should go into the <br>
sandbox<br>
for the Wakefield project ... perhaps that is what you are intending here ?<br>
Until that project adds support back into main line for Wayland's X11 compat<br>
mode we only support running on X.org, so there won't be a wayland <br>
server to query,<br>
so this fix can't help mainline today.<br>
<br>
I presume this code would still report integer scales ?<br>
My understanding is Wayland by design does not support fractional scales.<br>
<br>
-phil.<br>
<br>
On 2/2/23 2:47 PM, Nikita Gubarkov wrote:<br>
> JetBrains Runtime has support for per-monitor scaling in X11 mode <br>
> implemented a few months ago.<br>
><br>
> At first I tried to use the GTK library for reading the scales as <br>
> suggested in <a href="https://bugs.openjdk.org/browse/JDK-8260270" rel="noreferrer" target="_blank">https://bugs.openjdk.org/browse/JDK-8260270</a>, but in a <br>
> multi-monitor environment it is always returning scale of the main <br>
> display when running with X11 backend.<br>
> The final solution was to connect to Wayland just to read the scaling <br>
> values and then do a huge refactoring to make AWT's X11-related code <br>
> respect these individual scaling values.<br>
> For coordinate conversions I took the same approach that was used in <br>
> Windows - <a href="https://github.com/openjdk/jdk/pull/375" rel="noreferrer" target="_blank">https://github.com/openjdk/jdk/pull/375</a><br>
> There were some issues that I was unable to solve, like the window <br>
> title bar is always scaled with the main monitor's scale no matter <br>
> what monitor the window is on, the same with mouse cursor when it's <br>
> over the window, but overall it seems to work.<br>
><br>
> I can try porting this into OpenJDK and create a PR if needed.<br>
><br>
> JBR issue: <a href="https://youtrack.jetbrains.com/issue/JBR-5208" rel="noreferrer" target="_blank">https://youtrack.jetbrains.com/issue/JBR-5208</a><br>
> Code: <br>
> <a href="https://github.com/JetBrains/JetBrainsRuntime/commit/bf073b92b8803fb45c5934127b8f4a9f58e508a1" rel="noreferrer" target="_blank">https://github.com/JetBrains/JetBrainsRuntime/commit/bf073b92b8803fb45c5934127b8f4a9f58e508a1</a><br>
<br>
</blockquote></div>