monitor: Generate mode IDs with 3 decimal places for Hz

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2465>
This commit is contained in:
Daniel van Vugt 2022-06-15 18:16:46 +08:00 committed by Marge Bot
parent 9c1cd66d41
commit f6e24c6293

View File

@ -540,17 +540,14 @@ static char *
generate_mode_id (MetaMonitorModeSpec *monitor_mode_spec) generate_mode_id (MetaMonitorModeSpec *monitor_mode_spec)
{ {
gboolean is_interlaced; gboolean is_interlaced;
char refresh_rate_str[G_ASCII_DTOSTR_BUF_SIZE];
is_interlaced = !!(monitor_mode_spec->flags & META_CRTC_MODE_FLAG_INTERLACE); is_interlaced = !!(monitor_mode_spec->flags & META_CRTC_MODE_FLAG_INTERLACE);
g_ascii_dtostr (refresh_rate_str, G_ASCII_DTOSTR_BUF_SIZE,
monitor_mode_spec->refresh_rate);
return g_strdup_printf ("%dx%d%s@%s", return g_strdup_printf ("%dx%d%s@%.3f",
monitor_mode_spec->width, monitor_mode_spec->width,
monitor_mode_spec->height, monitor_mode_spec->height,
is_interlaced ? "i" : "", is_interlaced ? "i" : "",
refresh_rate_str); monitor_mode_spec->refresh_rate);
} }
static gboolean static gboolean