diff --git a/src/core/display.c b/src/core/display.c index c1dbe8834..eb976e055 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -3513,6 +3513,37 @@ meta_display_get_monitor_geometry (MetaDisplay *display, *geometry = logical_monitor->rect; } +/** + * meta_display_get_monitor_scale: + * @display: a #MetaDisplay + * @monitor: the monitor number + * + * Gets the monitor scaling value for the given @monitor. + * + * Return value: the monitor scaling value + */ +float +meta_display_get_monitor_scale (MetaDisplay *display, + int monitor) +{ + MetaBackend *backend = meta_get_backend (); + MetaMonitorManager *monitor_manager = + meta_backend_get_monitor_manager (backend); + MetaLogicalMonitor *logical_monitor; +#ifndef G_DISABLE_CHECKS + int n_logical_monitors = + meta_monitor_manager_get_num_logical_monitors (monitor_manager); +#endif + + g_return_val_if_fail (META_IS_DISPLAY (display), 1.0f); + g_return_val_if_fail (monitor >= 0 && monitor < n_logical_monitors, 1.0f); + + logical_monitor = + meta_monitor_manager_get_logical_monitor_from_number (monitor_manager, + monitor); + return logical_monitor->scale; +} + /** * meta_display_get_monitor_in_fullscreen: * @display: a #MetaDisplay diff --git a/src/meta/display.h b/src/meta/display.h index d58150f26..170392048 100644 --- a/src/meta/display.h +++ b/src/meta/display.h @@ -246,6 +246,10 @@ void meta_display_get_monitor_geometry (MetaDisplay *display, int monitor, MetaRectangle *geometry); +META_EXPORT +float meta_display_get_monitor_scale (MetaDisplay *display, + int monitor); + META_EXPORT gboolean meta_display_get_monitor_in_fullscreen (MetaDisplay *display, int monitor);