monitor: Add helper to parse simple mode strings

This will be used to extract the resolution and refresh rate from
strings like "1920x1080@60.0" or "1280x720". This aims to replace the
use of the locale dependent sscanf() function.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2902>
This commit is contained in:
Jonas Ådahl
2023-03-07 22:36:57 +01:00
committed by Marge Bot
parent 550a1dadf1
commit 2fd9834d94
3 changed files with 135 additions and 0 deletions

View File

@ -318,4 +318,11 @@ gboolean meta_monitor_set_hdr_metadata (MetaMonitor *monitor,
MetaOutputHdrMetadata *metadata,
GError **error);
META_EXPORT_TEST
gboolean meta_parse_monitor_mode (const char *string,
int *out_width,
int *out_height,
float *out_refresh_rate,
float fallback_refresh_rate);
#endif /* META_MONITOR_H */