[mutter] monitor: Don't only use 'winsys ID' to check sameness
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] monitor: Don't only use 'winsys ID' to check sameness
- Date: Thu, 1 Sep 2022 14:52:10 +0000 (UTC)
commit 7ee60e114356d13a40370fb049a1805af0467ff0
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Thu Oct 28 15:27:49 2021 +0200
monitor: Don't only use 'winsys ID' to check sameness
What determines whether one MetaMonitor is the same as the other should
be whether the actual monitor is the same. The way to check this is
comparing the EDID vendor/product/serial fields. Whene these are
incomplete, fall back on the 'winsys ID'.
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
src/backends/meta-monitor.c | 31 ++++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)
---
diff --git a/src/backends/meta-monitor.c b/src/backends/meta-monitor.c
index 72e3c9e772..717cd8711c 100644
--- a/src/backends/meta-monitor.c
+++ b/src/backends/meta-monitor.c
@@ -405,12 +405,33 @@ gboolean
meta_monitor_is_same_as (MetaMonitor *monitor,
MetaMonitor *other_monitor)
{
- MetaMonitorPrivate *priv =
- meta_monitor_get_instance_private (monitor);
- MetaMonitorPrivate *other_priv =
- meta_monitor_get_instance_private (other_monitor);
+ const MetaMonitorSpec *spec = meta_monitor_get_spec (monitor);
+ const MetaMonitorSpec *other_spec = meta_monitor_get_spec (other_monitor);
+
+ if ((g_strcmp0 (spec->vendor, "unknown") == 0 ||
+ g_strcmp0 (spec->product, "unknown") == 0 ||
+ g_strcmp0 (spec->serial, "unknown") == 0) &&
+ (g_strcmp0 (other_spec->vendor, "unknown") == 0 ||
+ g_strcmp0 (other_spec->product, "unknown") == 0 ||
+ g_strcmp0 (other_spec->serial, "unknown") == 0))
+ {
+ MetaMonitorPrivate *priv = meta_monitor_get_instance_private (monitor);
+ MetaMonitorPrivate *other_priv =
+ meta_monitor_get_instance_private (other_monitor);
+
+ return priv->winsys_id == other_priv->winsys_id;
+ }
+
+ if (g_strcmp0 (spec->vendor, other_spec->vendor) != 0)
+ return FALSE;
- return priv->winsys_id == other_priv->winsys_id;
+ if (g_strcmp0 (spec->product, other_spec->product) != 0)
+ return FALSE;
+
+ if (g_strcmp0 (spec->serial, other_spec->serial) != 0)
+ return FALSE;
+
+ return TRUE;
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]