Bug 387849 - Display and Monitor: Scale Display should also apply to Gtk apps
Summary: Display and Monitor: Scale Display should also apply to Gtk apps
Status: RESOLVED FIXED
Alias: None
Product: KScreen
Classification: Plasma
Component: kcm (show other bugs)
Version: 5.11.4
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Sebastian Kügler
URL:
Keywords:
: 397217 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-12-12 22:44 UTC by Peter Eszlari
Modified: 2018-10-19 12:31 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.15.0


Attachments
set GTK scaling env vars in startkde (1.15 KB, patch)
2017-12-16 01:26 UTC, Peter Eszlari
Details
replace bc with awk (997 bytes, patch)
2017-12-21 23:39 UTC, Peter Eszlari
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Eszlari 2017-12-12 22:44:30 UTC
When changing the scaling value, it only gets applied to Qt based apps. I have to export GDK_SCALE and GDK_DPI_SCALE by myself, which is a bad user experience. While GDK_SCALE only supports integers, at least common use cases (2x, like in my case) would be covered.
Comment 1 David Edmundson 2017-12-15 23:42:41 UTC
This isn't part of kwin. Moving.
Given it's a simple patch to kscreen kcm and startkde do you want to write it?

(at least not for X, for wayland this "just works" already)
Comment 2 Peter Eszlari 2017-12-16 01:26:08 UTC
Created attachment 109398 [details]
set GTK scaling env vars in startkde
Comment 3 Nate Graham 2017-12-16 01:38:55 UTC
Very nice! Mint submitting it with http://phabricator.kde.org/?
Comment 4 David Edmundson 2017-12-16 14:27:42 UTC
Git commit aba3d48c07fce03d9e23717fc24de06aad5c75d7 by David Edmundson, on behalf of Peter Eszlari.
Committed on 16/12/2017 at 14:27.
Pushed by davidedmundson into branch 'master'.

Set GTK scaling env vars

Reviewed-by: David Edmundson

M  +3    -0    startkde/startkde.cmake

https://commits.kde.org/plasma-workspace/aba3d48c07fce03d9e23717fc24de06aad5c75d7
Comment 5 Peter Eszlari 2017-12-21 23:39:10 UTC
Created attachment 109479 [details]
replace bc with awk

As it turns out, OpenSuse Krypton (which provides KDE git snapshots) does not include bc(!) in the default system, so the attched patch replaces bc+echo with awk.
Comment 6 David Edmundson 2017-12-22 00:09:24 UTC
and what's to say they provide awk?
Comment 7 Peter Eszlari 2017-12-22 00:41:00 UTC
> and what's to say they provide awk?

Because I tested it?!

It seems to be the same with Arch: they have gawk in "Core" and bc only in "Extra":

https://www.archlinux.org/packages/core/x86_64/gawk/

https://www.archlinux.org/packages/extra/x86_64/bc/
Comment 8 Christoph Feck 2018-01-02 18:26:13 UTC
I never had 'bc' installed. On the other hand, 'awk' is needed by system scripts.
Comment 9 David Edmundson 2018-01-10 17:04:04 UTC
Git commit 6202fc258e0b4b3c730774a00bc2e1afd21b5a64 by David Edmundson, on behalf of Peter Eszlari.
Committed on 10/01/2018 at 17:03.
Pushed by davidedmundson into branch 'master'.

Replace bc with awk

M  +1    -1    startkde/startkde.cmake

https://commits.kde.org/plasma-workspace/6202fc258e0b4b3c730774a00bc2e1afd21b5a64
Comment 10 David Edmundson 2018-01-10 17:21:22 UTC
Thanks for following that up.

Peter in future can you use our review process at http://phabricator.kde.org it makes life easier for us.
Comment 11 Nate Graham 2018-08-06 17:16:42 UTC
Peter, sadly this broke some people and had to be reverted in Bug 389523.

Since GDK_SCALE only supports integers, perhaps we could only conditionally set GDK_SCALE and GDK_DPI_SCALE if $kdeglobals_kscreen_scalefactor is also an integer. What do you think?
Comment 12 Nate Graham 2018-08-06 17:17:26 UTC
*** Bug 397217 has been marked as a duplicate of this bug. ***
Comment 13 Peter Eszlari 2018-08-10 19:41:17 UTC
https://phabricator.kde.org/D14697
Comment 14 Michael Reiher 2018-08-22 17:16:50 UTC
Not sure what the status of this is, but it seems this could already work. If initial config would be fixed.

What happened for me is, that KDE already picked a proper scale. Perfect. So I had no need to manually configure it. However Gtk did not scale well and I had to manually set GDK_DPI_SCLAE=1.5. Later I tried to hook up a 2nd screen and played with the scaling settings and so actually wrote them (in the end just the defaults). On next restart I got huge Gtk apps, apparently 1.5 from the env var on top 1.5 from KDE(? or xrandr?). So I removed manually setting GDK_DPI_SCLAE, and everything was fine again as before, even without manually messing with GDK_DPI_SCLAE...

So why wasn't it just correct right from the beginning?

What changed, and apparently was missing before, is in kdeglobals:

       +[KScreen]
       +ScaleFactor=1.5
       +ScreenScaleFactors=DP-0=1.5;DP-1=1.5;DP-2=1.5;DP-3=1.5;DP-4=1.5;DP-5=1.5;DP-6=1.5;DP-7=1.5;
       +

So if whatever this does, KDE would do initially and write that config, then everything might be great right from the start (regarding Gtk scaling)?

Ubuntu 18.04 with KDE 5.12.6 (I would say..)
Comment 15 Nate Graham 2018-10-18 22:43:53 UTC
Git commit 31e1a1a96ca2d03e4da1284d6e965b0877376570 by Nate Graham, on behalf of Peter Eszlari.
Committed on 18/10/2018 at 22:43.
Pushed by ngraham into branch 'master'.

X11: set GDK_SCALE (try 2)

Summary: BUG: 387849

Reviewers: davidedmundson, ngraham, #plasma, broulik

Reviewed By: ngraham

Subscribers: broulik, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D14697

M  +5    -0    startkde/startkde.cmake

https://commits.kde.org/plasma-workspace/31e1a1a96ca2d03e4da1284d6e965b0877376570
Comment 16 Michael Reiher 2018-10-19 10:49:32 UTC
I admit, I'm not sure I understand what this patch fixes and also all this HIDPI scaling is highly confusing, but it looks strange...

Why does it only care about scale factor of 2 and 3? GDK_DPI_SCLAE=1.5 worked just fine for me...
Also why does scale factors of 2 and 3 result in a GDK_DPI_SCLAE=1/2 and 1/3 respectively?
Generally what happens if I have a [KScreen] ScaleFactor=1.5? Or some other fraction?

... just wondering :)
Comment 17 Nate Graham 2018-10-19 12:31:04 UTC
See https://developer.gnome.org/gtk3/stable/gtk-x11.html

This is the method that the GNOME devs recommend. GTK only officially supports integer scale factors, we only try to scale GTK apps when using an integer scale factor. The behavior is undefined and not guaranteed if we try to make them do fractional scaling.