Bug 483401 - Java applications start with wrong scaling on mixed scale monitors
Summary: Java applications start with wrong scaling on mixed scale monitors
Status: RESOLVED DOWNSTREAM
Alias: None
Product: kwin
Classification: Plasma
Component: multi-screen (show other bugs)
Version: 6.0.1
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords: multiscreen, qt6
Depends on:
Blocks:
 
Reported: 2024-03-13 04:25 UTC by elman
Modified: 2024-03-14 16:52 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description elman 2024-03-13 04:25:52 UTC
SUMMARY
***
I have laptop with 4k display, which I use with 200% scaling. Then I have secondary monitor, which is FHD and I run in with 100% scaling. 4K display is the default one.

When I run Java applications DBeaver 24.0.0 or PHPStorm 2023.3.5 following happens:

- If I have only 4K display connected, applications correctly start with 200% scaling.
- If I have both displays connected, applications start on 4K display, but with 100% scaling and therefore very small.

PHPStorm runs as xclient, DBeaver seems to run as native Wayland client (doesn't show in xlsclients).
***

STEPS TO REPRODUCE
1. Plug in 2 screens with different scaling.
2. Set the one with higher scaling as default.
3. Start Java application.

OBSERVED RESULT
Application started with scaling 100%.

EXPECTED RESULT
Application should start with scaling of default screen (200%).

SOFTWARE/OS VERSIONS
Operating System: EndeavourOS 
KDE Plasma Version: 6.0.1
KDE Frameworks Version: 6.0.0
Qt Version: 6.6.2
Kernel Version: 6.7.9-arch1-1 (64-bit)
Graphics Platform: Wayland

Could be related to 477177.
Comment 1 Nate Graham 2024-03-13 21:46:36 UTC
Are all affected apps using XWayland, or are any of the affected apps running as native Wayland apps?

Does it change anything if you go to System Settings > Display and Monitor and change the value of the "Legacy Applications (X11):" setting?

If it does, does it make a difference for all previously-affected apps, or only some?
Comment 2 elman 2024-03-14 04:59:10 UTC
XWayland
- RubyMine
- PHPStorm
- LanguageTool plugin in LibreOffice

Wayland
- DBeaver

When I set "Scaled by the system", XWayland apps are scaled to 100% on FHD screen and to 200% on 4K, but are blurry.

When I set "Apply scaling themselves", I manually configured RubyMine and PHPStorm to use 200% scaling. I did a lot of testing and this behaviour is erratic. Sometimes apps start on 4K, sometimes on FHD (I always keep cursor on 4K). Sometimes they start with correct scaling, sometimes not. And sometimes when I move windows between screens scaling gets "fixed" and sometimes it changes to 50%.

Couldn't find any pattern to it…
Comment 3 Nate Graham 2024-03-14 16:52:33 UTC
Ok, I'm pretty sure I know what's going on here: when you use the default "Apply scaling themselves" feature, KWin is relying on apps to have sane X11 digh DPI behavior. Evidently these apps don't, unfortunately. The fact that you can configure the scale in the apps on a per-app basis is a dead giveaway. Obviously this won't work in a mixed-DPI screen setup since the scale you set for an app that makes it look good on one screen won't be correct on the other screen. I have a feeling the apps are trying to be smart and fighting the system, outsmarting themselves in the process, and this is what accounts for the erratic results.