Merge lp:~azzar1/unity/round-gtk-scaling-to-closest-integer into lp:unity

Proposed by Andrea Azzarone on 2016-12-16
Status: Merged
Approved by: Marco Trevisan (Treviño) on 2016-12-20
Approved revision: 4215
Merged at revision: 4215
Proposed branch: lp:~azzar1/unity/round-gtk-scaling-to-closest-integer
Merge into: lp:unity
Diff against target: 21 lines (+2/-2)
1 file modified
unity-shared/UnitySettings.cpp (+2/-2)
To merge this branch: bzr merge lp:~azzar1/unity/round-gtk-scaling-to-closest-integer
Reviewer Review Type Date Requested Status
Marco Trevisan (Treviño) 2016-12-16 Approve on 2016-12-20
David Jordan (community) Approve on 2016-12-20
Review via email: mp+313459@code.launchpad.net

Commit message

Round gtk scaling factor to closest integer.

Description of the change

Round gtk scaling factor to closest integer.

To post a comment you must log in.
Omer Akram (om26er) wrote :

What's the impact of this one ? Will scaling of 1.68 effectively result in 2X scaling ?

Andrea Azzarone (azzar1) wrote :

This will not affect unity scaling, neither text scaling. Just gtk
window scaling that is integer. So yes 1.68 will be 2.

On Fri, Dec 16, 2016 at 8:34 PM, Omer Akram <email address hidden> wrote:
> What's the impact of this one ? Will scaling of 1.68 effectively result in 2X scaling ?
> --
> https://code.launchpad.net/~azzar1/unity/round-gtk-scaling-to-closest-integer/+merge/313459
> You are the owner of lp:~azzar1/unity/round-gtk-scaling-to-closest-integer.
>
> Launchpad-Message-Rationale: Owner
> Launchpad-Message-For: azzar1
> Launchpad-Notification-Type: code-review
> Launchpad-Branch: ~azzar1/unity/round-gtk-scaling-to-closest-integer
> Launchpad-Project: unity

David Jordan (dmj726) wrote :

Will test shortly on 14" and 17" machines, though I expect to see some issues with text size, qt scaling, etc.

David Jordan (dmj726) wrote :

The sudden switch in scaling factor when the user manually picks say 1.68 is pretty jarring, and I'm not sure it would be readily understood why it's happening, especially when text size changes at each step.

Let's leave the manual scaling alone and just focus on defaulting to scales we can represent perfectly.

review: Needs Fixing
David Jordan (dmj726) wrote :

Actually, digging into this more, I'd say this is a minor improvement (moving the sudden, size increase to 1.5x instead of having the jump at 2x), so I'm definitely fine with this patch.

It's not a fix for bug #1649736 though.

review: Approve
4214. By Andrea Azzarone on 2016-12-20

Improve optimal scale logic.

4215. By Andrea Azzarone on 2016-12-20

Round gtk scaling factor to closest integer.

Marco Trevisan (Treviño) (3v1n0) wrote :

Looks good, thanks.

review: Approve
David Jordan (dmj726) wrote :

Looks good to me!

Kai-Heng Feng (kaihengfeng) wrote :

Thanks for the patch!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'unity-shared/UnitySettings.cpp'
2--- unity-shared/UnitySettings.cpp 2016-11-30 11:06:15 +0000
3+++ unity-shared/UnitySettings.cpp 2016-12-20 16:33:36 +0000
4@@ -346,7 +346,7 @@
5 const auto dpi = std::max(dpi_x, dpi_y);
6
7 if (dpi > DPI_SCALING_LIMIT)
8- scale = static_cast<int>(std::lround(scale * dpi / DPI_SCALING_LIMIT));
9+ scale = static_cast<int>(scale * std::lround(dpi / DPI_SCALING_LIMIT));
10 }
11
12 return scale;
13@@ -423,7 +423,7 @@
14 {
15 changing_gnome_settings_ = true;
16 changing_gnome_settings_timeout_.reset();
17- unsigned integer_scaling = std::max<unsigned>(1, scale);
18+ unsigned integer_scaling = std::max<unsigned>(1, std::lround(scale));
19 double point_scaling = scale / static_cast<double>(integer_scaling);
20 double text_scale_factor = parent_->font_scaling() * point_scaling;
21 glib::Variant default_cursor_size(g_settings_get_default_value(gnome_ui_settings_, GNOME_CURSOR_SIZE.c_str()), glib::StealRef());