mirror of
https://github.com/brl/mutter.git
synced 2024-11-12 17:27:03 -05:00
monitor: Determine preferred monitor mode
Determine the preferred monitor mode given what the preferred CRTC mode is, and expose it via the API. https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
parent
5d9e2d8d2e
commit
2c32d94e1d
@ -37,6 +37,8 @@ typedef struct _MetaMonitorPrivate
|
||||
GList *outputs;
|
||||
GList *modes;
|
||||
|
||||
MetaMonitorMode *preferred_mode;
|
||||
|
||||
/*
|
||||
* The primary or first output for this monitor, 0 if we can't figure out.
|
||||
* It can be matched to a winsys_id of a MetaOutput.
|
||||
@ -187,6 +189,9 @@ meta_monitor_normal_generate_modes (MetaMonitorNormal *monitor_normal)
|
||||
.crtc_mode = crtc_mode
|
||||
};
|
||||
|
||||
if (crtc_mode == output->preferred_mode)
|
||||
monitor_priv->preferred_mode = mode;
|
||||
|
||||
monitor_priv->modes = g_list_append (monitor_priv->modes, mode);
|
||||
}
|
||||
}
|
||||
@ -365,6 +370,7 @@ meta_monitor_tiled_generate_modes (MetaMonitorTiled *monitor_tiled)
|
||||
}
|
||||
|
||||
monitor_priv->modes = g_list_append (monitor_priv->modes, mode);
|
||||
monitor_priv->preferred_mode = mode;
|
||||
|
||||
/* TODO: Add single tile modes */
|
||||
}
|
||||
@ -446,6 +452,14 @@ meta_monitor_mode_free (MetaMonitorMode *monitor_mode)
|
||||
g_free (monitor_mode);
|
||||
}
|
||||
|
||||
MetaMonitorMode *
|
||||
meta_monitor_get_preferred_mode (MetaMonitor *monitor)
|
||||
{
|
||||
MetaMonitorPrivate *priv = meta_monitor_get_instance_private (monitor);
|
||||
|
||||
return priv->preferred_mode;
|
||||
}
|
||||
|
||||
GList *
|
||||
meta_monitor_get_modes (MetaMonitor *monitor)
|
||||
{
|
||||
|
@ -96,6 +96,8 @@ const char * meta_monitor_get_product (MetaMonitor *monitor);
|
||||
|
||||
uint32_t meta_monitor_tiled_get_tile_group_id (MetaMonitorTiled *monitor_tiled);
|
||||
|
||||
MetaMonitorMode * meta_monitor_get_preferred_mode (MetaMonitor *monitor);
|
||||
|
||||
GList * meta_monitor_get_modes (MetaMonitor *monitor);
|
||||
|
||||
MetaMonitorModeSpec * meta_monitor_mode_get_spec (MetaMonitorMode *monitor_mode);
|
||||
|
Loading…
Reference in New Issue
Block a user