monitor: Add hash function
Will be used to keep a monitor spec as a hash table key. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1712>
This commit is contained in:
parent
fcbeae5f60
commit
4615da2122
2 changed files with 13 additions and 0 deletions
|
@ -127,6 +127,17 @@ meta_monitor_spec_clone (MetaMonitorSpec *monitor_spec)
|
|||
return new_monitor_spec;
|
||||
}
|
||||
|
||||
guint
|
||||
meta_monitor_spec_hash (gconstpointer key)
|
||||
{
|
||||
const MetaMonitorSpec *monitor_spec = key;
|
||||
|
||||
return (g_str_hash (monitor_spec->connector) +
|
||||
g_str_hash (monitor_spec->vendor) +
|
||||
g_str_hash (monitor_spec->product) +
|
||||
g_str_hash (monitor_spec->serial));
|
||||
}
|
||||
|
||||
gboolean
|
||||
meta_monitor_spec_equals (MetaMonitorSpec *monitor_spec,
|
||||
MetaMonitorSpec *other_monitor_spec)
|
||||
|
|
|
@ -262,6 +262,8 @@ gboolean meta_monitor_mode_should_be_advertised (MetaMonitorMode *monitor_mode);
|
|||
META_EXPORT_TEST
|
||||
MetaMonitorSpec * meta_monitor_spec_clone (MetaMonitorSpec *monitor_id);
|
||||
|
||||
guint meta_monitor_spec_hash (gconstpointer key);
|
||||
|
||||
META_EXPORT_TEST
|
||||
gboolean meta_monitor_spec_equals (MetaMonitorSpec *monitor_id,
|
||||
MetaMonitorSpec *other_monitor_id);
|
||||
|
|
Loading…
Reference in a new issue