monitor-config-store: Only save 3 decimal places of <rate>

Because elsewhere we already ignore precision beyond that. It's also
easier to read rounded to 3 places than 15 decimal places.

  59.996623992919922  ->  59.997

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2465>
This commit is contained in:
Daniel van Vugt 2022-06-15 18:14:26 +08:00 committed by Marge Bot
parent 8e5f5fbe54
commit 8711d44991

View File

@ -1465,10 +1465,6 @@ append_monitors (GString *buffer,
for (l = monitor_configs; l; l = l->next)
{
MetaMonitorConfig *monitor_config = l->data;
char rate_str[G_ASCII_DTOSTR_BUF_SIZE];
g_ascii_dtostr (rate_str, sizeof (rate_str),
monitor_config->mode_spec->refresh_rate);
g_string_append (buffer, " <monitor>\n");
append_monitor_spec (buffer, monitor_config->monitor_spec, " ");
@ -1477,8 +1473,8 @@ append_monitors (GString *buffer,
monitor_config->mode_spec->width);
g_string_append_printf (buffer, " <height>%d</height>\n",
monitor_config->mode_spec->height);
g_string_append_printf (buffer, " <rate>%s</rate>\n",
rate_str);
g_string_append_printf (buffer, " <rate>%.3f</rate>\n",
monitor_config->mode_spec->refresh_rate);
if (monitor_config->mode_spec->flags & META_CRTC_MODE_FLAG_INTERLACE)
g_string_append_printf (buffer, " <flag>interlace</flag>\n");
g_string_append (buffer, " </mode>\n");