monitor: Add API to compare with old instance

When monitors changed, previous monitor instances are defunct, and any
reference holder should drop its reference. Sometimes they will want to
continue having a reference to the same monitor, so add this function
to make it possible to find it.

Currently the output and crtc references are invalid, as they are not
yet reference counted, so this can only look at cached fields.

https://bugzilla.gnome.org/show_bug.cgi?id=784199
This commit is contained in:
Jonas Ådahl 2017-06-21 17:58:46 +08:00
parent 3005a400ca
commit 3ce3a5a952
2 changed files with 15 additions and 0 deletions

View File

@ -248,6 +248,18 @@ meta_monitor_is_laptop_panel (MetaMonitor *monitor)
} }
} }
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);
return priv->winsys_id == other_priv->winsys_id;
}
void void
meta_monitor_get_current_resolution (MetaMonitor *monitor, meta_monitor_get_current_resolution (MetaMonitor *monitor,
int *width, int *width,

View File

@ -111,6 +111,9 @@ gboolean meta_monitor_is_underscanning (MetaMonitor *monitor);
gboolean meta_monitor_is_laptop_panel (MetaMonitor *monitor); gboolean meta_monitor_is_laptop_panel (MetaMonitor *monitor);
gboolean meta_monitor_is_same_as (MetaMonitor *monitor,
MetaMonitor *other_monitor);
GList * meta_monitor_get_outputs (MetaMonitor *monitor); GList * meta_monitor_get_outputs (MetaMonitor *monitor);
void meta_monitor_get_current_resolution (MetaMonitor *monitor, void meta_monitor_get_current_resolution (MetaMonitor *monitor,