mlopatkin / andlogview

Tool for viewing application logs from Android devices.
https://andlogview.mlopatkin.name/
Apache License 2.0
43 stars 7 forks source link

Support high-density screens #136

Closed mlopatkin closed 2 years ago

mlopatkin commented 6 years ago

Original report by me.


On 4K displays (e.g. 15" 3840*2160) the app window is too small. It needs to support default platform scaling.

I've tested on Linux (Ubuntu 16.04.1) only, because I don't have Win/Mac device with 4K display yet.

mlopatkin commented 4 years ago

The workaround that I use now is to run the app with JDK 11. Support for HiDPI in Swing was added in JDK 10, now it respects system-wide scaling. However, Android developers often stuck on JDK 8 so some solution is needed here:

mlopatkin commented 4 years ago

Another workaround (on Windows) is to use JDK bundled with Android Studio (aka JetBrains Runtime). One needs to point JAVA_HOME to the Studio's JDK and set LOGVIEW_OPTS=-Dsun.java2d.uiScale.enabled=true in environment.

mlopatkin commented 4 years ago

It looks like the Linux situation is more broken than I thought. I've failed to set up 1.5 scaling on Ubuntu 16.04 with JDK 11. The same configuration seems to works on my desktop though (I need to re-check). Setting 2x scaling with GDK_SCALE=2 or -Dsun.java2d.uiScale.enabled=true works though.

mlopatkin commented 4 years ago

Fractional scaling on linux seems to be affected by https://bugs.openjdk.java.net/browse/JDK-8214227 (i.e. not supported)

mlopatkin commented 4 years ago

Fractional scaling is not supported by Jetbrains Runtime as well: https://youtrack.jetbrains.com/issue/JBR-1365

Not so many options left:

  1. Manual scaling everywhere (moderately difficult)
  2. Check if JavaFX supports fractional scaling and rewrite UI in JavaFX (checking is easy, rewriting is hard however beneficial to code health and my knowledge of JavaFX :))
  3. Check if SWT supports fractional scaling and rewrite UI in SWT (again, checking is easy, rewriting is hard and I'm not sure SWT is a feasible choice).
mlopatkin commented 3 years ago

JPackage is going to hit stable in Java 16. I should probably bundle the runtime with the app so users with HiDPI displays don't have to set up a separate JDK.

mlopatkin commented 2 years ago

The simplest option might be to use flatlaf, it supports HiDPI. There are problems with colors though - default selection color doesn't play well with my priority colors.

mlopatkin commented 2 years ago

Still works weirdly in my Linux environment and JDK 11 (Unity, scale 125%). The scaling is way to large, 200% or even more.

mlopatkin commented 2 years ago

Still works weirdly in my Linux environment and JDK 11 (Unity, scale 125%). The scaling is way to large, 200% or even more.

Playing with flatlaf demo, I can see that it is indeed 200%, but only on JDKs 11-16. JDK 17 works fine. And I suppose, it might be different in Gnome/KDE. AARGH!

mlopatkin commented 2 years ago

I give up. My other Linux box doesn't reproduce the problem, FlatLaf picks up user scale (1.25) successfully. I'm closing the issue, one can use -Dsun.java2d.uiScale.enabled=false to force user scale, I guess.