Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix automatic HiDPI scaling on Linux #7780

Open
cristatus opened this issue Sep 22, 2024 · 1 comment
Open

Fix automatic HiDPI scaling on Linux #7780

cristatus opened this issue Sep 22, 2024 · 1 comment
Labels
kind:bug Bug report or fix needs:triage Requires attention from one of the committers os:linux UI User Interface

Comments

@cristatus
Copy link

Apache NetBeans version

Apache NetBeans 23 release candidate

What happened

Netbeans 23 launcher auto-detects HiDPI and set's GDK_SCALE=2. However, some jdk especially 21 and JBR distributions handle scaling naively. Setting GDK_SCALE=2 in launch script results in 4x scaling.

Language / Project Type / NetBeans Component

No response

How to reproduce

Use temurin jdk 21 or Jetbrain JDK 21 and luanch netbeans 23. The netbeans UI on HiDPI screen with 2x scale looks like 4x scaled.

Did this work correctly in an earlier version?

Apache NetBeans 22

Operating System

Arch Linux

JDK

21

Apache NetBeans packaging

Apache NetBeans binary zip

Anything else

No response

Are you willing to submit a pull request?

Yes

@cristatus cristatus added kind:bug Bug report or fix needs:triage Requires attention from one of the committers labels Sep 22, 2024
@mbien mbien added the UI User Interface label Sep 22, 2024
@mbien
Copy link
Member

mbien commented Sep 22, 2024

GDK_SCALE might be a workaround from JDK 8 times, before JEP 263. Although the JDK does check the value too:
https://github.com/openjdk/jdk/blob/ab06a878f888827026424530781f0af414a8a611/src/java.desktop/unix/native/common/awt/systemscale/systemScale.c#L41-L52

If scaling is now detected correctly on JDK 17+ the extra launcher logic should be probably removed. There are going to be some edge cases with multi screen setups where not all screens need scaling etc. If it turns out that it is still needed, we might have to set -Dsun.java2d.uiScale.enabled=false too whenever GDK_SCALE is set to prevent double scaling issues.

btw NetBeans is currently only tested on OpenJDK re-distributions, experience may vary if you run it on forks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug Bug report or fix needs:triage Requires attention from one of the committers os:linux UI User Interface
Projects
None yet
Development

No branches or pull requests

2 participants