summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRui Matos <tiagomatos@gmail.com>2017-08-28 18:37:22 +0200
committerRui Matos <tiagomatos@gmail.com>2017-08-28 18:58:05 +0200
commit23d5ea29aa1dc2bd7e4bda0f71382529113d0430 (patch)
tree5ce24b89bf20f853cebb701984a1c993a88930e7
parentbbccf274881e00bda9f8faa2fb4bcb82afa7525e (diff)
downloadgnome-control-center-23d5ea29aa1dc2bd7e4bda0f71382529113d0430.tar.gz
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
-rw-r--r--panels/display/cc-display-panel.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/panels/display/cc-display-panel.c b/panels/display/cc-display-panel.c
index 277c39d94..32e5102de 100644
--- a/panels/display/cc-display-panel.c
+++ b/panels/display/cc-display-panel.c
@@ -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;