mirror of
https://github.com/brl/mutter.git
synced 2024-12-26 04:42:14 +00:00
Replace using sscanf() to parse mode strings with new helper
This fixes issues when the locale uses characters other than `.` in floating point numbers. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2902>
This commit is contained in:
parent
2fd9834d94
commit
86b5d9d809
@ -159,12 +159,10 @@ append_monitor (MetaMonitorManager *manager,
|
|||||||
for (i = 0; specs[i]; ++i)
|
for (i = 0; specs[i]; ++i)
|
||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
float refresh_rate = 60.0;
|
float refresh_rate;
|
||||||
|
|
||||||
if (sscanf (specs[i], "%dx%d@%f",
|
if (meta_parse_monitor_mode (specs[i], &width, &height, &refresh_rate,
|
||||||
&width, &height, &refresh_rate) == 3 ||
|
60.0))
|
||||||
sscanf (specs[i], "%dx%d",
|
|
||||||
&width, &height) == 2)
|
|
||||||
{
|
{
|
||||||
CrtcModeSpec *spec;
|
CrtcModeSpec *spec;
|
||||||
|
|
||||||
|
@ -533,12 +533,9 @@ add_virtual_monitor_cb (const char *option_name,
|
|||||||
{
|
{
|
||||||
MetaContextMain *context_main = user_data;
|
MetaContextMain *context_main = user_data;
|
||||||
int width, height;
|
int width, height;
|
||||||
float refresh_rate = 60.0;
|
float refresh_rate;
|
||||||
|
|
||||||
if (sscanf (value, "%dx%d@%f",
|
if (meta_parse_monitor_mode (value, &width, &height, &refresh_rate, 60.0))
|
||||||
&width, &height, &refresh_rate) == 3 ||
|
|
||||||
sscanf (value, "%dx%d",
|
|
||||||
&width, &height) == 2)
|
|
||||||
{
|
{
|
||||||
g_autofree char *serial = NULL;
|
g_autofree char *serial = NULL;
|
||||||
MetaVirtualMonitorInfo *virtual_monitor;
|
MetaVirtualMonitorInfo *virtual_monitor;
|
||||||
|
Loading…
Reference in New Issue
Block a user