monitor: Add API to check whether the monitor is virtual or not

As for the types of monitor, X11 and KMS are currently assumed to always be
physical, while the virtual ones are assumed to be virtual. In theory
X11 ones could be virtual, but lets not bother. KMS ones can be virtual
in the case of virtual KMS, but we typically use that for testing as if
it was physical, so lets leave it as such.

Will later be used to feed correct information to colord.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
This commit is contained in:
Jonas Ådahl 2021-10-27 22:57:31 +02:00 committed by Marge Bot
parent f8dbea27f8
commit 972e393fc0
4 changed files with 15 additions and 0 deletions

View File

@ -386,6 +386,15 @@ meta_monitor_is_laptop_panel (MetaMonitor *monitor)
}
}
gboolean
meta_monitor_is_virtual (MetaMonitor *monitor)
{
const MetaOutputInfo *output_info =
meta_monitor_get_main_output_info (monitor);
return output_info->is_virtual;
}
gboolean
meta_monitor_is_same_as (MetaMonitor *monitor,
MetaMonitor *other_monitor)

View File

@ -123,6 +123,8 @@ gboolean meta_monitor_get_max_bpc (MetaMonitor *monitor,
gboolean meta_monitor_is_laptop_panel (MetaMonitor *monitor);
gboolean meta_monitor_is_virtual (MetaMonitor *monitor);
gboolean meta_monitor_is_same_as (MetaMonitor *monitor,
MetaMonitor *other_monitor);

View File

@ -80,6 +80,8 @@ typedef struct _MetaOutputInfo
{
grefcount ref_count;
gboolean is_virtual;
char *name;
char *vendor;
char *product;

View File

@ -45,6 +45,8 @@ meta_output_virtual_new (uint64_t id,
output_info = meta_output_info_new ();
output_info->name = g_strdup_printf ("Meta-%" G_GUINT64_FORMAT, id);
output_info->is_virtual = TRUE;
output_info->n_possible_crtcs = 1;
output_info->possible_crtcs = g_new0 (MetaCrtc *, 1);
output_info->possible_crtcs[0] = META_CRTC (crtc_virtual);