1
0
Fork 0

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>
This commit is contained in:
Jonas Ådahl 2021-10-28 15:27:49 +02:00 committed by Marge Bot
parent ccb6a7e84f
commit 7ee60e1143

View file

@ -405,12 +405,33 @@ gboolean
meta_monitor_is_same_as (MetaMonitor *monitor, meta_monitor_is_same_as (MetaMonitor *monitor,
MetaMonitor *other_monitor) MetaMonitor *other_monitor)
{ {
MetaMonitorPrivate *priv = const MetaMonitorSpec *spec = meta_monitor_get_spec (monitor);
meta_monitor_get_instance_private (monitor); const MetaMonitorSpec *other_spec = meta_monitor_get_spec (other_monitor);
MetaMonitorPrivate *other_priv =
meta_monitor_get_instance_private (other_monitor);
return priv->winsys_id == other_priv->winsys_id; 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;
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 void