Bug 391682

Summary: Many Plasma UI elements (e.g. radiobuttons, checkboxes) are scaled incorrectly when using a scale factor
Product: [Plasma] plasmashell Reporter: battaglia01
Component: generalAssignee: David Edmundson <kde>
Status: RESOLVED DUPLICATE    
Severity: normal CC: katyaberezyaka, nate, plasma-bugs
Priority: NOR    
Version: 5.12.2   
Target Milestone: 1.0   
Platform: unspecified   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=424465
Latest Commit: Version Fixed In:
Attachments: Inconsistent HiDPI rendering (annotated) - Plasma 5.11.2 running on Manjaro 17.0.6 x64 stable
Inconsistent HiDPI rendering - Plasma 5.11.2 running on Manjaro 17.0.6 x64 stable
Inconsistent HiDPI rendering - Plasma 5.12.2 running on Neon 5.12 User Edition
Some HiDPI issues fixed on 5.12.2 Neon by enabling Qt scaling
Incorrect default scaling behavior for GTK3 apps - ex: manjaro-hello and Lollypop
Correct GTK3 scaling behavior - GDK_SCALE=2 and GDK_DPI_SCALE=0.5

Description battaglia01 2018-03-10 21:24:50 UTC
Created attachment 111301 [details]
Inconsistent HiDPI rendering (annotated) - Plasma 5.11.2 running on Manjaro 17.0.6 x64 stable

HiDPI sometimes renders inconsistently on Plasma 5.11.2 and 5.12.2. Sometimes widgets, icons, fonts, etc will render correctly, whereas other times these things will be tiny and/or lay out according to skewed geometry. Some windows have decorations that are far too small.

Attached are three pictures of the problem:

- Two running on Plasma 5.11.2/Frameworks 5.39.0/Qt 5.9.2 on Manjaro 17.0.6
- One running on Plasma 5.12.2/Frameworks 5.43.0/Qt 5.10.0 on Neon 5.12

I'm not sure exactly where the problem is located, so I put this under "plasmashell" - feel free to move if this isn't the right place.
Comment 1 battaglia01 2018-03-10 21:25:17 UTC
Created attachment 111302 [details]
Inconsistent HiDPI rendering - Plasma 5.11.2 running on Manjaro 17.0.6 x64 stable
Comment 2 battaglia01 2018-03-10 21:26:17 UTC
Created attachment 111303 [details]
Inconsistent HiDPI rendering - Plasma 5.12.2 running on Neon 5.12 User Edition
Comment 3 battaglia01 2018-03-10 21:32:02 UTC
To reproduce this, I simply went into the display settings and set "Scale" to 2.0.

