display: Add meta_display_get_monitor_scale
This will return the monitor scaling for the requested logical screen https://bugzilla.gnome.org/show_bug.cgi?id=765011
This commit is contained in:
parent
f76b3edf9c
commit
7442de81bb
@ -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
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user