display: Round the displayed scale values logically
Mutter currently generates 4 scales per integer scale. Knowing that, we can nicely "round" the values we display to what the ideal scales are even though the real values might be skewed since mutter creates scale values close to the ideal ones that yield integer logical sizes. https://bugzilla.gnome.org/show_bug.cgi?id=786922
This commit is contained in:
parent
bbccf27488
commit
23d5ea29aa
1 changed files with 8 additions and 1 deletions
|
@ -1105,10 +1105,17 @@ scale_buttons_active (CcDisplayPanel *panel,
|
|||
}
|
||||
}
|
||||
|
||||
static double
|
||||
round_scale_for_ui (double scale)
|
||||
{
|
||||
/* Keep in sync with mutter */
|
||||
return round (scale*4)/4;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
make_label_for_scale (double scale)
|
||||
{
|
||||
gchar *text = g_strdup_printf (" %d%% ", (int) round (scale*100));
|
||||
gchar *text = g_strdup_printf (" %d %% ", (int) (round_scale_for_ui (scale)*100));
|
||||
GtkWidget *label = gtk_label_new (text);
|
||||
g_free (text);
|
||||
return label;
|
||||
|
|
Loading…
Add table
Reference in a new issue