No other changes were made, other than a tweak to the system tray icon sizes, by going to /usr/share/plasma/plasmoids/org.kde.plasma.private.systemtray/contents/config/main.xml and changing 'iconSize' to 2. (taken from https://wiki.archlinux.org/index.php/HiDPI#KDE)
Comment 4 battaglia01 2018-03-10 21:36:11 UTC
Finally, this is on VirtualBox on a Surface Pro 4. It might not be a problem if I tried to install it natively, but I'm not sure.
Comment 5 Nate Graham 2018-03-10 22:10:51 UTC
If you `killall plasmashell` and then run `PLASMA_USE_QT_SCALING=true plasmashell` are things a bit better?


Related: https://phabricator.kde.org/D11131
Comment 6 battaglia01 2018-03-10 22:43:34 UTC
It does appear to work on 5.12.2 Neon, yes! I'll test on Manjaro later tonight.

At least it fixes the issue with small icons - the font layout is still off on some of the windows, but it's still way better. Picture attachment coming next.

How do I enable this by default?

Is there any reason that this setting is off? This should be enabled by default IMO, as HiDPI scaling is *really* weird without it. I haven't seen anything about this anywhere, on the Arch Wiki and etc.
Comment 7 battaglia01 2018-03-10 22:44:04 UTC
Created attachment 111305 [details]
Some HiDPI issues fixed on 5.12.2 Neon by enabling Qt scaling
Comment 8 David Edmundson 2018-03-10 23:25:46 UTC
>I'll test on Manjaro later tonight.

You don't need to, it'll be the same on > 5.11

See linked report.

*** This bug has been marked as a duplicate of bug 356446 ***
Comment 9 battaglia01 2018-03-11 05:04:16 UTC
FWIW, I did get the same good results as on Neon, however the Manjaro Hello app is still screwed up.

So while the Qt scaling environment variable fix worked for the other things as in #356446, this part of the bug report is not related to that and hence still active.

According to the github repo (https://github.com/manjaro/manjaro-hello), the manjaro-hello app uses python, gtk3, and glade. Any idea what could be throwing the scaling off here? I don't know much about Glade, but perhaps something there, or with GTK3?
Comment 10 battaglia01 2018-03-11 05:43:19 UTC
Actually, it does appear to be GTK3. I thought I'd tested a GTK3 app previously, but I guess not. The problem also happens for Lollypop music player, which is GTK3.

Is there a separate environment variable that needs to be set for GTK3 scaling?
Comment 11 battaglia01 2018-03-11 05:44:02 UTC
Also, should I make a separate bug report for this, since you set this one as a duplicate of the other Qt issue? Turns out there are multiple things going on here.
Comment 12 Nate Graham 2018-03-11 19:52:40 UTC
You should file a bug against the Manjaro app on their own bug tracker.
Comment 13 battaglia01 2018-03-11 20:20:09 UTC
The issue applies to all GTK3 apps running in KDE. Read my description above where I mention Lollypop:

> Actually, it does appear to be GTK3. I thought I'd tested a GTK3 app previously, but I guess not. The problem also happens for Lollypop music player, which is GTK3.

I was able to fix this problem for GTK apps in general by setting GDK_SCALE=2 and GDK_DPI_SCALE=0.5.
Comment 14 battaglia01 2018-03-11 21:12:43 UTC
So below are attached two pictures of the GTK3 problem, and how I was able to fix it.

Note that this is a completely separate dimension from the Qt scaling issue, and that the problem is for all GTK3 apps, not only the Manjaro-Hello one. I have pictures of manjaro-hello and Lollypop for comparison.

The first picture is what the two apps look like with KDE's Display settings set to scale=2.0. Setting PLASMA_USE_QT_SCALING=true here makes no difference.

The second picture is what I get if I set GDK_SCALE=2.0 and GDK_DPI_SCALE=0.5. Everything looks great.

Setting GDK_DPI_SCALE=0.5 is necessary because if you don't, GTK widgets are scaled correctly, but fonts are double-scaled. GDK_DPI_SCALE de-scales the fonts while keeping widgets correct.
Comment 15 battaglia01 2018-03-11 21:14:30 UTC
Created attachment 111327 [details]
Incorrect default scaling behavior for GTK3 apps - ex: manjaro-hello and Lollypop

This has KDE scaling = 2.0 and no other changes. This problem is independent of the Qt scaling problem.
Comment 16 battaglia01 2018-03-11 21:16:01 UTC
Created attachment 111328 [details]
Correct GTK3 scaling behavior - GDK_SCALE=2 and GDK_DPI_SCALE=0.5

Correct behavior with GDK_SCALE=2 and GDK_DPI_SCALE=0.5. Note that without GDK_DPI_SCALE=0.5, fonts get double-scaled.
Comment 17 Nate Graham 2021-07-26 18:45:44 UTC
Largely tracked already by BUG 381794 and Bug 366088, but also some of BUG 390147.

Arbitrarily re-marking as a duplicate of BUG 381794 because we can't multi-dupe. :)

*** This bug has been marked as a duplicate of bug 390147 ***
Comment 18 Nate Graham 2021-07-26 19:30:01 UTC
Un-duping since this appears to be different from Bug 390147 after all. The fix may be similar, but fixing that will not automatically fix this.

Looking into it.
Comment 19 Nate Graham 2021-07-28 16:38:26 UTC
And upon further investigation and consultation with colleagues, it is impossible to fix without turning on Qt scaling, because you can't selectively turn on or off Qt scaling for only certain UI elements. The only thing we could do is split plasmashell into multiple processes and have one process draw everything that is drawable using Plasma scaling and another process draw everything that needs to be drawn using Qt scaling. Such an endeavor would be an enormous amount of work and add substantial complexity and fragility though, so it's not really feasible.

Re-duping to Bug 356446, and I will re-open it.

*** This bug has been marked as a duplicate of bug 356446 ***