diff --git a/src/backends/meta-monitor-manager-dummy.c b/src/backends/meta-monitor-manager-dummy.c index ef3c3c330..315117e5c 100644 --- a/src/backends/meta-monitor-manager-dummy.c +++ b/src/backends/meta-monitor-manager-dummy.c @@ -159,12 +159,10 @@ append_monitor (MetaMonitorManager *manager, for (i = 0; specs[i]; ++i) { int width, height; - float refresh_rate = 60.0; + float refresh_rate; - if (sscanf (specs[i], "%dx%d@%f", - &width, &height, &refresh_rate) == 3 || - sscanf (specs[i], "%dx%d", - &width, &height) == 2) + if (meta_parse_monitor_mode (specs[i], &width, &height, &refresh_rate, + 60.0)) { CrtcModeSpec *spec; diff --git a/src/core/meta-context-main.c b/src/core/meta-context-main.c index cc930116e..f673432f5 100644 --- a/src/core/meta-context-main.c +++ b/src/core/meta-context-main.c @@ -533,12 +533,9 @@ add_virtual_monitor_cb (const char *option_name, { MetaContextMain *context_main = user_data; int width, height; - float refresh_rate = 60.0; + float refresh_rate; - if (sscanf (value, "%dx%d@%f", - &width, &height, &refresh_rate) == 3 || - sscanf (value, "%dx%d", - &width, &height) == 2) + if (meta_parse_monitor_mode (value, &width, &height, &refresh_rate, 60.0)) { g_autofree char *serial = NULL; MetaVirtualMonitorInfo *virtual_monitor;