[mutter] monitor: Determine preferred monitor mode
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] monitor: Determine preferred monitor mode
- Date: Wed, 25 Jan 2017 08:35:40 +0000 (UTC)
commit 2c32d94e1d2065758cf445c0773e453e390c90fe
Author: Jonas Ådahl <jadahl gmail com>
Date: Sat Dec 17 22:32:05 2016 +0800
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
src/backends/meta-monitor.c | 14 ++++++++++++++
src/backends/meta-monitor.h | 2 ++
2 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c
index 7fa0094..a3fd155 100644
--- a/src/backends/meta-monitor.c
+++ b/src/backends/meta-monitor.c
@@ -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)
{
diff --git a/src/backends/meta-monitor.h b/src/backends/meta-monitor.h
index ec33984..3bab0a3 100644
--- a/src/backends/meta-monitor.h
+++ b/src/backends/meta-monitor.h
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]