Merge lp:~kaihengfeng/unity/set-hidpi-scale-factor into lp:unity
| Status: | Merged |
|---|---|
| Approved by: | Andrea Azzarone on 2016-11-24 |
| Approved revision: | 4133 |
| Merged at revision: | 4212 |
| Proposed branch: | lp:~kaihengfeng/unity/set-hidpi-scale-factor |
| Merge into: | lp:unity |
| Diff against target: |
153 lines (+64/-2) 3 files modified
unity-shared/UScreen.cpp (+10/-0) unity-shared/UScreen.h (+2/-0) unity-shared/UnitySettings.cpp (+52/-2) |
| To merge this branch: | bzr merge lp:~kaihengfeng/unity/set-hidpi-scale-factor |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Andrea Azzarone | 2016-07-07 | Approve on 2016-11-24 | |
|
Review via email:
|
|||
This proposal supersedes a proposal from 2016-07-04.
Commit Message
UnitySettings: If scale-factor is not set, find and set right scale for HiDPI displays.
| Kai-Heng Feng (kaihengfeng) wrote : | # |
| Marco Trevisan (Treviño) (3v1n0) wrote : | # |
Mh, this is something I always wanted to do, so thanks.
However I'm not sure is something that should be done at unity level, since it could cause to override the user setting.
Maybe this should be done only if the value is not the default one, I guess.
The preferred way to do this, would be using a migration script though. You can write it in python and follow the same we do for ./tools/
I'd like to discuss about the algorithm to find the proper scaling value. Since we also support non-integer values, it would be nicer to define a scaling to be proportional to display size by using some thresholds.
| Kai-Heng Feng (kaihengfeng) wrote : | # |
I think this won't override user setting, as long as it's greater than 0.
With this algorithm, a 27 inches 4K display will have scale factor 1.
So yes, I think if the scale can be proportional to display size would be great.
| Marco Trevisan (Treviño) (3v1n0) wrote : | # |
Ok, overriding a 0 value is fine then.
As for the thresholds calculations, can we do some testing?
| Kai-Heng Feng (kaihengfeng) wrote : | # |
Sure.
I think we can make the scale factor being proportional to the DPI, if the DPI is in range of DEFAULT_DPI to DEFAULT_DPI * 2. Your thought?
| Marco Trevisan (Treviño) (3v1n0) wrote : | # |
Yeah, I agree.
| Kai-Heng Feng (kaihengfeng) wrote : | # |
I choose 140 DPI as a base because it's the DPI on a 15" FHD screen. And both 15" UHD screen and 13" QHD+ screen has roughly 280 DPI, both of them look great with scale factor 2.
| Marco Trevisan (Treviño) (3v1n0) wrote : | # |
We're there, just a few style fixes.
| Kai-Heng Feng (kaihengfeng) wrote : | # |
Since the value eventually set into scale-factor is an integer, I use the same type for DPI_SCALING_STEP.
| Andrea Azzarone (azzar1) wrote : | # |
Can you explain why the check on the sizes as per diff comment?
| Kai-Heng Feng (kaihengfeng) wrote : | # |
It's from Unity Settings Daemon [1].
I believe this size check is cherry-picked from Gnome Settings Daemon.
| Kai-Heng Feng (kaihengfeng) wrote : | # |
Any chance to merge this patch? :)
| Kai-Heng Feng (kaihengfeng) wrote : | # |
Currently our team has several high-end machines with UHD/QHD display need to be enabled, so auto-scale will be great if it can work out of the box.
Is there any improvement for this patch I can make?
| Andrea Azzarone (azzar1) wrote : | # |
Code looks good to me and it works fine on my 4k monitor.


Set gsettings value is needed, otherwise Unity Control Center's Display will reset it because scale-factor is empty.